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