import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Set;
-import org.opendaylight.controller.config.util.capability.BasicCapability;
-import org.opendaylight.controller.config.util.capability.Capability;
+import org.opendaylight.netconf.api.capability.BasicCapability;
+import org.opendaylight.netconf.api.capability.Capability;
import org.opendaylight.netconf.api.monitoring.CapabilityListener;
import org.opendaylight.netconf.api.util.NetconfConstants;
import org.opendaylight.netconf.mapping.api.NetconfOperation;
private NetconfNotificationManager netconfNotificationManager;
@Override
- public void start(final BundleContext context) throws Exception {
+ public void start(final BundleContext context) {
netconfNotificationManager = new NetconfNotificationManager();
// Add properties to autowire with netconf-impl instance for cfg subsystem
final Dictionary<String, String> props = new Hashtable<>();
props.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_NOTIFICATION);
- netconfNotificationCollectorServiceRegistration = context.registerService(NetconfNotificationCollector.class, netconfNotificationManager, new Hashtable<String, Object>());
+ netconfNotificationCollectorServiceRegistration = context.registerService(NetconfNotificationCollector.class,
+ netconfNotificationManager, new Hashtable<>());
final NetconfOperationServiceFactory netconfOperationServiceFactory = new NetconfOperationServiceFactory() {
- private final Set<Capability> capabilities = Collections.<Capability>singleton(new BasicCapability(NetconfNotification.NOTIFICATION_NAMESPACE));
+ private final Set<Capability> capabilities =
+ Collections.singleton(new BasicCapability(NetconfNotification.NOTIFICATION_NAMESPACE));
@Override
public Set<Capability> getCapabilities() {
@Override
public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
- listener.onCapabilitiesChanged(capabilities, Collections.<Capability>emptySet());
- return new AutoCloseable() {
- @Override
- public void close() {
- listener.onCapabilitiesChanged(Collections.<Capability>emptySet(), capabilities);
- }
- };
+ listener.onCapabilitiesChanged(capabilities, Collections.emptySet());
+ return () -> listener.onCapabilitiesChanged(Collections.emptySet(), capabilities);
}
@Override
public NetconfOperationService createService(final String netconfSessionIdForReporting) {
return new NetconfOperationService() {
- private final CreateSubscription createSubscription = new CreateSubscription(netconfSessionIdForReporting, netconfNotificationManager);
+ private final CreateSubscription createSubscription =
+ new CreateSubscription(netconfSessionIdForReporting, netconfNotificationManager);
@Override
public Set<NetconfOperation> getNetconfOperations() {
- return Sets.<NetconfOperation>newHashSet(
+ return Sets.newHashSet(
new Get(netconfSessionIdForReporting, netconfNotificationManager),
createSubscription);
}
final Dictionary<String, String> properties = new Hashtable<>();
properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_MONITORING);
- operationaServiceRegistration = context.registerService(NetconfOperationServiceFactory.class, netconfOperationServiceFactory, properties);
+ operationaServiceRegistration = context.registerService(NetconfOperationServiceFactory.class,
+ netconfOperationServiceFactory, properties);
}
@Override
- public void stop(final BundleContext context) throws Exception {
- if(netconfNotificationCollectorServiceRegistration != null) {
+ public void stop(final BundleContext context) {
+ if (netconfNotificationCollectorServiceRegistration != null) {
netconfNotificationCollectorServiceRegistration.unregister();
netconfNotificationCollectorServiceRegistration = null;
}