Use SimpleSchemaContext instead of EffectiveSchemaContext 54/58754/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 12 Jun 2017 16:56:37 +0000 (18:56 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 14 Jun 2017 09:06:46 +0000 (09:06 +0000)
EffectiveSchemaContext is an implementation detail of the parser,
SimpleSchemeContext is a beta-level API from yang-model-util.

Change-Id: I524f9e91562b5fa8d6d942f40bf957ec97e40e88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/base/services/impl/RestconfOperationsServiceImpl.java

index 7c4a7d508423b38573b8ef026e7cce55c5b52e74..4abc492dff87e6bdadcd89e000507358faab2115 100644 (file)
@@ -106,7 +106,7 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveSchemaContext;
+import org.opendaylight.yangtools.yang.model.util.SimpleSchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -383,9 +383,7 @@ public class RestconfImpl implements RestconfService {
         neededModules.forEach(imp -> fakeModules.add(new FakeImportedModule(imp)));
         fakeModules.add(new FakeRestconfModule(neededModules, fakeCont));
 
-        // FIXME: use a separate sublcass of AbstractSchemaContext
-        final SchemaContext fakeSchemaCtx =
-                EffectiveSchemaContext.resolveSchemaContext(ImmutableSet.copyOf(fakeModules));
+        final SchemaContext fakeSchemaCtx = SimpleSchemaContext.forModules(ImmutableSet.copyOf(fakeModules));
         final InstanceIdentifierContext<ContainerSchemaNode> instanceIdentifierContext =
                 new InstanceIdentifierContext<>(null, fakeCont, mountPoint, fakeSchemaCtx);
         return new NormalizedNodeContext(instanceIdentifierContext, containerBuilder.build());
@@ -1264,7 +1262,7 @@ public class RestconfImpl implements RestconfService {
      * @return {@link URI} of location
      */
     private URI dataSubs(final String identifier, final UriInfo uriInfo, final Instant start, final Instant stop,
-            final String filter, boolean leafNodesOnly) {
+            final String filter, final boolean leafNodesOnly) {
         final String streamName = Notificator.createStreamNameFromUri(identifier);
         if (Strings.isNullOrEmpty(streamName)) {
             throw new RestconfDocumentedException("Stream name is empty.", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
index 62fc11e92bb0be7c5ad86d151be35057d0b79294..5053db01ad90d60707d655ecf2d75d7a42d39331 100644 (file)
@@ -35,7 +35,7 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveSchemaContext;
+import org.opendaylight.yangtools.yang.model.util.SimpleSchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -129,9 +129,7 @@ public class RestconfOperationsServiceImpl implements RestconfOperationsService
         neededModules.forEach(imp -> fakeModules.add(new FakeImportedModule(imp)));
         fakeModules.add(new FakeRestconfModule(neededModules, fakeCont));
 
-        // FIXME: use a separate sublcass of AbstractSchemaContext
-        final SchemaContext fakeSchemaCtx =
-                EffectiveSchemaContext.resolveSchemaContext(ImmutableSet.copyOf(fakeModules));
+        final SchemaContext fakeSchemaCtx = SimpleSchemaContext.forModules(ImmutableSet.copyOf(fakeModules));
         final InstanceIdentifierContext<ContainerSchemaNode> instanceIdentifierContext =
                 new InstanceIdentifierContext<>(null, fakeCont, mountPoint, fakeSchemaCtx);
         return new NormalizedNodeContext(instanceIdentifierContext, containerBuilder.build());