842bb43d79bd00573cd69a4ab298a4805a4bda5e
[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.File;
11 import java.io.InputStream;
12 import java.util.List;
13 import java.util.Map;
14 import java.util.Set;
15
16 import org.opendaylight.controller.yang.model.api.Module;
17 import org.opendaylight.controller.yang.model.api.SchemaContext;
18 import org.opendaylight.controller.yang.model.api.type.UnknownTypeDefinition;
19
20 /**
21  * Yang Model Parser interface is designed for parsing yang models and convert
22  * the information to Data Schema Tree.
23  *
24  */
25 public interface YangModelParser {
26
27     /**
28      * Parse one or more Yang model files and return the definitions of Yang
29      * modules defined in *.Yang files; <br>
30      * This method SHOULD be used if user need to parse multiple yang models
31      * that are referenced either through import or include statements.
32      *
33      * @param yangFiles
34      *            yang files to parse
35      * @return Set of Yang Modules
36      */
37     Set<Module> parseYangModels(final List<File> yangFiles);
38
39     /**
40      * Equivalent to {@link #parseYangModels(List)} that returns parsed modules
41      * mapped to Files from which they were parsed.
42      *
43      * @param yangFiles
44      *            yang files to parse
45      * @return Map of Yang Modules
46      */
47     Map<File, Module> parseYangModelsMapped(final List<File> yangFiles);
48
49     Set<Module> parseYangModelsFromStreams(
50             final List<InputStream> yangModelStreams);
51
52     Map<InputStream, Module> parseYangModelsFromStreamsMapped(
53             final List<InputStream> yangModelStreams);
54
55     /**
56      * Creates {@link SchemaContext} from specified Modules. The modules SHOULD
57      * not contain any unresolved Schema Nodes or Type Definitions. By
58      * unresolved Schema Nodes or Type Definitions we mean that the Module
59      * should not contain ANY Schema Nodes that contains
60      * {@link UnknownTypeDefinition} and all dependencies although via import or
61      * include definitions are resolved.
62      *
63      * @param modules
64      *            Set of Yang Modules
65      * @return Schema Context instance constructed from whole Set of Modules.
66      */
67     SchemaContext resolveSchemaContext(final Set<Module> modules);
68 }