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.configuration.IConfigurationContainerService;
22 import org.opendaylight.controller.hosttracker.IfIptoHost;
23 import org.opendaylight.controller.hosttracker.IfNewHostNotify;
25 public class Activator extends ComponentActivatorAbstractBase {
26 protected static final Logger logger = LoggerFactory
27 .getLogger(Activator.class);
31 * Function that is used to communicate to dependency manager the
32 * list of known implementations for services inside a container
35 * @return An array containing all the CLASS objects that will be
36 * instantiated in order to get an fully working implementation
40 public Object[] getImplementations() {
41 Object[] res = { StaticRoutingImplementation.class };
46 * Function that is called when configuration of the dependencies
49 * @param c dependency manager Component object, used for
50 * configuring the dependencies exported and imported
51 * @param imp Implementation class that is being configured,
52 * needed as long as the same routine can configure multiple
54 * @param containerName The containerName being configured, this allow
55 * also optional per-container different behavior if needed, usually
56 * should not be the case though.
59 public void configureInstance(Component c, Object imp, String containerName) {
60 if (imp.equals(StaticRoutingImplementation.class)) {
61 c.setInterface(new String[] {
62 IForwardingStaticRouting.class.getName(),
63 IfNewHostNotify.class.getName(),
64 IConfigurationContainerAware.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 IfIptoHost.class).setCallbacks("setHostTracker",
73 "unsetHostTracker").setRequired(true));
75 // Static routing aware there could be many
76 c.add(createContainerServiceDependency(containerName).setService(
77 IStaticRoutingAware.class).setCallbacks(
78 "setStaticRoutingAware", "unsetStaticRoutingAware")
81 c.add(createContainerServiceDependency(containerName).setService(
82 IConfigurationContainerService.class).setCallbacks(
83 "setConfigurationContainerService",
84 "unsetConfigurationContainerService").setRequired(true));