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.samples.simpleforwarding.internal;
12 import org.apache.felix.dm.Component;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
17 import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
18 import org.opendaylight.controller.hosttracker.IfIptoHost;
19 import org.opendaylight.controller.hosttracker.IfNewHostNotify;
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.IInventoryListener;
24 import org.opendaylight.controller.switchmanager.ISwitchManager;
25 import org.opendaylight.controller.topologymanager.ITopologyManager;
27 public class Activator extends ComponentActivatorAbstractBase {
28 protected static final Logger logger = LoggerFactory
29 .getLogger(Activator.class);
32 * Function called when the activator starts just after some
33 * initializations are done by the
34 * ComponentActivatorAbstractBase.
42 * Function called when the activator stops just before the
43 * cleanup done by ComponentActivatorAbstractBase
46 public void destroy() {
51 * Function that is used to communicate to dependency manager the
52 * list of known implementations for services inside a container
55 * @return An array containing all the CLASS objects that will be
56 * instantiated in order to get an fully working implementation
59 public Object[] getImplementations() {
60 Object[] res = { SimpleForwardingImpl.class };
65 * Function that is called when configuration of the dependencies
68 * @param c dependency manager Component object, used for
69 * configuring the dependencies exported and imported
70 * @param imp Implementation class that is being configured,
71 * needed as long as the same routine can configure multiple
73 * @param containerName The containerName being configured, this allow
74 * also optional per-container different behavior if needed, usually
75 * should not be the case though.
77 public void configureInstance(Component c, Object imp, String containerName) {
78 if (imp.equals(SimpleForwardingImpl.class)) {
80 c.setInterface(new String[] { IInventoryListener.class.getName(),
81 IfNewHostNotify.class.getName(),
82 IListenRoutingUpdates.class.getName() }, null);
84 c.add(createContainerServiceDependency(containerName).setService(
85 IClusterContainerServices.class).setCallbacks(
86 "setClusterContainerService",
87 "unsetClusterContainerService").setRequired(true));
89 c.add(createContainerServiceDependency(containerName).setService(
90 ISwitchManager.class).setCallbacks("setSwitchManager",
91 "unsetSwitchManager").setRequired(false));
93 c.add(createContainerServiceDependency(containerName).setService(
94 IfIptoHost.class).setCallbacks("setHostTracker",
95 "unsetHostTracker").setRequired(false));
97 c.add(createContainerServiceDependency(containerName).setService(
98 IForwardingRulesManager.class).setCallbacks(
99 "setForwardingRulesManager", "unsetForwardingRulesManager")
100 .setRequired(false));
102 c.add(createContainerServiceDependency(containerName).setService(
103 ITopologyManager.class).setCallbacks("setTopologyManager",
104 "unsetTopologyManager").setRequired(false));
106 c.add(createContainerServiceDependency(containerName).setService(
107 IRouting.class).setCallbacks("setRouting", "unsetRouting")
108 .setRequired(false));