Merge branch 'master' of ../controller
[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 org.opendaylight.yangtools.concepts.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 module.
22  */
23 public interface Module extends DataNodeContainer, DocumentedNode, Immutable, NotificationNodeContainer,
24         NamespaceRevisionAware {
25     /**
26      * Returns the name of the module which is specified as argument of YANG {@code module} statement.
27      *
28      * @return string with the name of the module
29      */
30     String getName();
31
32     /**
33      * Returns a {@link QNameModule}, which contains the namespace and the revision of the module.
34      *
35      * @return QNameModule identifier.
36      */
37     QNameModule getQNameModule();
38
39     /**
40      * Returns the namespace of the module which is specified as argument of YANG {@code namespace}
41      * keyword. If you need both namespace and revision, please consider using {@link #getQNameModule()}.
42      *
43      * @return URI format of the namespace of the module
44      */
45     @Override
46     default URI getNamespace() {
47         return getQNameModule().getNamespace();
48     }
49
50     /**
51      * Returns the revision date for the module. If you need both namespace and
52      * revision, please consider using {@link #getQNameModule()}.
53      *
54      * @return date of the module revision which is specified as argument of YANG {@code revison} statement
55      */
56     @Override
57     default Optional<Revision> getRevision() {
58         return getQNameModule().getRevision();
59     }
60
61     /**
62      * Returns the semantic version of YANG module. If the semantic version is not specified, default semantic version
63      * of module is returned.
64      *
65      * @return SemVer semantic version of YANG module which is specified as argument of
66      *         {@code (urn:opendaylight:yang:extension:semantic-version?revision=2016-02-02)semantic-version} statement
67      */
68     Optional<SemVer> getSemanticVersion();
69
70     /**
71      * Returns the prefix of the module.
72      *
73      * @return string with the module prefix which is specified as argument of YANG {@code prefix} statement
74      */
75     String getPrefix();
76
77     /**
78      * Returns the YANG version.
79      *
80      * @return YANG version of this module.
81      */
82     YangVersion getYangVersion();
83
84     /**
85      * Returns the module organization.
86      *
87      * @return string with the name of the organization specified in the module as the argument of YANG
88      *         {@code organization} statement
89      */
90     Optional<String> getOrganization();
91
92     /**
93      * Returns the module contact.
94      *
95      * <p>
96      * The contact represents the person or persons to whom technical queries concerning this module should be sent,
97      * such as their name, postal address, telephone number, and electronic mail address.
98      *
99      * @return string with the contact data specified in the module as the argument of YANG {@code contact} statement
100      */
101     Optional<String> getContact();
102
103     /**
104      * Returns imports which represents YANG modules which are imported to this module via {@code import} statement.
105      *
106      * @return set of module imports which are specified in the module as the argument of YANG {@code import}
107      *         statements.
108      */
109     Set<ModuleImport> getImports();
110
111     Set<Module> getSubmodules();
112
113     /**
114      * Returns {@link FeatureDefinition} instances which contain data from {@code feature} statements defined in the
115      * module.
116      *
117      * <p>
118      * The feature is used to define a mechanism by which portions of the schema are marked as conditional.
119      *
120      * @return feature statements in lexicographical order which are specified in the module as the argument of YANG
121      *         {@code feature} statements.
122      */
123     Set<FeatureDefinition> getFeatures();
124
125     /**
126      * Returns {@link AugmentationSchemaNode} instances which contain data from {@code augment} statements defined
127      * in the module.
128      *
129      * @return set of the augmentation schema instances which are specified in the module as YANG {@code augment}
130      *         statement and are lexicographically ordered
131      */
132     Set<AugmentationSchemaNode> getAugmentations();
133
134     /**
135      * Returns {@link RpcDefinition} instances which contain data from {@code rpc} statements defined in the module.
136      *
137      * @return set of the RPC definition instances which are specified in the module as YANG {@code rpc} statements and
138      *         are lexicographicaly ordered
139      */
140     Set<RpcDefinition> getRpcs();
141
142     /**
143      * Returns {@link Deviation} instances which contain data from {@code deviation} statements defined in the module.
144      *
145      * @return set of the deviation instances
146      */
147     Set<Deviation> getDeviations();
148
149     /**
150      * Returns {@link IdentitySchemaNode} instances which contain data from {@code identity} statements defined in the
151      * module.
152      *
153      * @return set of identity schema node instances which are specified in the module as YANG {@code identity}
154      *         statements and are lexicographically ordered
155      */
156     Set<IdentitySchemaNode> getIdentities();
157
158     /**
159      * Returns {@link ExtensionDefinition} instances which contain data from {@code extension} statements defined in
160      * the module.
161      *
162      * @return set of extension definition instances which are specified in the module as YANG {@code extension}
163      *         statements and are lexicographically ordered
164      */
165     List<ExtensionDefinition> getExtensionSchemaNodes();
166 }