Merge "Checkstyle logging rules"
[yangtools.git] / yang / yang-parser-api / src / main / java / org / opendaylight / yangtools / yang / model / parser / api / YangContextParser.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.model.parser.api;
9
10 import com.google.common.io.ByteSource;
11 import java.io.File;
12 import java.io.IOException;
13 import java.util.Collection;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
15
16 /**
17  * Parse yang models and convert data to SchemaContext.
18  *
19  */
20 public interface YangContextParser extends YangModelParser {
21
22     /**
23      * Parse yangFile file and all yang files found in directory.
24      *
25      * @param yangFile
26      *            file to parse
27      * @param dependenciesDirectory
28      *            directory which contains additional yang files
29      * @return parsed data as SchemaContext. Resulting context will contains
30      *         only module parsed from yangFile and modules which yangFile needs
31      *         as dependencies.
32      */
33     SchemaContext parseFile(final File yangFile, final File dependenciesDirectory) throws IOException;
34
35     /**
36      * Parse one or more Yang model files and return the definitions of Yang
37      * modules defined in *.yang files; <br>
38      * This method SHOULD be used if user need to parse multiple yang models
39      * that are referenced either through import or include statements.
40      *
41      * @param yangFiles
42      *            yang files to parse
43      * @return parsed data as SchemaContext
44      */
45     SchemaContext parseFiles(final Collection<File> yangFiles) throws IOException;
46
47     /**
48      * Parse one or more Yang model files and return the definitions of Yang
49      * modules defined in *.yang files. <br>
50      * This method SHOULD be used if user has already parsed context and need to
51      * parse additinal yang models which can have dependencies on models in this
52      * context.
53      *
54      * @param yangFiles
55      *            yang files to parse
56      * @param context
57      *            SchemaContext containing already parsed yang models
58      * @return parsed data as SchemaContext
59      */
60     SchemaContext parseFiles(final Collection<File> yangFiles, final SchemaContext context) throws IOException;
61
62     /**
63      * Parse one or more Yang model streams and return the definitions of Yang
64      * modules defined in *.yang files; <br>
65      * This method SHOULD be used if user need to parse multiple yang models
66      * that are referenced either through import or include statements.
67      *
68      * @param sources
69      *            yang streams to parse
70      * @return parsed data as SchemaContext
71      */
72     SchemaContext parseSources(final Collection<ByteSource> sources) throws IOException;
73
74     /**
75      * Parse one or more Yang model streams and return the definitions of Yang
76      * modules defined in *.yang files. <br>
77      * This method SHOULD be used if user has already parsed context and need to
78      * parse additinal yang models which can have dependencies on models in this
79      * context.
80      *
81      * @param sources
82      *            yang streams to parse
83      * @param context
84      *            SchemaContext containing already parsed yang models
85      * @return parsed data as SchemaContext
86      */
87     SchemaContext parseSources(final Collection<ByteSource> sources, final SchemaContext context) throws IOException;
88
89 }