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.networkconfig.neutron.implementation.NeutronFloatingIPInterface;
\r
24 import org.opendaylight.controller.networkconfig.neutron.implementation.NeutronNetworkInterface;
\r
25 import org.opendaylight.controller.networkconfig.neutron.implementation.NeutronPortInterface;
\r
26 import org.opendaylight.controller.networkconfig.neutron.implementation.NeutronRouterInterface;
\r
27 import org.opendaylight.controller.networkconfig.neutron.implementation.NeutronSubnetInterface;
\r
28 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
\r
30 public class Activator extends ComponentActivatorAbstractBase {
\r
31 protected static final Logger logger = LoggerFactory
\r
32 .getLogger(Activator.class);
\r
35 * Function called when the activator starts just after some
\r
36 * initializations are done by the
\r
37 * ComponentActivatorAbstractBase.
\r
40 public void init() {
\r
45 * Function called when the activator stops just before the
\r
46 * cleanup done by ComponentActivatorAbstractBase
\r
49 public void destroy() {
\r
54 * Function that is used to communicate to dependency manager the
\r
55 * list of known implementations for services inside a container
\r
58 * @return An array containing all the CLASS objects that will be
\r
59 * instantiated in order to get an fully working implementation
\r
62 public Object[] getImplementations() {
\r
63 Object[] res = { NeutronFloatingIPInterface.class,
\r
64 NeutronRouterInterface.class,
\r
65 NeutronPortInterface.class,
\r
66 NeutronSubnetInterface.class,
\r
67 NeutronNetworkInterface.class };
\r
72 * Function that is called when configuration of the dependencies
\r
75 * @param c dependency manager Component object, used for
\r
76 * configuring the dependencies exported and imported
\r
77 * @param imp Implementation class that is being configured,
\r
78 * needed as long as the same routine can configure multiple
\r
80 * @param containerName The containerName being configured, this allow
\r
81 * also optional per-container different behavior if needed, usually
\r
82 * should not be the case though.
\r
84 public void configureInstance(Component c, Object imp, String containerName) {
\r
85 if (imp.equals(NeutronFloatingIPInterface.class)) {
\r
86 // export the service
\r
88 new String[] { INeutronFloatingIPCRUD.class.getName() }, null);
\r
89 Dictionary<String, String> props = new Hashtable<String, String>();
\r
90 props.put("salListenerName", "neutron");
\r
91 c.add(createContainerServiceDependency(containerName)
\r
92 .setService(IClusterContainerServices.class)
\r
93 .setCallbacks("setClusterContainerService",
\r
94 "unsetClusterContainerService").setRequired(true));
\r
96 if (imp.equals(NeutronRouterInterface.class)) {
\r
97 // export the service
\r
99 new String[] { INeutronRouterCRUD.class.getName() }, null);
\r
100 Dictionary<String, String> props = new Hashtable<String, String>();
\r
101 props.put("salListenerName", "neutron");
\r
102 c.add(createContainerServiceDependency(containerName)
\r
103 .setService(IClusterContainerServices.class)
\r
104 .setCallbacks("setClusterContainerService",
\r
105 "unsetClusterContainerService").setRequired(true));
\r
107 if (imp.equals(NeutronPortInterface.class)) {
\r
108 // export the service
\r
110 new String[] { INeutronPortCRUD.class.getName() }, null);
\r
111 Dictionary<String, String> props = new Hashtable<String, String>();
\r
112 props.put("salListenerName", "neutron");
\r
113 c.add(createContainerServiceDependency(containerName)
\r
114 .setService(IClusterContainerServices.class)
\r
115 .setCallbacks("setClusterContainerService",
\r
116 "unsetClusterContainerService").setRequired(true));
\r
118 if (imp.equals(NeutronSubnetInterface.class)) {
\r
119 // export the service
\r
121 new String[] { INeutronSubnetCRUD.class.getName() }, null);
\r
122 Dictionary<String, String> props = new Hashtable<String, String>();
\r
123 props.put("salListenerName", "neutron");
\r
124 c.add(createContainerServiceDependency(containerName)
\r
125 .setService(IClusterContainerServices.class)
\r
126 .setCallbacks("setClusterContainerService",
\r
127 "unsetClusterContainerService").setRequired(true));
\r
129 if (imp.equals(NeutronNetworkInterface.class)) {
\r
130 // export the service
\r
132 new String[] { INeutronNetworkCRUD.class.getName() }, null);
\r
133 Dictionary<String, String> props = new Hashtable<String, String>();
\r
134 props.put("salListenerName", "neutron");
\r
135 c.add(createContainerServiceDependency(containerName)
\r
136 .setService(IClusterContainerServices.class)
\r
137 .setCallbacks("setClusterContainerService",
\r
138 "unsetClusterContainerService").setRequired(true));
\r