3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.switchmanager.internal;
12 import org.apache.felix.dm.Component;
13 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
14 import org.opendaylight.controller.configuration.IConfigurationContainerAware;
15 import org.opendaylight.controller.configuration.IConfigurationContainerService;
16 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
17 import org.opendaylight.controller.sal.inventory.IInventoryService;
18 import org.opendaylight.controller.sal.inventory.IListenInventoryUpdates;
19 import org.opendaylight.controller.statisticsmanager.IStatisticsManager;
20 import org.opendaylight.controller.switchmanager.IInventoryListener;
21 import org.opendaylight.controller.switchmanager.ISpanAware;
22 import org.opendaylight.controller.switchmanager.ISwitchManager;
23 import org.opendaylight.controller.switchmanager.ISwitchManagerAware;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
28 * SwitchManager Bundle Activator
32 public class Activator extends ComponentActivatorAbstractBase {
33 protected static final Logger logger = LoggerFactory
34 .getLogger(Activator.class);
38 * Function that is used to communicate to dependency manager the
39 * list of known implementations for services inside a container
42 * @return An array containing all the CLASS objects that will be
43 * instantiated in order to get an fully working implementation
47 public Object[] getImplementations() {
48 Object[] res = { SwitchManager.class };
53 * Function that is called when configuration of the dependencies
56 * @param c dependency manager Component object, used for
57 * configuring the dependencies exported and imported
58 * @param imp Implementation class that is being configured,
59 * needed as long as the same routine can configure multiple
61 * @param containerName The containerName being configured, this allow
62 * also optional per-container different behavior if needed, usually
63 * should not be the case though.
66 public void configureInstance(Component c, Object imp, String containerName) {
67 if (imp.equals(SwitchManager.class)) {
69 c.setInterface(new String[] {
70 IListenInventoryUpdates.class.getName(),
71 ISwitchManager.class.getName(),
72 IConfigurationContainerAware.class.getName() }, null);
74 // Now lets add a service dependency to make sure the
75 // provider of service exists
76 c.add(createContainerServiceDependency(containerName).setService(
77 IInventoryService.class).setCallbacks(
78 "setInventoryService", "unsetInventoryService")
80 c.add(createContainerServiceDependency(containerName).setService(
81 IStatisticsManager.class).setCallbacks(
82 "setStatisticsManager", "unsetStatisticsManager")
84 c.add(createContainerServiceDependency(containerName).setService(
85 ISwitchManagerAware.class).setCallbacks(
86 "setSwitchManagerAware", "unsetSwitchManagerAware")
88 c.add(createContainerServiceDependency(containerName).setService(
89 IInventoryListener.class).setCallbacks(
90 "setInventoryListener", "unsetInventoryListener")
92 c.add(createContainerServiceDependency(containerName).setService(
93 ISpanAware.class).setCallbacks("setSpanAware",
94 "unsetSpanAware").setRequired(false));
95 c.add(createContainerServiceDependency(containerName).setService(
96 IClusterContainerServices.class).setCallbacks(
97 "setClusterContainerService",
98 "unsetClusterContainerService").setRequired(true));
99 c.add(createContainerServiceDependency(containerName).setService(
100 IConfigurationContainerService.class).setCallbacks(
101 "setConfigurationContainerService",
102 "unsetConfigurationContainerService").setRequired(true));
107 protected Object[] getGlobalImplementations() {
108 final Object[] res = { SwitchManagerCLI.class };