Fix Revision confusion
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / services / simple / impl / RestconfImpl.java
index 386c991ad387e6ecd34e11fb2104a4b68ad8cff7..e3db40ba725c62d726dfe600d688cb361c1cf783 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.restconf.nb.rfc8040.services.simple.impl;
 
+import javax.ws.rs.Path;
 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
 import org.opendaylight.restconf.nb.rfc8040.Rfc8040.IetfYangLibrary;
@@ -23,9 +24,10 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 
+@Path("/")
 public class RestconfImpl implements RestconfService {
 
-    private SchemaContextHandler schemaContextHandler;
+    private volatile SchemaContextHandler schemaContextHandler;
 
     public RestconfImpl(final SchemaContextHandler schemaContextHandler) {
         this.schemaContextHandler = schemaContextHandler;
@@ -36,7 +38,7 @@ public class RestconfImpl implements RestconfService {
         final SchemaContext context = this.schemaContextHandler.get();
         SchemaNode schemaNode = null;
         for (final GroupingDefinition groupingDefinition : context
-                .findModuleByNamespaceAndRevision(RestconfModule.URI_MODULE, RestconfModule.DATE).getGroupings()) {
+                .findModule(RestconfModule.IETF_RESTCONF_QNAME.getModule()).get().getGroupings()) {
             if (groupingDefinition.getQName().equals(RestconfModule.RESTCONF_GROUPING_QNAME)) {
                 schemaNode = ((ContainerSchemaNode) groupingDefinition
                         .getDataChildByName(RestconfModule.RESTCONF_CONTAINER_QNAME))
@@ -44,11 +46,11 @@ public class RestconfImpl implements RestconfService {
             }
         }
         final YangInstanceIdentifier yangIId = YangInstanceIdentifier.of(
-                QName.create(RestconfModule.NAME, RestconfModule.REVISION, RestconfModule.LIB_VER_LEAF_SCHEMA_NODE));
+                QName.create(RestconfModule.IETF_RESTCONF_QNAME, RestconfModule.LIB_VER_LEAF_SCHEMA_NODE));
         final InstanceIdentifierContext<? extends SchemaNode> iid =
-                new InstanceIdentifierContext<SchemaNode>(yangIId, schemaNode, null, context);
-        final NormalizedNode<?, ?> data =
-                Builders.leafBuilder((LeafSchemaNode) schemaNode).withValue(IetfYangLibrary.REVISION).build();
+                new InstanceIdentifierContext<>(yangIId, schemaNode, null, context);
+        final NormalizedNode<?, ?> data = Builders.leafBuilder((LeafSchemaNode) schemaNode)
+                .withValue(IetfYangLibrary.REVISION.toString()).build();
         return new NormalizedNodeContext(iid, data);
     }