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.yangtools.yang.model.parser.api;
11 import java.io.IOException;
12 import java.util.Collection;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 import com.google.common.io.ByteSource;
19 * Parse yang models and convert data to SchemaContext.
22 public interface YangContextParser extends YangModelParser {
25 * Parse yangFile file and all yang files found in directory.
29 * @param dependenciesDirectory
30 * directory which contains additional yang files
31 * @return parsed data as SchemaContext. Resulting context will contains
32 * only module parsed from yangFile and modules which yangFile needs
35 SchemaContext parseFile(final File yangFile, final File dependenciesDirectory) throws IOException, YangSyntaxErrorException;
38 * Parse one or more Yang model files and return the definitions of Yang
39 * modules defined in *.yang files; <br>
40 * This method SHOULD be used if user need to parse multiple yang models
41 * that are referenced either through import or include statements.
45 * @return parsed data as SchemaContext
47 SchemaContext parseFiles(final Collection<File> yangFiles) throws IOException;
50 * Parse one or more Yang model files and return the definitions of Yang
51 * modules defined in *.yang files. <br>
52 * This method SHOULD be used if user has already parsed context and need to
53 * parse additinal yang models which can have dependencies on models in this
59 * SchemaContext containing already parsed yang models
60 * @return parsed data as SchemaContext
62 SchemaContext parseFiles(final Collection<File> yangFiles, final SchemaContext context) throws IOException, YangSyntaxErrorException;
65 * Parse one or more Yang model streams and return the definitions of Yang
66 * modules defined in *.yang files; <br>
67 * This method SHOULD be used if user need to parse multiple yang models
68 * that are referenced either through import or include statements.
71 * yang streams to parse
72 * @return parsed data as SchemaContext
74 SchemaContext parseSources(final Collection<ByteSource> sources) throws IOException, YangSyntaxErrorException;
77 * Parse one or more Yang model streams and return the definitions of Yang
78 * modules defined in *.yang files. <br>
79 * This method SHOULD be used if user has already parsed context and need to
80 * parse additinal yang models which can have dependencies on models in this
84 * yang streams to parse
86 * SchemaContext containing already parsed yang models
87 * @return parsed data as SchemaContext
89 SchemaContext parseSources(final Collection<ByteSource> sources, final SchemaContext context) throws IOException, YangSyntaxErrorException;