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