<extensions>true</extensions>
<configuration>
<instructions>
- <Import-Package>
- org.opendaylight.controller.sal.packet,
- org.opendaylight.controller.sal.action,
- org.opendaylight.controller.sal.discovery,
- org.opendaylight.controller.sal.topology,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.flowprogrammer,
- org.opendaylight.controller.sal.reader,
- org.opendaylight.controller.sal.inventory,
- org.opendaylight.controller.sal.match,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.ovsdb.lib.error,
- org.opendaylight.ovsdb.lib.notation,
- org.opendaylight.ovsdb.lib.operations,
- org.opendaylight.ovsdb.lib.message,
- org.opendaylight.ovsdb.schema.openvswitch,
- org.apache.commons.lang3.builder,
- org.apache.commons.lang3.tuple,
- org.apache.felix.dm,
- org.slf4j,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- javax.net.ssl,
- *
- </Import-Package>
<Embed-Dependency>commons-codec,javax.servlet-api,portlet-api,commons-collections,utils.config;type=!pom;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Bundle-Activator>org.opendaylight.ovsdb.plugin.internal.Activator</Bundle-Activator>
import java.util.Dictionary;
import java.util.Hashtable;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
import org.opendaylight.ovsdb.plugin.impl.NodeConnectorFactory;
import org.opendaylight.ovsdb.plugin.impl.NodeFactory;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*
*
*/
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator extends DependencyActivatorBase {
protected static final Logger logger = LoggerFactory
.getLogger(Activator.class);
- /**
- * Function called when the activator starts just after some initializations
- * are done by the ComponentActivatorAbstractBase.
- * Here it registers the node Type
- *
- */
@Override
- public void init() {
+ public void init(BundleContext context, DependencyManager manager) throws Exception {
Node.NodeIDType.registerIDType("OVS", String.class);
NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
- }
-
- /**
- * Function called when the activator stops just before the cleanup done by
- * ComponentActivatorAbstractBase
- *
- */
- @Override
- public void destroy() {
- Node.NodeIDType.unRegisterIDType("OVS");
- NodeConnector.NodeConnectorIDType.unRegisterIDType("OVS");
- }
- @Override
- public Object[] getGlobalImplementations() {
- Object[] res = { ConnectionServiceImpl.class, ConfigurationServiceImpl.class, NodeFactory.class, NodeConnectorFactory.class, InventoryServiceImpl.class };
- return res;
- }
- @Override
- public void configureGlobalInstance(Component c, Object imp){
- if (imp.equals(ConfigurationServiceImpl.class)) {
- // export the service to be used by SAL
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- // Set the protocolPluginType property which will be used
- // by SAL
- props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
- c.setInterface(new String[] { OvsdbConfigurationService.class.getName()}, props);
+ Dictionary<String, Object> props = new Hashtable<String, Object>();
+ props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
- c.add(createServiceDependency()
- .setService(OvsdbConnectionService.class)
- .setRequired(true));
- c.add(createServiceDependency()
- .setService(OvsdbInventoryService.class)
- .setRequired(true));
- }
+ manager.add(createComponent()
+ .setInterface(OvsdbConfigurationService.class.getName(), props)
+ .setImplementation(ConfigurationServiceImpl.class)
+ .add(createServiceDependency()
+ .setService(OvsdbConnectionService.class)
+ .setRequired(true))
+ .add(createServiceDependency()
+ .setService(OvsdbInventoryService.class)
+ .setRequired(true)));
- if (imp.equals(ConnectionServiceImpl.class)) {
- // export the service to be used by SAL
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- // Set the protocolPluginType property which will be used
- // by SAL
- props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
- c.setInterface(
- new String[] {OvsdbConnectionService.class.getName(),
- OvsdbConnectionListener.class.getName()}, props);
- c.add(createServiceDependency()
- .setService(OvsdbInventoryService.class)
- .setRequired(true));
- c.add(createServiceDependency()
- .setService(OvsdbConnection.class)
- .setRequired(true));
- }
+ Dictionary<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+ manager.add(createComponent()
+ .setInterface(
+ new String[] {OvsdbConnectionService.class.getName(),
+ OvsdbConnectionListener.class.getName()}, props2)
+ .setImplementation(ConnectionServiceImpl.class)
+ .add(createServiceDependency()
+ .setService(OvsdbInventoryService.class)
+ .setRequired(true))
+ .add(createServiceDependency()
+ .setService(OvsdbConnection.class)
+ .setRequired(true))
+ );
- if (imp.equals(InventoryServiceImpl.class)) {
- Dictionary<String, Object> props = new Hashtable<>();
- props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
- props.put("scope", "Global");
- c.setInterface(
- new String[]{IPluginInInventoryService.class.getName(),
- OvsdbInventoryService.class.getName()}, props);
- c.add(createServiceDependency()
- .setService(IPluginOutInventoryService.class, "(scope=Global)")
- .setCallbacks("setPluginOutInventoryServices",
+ Dictionary<String, Object> props3 = new Hashtable<>();
+ props3.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+ props3.put("scope", "Global");
+ manager.add(createComponent()
+ .setInterface(
+ new String[]{IPluginInInventoryService.class.getName(),
+ OvsdbInventoryService.class.getName()}, props3)
+ .setImplementation(InventoryServiceImpl.class)
+ .add(createServiceDependency()
+ .setService(IPluginOutInventoryService.class, "(scope=Global)")
+ .setCallbacks("setPluginOutInventoryServices",
"unsetPluginOutInventoryServices")
- .setRequired(true));
- c.add(createServiceDependency()
- .setService(OvsdbInventoryListener.class)
- .setCallbacks("listenerAdded", "listenerRemoved"));
- c.add(createServiceDependency()
- .setService(OvsdbConfigurationService.class)
- .setRequired(false));
- }
+ .setRequired(true))
+ .add(createServiceDependency()
+ .setService(OvsdbInventoryListener.class)
+ .setCallbacks("listenerAdded", "listenerRemoved"))
+ .add(createServiceDependency()
+ .setService(OvsdbConfigurationService.class)
+ .setRequired(false)));
+
+ Dictionary<String, Object> props4 = new Hashtable<String, Object>();
+ props4.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+ props4.put("protocolName", "OVS");
+
+ manager.add(createComponent()
+ .setInterface(INodeFactory.class.getName(), props4)
+ .setImplementation(NodeFactory.class));
+
+ Dictionary<String, Object> props5 = new Hashtable<String, Object>();
+ props5.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+ props5.put("protocolName", "OVS");
- if (imp.equals(NodeFactory.class)) {
- // export the service to be used by SAL
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- // Set the protocolPluginType property which will be used
- // by SAL
- props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
- props.put("protocolName", "OVS");
- c.setInterface(INodeFactory.class.getName(), props);
- }
- if (imp.equals(NodeConnectorFactory.class)) {
- // export the service to be used by SAL
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- // Set the protocolPluginType property which will be used
- // by SAL
- props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
- props.put("protocolName", "OVS");
- c.setInterface(INodeConnectorFactory.class.getName(), props);
- }
+ manager.add(createComponent()
+ .setInterface(INodeConnectorFactory.class.getName(), props5)
+ .setImplementation(NodeConnectorFactory.class));
+ }
+ @Override
+ public void destroy(BundleContext context, DependencyManager manager) throws Exception {
+ Node.NodeIDType.unRegisterIDType("OVS");
+ NodeConnector.NodeConnectorIDType.unRegisterIDType("OVS");
}
}