BUG-865: deprecate pre-Beryllium parser elements
[yangtools.git] / yang / yang-parser-api / src / main / java / org / opendaylight / yangtools / yang / model / parser / api / YangContextParser.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.yangtools.yang.model.parser.api;
9
10 import com.google.common.io.ByteSource;
11 import java.io.File;
12 import java.io.IOException;
13 import java.util.Collection;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
15
16 /**
17  * Parse YANG models and convert data to SchemaContext.
18  *
19  * @deprecated Use {@link org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory} and related classes
20  *             instead.
21  */
22 @Deprecated
23 public interface YangContextParser extends YangModelParser {
24
25     /**
26      * Parse yangFile file and all yang files found in directory.
27      *
28      * @param yangFile
29      *            file to parse
30      * @param dependenciesDirectory
31      *            directory which contains additional yang files
32      * @return parsed data as SchemaContext. Resulting context will contains
33      *         only module parsed from yangFile and modules which yangFile needs
34      *         as dependencies.
35      */
36     SchemaContext parseFile(final File yangFile, final File dependenciesDirectory) throws IOException, YangSyntaxErrorException;
37
38     /**
39      * Parse one or more Yang model files and return the definitions of Yang
40      * modules defined in *.yang files; <br>
41      * This method SHOULD be used if user need to parse multiple yang models
42      * that are referenced either through import or include statements.
43      *
44      * @param yangFiles
45      *            yang files to parse
46      * @return parsed data as SchemaContext
47      */
48     SchemaContext parseFiles(final Collection<File> yangFiles) throws IOException;
49
50     /**
51      * Parse one or more Yang model files and return the definitions of Yang
52      * modules defined in *.yang files. <br>
53      * This method SHOULD be used if user has already parsed context and need to
54      * parse additinal yang models which can have dependencies on models in this
55      * context.
56      *
57      * @param yangFiles
58      *            yang files to parse
59      * @param context
60      *            SchemaContext containing already parsed yang models
61      * @return parsed data as SchemaContext
62      */
63     SchemaContext parseFiles(final Collection<File> yangFiles, final SchemaContext context) throws IOException, YangSyntaxErrorException;
64
65     /**
66      * Parse one or more Yang model streams and return the definitions of Yang
67      * modules defined in *.yang files; <br>
68      * This method SHOULD be used if user need to parse multiple yang models
69      * that are referenced either through import or include statements.
70      *
71      * @param sources
72      *            yang streams to parse
73      * @return parsed data as SchemaContext
74      */
75     SchemaContext parseSources(final Collection<ByteSource> sources) throws IOException, YangSyntaxErrorException;
76
77     /**
78      * Parse one or more Yang model streams and return the definitions of Yang
79      * modules defined in *.yang files. <br>
80      * This method SHOULD be used if user has already parsed context and need to
81      * parse additinal yang models which can have dependencies on models in this
82      * context.
83      *
84      * @param sources
85      *            yang streams to parse
86      * @param context
87      *            SchemaContext containing already parsed yang models
88      * @return parsed data as SchemaContext
89      */
90     SchemaContext parseSources(final Collection<ByteSource> sources, final SchemaContext context) throws IOException, YangSyntaxErrorException;
91
92 }