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);
27 * Function called when the activator starts just after some initializations
28 * are done by the ComponentActivatorAbstractBase.
35 * Function called when the activator stops just before the cleanup done by
36 * ComponentActivatorAbstractBase
39 public void destroy() {
43 * Function that is used to communicate to dependency manager the list of
44 * known implementations for services inside a container
47 * @return An array containing all the CLASS objects that will be
48 * instantiated in order to get an fully working implementation
51 public Object[] getImplementations() {
52 Object[] res = { StatisticsManager.class };
57 * Function that is called when configuration of the dependencies is
61 * dependency manager Component object, used for configuring the
62 * dependencies exported and imported
64 * Implementation class that is being configured, needed as long
65 * as the same routine can configure multiple implementations
66 * @param containerName
67 * The containerName being configured, this allow also optional
68 * per-container different behavior if needed, usually should not
71 public void configureInstance(Component c, Object imp, String containerName) {
72 if (imp.equals(StatisticsManager.class)) {
74 c.setInterface(new String[] {
75 IStatisticsManager.class.getName(),
76 IReadServiceListener.class.getName(),
77 IListenInventoryUpdates.class.getName() }, null);
79 c.add(createContainerServiceDependency(containerName).setService(IReadService.class)
80 .setCallbacks("setReaderService", "unsetReaderService").setRequired(true));
81 c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
82 .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
83 c.add(createContainerServiceDependency(containerName).setService(IContainer.class)
84 .setCallbacks("setIContainer", "unsetIContainer").setRequired(true));