X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FActivator.java;h=07c08129db09cc96dbe8d75d8ded82e9d4b1792e;hb=refs%2Fchanges%2F27%2F1327%2F1;hp=6c09abbdc7cd851df41e9e72b2bba987cd6171e9;hpb=eed57e2b0afd50823bc882123b6cbac04bcc48d9;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java index 6c09abbdc7..07c08129db 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java @@ -28,7 +28,10 @@ import org.opendaylight.controller.protocol_plugin.openflow.ITopologyServiceShim import org.opendaylight.controller.protocol_plugin.openflow.core.IController; import org.opendaylight.controller.protocol_plugin.openflow.core.IMessageListener; import org.opendaylight.controller.protocol_plugin.openflow.core.internal.Controller; +import org.opendaylight.controller.sal.connection.IPluginInConnectionService; +import org.opendaylight.controller.sal.connection.IPluginOutConnectionService; import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase; +import org.opendaylight.controller.sal.core.IContainerAware; import org.opendaylight.controller.sal.core.IContainerListener; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService; @@ -54,21 +57,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. - * - */ - public void init() { - } - - /** - * Function called when the activator stops just before the cleanup done by - * ComponentActivatorAbstractBase - * - */ - public void destroy() { - } /** * Function that is used to communicate to dependency manager the list of @@ -79,6 +67,7 @@ public class Activator extends ComponentActivatorAbstractBase { * instantiated in order to get an fully working implementation * Object */ + @Override public Object[] getImplementations() { Object[] res = { TopologyServices.class, DataPacketServices.class, InventoryService.class, ReadService.class, @@ -101,6 +90,7 @@ public class Activator extends ComponentActivatorAbstractBase { * per-container different behavior if needed, usually should not * be the case though. */ + @Override public void configureInstance(Component c, Object imp, String containerName) { if (imp.equals(TopologyServices.class)) { // export the service to be used by SAL @@ -162,6 +152,11 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setPluginOutDataPacketService", "unsetPluginOutDataPacketService") .setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(ReadService.class)) { @@ -178,11 +173,18 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IReadServiceFilter.class) .setCallbacks("setService", "unsetService") .setRequired(true)); + c.add(createContainerServiceDependency(containerName) .setService(IPluginOutReadService.class) .setCallbacks("setPluginOutReadServices", "unsetPluginOutReadServices") .setRequired(false)); + + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(FlowProgrammerNotifier.class)) { @@ -198,6 +200,11 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setPluginOutFlowProgrammerService", "unsetPluginOutFlowProgrammerService") .setRequired(true)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } } @@ -210,10 +217,11 @@ public class Activator extends ComponentActivatorAbstractBase { * instantiated in order to get an fully working implementation * Object */ + @Override public Object[] getGlobalImplementations() { Object[] res = { Controller.class, OFStatisticsManager.class, FlowProgrammerService.class, ReadServiceFilter.class, - DiscoveryService.class, DataPacketMuxDemux.class, + DiscoveryService.class, DataPacketMuxDemux.class, InventoryService.class, InventoryServiceShim.class, TopologyServiceShim.class }; return res; } @@ -229,13 +237,17 @@ public class Activator extends ComponentActivatorAbstractBase { * Implementation class that is being configured, needed as long * as the same routine can configure multiple implementations */ + @Override public void configureGlobalInstance(Component c, Object imp) { if (imp.equals(Controller.class)) { logger.debug("Activator configureGlobalInstance( ) is called"); Dictionary props = new Hashtable(); props.put("name", "Controller"); - c.setInterface(IController.class.getName(), props); + props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); + c.setInterface(new String[] { IController.class.getName(), + IPluginInConnectionService.class.getName()}, + props); } if (imp.equals(FlowProgrammerService.class)) { @@ -245,12 +257,9 @@ public class Activator extends ComponentActivatorAbstractBase { // by SAL props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); c.setInterface( - new String[] { - IPluginInFlowProgrammerService.class.getName(), - IMessageListener.class.getName(), - IContainerListener.class.getName(), - IInventoryShimExternalListener.class.getName() }, - props); + new String[] { IPluginInFlowProgrammerService.class.getName(), IMessageListener.class.getName(), + IContainerListener.class.getName(), IInventoryShimExternalListener.class.getName(), + IContainerAware.class.getName() }, props); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") @@ -263,14 +272,17 @@ public class Activator extends ComponentActivatorAbstractBase { "unsetsetFlowProgrammerNotifier") .setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(ReadServiceFilter.class)) { - c.setInterface(new String[] { - IReadServiceFilter.class.getName(), - IContainerListener.class.getName(), - IOFStatisticsListener.class.getName() }, null); + c.setInterface(new String[] { IReadServiceFilter.class.getName(), IContainerListener.class.getName(), + IOFStatisticsListener.class.getName(), IContainerAware.class.getName() }, null); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") @@ -285,7 +297,6 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setReadFilterInternalListener", "unsetReadFilterInternalListener") .setRequired(false)); - } if (imp.equals(OFStatisticsManager.class)) { @@ -306,9 +317,7 @@ public class Activator extends ComponentActivatorAbstractBase { if (imp.equals(DiscoveryService.class)) { // export the service c.setInterface( - new String[] { - IInventoryShimExternalListener.class.getName(), - IDataPacketListen.class.getName(), + new String[] { IInventoryShimExternalListener.class.getName(), IDataPacketListen.class.getName(), IContainerListener.class.getName() }, null); c.add(createServiceDependency() @@ -327,14 +336,18 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IDiscoveryListener.class) .setCallbacks("setDiscoveryListener", "unsetDiscoveryListener").setRequired(true)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } // DataPacket mux/demux services, which is teh actual engine // doing the packet switching if (imp.equals(DataPacketMuxDemux.class)) { - c.setInterface(new String[] { IDataPacketMux.class.getName(), - IContainerListener.class.getName(), - IInventoryShimExternalListener.class.getName() }, null); + c.setInterface(new String[] { IDataPacketMux.class.getName(), IContainerListener.class.getName(), + IInventoryShimExternalListener.class.getName(), IContainerAware.class.getName() }, null); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") @@ -350,33 +363,70 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IDataPacketListen.class) .setCallbacks("setIDataPacketListen", "unsetIDataPacketListen").setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); + } + + if (imp.equals(InventoryService.class)) { + // export the service + Dictionary props = new Hashtable(); + props.put("scope", "Global"); + + c.setInterface( + new String[] { IPluginInInventoryService.class.getName(), + IInventoryShimInternalListener.class.getName(), + IInventoryProvider.class.getName() }, props); + + // Now lets add a service dependency to make sure the + // provider of service exists + c.add(createServiceDependency() + .setService(IController.class, "(name=Controller)") + .setCallbacks("setController", "unsetController") + .setRequired(true)); + c.add(createServiceDependency() + .setService(IPluginOutInventoryService.class, "(scope=Global)") + .setCallbacks("setPluginOutInventoryServices", + "unsetPluginOutInventoryServices") + .setRequired(true)); } if (imp.equals(InventoryServiceShim.class)) { c.setInterface(new String[] { IContainerListener.class.getName(), - IOFStatisticsListener.class.getName()}, null); + IOFStatisticsListener.class.getName(), IContainerAware.class.getName() }, null); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") .setCallbacks("setController", "unsetController") .setRequired(true)); c.add(createServiceDependency() - .setService(IInventoryShimInternalListener.class) + .setService(IInventoryShimInternalListener.class, "(!(scope=Global))") .setCallbacks("setInventoryShimInternalListener", "unsetInventoryShimInternalListener") .setRequired(true)); + c.add(createServiceDependency() + .setService(IInventoryShimInternalListener.class, "(scope=Global)") + .setCallbacks("setInventoryShimGlobalInternalListener", + "unsetInventoryShimGlobalInternalListener") + .setRequired(true)); c.add(createServiceDependency() .setService(IInventoryShimExternalListener.class) .setCallbacks("setInventoryShimExternalListener", "unsetInventoryShimExternalListener") .setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(TopologyServiceShim.class)) { - c.setInterface(new String[] { IDiscoveryListener.class.getName(), - IContainerListener.class.getName(), - IRefreshInternalProvider.class.getName(), - IInventoryShimExternalListener.class.getName() }, null); + c.setInterface(new String[] { IDiscoveryListener.class.getName(), IContainerListener.class.getName(), + IRefreshInternalProvider.class.getName(), IInventoryShimExternalListener.class.getName(), + IContainerAware.class.getName() }, null); c.add(createServiceDependency() .setService(ITopologyServiceShimListener.class) .setCallbacks("setTopologyServiceShimListener",