59cea3041d14a6d46baf0c7bd5994a055716c037
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-api / src / main / java / org / opendaylight / controller / yang / model / parser / api / YangModelParser.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.controller.yang.model.parser.api;
9
10 import java.io.InputStream;
11 import java.util.Set;
12
13 import org.opendaylight.controller.yang.model.api.Module;
14 import org.opendaylight.controller.yang.model.api.SchemaContext;
15 import org.opendaylight.controller.yang.model.api.type.UnknownTypeDefinition;
16
17 /**
18  * Yang Model Parser interface is designed for parsing yang models and convert
19  * the information to Data Schema Tree.
20  *
21  */
22 public interface YangModelParser {
23
24     /**
25      * Parse single Yang model file and return the schema definition of Yang
26      * module defined in *.Yang file.
27      *
28      * @param yangFile
29      *            yang file to parse
30      * @return the schema definition of Yang module defined in .Yang file.
31      */
32     public Module parseYangModel(final String yangFile);
33
34     /**
35      * Parse one or more Yang model files and return the definitions of Yang
36      * modules defined in *.Yang files; <br>
37      * This method SHOULD be used if user need to parse multiple yang models
38      * that are referenced either through import or include statements.
39      *
40      * @param yangFiles
41      *            yang files to parse
42      * @return Set of Yang Modules
43      */
44     public Set<Module> parseYangModels(final String... yangFiles);
45
46     public Set<Module> parseYangModelsFromStreams(
47             final InputStream... yangModelStreams);
48
49     /**
50      * Creates {@link SchemaContext} from specified Modules. The modules SHOULD
51      * not contain any unresolved Schema Nodes or Type Definitions. By
52      * unresolved Schema Nodes or Type Definitions we mean that the Module
53      * should not contain ANY Schema Nodes that contains
54      * {@link UnknownTypeDefinition} and all dependencies although via import or
55      * include definitions are resolved.
56      *
57      * @param modules
58      *            Set of Yang Modules
59      * @return Schema Context instance constructed from whole Set of Modules.
60      */
61     public SchemaContext resolveSchemaContext(final Set<Module> modules);
62 }