Make DOMSchemaService operate of EffectiveModelContext 97/84797/5
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 30 Sep 2019 05:08:26 +0000 (07:08 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 9 Apr 2020 09:16:10 +0000 (11:16 +0200)
We are stepping towards working on Declared/EffectiveStatements
instead of SchemaNodes, this exposes EffectiveModelContext from
the DOMSchemaService.

JIRA: MDSAL-435
Change-Id: I6b24f423e104683e008a97595647a7b9ce4d3a11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
33 files changed:
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/BindingToNormalizedNodeCodec.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/BindingNormalizedCodecTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/AbstractBaseDataBrokerTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/AbstractDataBrokerTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/AbstractDataBrokerTestCustomizer.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/AbstractNotificationBrokerTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/AbstractSchemaAwareTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/util/MockSchemaService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMSchemaService.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/AbstractDOMRoutingTable.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMActionRoutingTable.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMRpcRouter.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMRpcRoutingTable.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/schema/ScanningSchemaServiceProvider.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMBrokerTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMDataTreeChangeListenerTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMDataTreeListenerTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMRpcRouterTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMTransactionChainTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/ShardedDOMDataTreeProducerMultiShardTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/ShardedDOMDataTreeTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/schema/ScanningSchemaServiceProviderTest.java
dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataStore.java
dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataTreeShard.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataStoreFactoryTest.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataTreeShardTest.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDataStoreTest.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/mdsal/dom/store/inmemory/TestModel.java
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/EffectiveModelContextImpl.java [moved from dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/SchemaSchemaContextListenerImpl.java with 60% similarity]
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/OSGiDOMSchemaService.java
dom/mdsal-dom-schema-osgi/src/test/java/org/opendaylight/mdsal/dom/schema/osgi/impl/TestModel.java
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/AbstractDOMSchemaService.java
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/FixedDOMSchemaService.java

index b65573aaff382a6c144d2da14d9c2f9aa8954e24..14afc58e6c991b7893e48794084df1fee38e1aa7 100644 (file)
@@ -66,11 +66,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -83,7 +84,7 @@ import org.slf4j.LoggerFactory;
  * NOTE: this class is non-final to allow controller adapter migration without duplicated code.
  */
 @Singleton
-public class BindingToNormalizedNodeCodec implements BindingNormalizedNodeSerializer, SchemaContextListener,
+public class BindingToNormalizedNodeCodec implements BindingNormalizedNodeSerializer, EffectiveModelContextListener,
         AutoCloseable {
 
     private static final long WAIT_DURATION_SEC = 5;
@@ -317,9 +318,9 @@ public class BindingToNormalizedNodeCodec implements BindingNormalizedNodeSerial
     }
 
     @Override
-    public void onGlobalContextUpdated(final SchemaContext context) {
+    public void onModelContextUpdated(final EffectiveModelContext newModelContext) {
         final BindingRuntimeContext runtimeContext = DefaultBindingRuntimeContext.create(
-            generator.generateTypeMapping(context), classLoadingStrategy);
+            generator.generateTypeMapping(newModelContext), classLoadingStrategy);
         codecRegistry.onBindingRuntimeContextUpdated(runtimeContext);
         futureSchema.onRuntimeContextUpdated(runtimeContext);
     }
index e19d958e98b8433b0a1e1a7f49df504cb9ffd56f..eec5c987ee9837573cbaec9e4eb49134afd516f7 100644 (file)
@@ -41,9 +41,10 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.util.AbstractSchemaContext;
 
 public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
@@ -61,10 +62,10 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         .node(TopLevelList.QNAME).nodeWithKey(TopLevelList.QNAME, NAME_QNAME, TOP_FOO_KEY.getName()).build();
 
     private BindingToNormalizedNodeCodec codec;
-    private SchemaContext context;
+    private EffectiveModelContext context;
 
     @Override
-    protected void setupWithSchema(final SchemaContext schemaContext) {
+    protected void setupWithSchema(final EffectiveModelContext schemaContext) {
         this.context = schemaContext;
         this.codec = new BindingToNormalizedNodeCodec(new DefaultBindingRuntimeGenerator(),
             GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(),
@@ -73,7 +74,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
     @Test
     public void testComplexAugmentationSerialization() {
-        this.codec.onGlobalContextUpdated(this.context);
+        this.codec.onModelContextUpdated(this.context);
         final PathArgument lastArg = this.codec.toYangInstanceIdentifier(BA_TREE_COMPLEX_USES).getLastPathArgument();
         assertTrue(lastArg instanceof AugmentationIdentifier);
     }
@@ -81,7 +82,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
     @Test
     public void testLeafOnlyAugmentationSerialization() {
-        this.codec.onGlobalContextUpdated(this.context);
+        this.codec.onModelContextUpdated(this.context);
         final PathArgument leafOnlyLastArg = this.codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY)
             .getLastPathArgument();
         assertTrue(leafOnlyLastArg instanceof AugmentationIdentifier);
@@ -91,7 +92,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     @Test
     @SuppressWarnings("checkstyle:illegalCatch")
     public void testToYangInstanceIdentifierBlocking() {
-        this.codec.onGlobalContextUpdated(new EmptySchemaContext());
+        this.codec.onModelContextUpdated(new EmptyEffectiveModelContext());
 
         final CountDownLatch done = new CountDownLatch(1);
         final AtomicReference<YangInstanceIdentifier> yangId = new AtomicReference<>();
@@ -107,7 +108,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         }).start();
 
         Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-        this.codec.onGlobalContextUpdated(this.context);
+        this.codec.onModelContextUpdated(this.context);
 
         assertTrue("toYangInstanceIdentifierBlocking completed",
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
@@ -125,7 +126,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
     @Test
     public void testGetRpcMethodToSchemaPathBlocking() {
-        this.codec.onGlobalContextUpdated(new EmptySchemaContext());
+        this.codec.onModelContextUpdated(new EmptyEffectiveModelContext());
         testGetRpcMethodToSchemaPath();
     }
 
@@ -146,7 +147,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         }).start();
 
         Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-        this.codec.onGlobalContextUpdated(this.context);
+        this.codec.onModelContextUpdated(this.context);
 
         assertTrue("getRpcMethodToSchemaPath completed",
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
@@ -163,7 +164,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         fail("rockTheHouse RPC method not found");
     }
 
-    static class EmptySchemaContext extends AbstractSchemaContext {
+    static class EmptyEffectiveModelContext extends AbstractSchemaContext implements EffectiveModelContext {
         @Override
         public Set<Module> getModules() {
             return ImmutableSet.of();
@@ -183,5 +184,10 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         protected SetMultimap<String, Module> getNameToModules() {
             return ImmutableSetMultimap.of();
         }
+
+        @Override
+        public Map<QNameModule, ModuleEffectiveStatement> getModuleStatements() {
+            return ImmutableMap.of();
+        }
     }
 }
index 9f8baa54362546c1f9d5fde6aa24e42030aa024a..ea4c2ef27ccffaaa3470c7c2a1050f4080bee711 100644 (file)
@@ -13,10 +13,9 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 public abstract class AbstractBaseDataBrokerTest extends AbstractSchemaAwareTest {
-
     private static final int ASSERT_COMMIT_DEFAULT_TIMEOUT = 5000;
 
     private AbstractDataBrokerTestCustomizer testCustomizer;
@@ -33,7 +32,7 @@ public abstract class AbstractBaseDataBrokerTest extends AbstractSchemaAwareTest
     }
 
     @Override
-    protected void setupWithSchema(final SchemaContext context) {
+    protected void setupWithSchema(final EffectiveModelContext context) {
         testCustomizer = createDataBrokerTestCustomizer();
         dataBroker = testCustomizer.createDataBroker();
         domBroker = testCustomizer.getDOMDataBroker();
@@ -52,7 +51,7 @@ public abstract class AbstractBaseDataBrokerTest extends AbstractSchemaAwareTest
         assertCommit(commit, ASSERT_COMMIT_DEFAULT_TIMEOUT);
     }
 
-    protected static final void assertCommit(final ListenableFuture<?> commit, long timeoutInMS) {
+    protected static final void assertCommit(final ListenableFuture<?> commit, final long timeoutInMS) {
         try {
             commit.get(timeoutInMS, TimeUnit.MILLISECONDS);
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
index 41c1963fe9d788780a65c2b7cf9a3bc9d37ee8ff..8f1639f092575eb9c148ca90f8a739db47b5cc1c 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.binding.dom.adapter.test;
 
 import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 /**
  * Abstract base for DataBroker tests. Note that it performs synchronous commits via a direct executor which can cause
@@ -21,7 +21,7 @@ public class AbstractDataBrokerTest extends AbstractBaseDataBrokerTest {
     }
 
     @Override
-    protected void setupWithSchema(SchemaContext context) {
+    protected void setupWithSchema(final EffectiveModelContext context) {
         super.setupWithSchema(context);
         setupWithDataBroker(getDataBroker());
     }
index 05112678edec00ade859d04a78e22e6e30e382c5..120bbfc39867f44563ee5f48d5ec7d5c5163df79 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
 import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
 import org.opendaylight.mdsal.dom.spi.store.DOMStore;
 import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 public abstract class AbstractDataBrokerTestCustomizer {
 
@@ -110,7 +110,7 @@ public abstract class AbstractDataBrokerTestCustomizer {
         return this.datastores;
     }
 
-    public void updateSchema(final SchemaContext ctx) {
+    public void updateSchema(final EffectiveModelContext ctx) {
         this.schemaService.changeSchema(ctx);
     }
 
index c711bca0f668d421fb8b31a8f6a04f1c58514ead..abcc6e74c367cc2357506e7b9dc2f208d9a8cde2 100644 (file)
@@ -11,7 +11,7 @@ import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
 import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 public class AbstractNotificationBrokerTest extends AbstractSchemaAwareTest {
     private BindingToNormalizedNodeCodec bindingToNormalizedNodeCodec;
@@ -21,7 +21,7 @@ public class AbstractNotificationBrokerTest extends AbstractSchemaAwareTest {
 
 
     @Override
-    protected void setupWithSchema(final SchemaContext context) {
+    protected void setupWithSchema(final EffectiveModelContext context) {
         final DataBrokerTestCustomizer testCustomizer = createDataBrokerTestCustomizer();
         domNotificationRouter = testCustomizer.getDomNotificationRouter();
         notificationService = testCustomizer.createNotificationService();
index 9b8505325df0f303f8d7761d10e1e78be3566667..05a3c46922786c7d5bc8551335c4112eb07fe6be 100644 (file)
@@ -17,18 +17,19 @@ import org.opendaylight.binding.runtime.spi.GeneratedClassLoadingStrategy;
 import org.opendaylight.binding.runtime.spi.ModuleInfoBackedContext;
 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 public abstract class AbstractSchemaAwareTest {
-    private static final LoadingCache<Set<YangModuleInfo>, SchemaContext> SCHEMA_CONTEXT_CACHE =
-            CacheBuilder.newBuilder().weakValues().build(new CacheLoader<Set<YangModuleInfo>, SchemaContext>() {
-                @Override
-                public SchemaContext load(final Set<YangModuleInfo> key) {
-                    return ModuleInfoBackedContext.cacheContext(
-                        GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), ImmutableSet.copyOf(key))
-                            .tryToCreateModelContext().get();
-                }
-            });
+    private static final LoadingCache<Set<YangModuleInfo>, EffectiveModelContext> SCHEMA_CONTEXT_CACHE =
+            CacheBuilder.newBuilder().weakValues().build(
+                new CacheLoader<Set<YangModuleInfo>, EffectiveModelContext>() {
+                    @Override
+                    public EffectiveModelContext load(final Set<YangModuleInfo> key) {
+                        return ModuleInfoBackedContext.cacheContext(
+                            GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), ImmutableSet.copyOf(key))
+                                .tryToCreateModelContext().get();
+                    }
+                });
 
     @Before
     public final void setup() throws Exception {
@@ -39,7 +40,7 @@ public abstract class AbstractSchemaAwareTest {
         return BindingReflections.cacheModuleInfos(Thread.currentThread().getContextClassLoader());
     }
 
-    protected SchemaContext getSchemaContext() throws Exception {
+    protected EffectiveModelContext getSchemaContext() throws Exception {
         return SCHEMA_CONTEXT_CACHE.getUnchecked(getModuleInfos());
     }
 
@@ -48,5 +49,5 @@ public abstract class AbstractSchemaAwareTest {
      *
      * @param context schema context
      */
-    protected abstract void setupWithSchema(SchemaContext context);
+    protected abstract void setupWithSchema(EffectiveModelContext context);
 }
index a75d987c04fd7b768335c4c385be3dfddd2fc697..32545a185476aff520e5808a6b9e101797916c53 100644 (file)
@@ -13,34 +13,29 @@ import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaServiceExtension;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
 
-public final class MockSchemaService implements DOMSchemaService, SchemaContextProvider {
+public final class MockSchemaService implements DOMSchemaService, EffectiveModelContextProvider {
 
-    private SchemaContext schemaContext;
+    private EffectiveModelContext schemaContext;
 
-    final ListenerRegistry<SchemaContextListener> listeners = ListenerRegistry.create();
+    final ListenerRegistry<EffectiveModelContextListener> listeners = ListenerRegistry.create();
 
     @Override
-    public synchronized SchemaContext getGlobalContext() {
+    public synchronized EffectiveModelContext getGlobalContext() {
         return schemaContext;
     }
 
     @Override
-    public synchronized SchemaContext getSessionContext() {
-        return schemaContext;
-    }
-
-    @Override
-    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
-            final SchemaContextListener listener) {
+    public ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener(
+            final EffectiveModelContextListener listener) {
         return listeners.register(listener);
     }
 
     @Override
-    public synchronized SchemaContext getSchemaContext() {
+    public synchronized EffectiveModelContext getEffectiveModelContext() {
         return schemaContext;
     }
 
@@ -49,8 +44,8 @@ public final class MockSchemaService implements DOMSchemaService, SchemaContextP
         return ImmutableClassToInstanceMap.of();
     }
 
-    public synchronized void changeSchema(final SchemaContext newContext) {
+    public synchronized void changeSchema(final EffectiveModelContext newContext) {
         schemaContext = newContext;
-        listeners.streamListeners().forEach(listener -> listener.onGlobalContextUpdated(schemaContext));
+        listeners.streamListeners().forEach(listener -> listener.onModelContextUpdated(schemaContext));
     }
 }
index 8066671d6d285c19945d166214ae9e6b779d5914..a0342fc9be75c655bf5e90a61edd5f05704bcc55 100644 (file)
@@ -8,23 +8,27 @@
 package org.opendaylight.mdsal.dom.api;
 
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 
 public interface DOMSchemaService extends DOMExtensibleService<DOMSchemaService, DOMSchemaServiceExtension> {
     /**
      * Returns session specific YANG schema context.
      *
      * @return schemaContext
+     * @deprecated This method never fully materialized, use {@link #getGlobalContext()} instead.
      */
-    SchemaContext getSessionContext();
+    @Deprecated
+    default EffectiveModelContext getSessionContext() {
+        throw new UnsupportedOperationException("getSessionContext() is not specified nor implemented");
+    }
 
     /**
      * Returns global schema context.
      *
      * @return schemaContext
      */
-    SchemaContext getGlobalContext();
+    EffectiveModelContext getGlobalContext();
 
     /**
      * Register a listener for changes in schema context.
@@ -32,5 +36,6 @@ public interface DOMSchemaService extends DOMExtensibleService<DOMSchemaService,
      * @param listener Listener which should be registered
      * @return Listener registration handle
      */
-    ListenerRegistration<SchemaContextListener> registerSchemaContextListener(SchemaContextListener listener);
+    ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener(
+            EffectiveModelContextListener listener);
 }
index 914164d62d3992604978e730156832a71a291053..ae81b34fd4a26e8e3a1d5a76dc0fe1c8a5a355aa 100644 (file)
@@ -26,7 +26,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
@@ -41,15 +41,14 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 abstract class AbstractDOMRoutingTable<I, D, M, L extends EventListener,
         E extends AbstractDOMRoutingTableEntry<D, M, L>> {
     private final Map<SchemaPath, E> operations;
-    private final SchemaContext schemaContext;
+    private final EffectiveModelContext schemaContext;
 
-    AbstractDOMRoutingTable(final Map<SchemaPath, E> operations,
-            final SchemaContext schemaContext) {
+    AbstractDOMRoutingTable(final Map<SchemaPath, E> operations, final EffectiveModelContext schemaContext) {
         this.operations = requireNonNull(operations);
         this.schemaContext = schemaContext;
     }
 
-    AbstractDOMRoutingTable<I, D, M, L, E> setSchemaContext(final SchemaContext context) {
+    AbstractDOMRoutingTable<I, D, M, L, E> setSchemaContext(final EffectiveModelContext context) {
         final Builder<SchemaPath, E> b = ImmutableMap.builder();
 
         for (Entry<SchemaPath, E> e : operations.entrySet()) {
@@ -149,9 +148,9 @@ abstract class AbstractDOMRoutingTable<I, D, M, L extends EventListener,
     }
 
     protected abstract AbstractDOMRoutingTable<I, D, M, L, E> newInstance(Map<SchemaPath, E> operations,
-            SchemaContext schemaContext);
+            EffectiveModelContext schemaContext);
 
     abstract ListMultimap<SchemaPath, D> decomposeIdentifiers(Set<I> instances);
 
-    abstract E createOperationEntry(SchemaContext context, SchemaPath key, Map<D, List<M>> implementations);
+    abstract E createOperationEntry(EffectiveModelContext context, SchemaPath key, Map<D, List<M>> implementations);
 }
index 00a062cba17f398ad32a07bca5736d2d5e38fb9a..58669acfa4e0cfa68c08200bd3636d8ce8284eca 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.mdsal.dom.api.DOMActionInstance;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
 import org.opendaylight.yangtools.yang.model.api.ActionNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -35,13 +36,13 @@ final class DOMActionRoutingTable extends AbstractDOMRoutingTable<DOMActionInsta
     static final DOMActionRoutingTable EMPTY = new DOMActionRoutingTable(ImmutableMap.of(), null);
 
     private DOMActionRoutingTable(final Map<SchemaPath, DOMActionRoutingTableEntry> actions,
-            final SchemaContext schemaContext) {
+            final EffectiveModelContext schemaContext) {
         super(actions, schemaContext);
     }
 
     @Override
     protected DOMActionRoutingTable newInstance(final Map<SchemaPath, DOMActionRoutingTableEntry> operations,
-            final SchemaContext schemaContext) {
+            final EffectiveModelContext schemaContext) {
         return new DOMActionRoutingTable(operations, schemaContext);
     }
 
@@ -56,8 +57,8 @@ final class DOMActionRoutingTable extends AbstractDOMRoutingTable<DOMActionInsta
     }
 
     @Override
-    protected DOMActionRoutingTableEntry createOperationEntry(final SchemaContext context, final SchemaPath type,
-            final Map<DOMDataTreeIdentifier, List<DOMActionImplementation>> implementations) {
+    protected DOMActionRoutingTableEntry createOperationEntry(final EffectiveModelContext context,
+            final SchemaPath type, final Map<DOMDataTreeIdentifier, List<DOMActionImplementation>> implementations) {
         final ActionDefinition actionDef = findActionDefinition(context, type);
         if (actionDef == null) {
             //FIXME: return null directly instead of providing kind of unknown entry.
index e05d4e628ed75a79465191e71c8de93a8d5848e6..2128bd7fa986ec4248d5fce2dd4b2c80ecbab18d 100644 (file)
@@ -69,13 +69,13 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class DOMRpcRouter extends AbstractRegistration implements SchemaContextListener {
+public final class DOMRpcRouter extends AbstractRegistration implements EffectiveModelContextListener {
     private static final ThreadFactory THREAD_FACTORY = new ThreadFactoryBuilder().setNameFormat(
             "DOMRpcRouter-listener-%s").setDaemon(true).build();
 
@@ -175,13 +175,14 @@ public final class DOMRpcRouter extends AbstractRegistration implements SchemaCo
     }
 
     @Override
-    public synchronized void onGlobalContextUpdated(final SchemaContext context) {
+    public synchronized void onModelContextUpdated(final EffectiveModelContext newModelContext) {
         final DOMRpcRoutingTable oldTable = routingTable;
-        final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.setSchemaContext(context);
+        final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.setSchemaContext(newModelContext);
         routingTable = newTable;
 
         final DOMActionRoutingTable oldActionTable = actionRoutingTable;
-        final DOMActionRoutingTable newActionTable = (DOMActionRoutingTable) oldActionTable.setSchemaContext(context);
+        final DOMActionRoutingTable newActionTable =
+                (DOMActionRoutingTable) oldActionTable.setSchemaContext(newModelContext);
         actionRoutingTable = newActionTable;
     }
 
index 6a70f38ba36664c56c0f906e0555d93f87f1da9f..82249d6266fa551685660bc4cec9cc7c6e50e72b 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
 import org.opendaylight.mdsal.dom.spi.RpcRoutingStrategy;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -29,7 +30,7 @@ final class DOMRpcRoutingTable extends AbstractDOMRoutingTable<DOMRpcIdentifier,
     static final DOMRpcRoutingTable EMPTY = new DOMRpcRoutingTable(ImmutableMap.of(), null);
 
     private DOMRpcRoutingTable(final Map<SchemaPath, AbstractDOMRpcRoutingTableEntry> rpcs,
-            final SchemaContext schemaContext) {
+            final EffectiveModelContext schemaContext) {
         super(rpcs, schemaContext);
     }
 
@@ -40,7 +41,7 @@ final class DOMRpcRoutingTable extends AbstractDOMRoutingTable<DOMRpcIdentifier,
 
     @Override
     protected DOMRpcRoutingTable newInstance(final Map<SchemaPath, AbstractDOMRpcRoutingTableEntry> operations,
-            final SchemaContext schemaContext) {
+            final EffectiveModelContext schemaContext) {
         return new DOMRpcRoutingTable(operations, schemaContext);
     }
 
@@ -55,7 +56,7 @@ final class DOMRpcRoutingTable extends AbstractDOMRoutingTable<DOMRpcIdentifier,
     }
 
     @Override
-    AbstractDOMRpcRoutingTableEntry createOperationEntry(final SchemaContext context, final SchemaPath key,
+    AbstractDOMRpcRoutingTableEntry createOperationEntry(final EffectiveModelContext context, final SchemaPath key,
             final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> implementations) {
         final RpcDefinition rpcDef = findRpcDefinition(context, key);
         if (rpcDef == null) {
index 98e084f54871845dfc131c081e9ce7ce03064827..1b7d8c55e527619b2f09c38ca227df4b5bf2bef0 100644 (file)
@@ -19,8 +19,8 @@ import org.opendaylight.mdsal.dom.spi.AbstractDOMSchemaService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
@@ -36,12 +36,12 @@ public class ScanningSchemaServiceProvider extends AbstractDOMSchemaService.With
 
     private final YangTextSchemaContextResolver contextResolver = YangTextSchemaContextResolver.create("global-bundle");
     @GuardedBy("lock")
-    private final ListenerRegistry<SchemaContextListener> listeners = ListenerRegistry.create();
+    private final ListenerRegistry<EffectiveModelContextListener> listeners = ListenerRegistry.create();
     private final Object lock = new Object();
 
     public void tryToUpdateSchemaContext() {
         synchronized (lock) {
-            final Optional<? extends SchemaContext> optSchema = contextResolver.getSchemaContext();
+            final Optional<? extends EffectiveModelContext> optSchema = contextResolver.getEffectiveModelContext();
             optSchema.ifPresent(schema -> {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Got new SchemaContext: # of modules {}", schema.getModules().size());
@@ -53,11 +53,11 @@ public class ScanningSchemaServiceProvider extends AbstractDOMSchemaService.With
 
     @VisibleForTesting
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public void notifyListeners(final SchemaContext schemaContext) {
+    public void notifyListeners(final EffectiveModelContext schemaContext) {
         synchronized (lock) {
             listeners.streamListeners().forEach(listener -> {
                 try {
-                    listener.onGlobalContextUpdated(schemaContext);
+                    listener.onModelContextUpdated(schemaContext);
                 } catch (final Exception e) {
                     LOG.error("Exception occured during invoking listener {}", listener, e);
                 }
@@ -84,15 +84,15 @@ public class ScanningSchemaServiceProvider extends AbstractDOMSchemaService.With
     }
 
     @Override
-    public SchemaContext getGlobalContext() {
-        return contextResolver.getSchemaContext().orElse(null);
+    public EffectiveModelContext getGlobalContext() {
+        return contextResolver.getEffectiveModelContext().orElse(null);
     }
 
     @Override
-    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
-            final SchemaContextListener listener) {
+    public ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener(
+            final EffectiveModelContextListener listener) {
         synchronized (lock) {
-            contextResolver.getSchemaContext().ifPresent(listener::onGlobalContextUpdated);
+            contextResolver.getEffectiveModelContext().ifPresent(listener::onModelContextUpdated);
             return listeners.register(listener);
         }
     }
index f4ed7f182b95c28f3fff6e823878599133343126..598eb7584a86a14bd77823137869655428d32250 100644 (file)
@@ -62,8 +62,8 @@ public class DOMBrokerTest extends AbstractDatastoreTest {
         final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
                 MoreExecutors.newDirectExecutorService());
 
-        operStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
-        configStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        operStore.onModelContextUpdated(SCHEMA_CONTEXT);
+        configStore.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ImmutableMap<LogicalDatastoreType, DOMStore> stores =
                 ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
index 3fa4e3eabb95ef4324ec1bd67e0d9cd8264b007a..a9caac9acb658c42acf14f4bad165fc475e32850 100644 (file)
@@ -42,7 +42,7 @@ public class DOMDataTreeChangeListenerTest extends AbstractDatastoreTest {
     @Before
     public void setUp() {
         domStore = new InMemoryDOMDataStore("Mdsal217", MoreExecutors.newDirectExecutorService());
-        domStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        domStore.onModelContextUpdated(SCHEMA_CONTEXT);
     }
 
     @Test
index 9c5848ca2211b5e13d1f414257991cbd2ed12ba1..8342f227db503290f6e1125cdc6d6e9fee04742e 100644 (file)
@@ -93,8 +93,8 @@ public class DOMDataTreeListenerTest extends AbstractDatastoreTest {
         final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
                 MoreExecutors.newDirectExecutorService());
 
-        operStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
-        configStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        operStore.onModelContextUpdated(SCHEMA_CONTEXT);
+        configStore.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ImmutableMap<LogicalDatastoreType, DOMStore> stores = ImmutableMap.<LogicalDatastoreType,
                 DOMStore>builder()
index fd9461b6d90a295be48299274736a144d7cf4aff..f35adf97eddf2d878eb8a4405f28dea97f50b40d 100644 (file)
@@ -70,7 +70,7 @@ public class DOMRpcRouterTest extends TestUtils {
 
             final DOMRpcRoutingTable routingTableOriginal = rpcRouter.routingTable();
 
-            rpcRouter.onGlobalContextUpdated(TestModel.createTestContext());
+            rpcRouter.onModelContextUpdated(TestModel.createTestContext());
 
             final DOMRpcRoutingTable routingTableChanged = rpcRouter.routingTable();
             assertNotEquals(routingTableOriginal, routingTableChanged);
index 28a5539956793b89e8088135da06ca30f6b0eb94..005745b53d0c4e573ae2234a555a7fbbb2e39555 100644 (file)
@@ -46,8 +46,8 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
                 MoreExecutors.newDirectExecutorService());
 
-        operStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
-        configStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        operStore.onModelContextUpdated(SCHEMA_CONTEXT);
+        configStore.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ImmutableMap<LogicalDatastoreType, DOMStore> stores =
                 ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
index 25bc4b2bf98786671e116335b546b26fcdae94b4..978d4fba96626a820eb465d8c77242c29da9ecbb 100644 (file)
@@ -92,7 +92,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest extends AbstractDatastoreT
         MockitoAnnotations.initMocks(this);
 
         rootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
-        rootShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        rootShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ShardedDOMDataTree dataTree = new ShardedDOMDataTree();
         final DOMDataTreeProducer shardRegProducer = dataTree.createProducer(Collections.singletonList(ROOT_ID));
@@ -213,7 +213,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest extends AbstractDatastoreT
         doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap());
 
         final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
-        innerShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        innerShard.onModelContextUpdated(SCHEMA_CONTEXT);
         final DOMDataTreeProducer shardRegProducer =
                 dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
         innerShardReg = dataTreeService.registerDataTreeShard(INNER_CONTAINER_ID, innerShard, shardRegProducer);
@@ -253,7 +253,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest extends AbstractDatastoreT
     @Test
     public void testMultipleShardsProducerClose() throws Exception {
         final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
-        innerShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        innerShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         assertTrue(rootShard.getProducers().isEmpty());
 
@@ -296,7 +296,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest extends AbstractDatastoreT
     @Test
     public void testMultipleShardsChildProducerClose() throws Exception {
         final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
-        innerShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        innerShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final DOMDataTreeProducer innerShardRegProducer =
                 dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
@@ -336,7 +336,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest extends AbstractDatastoreT
     @Test
     public void testMultipleShardsProducerCloseForSubshardAttached() throws Exception {
         final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
-        innerShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        innerShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final DOMDataTreeProducer innerShardRegProducer =
                 dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
@@ -359,7 +359,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest extends AbstractDatastoreT
                 Collections.singletonList(INNER_CONTAINER_ID).toString());
 
         final InMemoryDOMDataTreeShard test2Shard = InMemoryDOMDataTreeShard.create(TEST2_ID, executor, 1);
-        innerShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        innerShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final DOMDataTreeProducer test2ShardRegProducer =
                 dataTreeService.createProducer(Collections.singletonList(TEST2_ID));
index c50438cabbd0ff26bb8c4a2a543ab3ce0daa44ff..771312c05c50b46b7f921a377fd4f98fcd051b48 100644 (file)
@@ -92,7 +92,7 @@ public class ShardedDOMDataTreeTest extends AbstractDatastoreTest {
         MockitoAnnotations.initMocks(this);
 
         rootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
-        rootShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        rootShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ShardedDOMDataTree dataTree = new ShardedDOMDataTree();
         final DOMDataTreeProducer shardRegProducer = dataTree.createProducer(Collections.singletonList(ROOT_ID));
@@ -119,7 +119,7 @@ public class ShardedDOMDataTreeTest extends AbstractDatastoreTest {
         rootShardReg.close();
 
         final InMemoryDOMDataTreeShard newRootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
-        newRootShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        newRootShard.onModelContextUpdated(SCHEMA_CONTEXT);
         final DOMDataTreeProducer shardRegProducer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
 
         final ListenerRegistration<InMemoryDOMDataTreeShard> newRootShardReg =
@@ -127,7 +127,7 @@ public class ShardedDOMDataTreeTest extends AbstractDatastoreTest {
         shardRegProducer.close();
 
         final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
-        innerShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        innerShard.onModelContextUpdated(SCHEMA_CONTEXT);
         final DOMDataTreeProducer shardRegProducer2 =
                 dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
         ListenerRegistration<InMemoryDOMDataTreeShard> innerShardReg =
@@ -210,7 +210,7 @@ public class ShardedDOMDataTreeTest extends AbstractDatastoreTest {
         doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap());
 
         InMemoryDOMDataTreeShard testShard = InMemoryDOMDataTreeShard.create(TEST_ID, executor, 1);
-        testShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        testShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final DOMDataTreeProducer regProducer = dataTreeService.createProducer(Collections.singleton(TEST_ID));
         dataTreeService.registerDataTreeShard(TEST_ID, testShard, regProducer);
@@ -257,7 +257,7 @@ public class ShardedDOMDataTreeTest extends AbstractDatastoreTest {
         final DOMDataTreeProducer shardProducer = dataTreeService.createProducer(
                 Collections.singletonList(outerListPath));
         final InMemoryDOMDataTreeShard outerListShard = InMemoryDOMDataTreeShard.create(outerListPath, executor, 1000);
-        outerListShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        outerListShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ListenerRegistration<InMemoryDOMDataTreeShard> oid1ShardRegistration =
                 dataTreeService.registerDataTreeShard(outerListPath, outerListShard, shardProducer);
@@ -402,7 +402,7 @@ public class ShardedDOMDataTreeTest extends AbstractDatastoreTest {
     public void testLargerSubshardSpace() throws Exception {
 
         final InMemoryDOMDataTreeShard outerListShard = InMemoryDOMDataTreeShard.create(OUTER_LIST_ID, executor, 1, 1);
-        outerListShard.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        outerListShard.onModelContextUpdated(SCHEMA_CONTEXT);
 
         try (DOMDataTreeProducer producer =
                      dataTreeService.createProducer(Collections.singletonList(OUTER_LIST_ID))) {
index e06ccdee07b90e2c7de78597633fc7ebebb7deaa..a285b6affe414111daacab8a87883b82de5a1a58 100644 (file)
@@ -24,8 +24,9 @@ import org.mockito.internal.util.io.IOUtil;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@@ -66,8 +67,8 @@ public class ScanningSchemaServiceProviderTest {
         assertFalse(schemaService.hasListeners());
 
         final SchemaContextHolder actualSchemaCtx = new SchemaContextHolder();
-        final SchemaContextListener listener = actualSchemaCtx::setSchemaContext;
-        final ListenerRegistration<SchemaContextListener> registerSchemaContextListener =
+        final EffectiveModelContextListener listener = actualSchemaCtx::setSchemaContext;
+        final ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener =
                 schemaService.registerSchemaContextListener(listener);
         assertEquals(registerSchemaContextListener.getInstance(), listener);
         assertEquals(schemaService.getSchemaContext(), actualSchemaCtx.getSchemaContext());
@@ -75,14 +76,14 @@ public class ScanningSchemaServiceProviderTest {
 
     @Test
     public void notifyListenersTest() {
-        final SchemaContext baseSchemaCtx = schemaService.getGlobalContext();
+        final EffectiveModelContext baseSchemaCtx = schemaService.getGlobalContext();
         assertNotNull(baseSchemaCtx);
         assertTrue(baseSchemaCtx.getModules().size() == 1);
 
         final SchemaContextHolder actualSchemaCtx = new SchemaContextHolder();
 
-        final SchemaContextListener schemaCtxListener = actualSchemaCtx::setSchemaContext;
-        final ListenerRegistration<SchemaContextListener> registerSchemaContextListener =
+        final EffectiveModelContextListener schemaCtxListener = actualSchemaCtx::setSchemaContext;
+        final ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener =
                 schemaService.registerSchemaContextListener(schemaCtxListener);
         assertEquals(registerSchemaContextListener.getInstance(), schemaCtxListener);
         assertNotNull(actualSchemaCtx.getSchemaContext());
@@ -91,7 +92,7 @@ public class ScanningSchemaServiceProviderTest {
         addYang("/empty-test1.yang");
         addYangs(schemaService);
 
-        final SchemaContext nextSchemaCtx = schemaService.getGlobalContext();
+        final EffectiveModelContext nextSchemaCtx = schemaService.getGlobalContext();
         assertNotNull(nextSchemaCtx);
         assertTrue(nextSchemaCtx.getModules().size() == 2);
 
@@ -103,7 +104,7 @@ public class ScanningSchemaServiceProviderTest {
         addYang("/empty-test2.yang");
         addYangs(schemaService);
 
-        final SchemaContext unregistredListenerSchemaCtx = schemaService.getGlobalContext();
+        final EffectiveModelContext unregistredListenerSchemaCtx = schemaService.getGlobalContext();
         assertNotNull(unregistredListenerSchemaCtx);
         assertTrue(unregistredListenerSchemaCtx.getModules().size() == 3);
 
@@ -170,13 +171,13 @@ public class ScanningSchemaServiceProviderTest {
 
     private class SchemaContextHolder {
 
-        private SchemaContext schemaCtx;
+        private EffectiveModelContext schemaCtx;
 
-        public void setSchemaContext(final SchemaContext ctx) {
+        public void setSchemaContext(final EffectiveModelContext ctx) {
             schemaCtx = ctx;
         }
 
-        public SchemaContext getSchemaContext() {
+        public EffectiveModelContext getSchemaContext() {
             return schemaCtx;
         }
     }
index f8f10522da0db0ee259d48d272b3bce4f30e95f5..aa36a99ccae4bdd99cced2d645022defae63ddc3 100644 (file)
@@ -36,23 +36,18 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * In-memory DOM Data Store.
- *
- *<p>
- * Implementation of {@link DOMStore} which uses {@link DataTree} and other
- * classes such as {@link SnapshotBackedWriteTransaction}.
- * {@link org.opendaylight.mdsal.dom.spi.store.SnapshotBackedReadTransaction} to implement {@link DOMStore}
- * contract.
- *
+ * In-memory DOM Data Store. Implementation of {@link DOMStore} which uses {@link DataTree} and other classes such as
+ * {@link SnapshotBackedWriteTransaction}.
+ * {@link org.opendaylight.mdsal.dom.spi.store.SnapshotBackedReadTransaction} to implement {@link DOMStore} contract.
  */
 public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> implements DOMStore,
-        Identifiable<String>, SchemaContextListener, AutoCloseable, DOMStoreTreeChangePublisher {
+        Identifiable<String>, EffectiveModelContextListener, AutoCloseable, DOMStoreTreeChangePublisher {
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMDataStore.class);
 
     private final AtomicLong txCounter = new AtomicLong(0);
@@ -130,8 +125,8 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
     }
 
     @Override
-    public synchronized void onGlobalContextUpdated(final SchemaContext ctx) {
-        dataTree.setSchemaContext(ctx);
+    public synchronized void onModelContextUpdated(final EffectiveModelContext newModelContext) {
+        dataTree.setEffectiveModelContext(newModelContext);
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
index e03795b2143f0b85bd26303c44160ce13235193f..0eea70c545ff859c9fce1c5f46b6357ac6d339b0 100644 (file)
@@ -42,13 +42,13 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Beta
-public class InMemoryDOMDataTreeShard implements ReadableWriteableDOMDataTreeShard, SchemaContextListener {
+public class InMemoryDOMDataTreeShard implements ReadableWriteableDOMDataTreeShard, EffectiveModelContextListener {
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMDataTreeShard.class);
     private static final int DEFAULT_SUBMIT_QUEUE_SIZE = 1000;
 
@@ -98,8 +98,8 @@ public class InMemoryDOMDataTreeShard implements ReadableWriteableDOMDataTreeSha
     }
 
     @Override
-    public void onGlobalContextUpdated(final SchemaContext context) {
-        dataTree.setSchemaContext(context);
+    public void onModelContextUpdated(final EffectiveModelContext newModelContext) {
+        dataTree.setEffectiveModelContext(newModelContext);
     }
 
     @Override
index 1cf3ce1aca74ff74e59a279c3c35f961d7e4ed95..5a079acce2985b0e6faf23e0e6fc183a8cb3fab5 100644 (file)
@@ -21,7 +21,7 @@ import org.junit.Test;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 
 public class InMemoryDOMDataStoreFactoryTest {
 
@@ -29,7 +29,7 @@ public class InMemoryDOMDataStoreFactoryTest {
     public void basicTest() throws Exception {
         final String testStoreName = "TestStore";
         final DOMSchemaService domSchemaService = mock(DOMSchemaService.class);
-        doReturn(null).when(domSchemaService).registerSchemaContextListener(any(SchemaContextListener.class));
+        doReturn(null).when(domSchemaService).registerSchemaContextListener(any(EffectiveModelContextListener.class));
 
         final InMemoryDOMDataStore inMemoryDOMDataStore =
                 InMemoryDOMDataStoreFactory.create(testStoreName, domSchemaService);
@@ -40,7 +40,7 @@ public class InMemoryDOMDataStoreFactoryTest {
         doReturn("testListener").when(domDataTreeChangeListener).toString();
         doNothing().when(domDataTreeChangeListener).onDataTreeChanged(any());
         doNothing().when(domDataTreeChangeListener).onInitialData();
-        inMemoryDOMDataStore.onGlobalContextUpdated(TestModel.createTestContext());
+        inMemoryDOMDataStore.onModelContextUpdated(TestModel.createTestContext());
         inMemoryDOMDataStore.registerTreeChangeListener(YangInstanceIdentifier.empty(), domDataTreeChangeListener);
 
         final AutoCloseable autoCloseable = mock(AutoCloseable.class);
index d2e9856996bd1e12f177c34a249b13f8d560748f..c45ac2effc402d07e38627bc5070df0e7f759c3e 100644 (file)
@@ -66,7 +66,7 @@ public class InMemoryDOMDataTreeShardTest {
         doReturn(inMemoryDOMDataTreeShard.createModificationFactory(prefixes))
                 .when(mockProducer).getModificationFactory();
 
-        inMemoryDOMDataTreeShard.onGlobalContextUpdated(createTestContext());
+        inMemoryDOMDataTreeShard.onModelContextUpdated(createTestContext());
         inMemoryDOMDataTreeShard.createTransaction("", mockProducer, mock(CursorAwareDataTreeSnapshot.class));
 
         final DOMDataTreeChangeListener domDataTreeChangeListener = mock(DOMDataTreeChangeListener.class);
index d4c64204c5453744f425852607b0bd2292df8d93..a65ff18456ae7412918a7b4a5825b12c4ffe187a 100644 (file)
@@ -16,8 +16,10 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -37,18 +39,27 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 public class InMemoryDataStoreTest {
+    private static EffectiveModelContext SCHEMA_CONTEXT;
 
-    private SchemaContext schemaContext;
     private InMemoryDOMDataStore domStore;
 
+    @BeforeClass
+    public static void beforeClass() {
+        SCHEMA_CONTEXT = TestModel.createTestContext();
+    }
+
+    @AfterClass
+    public static void afterClass() {
+        SCHEMA_CONTEXT = null;
+    }
+
     @Before
     public void setupStore() {
         domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
-        schemaContext = TestModel.createTestContext();
-        domStore.onGlobalContextUpdated(schemaContext);
+        domStore.onModelContextUpdated(SCHEMA_CONTEXT);
     }
 
     @Test
index ff8f9e7866939aa339eaa73d6114b3c23eb5e8cc..c77a4f2e7898eaa2ae054009ab1a84c2a8319de4 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.mdsal.dom.store.inmemory;
 
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public final class TestModel {
@@ -41,7 +41,7 @@ public final class TestModel {
         throw new UnsupportedOperationException();
     }
 
-    public static SchemaContext createTestContext() {
+    public static EffectiveModelContext createTestContext() {
         return YangParserTestUtils.parseYangResource("/odl-datastore-test.yang");
     }
 }
@@ -15,33 +15,33 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.Map;
 import org.gaul.modernizer_maven_annotations.SuppressModernizer;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
 
 /**
- * A Factory Component which implements {@link SchemaContextListener}. Instances of this component are created through
- * by {@link OSGiDOMSchemaService} each time a listener is registered.
+ * A Factory Component which implements {@link EffectiveModelContextListener}. Instances of this component are created
+ * through by {@link OSGiDOMSchemaService} each time a listener is registered.
  */
-@Component(factory = SchemaSchemaContextListenerImpl.FACTORY_NAME, service = SchemaContextListener.class)
-public final class SchemaSchemaContextListenerImpl implements SchemaContextListener {
+@Component(factory = EffectiveModelContextImpl.FACTORY_NAME, service = EffectiveModelContextListener.class)
+public final class EffectiveModelContextImpl implements EffectiveModelContextListener {
     static final String FACTORY_NAME = "org.opendaylight.mdsal.dom.schema.osgi.impl.SchemaSchemaContextListener";
 
     @VisibleForTesting
     static final String DELEGATE = "org.opendaylight.mdsal.dom.schema.osgi.SchemaSchemaContextListener";
 
-    private SchemaContextListener delegate = null;
+    private EffectiveModelContextListener delegate = null;
 
     @Override
-    public void onGlobalContextUpdated(final SchemaContext context) {
-        delegate.onGlobalContextUpdated(context);
+    public void onModelContextUpdated(final EffectiveModelContext newModelContext) {
+        delegate.onModelContextUpdated(newModelContext);
     }
 
     @Activate
     void activate(final Map<String, ?> properties) {
-        delegate = (SchemaContextListener) verifyNotNull(properties.get(DELEGATE));
+        delegate = (EffectiveModelContextListener) verifyNotNull(properties.get(DELEGATE));
     }
 
     @Deactivate
@@ -50,7 +50,7 @@ public final class SchemaSchemaContextListenerImpl implements SchemaContextListe
     }
 
     @SuppressModernizer
-    static Dictionary<String, ?> props(final SchemaContextListener delegate) {
+    static Dictionary<String, ?> props(final EffectiveModelContextListener delegate) {
         final Dictionary<String, Object> ret = new Hashtable<>(2);
         ret.put(DELEGATE, requireNonNull(delegate));
         return ret;
index 38e4f2d2a343f0a29d51579228a179a2062444c9..28d76bd0eca41b04535aa8dce89008e8d141cd75 100644 (file)
@@ -18,8 +18,7 @@ import org.opendaylight.mdsal.dom.schema.osgi.OSGiModuleInfoSnapshot;
 import org.opendaylight.mdsal.dom.spi.AbstractDOMSchemaService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.osgi.service.component.ComponentFactory;
 import org.osgi.service.component.ComponentInstance;
 import org.osgi.service.component.annotations.Activate;
@@ -40,10 +39,10 @@ import org.slf4j.LoggerFactory;
 public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
     private static final Logger LOG = LoggerFactory.getLogger(OSGiDOMSchemaService.class);
 
-    @Reference(target = "(component.factory=" + SchemaSchemaContextListenerImpl.FACTORY_NAME + ")")
+    @Reference(target = "(component.factory=" + EffectiveModelContextImpl.FACTORY_NAME + ")")
     ComponentFactory listenerFactory = null;
 
-    private final List<SchemaContextListener> listeners = new CopyOnWriteArrayList<>();
+    private final List<EffectiveModelContextListener> listeners = new CopyOnWriteArrayList<>();
 
     private volatile ModuleInfoSnapshot currentSnapshot;
 
@@ -53,8 +52,8 @@ public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
     }
 
     @Override
-    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
-            final SchemaContextListener listener) {
+    public ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener(
+            final EffectiveModelContextListener listener) {
         return registerListener(requireNonNull(listener));
     }
 
@@ -69,13 +68,13 @@ public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
 
     @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC,
             policyOption = ReferencePolicyOption.GREEDY)
-    void addListener(final SchemaContextListener listener) {
+    void addListener(final EffectiveModelContextListener listener) {
         LOG.trace("Adding listener {}", listener);
         listeners.add(listener);
-        listener.onGlobalContextUpdated(getGlobalContext());
+        listener.onModelContextUpdated(getGlobalContext());
     }
 
-    void removeListener(final SchemaContextListener listener) {
+    void removeListener(final EffectiveModelContextListener listener) {
         LOG.trace("Removing listener {}", listener);
         listeners.remove(listener);
     }
@@ -92,12 +91,12 @@ public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
         LOG.info("DOM Schema services deactivated");
     }
 
-    private @NonNull ListenerRegistration<SchemaContextListener> registerListener(
-            final @NonNull SchemaContextListener listener) {
-        final ComponentInstance reg = listenerFactory.newInstance(SchemaSchemaContextListenerImpl.props(listener));
+    private @NonNull ListenerRegistration<EffectiveModelContextListener> registerListener(
+            final @NonNull EffectiveModelContextListener listener) {
+        final ComponentInstance reg = listenerFactory.newInstance(EffectiveModelContextImpl.props(listener));
         return new ListenerRegistration<>() {
             @Override
-            public SchemaContextListener getInstance() {
+            public EffectiveModelContextListener getInstance() {
                 return listener;
             }
 
@@ -109,9 +108,10 @@ public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
     }
 
     @SuppressWarnings("checkstyle:illegalCatch")
-    private static void notifyListener(final SchemaContext context, final SchemaContextListener listener) {
+    private static void notifyListener(final EffectiveModelContext context,
+            final EffectiveModelContextListener listener) {
         try {
-            listener.onGlobalContextUpdated(context);
+            listener.onModelContextUpdated(context);
         } catch (RuntimeException e) {
             LOG.warn("Failed to notify listener {}", listener, e);
         }
index f136e4976ca7a36fdf072bfaa5134a20d1f4ca6a..73e2a35c8bf9759ff914a8710e1c831deda4668f 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.mdsal.dom.schema.osgi.impl;
 
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public final class TestModel {
@@ -49,7 +49,7 @@ public final class TestModel {
 
     }
 
-    public static SchemaContext createTestContext() {
+    public static EffectiveModelContext createTestContext() {
         return YangParserTestUtils.parseYangResource("/odl-datastore-test.yang");
     }
 }
index dbcb9d4cae2cd504af8fa23b9da117c7d0e25b80..a6a48d5370a23d09bfd61a34c055be795d2bba6a 100644 (file)
@@ -14,8 +14,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaServiceExtension;
 import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
 
 /**
  * Base class to implement DOMSchemaService more easily while providing a bridge between MD-SAL DOM Schema services
@@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
  */
 @Beta
 @NonNullByDefault
-public abstract class AbstractDOMSchemaService implements DOMSchemaService, SchemaContextProvider {
+public abstract class AbstractDOMSchemaService implements DOMSchemaService, EffectiveModelContextProvider {
     public abstract static class WithYangTextSources extends AbstractDOMSchemaService
             implements DOMYangTextSourceProvider {
         @Override
@@ -35,13 +35,13 @@ public abstract class AbstractDOMSchemaService implements DOMSchemaService, Sche
     }
 
     @Override
-    public final SchemaContext getSchemaContext() {
+    public final EffectiveModelContext getEffectiveModelContext() {
         // Always route context queries to a single method
         return getGlobalContext();
     }
 
     @Override
-    public final SchemaContext getSessionContext() {
+    public final EffectiveModelContext getSessionContext() {
         // This method should not be implemented
         throw new UnsupportedOperationException();
     }
index f73cc27bd15eb1ddb20e32e1cb8f53f0f6c73ce7..f9db3190aace903f85e4894be313c36c7f65f634 100644 (file)
@@ -19,8 +19,9 @@ import org.opendaylight.mdsal.dom.api.DOMSchemaServiceExtension;
 import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.NoOpListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@@ -38,7 +39,7 @@ public class FixedDOMSchemaService extends AbstractDOMSchemaService {
     private static final class WithYangTextSources extends FixedDOMSchemaService implements DOMYangTextSourceProvider {
         private final @NonNull SchemaSourceProvider<YangTextSchemaSource> schemaSourceProvider;
 
-        WithYangTextSources(final SchemaContextProvider schemaContextProvider,
+        WithYangTextSources(final EffectiveModelContextProvider schemaContextProvider,
                 final SchemaSourceProvider<YangTextSchemaSource> schemaSourceProvider) {
             super(schemaContextProvider);
             this.schemaSourceProvider = requireNonNull(schemaSourceProvider);
@@ -55,30 +56,30 @@ public class FixedDOMSchemaService extends AbstractDOMSchemaService {
         }
     }
 
-    private final @NonNull SchemaContextProvider schemaContextProvider;
+    private final @NonNull EffectiveModelContextProvider schemaContextProvider;
 
-    private FixedDOMSchemaService(final SchemaContextProvider schemaContextProvider) {
+    private FixedDOMSchemaService(final EffectiveModelContextProvider schemaContextProvider) {
         this.schemaContextProvider = requireNonNull(schemaContextProvider);
     }
 
-    public static @NonNull DOMSchemaService of(final SchemaContextProvider schemaContextProvider) {
+    public static @NonNull DOMSchemaService of(final EffectiveModelContextProvider schemaContextProvider) {
         return new FixedDOMSchemaService(schemaContextProvider);
     }
 
-    public static @NonNull DOMSchemaService of(final SchemaContextProvider schemaContextProvider,
+    public static @NonNull DOMSchemaService of(final EffectiveModelContextProvider schemaContextProvider,
             final SchemaSourceProvider<YangTextSchemaSource> yangTextSourceProvider) {
         return new WithYangTextSources(schemaContextProvider, requireNonNull(yangTextSourceProvider));
     }
 
     @Override
-    public final SchemaContext getGlobalContext() {
-        return schemaContextProvider.getSchemaContext();
+    public final EffectiveModelContext getGlobalContext() {
+        return schemaContextProvider.getEffectiveModelContext();
     }
 
     @Override
-    public final @NonNull ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
-            final SchemaContextListener listener) {
-        listener.onGlobalContextUpdated(getGlobalContext());
+    public final @NonNull ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener(
+            final EffectiveModelContextListener listener) {
+        listener.onModelContextUpdated(getGlobalContext());
         return NoOpListenerRegistration.of(listener);
     }
 }