X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fstub%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugins%2Fstub%2Finternal%2FActivator.java;h=8e4c985c06b76ea6055717ae7a5d46370335673e;hp=cf93fb0a37fb1381716934da2220d6df7eba456c;hb=e2f7aaa41e482815ca1d4495eb85c8653cd903ab;hpb=6ce68c7d4d71586d027668df5d9427d663d6b210 diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java index cf93fb0a37..8e4c985c06 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java @@ -7,7 +7,10 @@ import org.apache.felix.dm.Component; import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase; import org.opendaylight.controller.sal.core.IContainerListener; +import org.opendaylight.controller.sal.utils.INodeConnectorFactory; +import org.opendaylight.controller.sal.utils.INodeFactory; import org.opendaylight.controller.sal.core.Node; +import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.discovery.IDiscoveryService; import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService; import org.opendaylight.controller.sal.inventory.IPluginInInventoryService; @@ -38,6 +41,8 @@ public class Activator extends ComponentActivatorAbstractBase { * */ public void init() { + Node.NodeIDType.registerIDType("STUB", Integer.class); + NodeConnector.NodeConnectorIDType.registerIDType("STUB", Integer.class, "STUB"); } /** @@ -46,6 +51,8 @@ public class Activator extends ComponentActivatorAbstractBase { * */ public void destroy() { + Node.NodeIDType.unRegisterIDType("STUB"); + NodeConnector.NodeConnectorIDType.unRegisterIDType("STUB"); } /** @@ -83,7 +90,7 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); // Set the protocolPluginType property which will be used // by SAL - props.put("protocolPluginType", Node.NodeIDType.OPENFLOW); + props.put("protocolPluginType", "STUB"); c.setInterface(IPluginInReadService.class.getName(), props); } @@ -92,8 +99,43 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); // Set the protocolPluginType property which will be used // by SAL - props.put("protocolPluginType", Node.NodeIDType.OPENFLOW); + props.put("protocolPluginType", "STUB"); c.setInterface(IPluginInInventoryService.class.getName(), props); } } + + public Object[] getGlobalImplementations() { + Object[] res = { FlowProgrammerService.class, StubNodeFactory.class, StubNodeConnectorFactory.class }; + return res; + } + + public void configureGlobalInstance(Component c, Object imp){ + if (imp.equals(FlowProgrammerService.class)) { + // export the service to be used by SAL + Dictionary props = new Hashtable(); + // Set the protocolPluginType property which will be used + // by SAL + props.put("protocolPluginType", "STUB"); + c.setInterface(IPluginInFlowProgrammerService.class.getName(), props); + } + if (imp.equals(StubNodeFactory.class)) { + // export the service to be used by SAL + Dictionary props = new Hashtable(); + // Set the protocolPluginType property which will be used + // by SAL + props.put("protocolPluginType", "STUB"); + props.put("protocolName", "STUB"); + c.setInterface(INodeFactory.class.getName(), props); + } + if (imp.equals(StubNodeConnectorFactory.class)) { + // export the service to be used by SAL + Dictionary props = new Hashtable(); + // Set the protocolPluginType property which will be used + // by SAL + props.put("protocolPluginType", "STUB"); + props.put("protocolName", "STUB"); + c.setInterface(INodeConnectorFactory.class.getName(), props); + } + + } }