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);
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
48 public void destroy() {
53 * Function that is used to communicate to dependency manager the
54 * list of known implementations for services inside a container
57 * @return An array containing all the CLASS objects that will be
58 * instantiated in order to get an fully working implementation
61 public Object[] getImplementations() {
62 Object[] res = { StaticRoutingImplementation.class };
67 * Function that is called when configuration of the dependencies
70 * @param c dependency manager Component object, used for
71 * configuring the dependencies exported and imported
72 * @param imp Implementation class that is being configured,
73 * needed as long as the same routine can configure multiple
75 * @param containerName The containerName being configured, this allow
76 * also optional per-container different behavior if needed, usually
77 * should not be the case though.
79 public void configureInstance(Component c, Object imp, String containerName) {
80 if (imp.equals(StaticRoutingImplementation.class)) {
81 c.setInterface(new String[] {
82 IForwardingStaticRouting.class.getName(),
83 IfNewHostNotify.class.getName(),
84 IConfigurationContainerAware.class.getName() }, null);
86 c.add(createContainerServiceDependency(containerName).setService(
87 IClusterContainerServices.class).setCallbacks(
88 "setClusterContainerService",
89 "unsetClusterContainerService").setRequired(true));
91 c.add(createContainerServiceDependency(containerName).setService(
92 IfIptoHost.class).setCallbacks("setHostTracker",
93 "unsetHostTracker").setRequired(true));
95 // Static routing aware there could be many
96 c.add(createContainerServiceDependency(containerName).setService(
97 IStaticRoutingAware.class).setCallbacks(
98 "setStaticRoutingAware", "unsetStaticRoutingAware")