Refactoring of web-sockets in RESTCONF RFC-8040
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / RestconfStreamsSubscriptionServiceImpl.java
index 9d4309e584ac5ab36a6d2916adc87ca2e631187f..d9a3b6773f27ff3a9a51a60ffbd926bac008532c 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
 import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants;
 import org.opendaylight.restconf.nb.rfc8040.rests.utils.SubscribeToStreamUtil;
-import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
@@ -41,7 +40,6 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Implementation of {@link RestconfStreamsSubscriptionService}.
- *
  */
 @Path("/")
 public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSubscriptionService {
@@ -83,11 +81,11 @@ public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSu
         final NotificationQueryParams notificationQueryParams = NotificationQueryParams.fromUriInfo(uriInfo);
 
         URI response = null;
-        if (identifier.contains(RestconfStreamsConstants.DATA_SUBSCR)) {
-            response = SubscribeToStreamUtil.notifiDataStream(identifier, uriInfo, notificationQueryParams,
+        if (identifier.contains(RestconfStreamsConstants.DATA_SUBSCRIPTION)) {
+            response = SubscribeToStreamUtil.subscribeToDataStream(identifier, uriInfo, notificationQueryParams,
                     this.handlersHolder);
         } else if (identifier.contains(RestconfStreamsConstants.NOTIFICATION_STREAM)) {
-            response = SubscribeToStreamUtil.notifYangStream(identifier, uriInfo, notificationQueryParams,
+            response = SubscribeToStreamUtil.subscribeToYangStream(identifier, uriInfo, notificationQueryParams,
                     this.handlersHolder);
         }
 
@@ -97,8 +95,7 @@ public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSu
                     SubscribeToStreamUtil.prepareIIDSubsStreamOutput(this.handlersHolder.getSchemaHandler());
             final NormalizedNodeBuilder<NodeIdentifier, Object, LeafNode<Object>> builder =
                     ImmutableLeafNodeBuilder.create().withValue(response.toString());
-            builder.withNodeIdentifier(
-                    NodeIdentifier.create(QName.create("subscribe:to:notification", "2016-10-28", "location")));
+            builder.withNodeIdentifier(NodeIdentifier.create(RestconfStreamsConstants.LOCATION_QNAME));
 
             // prepare new header with location
             final Map<String, Object> headers = new HashMap<>();
@@ -170,7 +167,6 @@ public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSu
 
     /**
      * Parser and holder of query paramteres from uriInfo for notifications.
-     *
      */
     public static final class NotificationQueryParams {
 
@@ -255,5 +251,4 @@ public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSu
             return Optional.ofNullable(filter);
         }
     }
-
-}
+}
\ No newline at end of file