X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-notifications-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnotifications%2Fimpl%2Fosgi%2FActivator.java;h=a0a0dfcb8f5e506071daa1b5b894aa0074f556ca;hp=ef950f8a788d768509749e3138afd3d3120e6a93;hb=e3998d55e33da9f6ecb69da75ecc71a047b6362b;hpb=83dfe301bf2a2b1eff6883a2af3282c95d5a752e diff --git a/opendaylight/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/netconf/notifications/impl/osgi/Activator.java b/opendaylight/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/netconf/notifications/impl/osgi/Activator.java index ef950f8a78..a0a0dfcb8f 100644 --- a/opendaylight/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/netconf/notifications/impl/osgi/Activator.java +++ b/opendaylight/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/netconf/notifications/impl/osgi/Activator.java @@ -12,9 +12,12 @@ import com.google.common.base.Optional; import com.google.common.collect.Sets; import java.util.Collection; import java.util.Collections; +import java.util.Dictionary; import java.util.Hashtable; import java.util.Set; -import org.opendaylight.controller.netconf.mapping.api.Capability; +import org.opendaylight.controller.netconf.api.Capability; +import org.opendaylight.controller.netconf.api.monitoring.CapabilityListener; +import org.opendaylight.controller.netconf.api.util.NetconfConstants; import org.opendaylight.controller.netconf.mapping.api.NetconfOperation; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory; @@ -40,16 +43,30 @@ public class Activator implements BundleActivator { final NetconfOperationServiceFactory netconfOperationServiceFactory = new NetconfOperationServiceFactory() { + private final Set capabilities = Collections.singleton(new NotificationsCapability()); + + @Override + public Set getCapabilities() { + return capabilities; + } + + @Override + public AutoCloseable registerCapabilityListener(final CapabilityListener listener) { + listener.onCapabilitiesAdded(capabilities); + return new AutoCloseable() { + @Override + public void close() { + listener.onCapabilitiesRemoved(capabilities); + } + }; + } + @Override public NetconfOperationService createService(final String netconfSessionIdForReporting) { return new NetconfOperationService() { private final CreateSubscription createSubscription = new CreateSubscription(netconfSessionIdForReporting, netconfNotificationManager); - @Override - public Set getCapabilities() { - return Collections.singleton(new NotificationsCapability()); - } @Override public Set getNetconfOperations() { @@ -66,7 +83,9 @@ public class Activator implements BundleActivator { } }; - operationaServiceRegistration = context.registerService(NetconfOperationServiceFactory.class, netconfOperationServiceFactory, new Hashtable()); + final Dictionary properties = new Hashtable<>(); + properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_MONITORING); + operationaServiceRegistration = context.registerService(NetconfOperationServiceFactory.class, netconfOperationServiceFactory, properties); }