X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fosgi%2FNetconfOperationServiceFactoryTracker.java;h=d97ac909227fa937054ed18dd3ff159b29efedc3;hb=ecabb3cf9b22efd564ef71cb60918318af19d753;hp=4d2bcb34fa687bcd0886c509d7678cae633be6dd;hpb=a92d9d6a21a0f6ca8d2153795721f500eaf29ee9;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationServiceFactoryTracker.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationServiceFactoryTracker.java index 4d2bcb34fa..d97ac90922 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationServiceFactoryTracker.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationServiceFactoryTracker.java @@ -7,32 +7,43 @@ */ package org.opendaylight.controller.netconf.impl.osgi; +import org.opendaylight.controller.netconf.api.util.NetconfConstants; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory; +import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactoryListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; class NetconfOperationServiceFactoryTracker extends ServiceTracker { - private final NetconfOperationServiceFactoryListener operationRouter; + private final NetconfOperationServiceFactoryListener factoriesListener; NetconfOperationServiceFactoryTracker(BundleContext context, - final NetconfOperationServiceFactoryListener operationRouter) { + final NetconfOperationServiceFactoryListener factoriesListener) { super(context, NetconfOperationServiceFactory.class, null); - this.operationRouter = operationRouter; + this.factoriesListener = factoriesListener; } @Override public NetconfOperationServiceFactory addingService(ServiceReference reference) { - NetconfOperationServiceFactory netconfOperationServiceFactory = super.addingService(reference); - operationRouter.onAddNetconfOperationServiceFactory(netconfOperationServiceFactory); - return netconfOperationServiceFactory; + Object property = reference.getProperty(NetconfConstants.SERVICE_NAME); + if (property != null + && (property.equals(NetconfConstants.CONFIG_NETCONF_CONNECTOR) + || property.equals(NetconfConstants.NETCONF_MONITORING))) { + NetconfOperationServiceFactory netconfOperationServiceFactory = super.addingService(reference); + factoriesListener.onAddNetconfOperationServiceFactory(netconfOperationServiceFactory); + return netconfOperationServiceFactory; + } + + return null; } @Override public void removedService(ServiceReference reference, NetconfOperationServiceFactory netconfOperationServiceFactory) { - operationRouter.onRemoveNetconfOperationServiceFactory(netconfOperationServiceFactory); + if (netconfOperationServiceFactory != null) { + factoriesListener.onRemoveNetconfOperationServiceFactory(netconfOperationServiceFactory); + } } }