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.sal.core.ComponentActivatorAbstractBase;
16 import org.opendaylight.controller.sal.inventory.IInventoryService;
17 import org.opendaylight.controller.sal.inventory.IListenInventoryUpdates;
18 import org.opendaylight.controller.statisticsmanager.IStatisticsManager;
19 import org.opendaylight.controller.switchmanager.IInventoryListener;
20 import org.opendaylight.controller.switchmanager.ISpanAware;
21 import org.opendaylight.controller.switchmanager.ISwitchManager;
22 import org.opendaylight.controller.switchmanager.ISwitchManagerAware;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
27 * SwitchManager Bundle Activator
31 public class Activator extends ComponentActivatorAbstractBase {
32 protected static final Logger logger = LoggerFactory
33 .getLogger(Activator.class);
37 * Function that is used to communicate to dependency manager the
38 * list of known implementations for services inside a container
41 * @return An array containing all the CLASS objects that will be
42 * instantiated in order to get an fully working implementation
46 public Object[] getImplementations() {
47 Object[] res = { SwitchManager.class };
52 * Function that is called when configuration of the dependencies
55 * @param c dependency manager Component object, used for
56 * configuring the dependencies exported and imported
57 * @param imp Implementation class that is being configured,
58 * needed as long as the same routine can configure multiple
60 * @param containerName The containerName being configured, this allow
61 * also optional per-container different behavior if needed, usually
62 * should not be the case though.
65 public void configureInstance(Component c, Object imp, String containerName) {
66 if (imp.equals(SwitchManager.class)) {
68 c.setInterface(new String[] {
69 IListenInventoryUpdates.class.getName(),
70 ISwitchManager.class.getName(),
71 IConfigurationContainerAware.class.getName() }, null);
73 // Now lets add a service dependency to make sure the
74 // provider of service exists
75 c.add(createContainerServiceDependency(containerName).setService(
76 IInventoryService.class).setCallbacks(
77 "setInventoryService", "unsetInventoryService")
79 c.add(createContainerServiceDependency(containerName).setService(
80 IStatisticsManager.class).setCallbacks(
81 "setStatisticsManager", "unsetStatisticsManager")
83 c.add(createContainerServiceDependency(containerName).setService(
84 ISwitchManagerAware.class).setCallbacks(
85 "setSwitchManagerAware", "unsetSwitchManagerAware")
87 c.add(createContainerServiceDependency(containerName).setService(
88 IInventoryListener.class).setCallbacks(
89 "setInventoryListener", "unsetInventoryListener")
91 c.add(createContainerServiceDependency(containerName).setService(
92 ISpanAware.class).setCallbacks("setSpanAware",
93 "unsetSpanAware").setRequired(false));
94 c.add(createContainerServiceDependency(containerName).setService(
95 IClusterContainerServices.class).setCallbacks(
96 "setClusterContainerService",
97 "unsetClusterContainerService").setRequired(true));
102 protected Object[] getGlobalImplementations() {
103 final Object[] res = { SwitchManagerCLI.class };