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.routing.dijkstra_implementation.internal;
12 import java.util.Dictionary;
13 import java.util.Hashtable;
15 import org.apache.felix.dm.Component;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
19 import org.opendaylight.controller.sal.routing.IListenRoutingUpdates;
20 import org.opendaylight.controller.sal.routing.IRouting;
21 import org.opendaylight.controller.switchmanager.ISwitchManager;
22 import org.opendaylight.controller.topologymanager.ITopologyManager;
23 import org.opendaylight.controller.topologymanager.ITopologyManagerClusterWideAware;
24 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
26 public class Activator extends ComponentActivatorAbstractBase {
27 protected static final Logger logger = LoggerFactory
28 .getLogger(Activator.class);
31 * Function that is used to communicate to dependency manager the
32 * list of known implementations for services inside a container
35 * @return An array containing all the CLASS objects that will be
36 * instantiated in order to get an fully working implementation
40 public Object[] getImplementations() {
41 Object[] res = { DijkstraImplementation.class };
46 * Function that is called when configuration of the dependencies
49 * @param c dependency manager Component object, used for
50 * configuring the dependencies exported and imported
51 * @param imp Implementation class that is being configured,
52 * needed as long as the same routine can configure multiple
54 * @param containerName The containerName being configured, this allow
55 * also optional per-container different behavior if needed, usually
56 * should not be the case though.
59 public void configureInstance(final Component c, final Object imp, final String containerName) {
60 if (imp.equals(DijkstraImplementation.class)) {
62 final Dictionary<String, Object> props = new Hashtable<String, Object>();
63 props.put("topoListenerName", "routing.Dijkstra");
65 c.setInterface(new String[] { ITopologyManagerClusterWideAware.class.getName(), IRouting.class.getName() },
68 // Now lets add a service dependency to make sure the
69 // provider of service exists
70 c.add(createContainerServiceDependency(containerName).setService(IListenRoutingUpdates.class)
71 .setCallbacks("setListenRoutingUpdates", "unsetListenRoutingUpdates")
74 c.add(createContainerServiceDependency(containerName).setService(ISwitchManager.class)
75 .setCallbacks("setSwitchManager", "unsetSwitchManager")
78 c.add(createContainerServiceDependency(containerName).setService(ITopologyManager.class)
79 .setCallbacks("setTopologyManager", "unsetTopologyManager")
82 c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
83 .setCallbacks("setClusterContainerService", "unsetClusterContainerService")
89 protected Object[] getGlobalImplementations() {
90 final Object[] res = { DijkstraImplementationCLI.class };