2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.lispflowmapping.neutron;
12 import java.util.Dictionary;
13 import java.util.Hashtable;
15 import org.apache.felix.dm.Component;
16 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
17 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
18 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
19 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
20 import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
25 * Main application activator class for registering the dependencies and
26 * Initializing the Mapping Service application.
30 public class Activator extends ComponentActivatorAbstractBase {
35 protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
38 * Function called when the activator starts just after some initializations
39 * are done by the ComponentActivatorAbstractBase.
44 logger.debug("LISP Neutron Service is initialized!");
49 * Function called when the activator stops just before the cleanup done by
50 * ComponentActivatorAbstractBase
54 public void destroy() {
55 logger.debug("LISP Neutron Service is destroyed!");
59 * Function that is used to communicate to dependency manager the list of
60 * known implementations for services inside a container
63 * @return An array containing all the CLASS objects that will be
64 * instantiated in order to get an fully working implementation
68 public Object[] getImplementations() {
69 Object[] res = { LispNeutronService.class,
70 LispNeutronSubnetHandler.class,
71 LispNeutronPortHandler.class,
72 LispNeutronNetworkHandler.class};
77 * Function that is called when configuration of the dependencies is
81 * dependency manager Component object, used for configuring the
82 * dependencies exported and imported
84 * Implementation class that is being configured, needed as long
85 * as the same routine can configure multiple implementations
86 * @param containerName
87 * The containerName being configured, this allow also optional
88 * per-container different behavior if needed, usually should not
92 public void configureInstance(Component c, Object imp, String containerName) {
93 Dictionary<String, String> props = new Hashtable<String, String>();
94 props.put("name", "mappingservice");
96 if (imp.equals(LispNeutronService.class)) {
97 c.setInterface(ILispNeutronService.class.getName(), props);
100 if (imp.equals(LispNeutronNetworkHandler.class)) {
101 c.setInterface(new String[] { ILispNeutronService.class.getName(), INeutronNetworkAware.class.getName()}, props);
104 if (imp.equals(LispNeutronSubnetHandler.class)) {
105 c.setInterface(new String[] { ILispNeutronService.class.getName(), INeutronSubnetAware.class.getName()}, props);
108 if (imp.equals(LispNeutronPortHandler.class)) {
109 c.setInterface(new String[] { ILispNeutronService.class.getName(), INeutronPortAware.class.getName()}, props);
112 c.add(createContainerServiceDependency(containerName)
113 .setService(IFlowMapping.class)
114 .setCallbacks("setMappingService", "unsetMappingService")