public static StreamNameType getDefaultInstance(String defaultValue) { return new StreamNameType(defaultValue); }
@Override public void onNotification(final StreamNameType stream, final NetconfNotification notification) { Preconditions.checkState(baseListener != null, "Already closed"); Preconditions.checkArgument(stream.equals(registeredStream)); baseListener.onNotification(stream, notification); } }
@Nullable @Override public String apply(@Nullable Stream input) { return input.getName().getValue(); } });
private static StreamNameType parseStreamIfPresent(final XmlElement operationElement) throws NetconfDocumentedException { final Optional<XmlElement> stream = operationElement.getOnlyChildElementWithSameNamespaceOptionally("stream"); return stream.isPresent() ? new StreamNameType(stream.get().getTextContent()) : NetconfNotificationManager.BASE_STREAM_NAME; }
/** * Creates registration to notification stream. * @param stream stream * @param notificationPrefix notifications namespace * @param netconfEventSource event source */ public StreamNotificationTopicRegistration(final Stream stream, final String notificationPrefix, NetconfEventSource netconfEventSource) { super(NotificationSourceType.NetconfDeviceStream, stream.getName().getValue(), notificationPrefix); this.netconfEventSource = netconfEventSource; this.mountPoint = netconfEventSource.getMount(); this.nodeId = mountPoint.getNode().getNodeId().getValue(); this.stream = stream; setReplaySupported(stream.isReplaySupport()); setActive(false); LOG.info("StreamNotificationTopicRegistration initialized for {}", getStreamName()); }
final NotificationsService rpcService = service.get().getRpcService(NotificationsService.class); final CreateSubscriptionInputBuilder createSubscriptionInputBuilder = new CreateSubscriptionInputBuilder(); createSubscriptionInputBuilder.setStream(new StreamNameType(streamName)); LOG.info("Triggering notification stream {} for node {}", streamName, nodeId); final Future<RpcResult<Void>> subscription = rpcService.createSubscription(createSubscriptionInputBuilder.build());