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.HashSet;
14 import java.util.Hashtable;
17 import org.apache.felix.dm.Component;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
21 import org.opendaylight.controller.sal.routing.IListenRoutingUpdates;
22 import org.opendaylight.controller.sal.routing.IRouting;
23 import org.opendaylight.controller.switchmanager.ISwitchManager;
24 import org.opendaylight.controller.topologymanager.ITopologyManager;
25 import org.opendaylight.controller.topologymanager.ITopologyManagerClusterWideAware;
26 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
27 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
29 public class Activator extends ComponentActivatorAbstractBase {
30 protected static final Logger logger = LoggerFactory
31 .getLogger(Activator.class);
34 * Function called when the activator starts just after some
35 * initializations are done by the
36 * ComponentActivatorAbstractBase.
44 * Function called when the activator stops just before the
45 * cleanup done by ComponentActivatorAbstractBase
49 public void destroy() {
54 * Function that is used to communicate to dependency manager the
55 * list of known implementations for services inside a container
58 * @return An array containing all the CLASS objects that will be
59 * instantiated in order to get an fully working implementation
63 public Object[] getImplementations() {
64 Object[] res = { DijkstraImplementation.class };
69 * Function that is called when configuration of the dependencies
72 * @param c dependency manager Component object, used for
73 * configuring the dependencies exported and imported
74 * @param imp Implementation class that is being configured,
75 * needed as long as the same routine can configure multiple
77 * @param containerName The containerName being configured, this allow
78 * also optional per-container different behavior if needed, usually
79 * should not be the case though.
82 public void configureInstance(final Component c, final Object imp, final String containerName) {
83 if (imp.equals(DijkstraImplementation.class)) {
85 final Dictionary<String, Object> props = new Hashtable<String, Object>();
86 props.put("topoListenerName", "routing.Dijkstra");
88 c.setInterface(new String[] { ITopologyManagerClusterWideAware.class.getName(), IRouting.class.getName() },
91 // Now lets add a service dependency to make sure the
92 // provider of service exists
93 c.add(createContainerServiceDependency(containerName).setService(IListenRoutingUpdates.class)
94 .setCallbacks("setListenRoutingUpdates", "unsetListenRoutingUpdates")
97 c.add(createContainerServiceDependency(containerName).setService(ISwitchManager.class)
98 .setCallbacks("setSwitchManager", "unsetSwitchManager")
101 c.add(createContainerServiceDependency(containerName).setService(ITopologyManager.class)
102 .setCallbacks("setTopologyManager", "unsetTopologyManager")
105 c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
106 .setCallbacks("setClusterContainerService", "unsetClusterContainerService")
112 protected Object[] getGlobalImplementations() {
113 final Object[] res = { DijkstraImplementationCLI.class };