1 package org.opendaylight.ovsdb.internal;
3 import java.util.Dictionary;
4 import java.util.Hashtable;
6 import org.apache.felix.dm.Component;
8 import org.opendaylight.controller.sal.networkconfig.bridgedomain.IPluginInBridgeDomainConfigService;
9 import org.opendaylight.controller.sal.connection.IPluginInConnectionService;
10 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
11 import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
12 import org.opendaylight.controller.sal.utils.INodeFactory;
13 import org.opendaylight.controller.sal.core.Node;
14 import org.opendaylight.controller.sal.core.NodeConnector;
15 import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
16 import org.opendaylight.controller.sal.utils.GlobalConstants;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * OVSDB protocol plugin Activator
26 public class Activator extends ComponentActivatorAbstractBase {
27 protected static final Logger logger = LoggerFactory
28 .getLogger(Activator.class);
31 * Function called when the activator starts just after some initializations
32 * are done by the ComponentActivatorAbstractBase.
33 * Here it registers the node Type
37 Node.NodeIDType.registerIDType("OVS", String.class);
38 NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
42 * Function called when the activator stops just before the cleanup done by
43 * ComponentActivatorAbstractBase
46 public void destroy() {
47 Node.NodeIDType.unRegisterIDType("OVS");
48 NodeConnector.NodeConnectorIDType.unRegisterIDType("OVS");
50 public Object[] getGlobalImplementations() {
51 Object[] res = { ConnectionService.class, ConfigurationService.class, NodeFactory.class, NodeConnectorFactory.class };
55 public void configureGlobalInstance(Component c, Object imp){
56 if (imp.equals(ConfigurationService.class)) {
57 // export the service to be used by SAL
58 Dictionary<String, Object> props = new Hashtable<String, Object>();
59 // Set the protocolPluginType property which will be used
61 props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
62 c.setInterface(IPluginInBridgeDomainConfigService.class.getName(), props);
64 c.add(createServiceDependency()
65 .setService(IConnectionServiceInternal.class)
66 .setCallbacks("setConnectionServiceInternal", "unsetConnectionServiceInternal")
70 if (imp.equals(ConnectionService.class)) {
71 // export the service to be used by SAL
72 Dictionary<String, Object> props = new Hashtable<String, Object>();
73 // Set the protocolPluginType property which will be used
75 props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
77 new String[] {IPluginInConnectionService.class.getName(),
78 IConnectionServiceInternal.class.getName()}, props);
81 if (imp.equals(NodeFactory.class)) {
82 // export the service to be used by SAL
83 Dictionary<String, Object> props = new Hashtable<String, Object>();
84 // Set the protocolPluginType property which will be used
86 props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
87 props.put("protocolName", "OVS");
88 c.setInterface(INodeFactory.class.getName(), props);
90 if (imp.equals(NodeConnectorFactory.class)) {
91 // export the service to be used by SAL
92 Dictionary<String, Object> props = new Hashtable<String, Object>();
93 // Set the protocolPluginType property which will be used
95 props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
96 props.put("protocolName", "OVS");
97 c.setInterface(INodeConnectorFactory.class.getName(), props);