X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Fosgi%2FActivator.java;h=f39a21d16b558e917cb7a86b145e5193c89345ff;hp=421870ca3611bb6e35a8e7ddd9ec574d0e62e4ab;hb=e3998d55e33da9f6ecb69da75ecc71a047b6362b;hpb=d5759c52d69ba8725d9bbdc18e81848f319861d1 diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/Activator.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/Activator.java index 421870ca36..f39a21d16b 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/Activator.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/Activator.java @@ -8,6 +8,11 @@ package org.opendaylight.controller.netconf.confignetconfconnector.osgi; +import static com.google.common.base.Preconditions.checkState; + +import java.util.Dictionary; +import java.util.Hashtable; +import org.opendaylight.controller.netconf.api.util.NetconfConstants; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory; import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider; import org.osgi.framework.BundleActivator; @@ -19,17 +24,12 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Dictionary; -import java.util.Hashtable; - -import static com.google.common.base.Preconditions.checkState; - public class Activator implements BundleActivator { - private static final Logger logger = LoggerFactory.getLogger(Activator.class); + private static final Logger LOG = LoggerFactory.getLogger(Activator.class); private BundleContext context; - private ServiceRegistration osgiRegistration; + private ServiceRegistration osgiRegistration; private ConfigRegistryLookupThread configRegistryLookup = null; @Override @@ -39,12 +39,12 @@ public class Activator implements BundleActivator { ServiceTrackerCustomizer customizer = new ServiceTrackerCustomizer() { @Override public ConfigRegistryLookupThread addingService(ServiceReference reference) { - logger.debug("Got addingService(SchemaContextProvider) event, starting ConfigRegistryLookupThread"); + LOG.debug("Got addingService(SchemaContextProvider) event, starting ConfigRegistryLookupThread"); checkState(configRegistryLookup == null, "More than one onYangStoreAdded received"); SchemaContextProvider schemaContextProvider = reference.getBundle().getBundleContext().getService(reference); - YangStoreServiceImpl yangStoreService = new YangStoreServiceImpl(schemaContextProvider); + YangStoreService yangStoreService = new YangStoreService(schemaContextProvider, context); configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService); configRegistryLookup.start(); return configRegistryLookup; @@ -52,7 +52,7 @@ public class Activator implements BundleActivator { @Override public void modifiedService(ServiceReference reference, ConfigRegistryLookupThread configRegistryLookup) { - logger.debug("Got modifiedService(SchemaContextProvider) event"); + LOG.debug("Got modifiedService(SchemaContextProvider) event"); configRegistryLookup.yangStoreService.refresh(); } @@ -73,16 +73,16 @@ public class Activator implements BundleActivator { } @Override - public void stop(BundleContext context) throws Exception { + public void stop(BundleContext context) { if (configRegistryLookup != null) { configRegistryLookup.interrupt(); } } private class ConfigRegistryLookupThread extends Thread { - private final YangStoreServiceImpl yangStoreService; + private final YangStoreService yangStoreService; - private ConfigRegistryLookupThread(YangStoreServiceImpl yangStoreService) { + private ConfigRegistryLookupThread(YangStoreService yangStoreService) { super("config-registry-lookup"); this.yangStoreService = yangStoreService; } @@ -90,9 +90,9 @@ public class Activator implements BundleActivator { @Override public void run() { NetconfOperationServiceFactoryImpl factory = new NetconfOperationServiceFactoryImpl(yangStoreService); - logger.debug("Registering into OSGi"); + LOG.debug("Registering into OSGi"); Dictionary properties = new Hashtable<>(); - properties.put("name", "config-netconf-connector"); + properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.CONFIG_NETCONF_CONNECTOR); osgiRegistration = context.registerService(NetconfOperationServiceFactory.class, factory, properties); } }