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;
14 import org.apache.felix.dm.Component;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
18 import org.opendaylight.controller.configuration.IConfigurationContainerAware;
19 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
20 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
21 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
22 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
23 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
24 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
26 public class Activator extends ComponentActivatorAbstractBase {
27 protected static final Logger logger = LoggerFactory
28 .getLogger(Activator.class);
31 * Function called when the activator starts just after some
32 * initializations are done by the
33 * ComponentActivatorAbstractBase.
42 * Function called when the activator stops just before the
43 * cleanup done by ComponentActivatorAbstractBase
47 public void destroy() {
52 * Function that is used to communicate to dependency manager the
53 * list of known implementations for services inside a container
56 * @return An array containing all the CLASS objects that will be
57 * instantiated in order to get an fully working implementation
61 public Object[] getImplementations() {
62 Object[] res = { NeutronFloatingIPInterface.class,
63 NeutronRouterInterface.class,
64 NeutronPortInterface.class,
65 NeutronSubnetInterface.class,
66 NeutronNetworkInterface.class };
71 * Function that is called when configuration of the dependencies
74 * @param c dependency manager Component object, used for
75 * configuring the dependencies exported and imported
76 * @param imp Implementation class that is being configured,
77 * needed as long as the same routine can configure multiple
79 * @param containerName The containerName being configured, this allow
80 * also optional per-container different behavior if needed, usually
81 * should not be the case though.
84 public void configureInstance(Component c, Object imp, String containerName) {
85 if (imp.equals(NeutronFloatingIPInterface.class)) {
88 new String[] { INeutronFloatingIPCRUD.class.getName(),
89 IConfigurationContainerAware.class.getName()}, null);
90 Dictionary<String, String> props = new Hashtable<String, String>();
91 props.put("salListenerName", "neutron");
92 c.add(createContainerServiceDependency(containerName)
93 .setService(IClusterContainerServices.class)
94 .setCallbacks("setClusterContainerService",
95 "unsetClusterContainerService").setRequired(true));
97 if (imp.equals(NeutronRouterInterface.class)) {
100 new String[] { INeutronRouterCRUD.class.getName(),
101 IConfigurationContainerAware.class.getName()}, null);
102 Dictionary<String, String> props = new Hashtable<String, String>();
103 props.put("salListenerName", "neutron");
104 c.add(createContainerServiceDependency(containerName)
105 .setService(IClusterContainerServices.class)
106 .setCallbacks("setClusterContainerService",
107 "unsetClusterContainerService").setRequired(true));
109 if (imp.equals(NeutronPortInterface.class)) {
110 // export the service
112 new String[] { INeutronPortCRUD.class.getName(),
113 IConfigurationContainerAware.class.getName()}, null);
114 Dictionary<String, String> props = new Hashtable<String, String>();
115 props.put("salListenerName", "neutron");
116 c.add(createContainerServiceDependency(containerName)
117 .setService(IClusterContainerServices.class)
118 .setCallbacks("setClusterContainerService",
119 "unsetClusterContainerService").setRequired(true));
121 if (imp.equals(NeutronSubnetInterface.class)) {
122 // export the service
124 new String[] { INeutronSubnetCRUD.class.getName(),
125 IConfigurationContainerAware.class.getName()}, null);
126 Dictionary<String, String> props = new Hashtable<String, String>();
127 props.put("salListenerName", "neutron");
128 c.add(createContainerServiceDependency(containerName)
129 .setService(IClusterContainerServices.class)
130 .setCallbacks("setClusterContainerService",
131 "unsetClusterContainerService").setRequired(true));
133 if (imp.equals(NeutronNetworkInterface.class)) {
134 // export the service
136 new String[] { INeutronNetworkCRUD.class.getName(),
137 IConfigurationContainerAware.class.getName()}, null);
138 Dictionary<String, String> props = new Hashtable<String, String>();
139 props.put("salListenerName", "neutron");
140 c.add(createContainerServiceDependency(containerName)
141 .setService(IClusterContainerServices.class)
142 .setCallbacks("setClusterContainerService",
143 "unsetClusterContainerService").setRequired(true));