1 package org.opendaylight.controller.protocol_plugins.stub.internal;
3 import java.util.Dictionary;
4 import java.util.Hashtable;
6 import org.apache.felix.dm.Component;
8 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
9 import org.opendaylight.controller.sal.core.IContainerListener;
10 import org.opendaylight.controller.sal.core.Node;
11 import org.opendaylight.controller.sal.core.NodeConnector;
12 import org.opendaylight.controller.sal.discovery.IDiscoveryService;
13 import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
14 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
15 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
16 import org.opendaylight.controller.sal.packet.IPluginInDataPacketService;
17 import org.opendaylight.controller.sal.packet.IPluginOutDataPacketService;
18 import org.opendaylight.controller.sal.reader.IPluginInReadService;
19 import org.opendaylight.controller.sal.reader.IReadService;
20 import org.opendaylight.controller.sal.topology.IPluginInTopologyService;
21 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService;
22 import org.opendaylight.controller.sal.utils.GlobalConstants;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
28 * stub protocol plugin Activator
32 public class Activator extends ComponentActivatorAbstractBase {
33 protected static final Logger logger = LoggerFactory
34 .getLogger(Activator.class);
37 * Function called when the activator starts just after some initializations
38 * are done by the ComponentActivatorAbstractBase.
42 Node.NodeIDType.registerIDType("STUB", Integer.class);
43 NodeConnector.NodeConnectorIDType.registerIDType("STUB", Integer.class, "STUB");
47 * Function called when the activator stops just before the cleanup done by
48 * ComponentActivatorAbstractBase
51 public void destroy() {
52 Node.NodeIDType.unRegisterIDType("STUB");
53 NodeConnector.NodeConnectorIDType.unRegisterIDType("STUB");
57 * Function that is used to communicate to dependency manager the list of
58 * known implementations for services inside a container
61 * @return An array containing all the CLASS objects that will be
62 * instantiated in order to get an fully working implementation
65 public Object[] getImplementations() {
66 Object[] res = { ReadService.class, InventoryService.class };
71 * Function that is called when configuration of the dependencies is
75 * dependency manager Component object, used for configuring the
76 * dependencies exported and imported
78 * Implementation class that is being configured, needed as long
79 * as the same routine can configure multiple implementations
80 * @param containerName
81 * The containerName being configured, this allow also optional
82 * per-container different behavior if needed, usually should not
85 public void configureInstance(Component c, Object imp, String containerName) {
86 if (imp.equals(ReadService.class)) {
87 // export the service to be used by SAL
88 Dictionary<String, Object> props = new Hashtable<String, Object>();
89 // Set the protocolPluginType property which will be used
91 props.put("protocolPluginType", "STUB");
92 c.setInterface(IPluginInReadService.class.getName(), props);
95 if (imp.equals(InventoryService.class)) {
96 // export the service to be used by SAL
97 Dictionary<String, Object> props = new Hashtable<String, Object>();
98 // Set the protocolPluginType property which will be used
100 props.put("protocolPluginType", "STUB");
101 c.setInterface(IPluginInInventoryService.class.getName(), props);
105 public Object[] getGlobalImplementations() {
106 Object[] res = { FlowProgrammerService.class };
110 public void configureGlobalInstance(Component c, Object imp){
111 if (imp.equals(FlowProgrammerService.class)) {
112 // export the service to be used by SAL
113 Dictionary<String, Object> props = new Hashtable<String, Object>();
114 // Set the protocolPluginType property which will be used
116 props.put("protocolPluginType", "STUB");
117 c.setInterface(IPluginInFlowProgrammerService.class.getName(), props);