Bug 4662: Introduce a SemanticVersion concept - import processing
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / Module.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.api;
9
10 import java.util.List;
11 import java.util.Set;
12 import javax.annotation.Nullable;
13 import javax.annotation.concurrent.Immutable;
14 import org.opendaylight.yangtools.concepts.SemVer;
15
16 /**
17  * This interface contains the methods for getting the data from the YANG
18  * module.<br>
19  * <br>
20  * <i>Example of YANG module</i> <code><br>
21  * {@link #getName() <b><font color="#FF0000">module</font></b>} module_name{<br>
22     &nbsp;&nbsp;{@link #getYangVersion() <b><font color="#8b4513">yang-version</font></b>} "1";<br><br>
23
24     &nbsp;&nbsp;{@link #getNamespace() <b><font color="#00FF00">namespace</font></b>} "urn:module:namespace";<br>
25     &nbsp;&nbsp;{@link #getPrefix() <b><font color="#0000FF">prefix</font></b><a name="prefix"></a>} "prefix";<br><br>
26
27     &nbsp;&nbsp;{@link #getDescription() <b><font color="#b8860b">description</font></b>} "description test";<br>
28     &nbsp;&nbsp;{@link #getReference() <b><font color="#008b8b">reference</font></b>} "reference test";<br><br>
29
30     &nbsp;&nbsp;{@link #getOrganization() <b><font color="#606060">organization</font></b>} "John Doe, john.doe@email.com";<br>
31     &nbsp;&nbsp;{@link #getContact() <b><font color="#FF9900">contact</font></b>} "http://www.opendaylight.org/";<br><br>
32
33     &nbsp;&nbsp;{@link #getFeatures() <b><font color="#8b0000">feature</font></b>} feature-test{<br>
34     &nbsp;&nbsp;&nbsp;&nbsp; description "description of some feature";<br>
35     &nbsp;&nbsp;}<br>
36
37     &nbsp;&nbsp;{@link #getNotifications() <b><font color="#b22222">notification</font></b>} notification-test;<br>
38     &nbsp;&nbsp;{@link #getRpcs() <b><font color="#d2691e">rpc</font></b>} rpc-test;<br>
39     <!-- &nbsp;&nbsp;{@link #getDeviations() <b><font color="#b8860b">deviation</font></b>} deviation-test;<br> -->
40     &nbsp;&nbsp;{@link #getIdentities() <b><font color="#bdb76b">identity</font></b>} identity-test;<br>
41     &nbsp;&nbsp;{@link #getExtensionSchemaNodes() <b><font color="#808000">extension</font></b>} extension-test;<br>
42
43
44     &nbsp;&nbsp;{@link #getRevision() <b><font color="#339900">revision</font></b>} 2011-08-27 {<br>
45
46     &nbsp;&nbsp;{@link #getImports() <b><font color="#9400d3">import</font></b>} other_module {<br>
47     &nbsp;&nbsp;&nbsp;&nbsp;prefix "other_module_prefix"<br>
48     &nbsp;&nbsp;&nbsp;&nbsp;revision-date 2011-08-27<br>
49     &nbsp;&nbsp;}<br><br>
50
51     &nbsp;&nbsp;container cont {<br>
52     &nbsp;&nbsp;}<br>
53
54     &nbsp;&nbsp;{@link #getAugmentations() <b><font color="#dc143c">augment</font></b>} "/cont" { ;<br>
55     &nbsp;&nbsp;}<br>
56     }
57
58     </code>
59  */
60 @Immutable
61 public interface Module extends DataNodeContainer, SourceStreamAware, ModuleIdentifier {
62     /**
63      * Default semantic version of Module.
64      */
65     SemVer DEFAULT_SEMANTIC_VERSION = SemVer.create(0, 0, 0);
66
67     /**
68      * Returns the prefix of the module
69      *
70      * @return string with the module prefix which is specified as argument of
71      *         YANG {@link Module <b><font color="#0000FF">prefix</font></b>}
72      *         keyword
73      */
74     String getPrefix();
75
76     /**
77      * Returns the YANG version.
78      *
79      * Default value is 1.
80      *
81      * @return string with the module YANG version which is specified as
82      *         argument of YANG {@link Module <b> <font
83      *         color="#8b4513">yang-version</font></b>} keyword
84      */
85     String getYangVersion();
86
87     /**
88      * Returns the module description.
89      *
90      * @return string with the module description which is specified as argument
91      *         of YANG {@link Module <b><font
92      *         color="#b8860b">description</font></b>} keyword
93      */
94     String getDescription();
95
96     /**
97      * Returns the module reference.
98      *
99      * @return string with the module reference which is specified as argument
100      *         of YANG {@link Module <b><font
101      *         color="#008b8b">reference</font></b>} keyword
102      */
103     String getReference();
104
105     /**
106      * Returns the module organization.
107      *
108      * @return string with the name of the organization specified in the module
109      *         as the argument of YANG {@link Module <b><font
110      *         color="#606060">organization</font></b>} keyword
111      */
112     String getOrganization();
113
114     /**
115      * Returns the module contact.
116      *
117      * The contact represents the person or persons to whom technical queries
118      * concerning this module should be sent, such as their name, postal
119      * address, telephone number, and electronic mail address.
120      *
121      * @return string with the contact data specified in the module as the
122      *         argument of YANG {@link Module <b><font
123      *         color="#FF9900">contact</font></b>} keyword
124      */
125     String getContact();
126
127     /**
128      * Returns imports which represents YANG modules which are imported to this
129      * module via <b>import</b> statement.
130      *
131      * @return set of module imports which are specified in the module as the
132      *         argument of YANG {@link Module <b><font
133      *         color="#9400d3">import</font></b>} keywords.
134      */
135     Set<ModuleImport> getImports();
136
137     Set<Module> getSubmodules();
138
139     /**
140      * Returns <code>FeatureDefinition</code> instances which contain data from
141      * <b>feature</b> statements defined in the module.
142      *
143      * The feature is used to define a mechanism by which portions of the schema
144      * are marked as conditional.
145      *
146      * @return feature statements in lexicographical order which are specified
147      *         in the module as the argument of YANG {@link Module <b><font
148      *         color="#8b0000">feature</font></b>} keywords.
149      */
150     Set<FeatureDefinition> getFeatures();
151
152     /**
153      * Returns <code>NotificationDefinition</code> instances which contain data
154      * from <b>notification</b> statements defined in the module.
155      *
156      * @return notification statements in lexicographical order which are
157      *         specified in the module as the argument of YANG {@link Module
158      *         <b><font color="#b22222">notification</font></b>} keywords.
159      */
160     Set<NotificationDefinition> getNotifications();
161
162     /**
163      * Returns <code>AugmentationSchema</code> instances which contain data from
164      * <b>augment</b> statements defined in the module.
165      *
166      * @return set of the augmentation schema instances which are specified in
167      *         the module as YANG {@link Module <b><font
168      *         color="#dc143c">augment</font></b>} keyword and are
169      *         lexicographically ordered
170      */
171     Set<AugmentationSchema> getAugmentations();
172
173     /**
174      * Returns <code>RpcDefinition</code> instances which contain data from
175      * <b>rpc</b> statements defined in the module.
176      *
177      * @return set of the rpc definition instances which are specified in the
178      *         module as YANG {@link Module <b><font
179      *         color="#d2691e">rpc</font></b>} keywords and are lexicographicaly
180      *         ordered
181      */
182     Set<RpcDefinition> getRpcs();
183
184     /**
185      * Returns <code>Deviation</code> instances which contain data from
186      * <b>deviation</b> statements defined in the module.
187      *
188      * @return set of the deviation instances
189      */
190     Set<Deviation> getDeviations();
191
192     /**
193      * Returns <code>IdentitySchemaNode</code> instances which contain data from
194      * <b>identity</b> statements defined in the module.
195      *
196      * @return set of identity schema node instances which are specified in the
197      *         module as YANG {@link Module <b><font
198      *         color="#bdb76b">identity</font></b>} keywords and are
199      *         lexicographically ordered
200      */
201     Set<IdentitySchemaNode> getIdentities();
202
203     /**
204      * Returns <code>ExtensionDefinition</code> instances which contain data
205      * from <b>extension</b> statements defined in the module.
206      *
207      * @return set of extension definition instances which are specified in the
208      *         module as YANG {@link Module <b><font
209      *         color="#808000">extension</font></b>} keyword and are
210      *         lexicographically ordered
211      */
212     List<ExtensionDefinition> getExtensionSchemaNodes();
213
214     /**
215      * Returns unknown nodes defined in module.
216      *
217      * @return unknown nodes in lexicographical order
218      */
219     List<UnknownSchemaNode> getUnknownSchemaNodes();
220
221     /**
222      * Get YANG source.
223      *
224      * @return YANG text of this module, or null if the source is not available.
225      * @deprecated Use {@link org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository#getSchemaSource(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier, Class)}
226      *             instead.
227      */
228     @Deprecated
229     @Nullable String getSource();
230 }