2 * Copyright IBM Corporation, 2013. 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.controller.networkconfig.neutron.implementation;
11 import java.util.Hashtable;
12 import java.util.Dictionary;
13 import org.apache.felix.dm.Component;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
18 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
19 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
20 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
21 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
22 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
23 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
25 public class Activator extends ComponentActivatorAbstractBase {
26 protected static final Logger logger = LoggerFactory
27 .getLogger(Activator.class);
30 * Function called when the activator starts just after some
31 * initializations are done by the
32 * ComponentActivatorAbstractBase.
40 * Function called when the activator stops just before the
41 * cleanup done by ComponentActivatorAbstractBase
44 public void destroy() {
49 * Function that is used to communicate to dependency manager the
50 * list of known implementations for services inside a container
53 * @return An array containing all the CLASS objects that will be
54 * instantiated in order to get an fully working implementation
57 public Object[] getImplementations() {
58 Object[] res = { NeutronFloatingIPInterface.class,
59 NeutronRouterInterface.class,
60 NeutronPortInterface.class,
61 NeutronSubnetInterface.class,
62 NeutronNetworkInterface.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(NeutronFloatingIPInterface.class)) {
83 new String[] { INeutronFloatingIPCRUD.class.getName() }, null);
84 Dictionary<String, String> props = new Hashtable<String, String>();
85 props.put("salListenerName", "neutron");
86 c.add(createContainerServiceDependency(containerName)
87 .setService(IClusterContainerServices.class)
88 .setCallbacks("setClusterContainerService",
89 "unsetClusterContainerService").setRequired(true));
91 if (imp.equals(NeutronRouterInterface.class)) {
94 new String[] { INeutronRouterCRUD.class.getName() }, null);
95 Dictionary<String, String> props = new Hashtable<String, String>();
96 props.put("salListenerName", "neutron");
97 c.add(createContainerServiceDependency(containerName)
98 .setService(IClusterContainerServices.class)
99 .setCallbacks("setClusterContainerService",
100 "unsetClusterContainerService").setRequired(true));
102 if (imp.equals(NeutronPortInterface.class)) {
103 // export the service
105 new String[] { INeutronPortCRUD.class.getName() }, null);
106 Dictionary<String, String> props = new Hashtable<String, String>();
107 props.put("salListenerName", "neutron");
108 c.add(createContainerServiceDependency(containerName)
109 .setService(IClusterContainerServices.class)
110 .setCallbacks("setClusterContainerService",
111 "unsetClusterContainerService").setRequired(true));
113 if (imp.equals(NeutronSubnetInterface.class)) {
114 // export the service
116 new String[] { INeutronSubnetCRUD.class.getName() }, null);
117 Dictionary<String, String> props = new Hashtable<String, String>();
118 props.put("salListenerName", "neutron");
119 c.add(createContainerServiceDependency(containerName)
120 .setService(IClusterContainerServices.class)
121 .setCallbacks("setClusterContainerService",
122 "unsetClusterContainerService").setRequired(true));
124 if (imp.equals(NeutronNetworkInterface.class)) {
125 // export the service
127 new String[] { INeutronNetworkCRUD.class.getName() }, null);
128 Dictionary<String, String> props = new Hashtable<String, String>();
129 props.put("salListenerName", "neutron");
130 c.add(createContainerServiceDependency(containerName)
131 .setService(IClusterContainerServices.class)
132 .setCallbacks("setClusterContainerService",
133 "unsetClusterContainerService").setRequired(true));