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.statisticsmanager.internal;
12 import org.apache.felix.dm.Component;
13 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
14 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
15 import org.opendaylight.controller.sal.core.IContainer;
16 import org.opendaylight.controller.sal.inventory.IListenInventoryUpdates;
17 import org.opendaylight.controller.sal.reader.IReadService;
18 import org.opendaylight.controller.sal.reader.IReadServiceListener;
19 import org.opendaylight.controller.statisticsmanager.IStatisticsManager;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
23 public class Activator extends ComponentActivatorAbstractBase {
24 protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
28 * Function that is used to communicate to dependency manager the list of
29 * known implementations for services inside a container
32 * @return An array containing all the CLASS objects that will be
33 * instantiated in order to get an fully working implementation
36 public Object[] getImplementations() {
37 Object[] res = { StatisticsManager.class };
42 * Function that is called when configuration of the dependencies is
46 * dependency manager Component object, used for configuring the
47 * dependencies exported and imported
49 * Implementation class that is being configured, needed as long
50 * as the same routine can configure multiple implementations
51 * @param containerName
52 * The containerName being configured, this allow also optional
53 * per-container different behavior if needed, usually should not
56 public void configureInstance(Component c, Object imp, String containerName) {
57 if (imp.equals(StatisticsManager.class)) {
59 c.setInterface(new String[] {
60 IStatisticsManager.class.getName(),
61 IReadServiceListener.class.getName(),
62 IListenInventoryUpdates.class.getName() }, null);
64 c.add(createContainerServiceDependency(containerName).setService(IReadService.class)
65 .setCallbacks("setReaderService", "unsetReaderService").setRequired(true));
66 c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
67 .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
68 c.add(createContainerServiceDependency(containerName).setService(IContainer.class)
69 .setCallbacks("setIContainer", "unsetIContainer").setRequired(true));