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.topologymanager.internal;
12 import org.apache.felix.dm.Component;
14 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
15 import org.opendaylight.controller.configuration.IConfigurationContainerAware;
16 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
17 import org.opendaylight.controller.sal.topology.IListenTopoUpdates;
18 import org.opendaylight.controller.sal.topology.ITopologyService;
19 import org.opendaylight.controller.topologymanager.ITopologyManager;
20 import org.opendaylight.controller.topologymanager.ITopologyManagerAware;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
24 public class Activator extends ComponentActivatorAbstractBase {
25 protected static final Logger logger = LoggerFactory
26 .getLogger(Activator.class);
29 * Function called when the activator starts just after some
30 * initializations are done by the
31 * ComponentActivatorAbstractBase.
39 * Function called when the activator stops just before the
40 * cleanup done by ComponentActivatorAbstractBase
43 public void destroy() {
48 * Function that is used to communicate to dependency manager the
49 * list of known implementations for services inside a container
52 * @return An array containing all the CLASS objects that will be
53 * instantiated in order to get an fully working implementation
56 public Object[] getImplementations() {
57 Object[] res = { TopologyManagerImpl.class };
62 * Function that is called when configuration of the dependencies
65 * @param c dependency manager Component object, used for
66 * configuring the dependencies exported and imported
67 * @param imp Implementation class that is being configured,
68 * needed as long as the same routine can configure multiple
70 * @param containerName The containerName being configured, this allow
71 * also optional per-container different behavior if needed, usually
72 * should not be the case though.
74 public void configureInstance(Component c, Object imp, String containerName) {
75 if (imp.equals(TopologyManagerImpl.class)) {
76 // export the service needed to listen to topology updates
77 c.setInterface(new String[] { IListenTopoUpdates.class.getName(),
78 ITopologyManager.class.getName(),
79 IConfigurationContainerAware.class.getName() }, null);
81 c.add(createContainerServiceDependency(containerName).setService(
82 ITopologyService.class).setCallbacks("setTopoService",
83 "unsetTopoService").setRequired(true));
85 // These are all the listeners for a topology manager
86 // updates, there could be many or none
87 c.add(createContainerServiceDependency(containerName).setService(
88 ITopologyManagerAware.class).setCallbacks(
89 "setTopologyManagerAware", "unsetTopologyManagerAware")
92 c.add(createContainerServiceDependency(containerName).setService(
93 IClusterContainerServices.class).setCallbacks(
94 "setClusterContainerService",
95 "unsetClusterContainerService").setRequired(true));