private final EventFormatterFactory<T> formatterFactory;
private final NotificationOutputType outputType;
private final String streamName;
- private final ListenersBroker listenersBroker;
+ protected final @NonNull ListenersBroker listenersBroker;
@GuardedBy("this")
private final Set<StreamSessionHandler> subscribers = new HashSet<>();
private final @NonNull EffectiveModelContext effectiveModel;
private final @NonNull DOMMountPointService mountPointService;
private final @NonNull YangInstanceIdentifier instanceIdentifier;
- private final @NonNull ListenersBroker listenersBroker;
private ListenerRegistration<DOMMountPointListener> reg;
- public DeviceNotificationListenerAdaptor(final String streamName, final NotificationOutputType outputType,
- final EffectiveModelContext effectiveModel, final DOMMountPointService mountPointService,
- final YangInstanceIdentifier path, final ListenersBroker listenersBroker) {
+ DeviceNotificationListenerAdaptor(final String streamName, final NotificationOutputType outputType,
+ final ListenersBroker listenersBroker, final EffectiveModelContext effectiveModel,
+ final DOMMountPointService mountPointService, final YangInstanceIdentifier instanceIdentifier) {
super(streamName, outputType, listenersBroker);
this.effectiveModel = requireNonNull(effectiveModel);
this.mountPointService = requireNonNull(mountPointService);
- instanceIdentifier = requireNonNull(path);
- this.listenersBroker = requireNonNull(listenersBroker);
+ this.instanceIdentifier = requireNonNull(instanceIdentifier);
}
public synchronized void listen(final DOMNotificationService notificationService, final Set<Absolute> paths) {
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.time.Instant;
import java.util.Collection;
* @param streamName The name of the stream.
* @param outputType Type of output on notification (JSON, XML).
*/
- @VisibleForTesting
- public ListenerAdapter(final LogicalDatastoreType datastore, final YangInstanceIdentifier path,
- final String streamName, final NotificationOutputType outputType, final ListenersBroker listenersBroker) {
+ ListenerAdapter(final String streamName, final NotificationOutputType outputType,
+ final ListenersBroker listenersBroker, final LogicalDatastoreType datastore,
+ final YangInstanceIdentifier path) {
super(streamName, outputType, getFormatterFactory(outputType), listenersBroker);
this.datastore = requireNonNull(datastore);
this.path = requireNonNull(path);
final long stamp = dataChangeListenersLock.writeLock();
try {
return dataChangeListeners.computeIfAbsent(sb.toString(),
- streamName -> new ListenerAdapter(datastore, path, streamName, outputType, this));
+ streamName -> new ListenerAdapter(streamName, outputType, this, datastore, path));
} finally {
dataChangeListenersLock.unlockWrite(stamp);
}
final long stamp = notificationListenersLock.writeLock();
try {
return notificationListeners.computeIfAbsent(sb.toString(),
- streamName -> new NotificationListenerAdapter(notifications, streamName, outputType, this));
+ streamName -> new NotificationListenerAdapter(streamName, outputType, this, notifications));
} finally {
notificationListenersLock.unlockWrite(stamp);
}
final long stamp = deviceNotificationListenersLock.writeLock();
try {
return deviceNotificationListeners.computeIfAbsent(sb.toString(),
- streamName -> new DeviceNotificationListenerAdaptor(streamName, outputType, refSchemaCtx,
- mountPointService, path, this));
+ streamName -> new DeviceNotificationListenerAdaptor(streamName, outputType, this, refSchemaCtx,
+ mountPointService, path));
} finally {
deviceNotificationListenersLock.unlockWrite(stamp);
}
* @param outputType Type of output on notification (JSON or XML).
* @param listenersBroker Associated {@link ListenersBroker}
*/
- NotificationListenerAdapter(final ImmutableSet<QName> paths, final String streamName,
- final NotificationOutputType outputType, final ListenersBroker listenersBroker) {
+ NotificationListenerAdapter(final String streamName, final NotificationOutputType outputType,
+ final ListenersBroker listenersBroker, final ImmutableSet<QName> paths) {
super(streamName, outputType, listenersBroker);
this.paths = requireNonNull(paths);
}
final NotificationOutputType outputType, final boolean leafNodesOnly,
final boolean skipNotificationData, final boolean changedLeafNodesOnly, final boolean childNodesOnly,
final ListenersBroker listenersBroker) {
- super(LogicalDatastoreType.CONFIGURATION, path, streamName, outputType, listenersBroker);
+ super(streamName, outputType, listenersBroker, LogicalDatastoreType.CONFIGURATION, path);
setQueryParams(NotificationQueryParams.of(StartTimeParam.forUriValue("1970-01-01T00:00:00Z"), null, null,
leafNodesOnly ? LeafNodesOnlyParam.of(true) : null,
skipNotificationData ? SkipNotificationDataParam.of(true) : null,