X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fosgi%2FNetconfOperationServiceFactoryTracker.java;h=d97ac909227fa937054ed18dd3ff159b29efedc3;hp=c1d9317c294ca96938dbd0ccec843eb7d5991d0f;hb=bfd413d87f82ee3ffed67a141a980805950a0f06;hpb=0a23c5e6383fe72e6c5f59aa727ae2b27bb966f5 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 c1d9317c29..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,7 +7,9 @@ */ 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; @@ -24,15 +26,24 @@ class NetconfOperationServiceFactoryTracker extends @Override public NetconfOperationServiceFactory addingService(ServiceReference reference) { - NetconfOperationServiceFactory netconfOperationServiceFactory = super.addingService(reference); - factoriesListener.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) { - factoriesListener.onRemoveNetconfOperationServiceFactory(netconfOperationServiceFactory); + if (netconfOperationServiceFactory != null) { + factoriesListener.onRemoveNetconfOperationServiceFactory(netconfOperationServiceFactory); + } } }