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;
/**
* Implementation of {@link RestconfStreamsSubscriptionService}.
- *
*/
@Path("/")
public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSubscriptionService {
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);
}
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<>();
/**
* Parser and holder of query paramteres from uriInfo for notifications.
- *
*/
public static final class NotificationQueryParams {
return Optional.ofNullable(filter);
}
}
-
-}
+}
\ No newline at end of file