X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fnetconf%2Fnetconf-monitoring%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fmonitoring%2Fosgi%2FNetconfMonitoringActivator.java;h=4e9ecae3f223e0a4bb97203e6a56f1a2dfad0d2e;hb=1f43b99185e388e435f68bd494d91936f61cf3cf;hp=9d332c644029ff3c26a2725703e4b348ff046cf0;hpb=2bee5a4b37bc6e2f7331df63757e5dc4e0236b29;p=controller.git diff --git a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringActivator.java b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringActivator.java index 9d332c6440..4e9ecae3f2 100644 --- a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringActivator.java +++ b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringActivator.java @@ -1,12 +1,17 @@ /* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + package org.opendaylight.controller.netconf.monitoring.osgi; +import java.util.Collections; +import java.util.Set; +import org.opendaylight.controller.netconf.api.Capability; +import org.opendaylight.controller.netconf.api.monitoring.CapabilityListener; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory; import org.osgi.framework.BundleActivator; @@ -16,7 +21,7 @@ import org.slf4j.LoggerFactory; public class NetconfMonitoringActivator implements BundleActivator { - private static final Logger logger = LoggerFactory.getLogger(NetconfMonitoringActivator.class); + private static final Logger LOG = LoggerFactory.getLogger(NetconfMonitoringActivator.class); private NetconfMonitoringServiceTracker monitor; @@ -31,22 +36,43 @@ public class NetconfMonitoringActivator implements BundleActivator { if(monitor!=null) { try { monitor.close(); - } catch (Exception e) { - logger.warn("Ignoring exception while closing {}", monitor, e); + } catch (final Exception e) { + LOG.warn("Ignoring exception while closing {}", monitor, e); } } } - public static class NetconfMonitoringOperationServiceFactory implements NetconfOperationServiceFactory { + public static class NetconfMonitoringOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable { + private final NetconfMonitoringOperationService operationService; - public NetconfMonitoringOperationServiceFactory(NetconfMonitoringOperationService operationService) { + private static final AutoCloseable AUTO_CLOSEABLE = new AutoCloseable() { + @Override + public void close() throws Exception { + // NOOP + } + }; + + public NetconfMonitoringOperationServiceFactory(final NetconfMonitoringOperationService operationService) { this.operationService = operationService; } @Override - public NetconfOperationService createService(String netconfSessionIdForReporting) { + public NetconfOperationService createService(final String netconfSessionIdForReporting) { return operationService; } + + @Override + public Set getCapabilities() { + return Collections.emptySet(); + } + + @Override + public AutoCloseable registerCapabilityListener(final CapabilityListener listener) { + return AUTO_CLOSEABLE; + } + + @Override + public void close() {} } }