Merge from development repository.
[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.util.Set;
11
12 import org.opendaylight.controller.model.api.type.UnknownTypeDefinition;
13 import org.opendaylight.controller.yang.model.api.Module;
14 import org.opendaylight.controller.yang.model.api.SchemaContext;
15
16 /**
17  * Yang Model Parser interface is designed for parsing yang models and 
18  * convert the information to Data Schema Tree.
19  * 
20  */
21 public interface YangModelParser {
22
23     /**
24      * Parse single Yang model file and return the schema definition of Yang
25      * module defined in *.Yang file.
26      * 
27      * @param yangFile
28      *            yang file to parse
29      * @return the schema definition of Yang module defined in .Yang file.
30      */
31     public Module parseYangModel(final String yangFile);
32
33     /**
34      * Parse one or more Yang model files and return the definitions of Yang
35      * modules defined in *.Yang files;
36      * <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 yang files to parse
41      * @return Set of Yang Modules
42      */
43     public Set<Module> parseYangModels(final String... yangFiles);
44
45     /**
46      * Creates {@link SchemaContext} from specified Modules. The modules SHOULD
47      * not contain any unresolved Schema Nodes or Type Definitions. By
48      * unresolved Schema Nodes or Type Definitions we mean that the Module
49      * should not contain ANY Schema Nodes that contains
50      * {@link UnknownTypeDefinition} and all dependencies although via import or
51      * include definitions are resolved.
52      * 
53      * @param modules
54      *            Set of Yang Modules
55      * @return Schema Context instance constructed from whole Set of Modules.
56      */
57     public SchemaContext resolveSchemaContext(final Set<Module> modules);
58 }