X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fswitchmanager%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fswitchmanager%2Finternal%2FActivator.java;h=deecf26e0d99227069114722f4b92addf7c136e1;hp=0cb55d6555903498b52a29aa492680d58bcf4780;hb=73e969cf365dd78772596c71e940ae44fe2f22d3;hpb=abe7cd0f3412d447cf054e618ce1c7c7fa096745 diff --git a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/Activator.java b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/Activator.java index 0cb55d6555..deecf26e0d 100644 --- a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/Activator.java +++ b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/Activator.java @@ -9,15 +9,11 @@ package org.opendaylight.controller.switchmanager.internal; -import java.util.Dictionary; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - import org.apache.felix.dm.Component; -import org.opendaylight.controller.clustering.services.ICacheUpdateAware; import org.opendaylight.controller.clustering.services.IClusterContainerServices; +import org.opendaylight.controller.clustering.services.IClusterGlobalServices; import org.opendaylight.controller.configuration.IConfigurationContainerAware; +import org.opendaylight.controller.configuration.IConfigurationContainerService; import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase; import org.opendaylight.controller.sal.inventory.IInventoryService; import org.opendaylight.controller.sal.inventory.IListenInventoryUpdates; @@ -38,26 +34,6 @@ public class Activator extends ComponentActivatorAbstractBase { protected static final Logger logger = LoggerFactory .getLogger(Activator.class); - /** - * Function called when the activator starts just after some - * initializations are done by the - * ComponentActivatorAbstractBase. - * - */ - @Override - public void init() { - - } - - /** - * Function called when the activator stops just before the - * cleanup done by ComponentActivatorAbstractBase - * - */ - @Override - public void destroy() { - - } /** * Function that is used to communicate to dependency manager the @@ -90,23 +66,18 @@ public class Activator extends ComponentActivatorAbstractBase { @Override public void configureInstance(Component c, Object imp, String containerName) { if (imp.equals(SwitchManager.class)) { - Dictionary> props = new Hashtable>(); - Set propSet = new HashSet(); - propSet.add("switchmanager.configSaveEvent"); - props.put("cachenames", propSet); // export the service c.setInterface(new String[] { IListenInventoryUpdates.class.getName(), ISwitchManager.class.getName(), - ICacheUpdateAware.class.getName(), - IConfigurationContainerAware.class.getName() }, props); + IConfigurationContainerAware.class.getName() }, null); // Now lets add a service dependency to make sure the // provider of service exists c.add(createContainerServiceDependency(containerName).setService( IInventoryService.class).setCallbacks( "setInventoryService", "unsetInventoryService") - .setRequired(false)); + .setRequired(true)); c.add(createContainerServiceDependency(containerName).setService( IStatisticsManager.class).setCallbacks( "setStatisticsManager", "unsetStatisticsManager") @@ -126,12 +97,38 @@ public class Activator extends ComponentActivatorAbstractBase { IClusterContainerServices.class).setCallbacks( "setClusterContainerService", "unsetClusterContainerService").setRequired(true)); + c.add(createContainerServiceDependency(containerName).setService( + IConfigurationContainerService.class).setCallbacks( + "setConfigurationContainerService", + "unsetConfigurationContainerService").setRequired(true)); + c.add(createServiceDependency() + .setService(IControllerProperties.class) + .setCallbacks("setControllerProperties", "unsetControllerProperties") + .setRequired(true)); } } + /** + * {@inheritDoc} + */ @Override protected Object[] getGlobalImplementations() { - final Object[] res = { SwitchManagerCLI.class }; + final Object[] res = { ControllerProperties.class, SwitchManagerCLI.class }; return res; } + + /** + * {@inheritDoc} + */ + @Override + public void configureGlobalInstance(Component c, Object imp) { + if (imp.equals(ControllerProperties.class)) { + c.setInterface(new String[] { IControllerProperties.class.getName() }, null); + + c.add(createServiceDependency() + .setService(IClusterGlobalServices.class) + .setCallbacks("setClusterService", "unsetClusterService") + .setRequired(true)); + } + } }