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);
33 * Function that is used to communicate to dependency manager the
34 * list of known implementations for services inside a container
37 * @return An array containing all the CLASS objects that will be
38 * instantiated in order to get an fully working implementation
41 public Object[] getImplementations() {
42 Object[] res = { SimpleForwardingImpl.class };
47 * Function that is called when configuration of the dependencies
50 * @param c dependency manager Component object, used for
51 * configuring the dependencies exported and imported
52 * @param imp Implementation class that is being configured,
53 * needed as long as the same routine can configure multiple
55 * @param containerName The containerName being configured, this allow
56 * also optional per-container different behavior if needed, usually
57 * should not be the case though.
59 public void configureInstance(Component c, Object imp, String containerName) {
60 if (imp.equals(SimpleForwardingImpl.class)) {
62 c.setInterface(new String[] { IInventoryListener.class.getName(),
63 IfNewHostNotify.class.getName(),
64 IListenRoutingUpdates.class.getName() }, null);
66 c.add(createContainerServiceDependency(containerName).setService(
67 IClusterContainerServices.class).setCallbacks(
68 "setClusterContainerService",
69 "unsetClusterContainerService").setRequired(true));
71 c.add(createContainerServiceDependency(containerName).setService(
72 ISwitchManager.class).setCallbacks("setSwitchManager",
73 "unsetSwitchManager").setRequired(false));
75 c.add(createContainerServiceDependency(containerName).setService(
76 IfIptoHost.class).setCallbacks("setHostTracker",
77 "unsetHostTracker").setRequired(false));
79 c.add(createContainerServiceDependency(containerName).setService(
80 IForwardingRulesManager.class).setCallbacks(
81 "setForwardingRulesManager", "unsetForwardingRulesManager")
84 c.add(createContainerServiceDependency(containerName).setService(
85 ITopologyManager.class).setCallbacks("setTopologyManager",
86 "unsetTopologyManager").setRequired(false));
88 c.add(createContainerServiceDependency(containerName).setService(
89 IRouting.class).setCallbacks("setRouting", "unsetRouting")