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.ovsdb.compatibility.plugin.api.OvsdbConfigurationService;
16 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConnectionService;
17 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbInventoryListener;
18 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbInventoryService;
19 import org.opendaylight.ovsdb.compatibility.plugin.impl.ConfigurationServiceImpl;
20 import org.opendaylight.ovsdb.compatibility.plugin.impl.ConnectionServiceImpl;
21 import org.opendaylight.ovsdb.compatibility.plugin.impl.InventoryServiceImpl;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 * Activator for ovsdb plugin compatibility layer
27 * @author Anil Vishnoi (vishnoianil@gmail.com)
30 public class Activator extends ComponentActivatorAbstractBase {
31 protected static final Logger logger = LoggerFactory
32 .getLogger(Activator.class);
35 * Function called when the activator starts just after some initializations
36 * are done by the ComponentActivatorAbstractBase.
37 * Here it registers the node Type
45 * Function called when the activator stops just before the cleanup done by
46 * ComponentActivatorAbstractBase
50 public void destroy() {
53 public Object[] getGlobalImplementations() {
54 Object[] res = { ConnectionServiceImpl.class, ConfigurationServiceImpl.class, InventoryServiceImpl.class };
59 public void configureGlobalInstance(Component c, Object imp){
60 if (imp.equals(ConfigurationServiceImpl.class)) {
61 // export the service to be used by SAL
62 Dictionary<String, Object> props = new Hashtable<String, Object>();
63 c.setInterface(new String[] { OvsdbConfigurationService.class.getName()}, props);
64 c.add(createServiceDependency()
65 .setService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService.class)
66 .setCallbacks("setOvsdbConfigurationService", "unsetOvsdbConfigurationService")
70 if (imp.equals(ConnectionServiceImpl.class)) {
71 // export the service to be used by SAL
72 Dictionary<String, Object> props = new Hashtable<String, Object>();
74 new String[] {OvsdbConnectionService.class.getName()}, props);
75 c.add(createServiceDependency()
76 .setService(org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService.class)
77 .setCallbacks("setOvsdbConnectionService", "unsetOvsdbConnectionService")
81 if (imp.equals(InventoryServiceImpl.class)) {
82 Dictionary<String, Object> props = new Hashtable<>();
84 new String[]{OvsdbInventoryService.class.getName(),
85 org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener.class.getName()}, props);
86 c.add(createServiceDependency()
87 .setService(org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService.class)
88 .setCallbacks("setOvsdbInventoryService", "unsetOvsdbInventoryService")
90 c.add(createServiceDependency()
91 .setService(OvsdbInventoryListener.class)
92 .setCallbacks("addOvsdbInventoryListener", "removeOvsdbInventoryListener")