X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FActivator.java;h=d92c57bd8a59d9852326e2f2238af9dac2784971;hp=16393fa21f0518fed7691f0960fbd53c02b54ce0;hb=315a10ec8b79abec3f4d718359ebb4202bffcb11;hpb=850d5b748e96c2667bb95ce423bdb00083838619 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 16393fa21f..d92c57bd8a 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013-2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -31,6 +31,7 @@ import org.opendaylight.controller.protocol_plugin.openflow.core.internal.Contro 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; @@ -57,20 +58,9 @@ public class Activator extends ComponentActivatorAbstractBase { .getLogger(Activator.class); /** - * Function called when the activator starts just after some initializations - * are done by the ComponentActivatorAbstractBase. - * + * Priority to determine whether to override existing protocol service. */ - public void init() { - } - - /** - * Function called when the activator stops just before the cleanup done by - * ComponentActivatorAbstractBase - * - */ - public void destroy() { - } + private static final int PLUGIN_PRIORITY = 10; /** * Function that is used to communicate to dependency manager the list of @@ -81,6 +71,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, @@ -103,6 +94,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 @@ -148,6 +140,8 @@ public class Activator extends ComponentActivatorAbstractBase { // Set the protocolPluginType property which will be used // by SAL props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); + props.put(GlobalConstants.PROTOCOLPLUGINPRIORITY.toString(), + Integer.valueOf(PLUGIN_PRIORITY)); c.setInterface(IPluginInDataPacketService.class.getName(), props); // Hook the services coming in from SAL, as optional in // case SAL is not yet there, could happen @@ -168,7 +162,7 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .setRequired(true)); } if (imp.equals(ReadService.class)) { @@ -177,6 +171,8 @@ public class Activator extends ComponentActivatorAbstractBase { // Set the protocolPluginType property which will be used // by SAL props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); + props.put(GlobalConstants.PROTOCOLPLUGINPRIORITY.toString(), + Integer.valueOf(PLUGIN_PRIORITY)); c.setInterface(new String[] { IReadFilterInternalListener.class.getName(), IPluginInReadService.class.getName() }, props); @@ -196,7 +192,7 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .setRequired(true)); } if (imp.equals(FlowProgrammerNotifier.class)) { @@ -216,7 +212,7 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .setRequired(true)); } } @@ -229,6 +225,7 @@ 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, @@ -248,6 +245,7 @@ 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)) { @@ -266,13 +264,12 @@ public class Activator extends ComponentActivatorAbstractBase { // Set the protocolPluginType property which will be used // by SAL props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); + props.put(GlobalConstants.PROTOCOLPLUGINPRIORITY.toString(), + Integer.valueOf(PLUGIN_PRIORITY)); 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)") @@ -282,22 +279,20 @@ public class Activator extends ComponentActivatorAbstractBase { c.add(createServiceDependency() .setService(IFlowProgrammerNotifier.class) .setCallbacks("setFlowProgrammerNotifier", - "unsetsetFlowProgrammerNotifier") + "unsetFlowProgrammerNotifier") .setRequired(false)); c.add(createServiceDependency() .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .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)") @@ -332,9 +327,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() @@ -357,15 +350,14 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .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)") @@ -385,7 +377,7 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .setRequired(true)); } if (imp.equals(InventoryService.class)) { @@ -408,12 +400,12 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutInventoryService.class, "(scope=Global)") .setCallbacks("setPluginOutInventoryServices", "unsetPluginOutInventoryServices") - .setRequired(false)); + .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)") @@ -438,14 +430,13 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IPluginOutConnectionService.class) .setCallbacks("setIPluginOutConnectionService", "unsetIPluginOutConnectionService") - .setRequired(false)); + .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",