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.forwarding.staticrouting.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.opendaylight.controller.forwarding.staticrouting.IForwardingStaticRouting;
19 import org.opendaylight.controller.forwarding.staticrouting.IStaticRoutingAware;
20 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
24 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
25 import org.opendaylight.controller.configuration.IConfigurationContainerAware;
26 import org.opendaylight.controller.hosttracker.IfIptoHost;
27 import org.opendaylight.controller.hosttracker.IfNewHostNotify;
29 public class Activator extends ComponentActivatorAbstractBase {
30 protected static final Logger logger = LoggerFactory
31 .getLogger(Activator.class);
35 * Function that is used to communicate to dependency manager the
36 * list of known implementations for services inside a container
39 * @return An array containing all the CLASS objects that will be
40 * instantiated in order to get an fully working implementation
43 public Object[] getImplementations() {
44 Object[] res = { StaticRoutingImplementation.class };
49 * Function that is called when configuration of the dependencies
52 * @param c dependency manager Component object, used for
53 * configuring the dependencies exported and imported
54 * @param imp Implementation class that is being configured,
55 * needed as long as the same routine can configure multiple
57 * @param containerName The containerName being configured, this allow
58 * also optional per-container different behavior if needed, usually
59 * should not be the case though.
61 public void configureInstance(Component c, Object imp, String containerName) {
62 if (imp.equals(StaticRoutingImplementation.class)) {
63 c.setInterface(new String[] {
64 IForwardingStaticRouting.class.getName(),
65 IfNewHostNotify.class.getName(),
66 IConfigurationContainerAware.class.getName() }, null);
68 c.add(createContainerServiceDependency(containerName).setService(
69 IClusterContainerServices.class).setCallbacks(
70 "setClusterContainerService",
71 "unsetClusterContainerService").setRequired(true));
73 c.add(createContainerServiceDependency(containerName).setService(
74 IfIptoHost.class).setCallbacks("setHostTracker",
75 "unsetHostTracker").setRequired(true));
77 // Static routing aware there could be many
78 c.add(createContainerServiceDependency(containerName).setService(
79 IStaticRoutingAware.class).setCallbacks(
80 "setStaticRoutingAware", "unsetStaticRoutingAware")