e51e4684323f63df9bd14fa6f6501ce1b48a034e
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / SchemaContext.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.Date;
12 import java.util.Set;
13
14 import org.opendaylight.yangtools.yang.common.QName;
15
16 /**
17  * The interface contains the methods for manipulating all the top level context
18  * data (data from all red modules) like YANG notifications, extensions,
19  * operations...
20  */
21 public interface SchemaContext extends ContainerSchemaNode {
22
23     public static final QName NAME = QName.create(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), null, "data");
24
25     /**
26      * Returns data schema node instances which represents direct subnodes (like
27      * leaf, leaf-list, list, container) in all YANG modules in the context.
28      *
29      * @return set of <code>DataSchemaNode</code> instances which represents
30      *         YANG data nodes at the module top level
31      */
32     Set<DataSchemaNode> getDataDefinitions();
33
34     /**
35      * Returns modules which are part of the schema context.
36      *
37      * @return set of the modules which belong to the schema context
38      */
39     Set<Module> getModules();
40
41     /**
42      *
43      * Returns notification definition instances which are defined as the direct
44      * subelements in all YANG modules in the context.
45      *
46      * @return set of <code>NotificationDefinition</code> instances which
47      *         represents nodes defined via <code>notification</code> YANG
48      *         keyword
49      */
50     Set<NotificationDefinition> getNotifications();
51
52     /**
53      * Returns rpc definition instances which are defined as the direct
54      * subelements in all YANG modules in the context.
55      *
56      * @return set of <code>RpcDefinition</code> instances which represents
57      *         nodes defined via <code>rpc</code> YANG keyword
58      */
59     Set<RpcDefinition> getOperations();
60
61     /**
62      * Returns extencion definition instances which are defined as the direct
63      * subelements in all YANG modules in the context
64      *
65      * @return set of <code>ExtensionDefinition</code> instances which
66      *         represents nodes defined via <code>extension</code> YANG keyword
67      */
68     Set<ExtensionDefinition> getExtensions();
69
70     /**
71      * Returns module instance (from the context) with concrete name and
72      * revision date.
73      *
74      * @param name
75      *            string with the module name
76      * @param revision
77      *            date of the module revision
78      * @return module instance which has name and revision (if specified) the
79      *         same as are the values specified in parameters <code>name</code>
80      *         and <code>revision</code>. In other cases the <code>null</code>
81      *         value is returned.
82      *
83      */
84     Module findModuleByName(final String name, final Date revision);
85
86     /**
87      *
88      * Returns module instance (from the context) with concrete namespace.
89      *
90      * @param namespace
91      *            URI instance with specified namespace
92      * @return module instance which has namespace equal to the
93      *         <code>namespace</code> or <code>null</code> in other cases
94      */
95     Set<Module> findModuleByNamespace(final URI namespace);
96
97     /**
98      * Returns module instance based on given namespace and revision. If
99      * revision is not specified, returns module with newest revision.
100      *
101      * @param namespace
102      * @param revision
103      * @return
104      */
105     Module findModuleByNamespaceAndRevision(final URI namespace, final Date revision);
106
107 }