- final String streamName = RestconfStreamsConstants.DATA_SUBSCR + "/"
- + Notificator
- .createStreamNameFromUri(ParserIdentifier.stringFromYangInstanceIdentifier(path, schemaContext)
- + RestconfStreamsConstants.DS_URI + ds + RestconfStreamsConstants.SCOPE_URI + scope);
- return streamName;
+ return RestconfStreamsConstants.DATA_SUBSCRIPTION
+ + "/"
+ + ListenersBroker.createStreamNameFromUri(
+ ParserIdentifier.stringFromYangInstanceIdentifier(path, schemaContext)
+ + RestconfStreamsConstants.DS_URI
+ + datastoreType
+ + RestconfStreamsConstants.SCOPE_URI
+ + scope);
+ }
+
+ /**
+ * Prepare {@link YangInstanceIdentifier} of stream source.
+ *
+ * @param data Container with stream settings (RPC create-stream).
+ * @param qualifiedName QName of the input RPC context (used only in debugging).
+ * @return Parsed {@link YangInstanceIdentifier} of data element from which the data-change-event notifications
+ * are going to be generated.
+ */
+ private static YangInstanceIdentifier preparePath(final ContainerNode data, final QName qualifiedName) {
+ final Optional<DataContainerChild<? extends PathArgument, ?>> path = data.getChild(
+ new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ qualifiedName,
+ RestconfStreamsConstants.STREAM_PATH_PARAM_NAME)));
+ Object pathValue = null;
+ if (path.isPresent()) {
+ pathValue = path.get().getValue();
+ }
+ if (!(pathValue instanceof YangInstanceIdentifier)) {
+ LOG.debug("Instance identifier {} was not normalized correctly", qualifiedName);
+ throw new RestconfDocumentedException(
+ "Instance identifier was not normalized correctly",
+ ErrorType.APPLICATION,
+ ErrorTag.OPERATION_FAILED);
+ }
+ return (YangInstanceIdentifier) pathValue;