Bug 1198: Make URLSchemaContextResolver thread safe
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / SchemaContext.java
index e51e4684323f63df9bd14fa6f6501ce1b48a034e..2bb1d993d9f12dcb2f486aa5064b0129d7177386 100644 (file)
@@ -7,17 +7,23 @@
  */
 package org.opendaylight.yangtools.yang.model.api;
 
+import com.google.common.base.Optional;
+import javax.annotation.concurrent.Immutable;
+import org.opendaylight.yangtools.yang.common.QName;
+
 import java.net.URI;
 import java.util.Date;
 import java.util.Set;
 
-import org.opendaylight.yangtools.yang.common.QName;
-
 /**
- * The interface contains the methods for manipulating all the top level context
- * data (data from all red modules) like YANG notifications, extensions,
+ * The interface represents static view of compiled yang files,
+ * contains the methods for obtaining all the top level context
+ * data (data from all modules) like YANG notifications, extensions,
  * operations...
+ * Instances MUST be immutable and thus usage in multi threaded
+ * environment is safe.
  */
+@Immutable
 public interface SchemaContext extends ContainerSchemaNode {
 
     public static final QName NAME = QName.create(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), null, "data");
@@ -104,4 +110,20 @@ public interface SchemaContext extends ContainerSchemaNode {
      */
     Module findModuleByNamespaceAndRevision(final URI namespace, final Date revision);
 
+
+    /**
+     * Get yang source code represented as string for matching
+     * {@link org.opendaylight.yangtools.yang.model.api.ModuleIdentifier}.
+     * @param moduleIdentifier must provide a non-null
+     * {@link org.opendaylight.yangtools.yang.model.api.ModuleIdentifier#getName()},
+     * other methods might return null.
+     * @return value iif matching module is found in schema context.
+     */
+    Optional<String> getModuleSource(ModuleIdentifier moduleIdentifier);
+
+    /**
+     * Get all module and submodule identifiers.
+     */
+    Set<ModuleIdentifier> getAllModuleIdentifiers();
+
 }