2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.yang.model.parser.api;
10 import java.io.InputStream;
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;
18 * Yang Model Parser interface is designed for parsing yang models and convert
19 * the information to Data Schema Tree.
22 public interface YangModelParser {
25 * Parse single Yang model file and return the schema definition of Yang
26 * module defined in *.Yang file.
30 * @return the schema definition of Yang module defined in .Yang file.
32 public Module parseYangModel(final String yangFile);
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.
42 * @return Set of Yang Modules
44 public Set<Module> parseYangModels(final String... yangFiles);
46 public Set<Module> parseYangModelsFromStreams(
47 final InputStream... yangModelStreams);
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.
59 * @return Schema Context instance constructed from whole Set of Modules.
61 public SchemaContext resolveSchemaContext(final Set<Module> modules);