2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.model.api;
10 import com.google.common.base.Optional;
12 import java.util.Date;
14 import javax.annotation.concurrent.Immutable;
15 import org.opendaylight.yangtools.yang.common.QName;
18 * The interface represents static view of compiled yang files,
19 * contains the methods for obtaining all the top level context
20 * data (data from all modules) like YANG notifications, extensions,
22 * Instances MUST be immutable and thus usage in multi threaded
23 * environment is safe.
26 public interface SchemaContext extends ContainerSchemaNode {
28 * QName of NETCONF top-level data node.
30 QName NAME = QName.create(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), null, "data").intern();
33 * Returns data schema node instances which represents direct subnodes (like
34 * leaf, leaf-list, list, container) in all YANG modules in the context.
36 * @return set of <code>DataSchemaNode</code> instances which represents
37 * YANG data nodes at the module top level
39 Set<DataSchemaNode> getDataDefinitions();
42 * Returns modules which are part of the schema context.
44 * @return set of the modules which belong to the schema context
46 Set<Module> getModules();
49 * Returns rpc definition instances which are defined as the direct
50 * subelements in all YANG modules in the context.
52 * @return set of <code>RpcDefinition</code> instances which represents
53 * nodes defined via <code>rpc</code> YANG keyword
55 Set<RpcDefinition> getOperations();
58 * Returns extencion definition instances which are defined as the direct
59 * subelements in all YANG modules in the context
61 * @return set of <code>ExtensionDefinition</code> instances which
62 * represents nodes defined via <code>extension</code> YANG keyword
64 Set<ExtensionDefinition> getExtensions();
67 * Returns module instance (from the context) with concrete name and
71 * string with the module name
73 * date of the module revision
74 * @return module instance which has name and revision (if specified) the
75 * same as are the values specified in parameters <code>name</code>
76 * and <code>revision</code>. In other cases the <code>null</code>
80 Module findModuleByName(final String name, final Date revision);
84 * Returns module instance (from the context) with concrete namespace.
87 * URI instance with specified namespace
88 * @return module instance which has namespace equal to the
89 * <code>namespace</code> or <code>null</code> in other cases
91 Set<Module> findModuleByNamespace(final URI namespace);
94 * Returns module instance based on given namespace and revision. If
95 * revision is not specified, returns module with newest revision.
101 Module findModuleByNamespaceAndRevision(final URI namespace, final Date revision);
105 * Get yang source code represented as string for matching
106 * {@link org.opendaylight.yangtools.yang.model.api.ModuleIdentifier}.
107 * @param moduleIdentifier must provide a non-null
108 * {@link org.opendaylight.yangtools.yang.model.api.ModuleIdentifier#getName()},
109 * other methods might return null.
110 * @return value iif matching module is found in schema context.
112 Optional<String> getModuleSource(ModuleIdentifier moduleIdentifier);
115 * Get all module and submodule identifiers.
117 Set<ModuleIdentifier> getAllModuleIdentifiers();