2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.ovsdb.compatibility.plugin.internal;
10 import java.util.Dictionary;
11 import java.util.Hashtable;
13 import org.apache.felix.dm.Component;
14 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
15 import org.opendaylight.controller.sal.core.Node;
16 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConfigurationService;
17 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConnectionService;
18 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbInventoryListener;
19 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbInventoryService;
20 import org.opendaylight.ovsdb.compatibility.plugin.impl.ConfigurationServiceImpl;
21 import org.opendaylight.ovsdb.compatibility.plugin.impl.ConnectionServiceImpl;
22 import org.opendaylight.ovsdb.compatibility.plugin.impl.InventoryServiceImpl;
25 * Activator for ovsdb plugin compatibility layer
26 * @author Anil Vishnoi (vishnoianil@gmail.com)
29 public class Activator extends ComponentActivatorAbstractBase {
32 * Function called when the activator starts just after some initializations
33 * are done by the ComponentActivatorAbstractBase.
34 * Here it registers the node Type
39 Node.NodeIDType.registerIDType("OVS", String.class);
43 * Function called when the activator stops just before the cleanup done by
44 * ComponentActivatorAbstractBase
48 public void destroy() {
49 Node.NodeIDType.unRegisterIDType("OVS");
52 public Object[] getGlobalImplementations() {
53 return new Object[]{ ConnectionServiceImpl.class, ConfigurationServiceImpl.class, InventoryServiceImpl.class };
57 public void configureGlobalInstance(Component c, Object imp){
58 if (imp.equals(ConfigurationServiceImpl.class)) {
59 // export the service to be used by SAL
60 Dictionary<String, Object> props = new Hashtable<>();
61 c.setInterface(new String[] { OvsdbConfigurationService.class.getName()}, props);
62 c.add(createServiceDependency()
63 .setService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService.class)
64 .setCallbacks("setOvsdbConfigurationService", "unsetOvsdbConfigurationService")
68 if (imp.equals(ConnectionServiceImpl.class)) {
69 // export the service to be used by SAL
70 Dictionary<String, Object> props = new Hashtable<>();
72 new String[] {OvsdbConnectionService.class.getName()}, props);
73 c.add(createServiceDependency()
74 .setService(org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService.class)
75 .setCallbacks("setOvsdbConnectionService", "unsetOvsdbConnectionService")
79 if (imp.equals(InventoryServiceImpl.class)) {
80 Dictionary<String, Object> props = new Hashtable<>();
82 new String[]{OvsdbInventoryService.class.getName(),
83 org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener.class.getName()}, props);
84 c.add(createServiceDependency()
85 .setService(org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService.class)
86 .setCallbacks("setOvsdbInventoryService", "unsetOvsdbInventoryService")
88 c.add(createServiceDependency()
89 .setService(OvsdbInventoryListener.class)
90 .setCallbacks("addOvsdbInventoryListener", "removeOvsdbInventoryListener")