2 * Copyright IBM Corporation, 2013. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.controller.networkconfig.neutron.implementation;
\r
11 import java.util.Hashtable;
\r
12 import java.util.Dictionary;
\r
13 import org.apache.felix.dm.Component;
\r
14 import org.slf4j.Logger;
\r
15 import org.slf4j.LoggerFactory;
\r
17 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
\r
18 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
\r
19 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
\r
20 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
\r
21 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
\r
22 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
\r
23 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
\r
25 public class Activator extends ComponentActivatorAbstractBase {
\r
26 protected static final Logger logger = LoggerFactory
\r
27 .getLogger(Activator.class);
\r
30 * Function called when the activator starts just after some
\r
31 * initializations are done by the
\r
32 * ComponentActivatorAbstractBase.
\r
35 public void init() {
\r
40 * Function called when the activator stops just before the
\r
41 * cleanup done by ComponentActivatorAbstractBase
\r
44 public void destroy() {
\r
49 * Function that is used to communicate to dependency manager the
\r
50 * list of known implementations for services inside a container
\r
53 * @return An array containing all the CLASS objects that will be
\r
54 * instantiated in order to get an fully working implementation
\r
57 public Object[] getImplementations() {
\r
58 Object[] res = { NeutronFloatingIPInterface.class,
\r
59 NeutronRouterInterface.class,
\r
60 NeutronPortInterface.class,
\r
61 NeutronSubnetInterface.class,
\r
62 NeutronNetworkInterface.class };
\r
67 * Function that is called when configuration of the dependencies
\r
70 * @param c dependency manager Component object, used for
\r
71 * configuring the dependencies exported and imported
\r
72 * @param imp Implementation class that is being configured,
\r
73 * needed as long as the same routine can configure multiple
\r
75 * @param containerName The containerName being configured, this allow
\r
76 * also optional per-container different behavior if needed, usually
\r
77 * should not be the case though.
\r
79 public void configureInstance(Component c, Object imp, String containerName) {
\r
80 if (imp.equals(NeutronFloatingIPInterface.class)) {
\r
81 // export the service
\r
83 new String[] { INeutronFloatingIPCRUD.class.getName() }, null);
\r
84 Dictionary<String, String> props = new Hashtable<String, String>();
\r
85 props.put("salListenerName", "neutron");
\r
86 c.add(createContainerServiceDependency(containerName)
\r
87 .setService(IClusterContainerServices.class)
\r
88 .setCallbacks("setClusterContainerService",
\r
89 "unsetClusterContainerService").setRequired(true));
\r
91 if (imp.equals(NeutronRouterInterface.class)) {
\r
92 // export the service
\r
94 new String[] { INeutronRouterCRUD.class.getName() }, null);
\r
95 Dictionary<String, String> props = new Hashtable<String, String>();
\r
96 props.put("salListenerName", "neutron");
\r
97 c.add(createContainerServiceDependency(containerName)
\r
98 .setService(IClusterContainerServices.class)
\r
99 .setCallbacks("setClusterContainerService",
\r
100 "unsetClusterContainerService").setRequired(true));
\r
102 if (imp.equals(NeutronPortInterface.class)) {
\r
103 // export the service
\r
105 new String[] { INeutronPortCRUD.class.getName() }, null);
\r
106 Dictionary<String, String> props = new Hashtable<String, String>();
\r
107 props.put("salListenerName", "neutron");
\r
108 c.add(createContainerServiceDependency(containerName)
\r
109 .setService(IClusterContainerServices.class)
\r
110 .setCallbacks("setClusterContainerService",
\r
111 "unsetClusterContainerService").setRequired(true));
\r
113 if (imp.equals(NeutronSubnetInterface.class)) {
\r
114 // export the service
\r
116 new String[] { INeutronSubnetCRUD.class.getName() }, null);
\r
117 Dictionary<String, String> props = new Hashtable<String, String>();
\r
118 props.put("salListenerName", "neutron");
\r
119 c.add(createContainerServiceDependency(containerName)
\r
120 .setService(IClusterContainerServices.class)
\r
121 .setCallbacks("setClusterContainerService",
\r
122 "unsetClusterContainerService").setRequired(true));
\r
124 if (imp.equals(NeutronNetworkInterface.class)) {
\r
125 // export the service
\r
127 new String[] { INeutronNetworkCRUD.class.getName() }, null);
\r
128 Dictionary<String, String> props = new Hashtable<String, String>();
\r
129 props.put("salListenerName", "neutron");
\r
130 c.add(createContainerServiceDependency(containerName)
\r
131 .setService(IClusterContainerServices.class)
\r
132 .setCallbacks("setClusterContainerService",
\r
133 "unsetClusterContainerService").setRequired(true));
\r