Make neutron a simple osgi app 54/12654/14
authorEd Warnicke <eaw@cisco.com>
Fri, 7 Nov 2014 21:15:58 +0000 (15:15 -0600)
committerEd Warnicke <eaw@cisco.com>
Thu, 4 Dec 2014 21:45:53 +0000 (21:45 +0000)
Change-Id: I57aabd9db316632d6051eae477ea8a9882699d7f
Signed-off-by: Ed Warnicke <eaw@cisco.com>
63 files changed:
features/neutron/pom.xml [new file with mode: 0644]
features/neutron/src/main/resources/features.xml [new file with mode: 0644]
features/pom.xml
opendaylight/distribution/opendaylight-karaf/pom.xml
opendaylight/networkconfiguration/neutron/implementation/pom.xml
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java
opendaylight/networkconfiguration/neutron/northbound/pom.xml
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java [new file with mode: 0644]
opendaylight/networkconfiguration/neutron/pom.xml
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java

diff --git a/features/neutron/pom.xml b/features/neutron/pom.xml
new file mode 100644 (file)
index 0000000..59a0af2
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+  </parent>
+  <artifactId>features-neutron</artifactId>
+  <version>${networkconfig.neutron.version}</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <features.file>features.xml</features.file>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>networkconfig.neutron</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>org.eclipse.persistence.moxy</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>org.eclipse.persistence.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>networkconfig.neutron</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-net</groupId>
+      <artifactId>commons-net</artifactId>
+    </dependency>
+    <!-- test to validate features.xml -->
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>features-test</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>features-test</artifactId>
+      <version>0.7.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>filter</id>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/${features.file}</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+            <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+            <karaf.distro.version>${commons.opendaylight.version}</karaf.distro.version>
+          </systemPropertyVariables>
+          <dependenciesToScan>
+           <dependency>org.opendaylight.yangtools:features-test</dependency>
+          </dependenciesToScan>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+  </scm>
+</project>
diff --git a/features/neutron/src/main/resources/features.xml b/features/neutron/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..263f907
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<features name="odl-neutron-${networkconfig.neutron.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+   <feature name='odl-neutron-all' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: API">
+    <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+    <feature version='${networkconfig.neutron.version}'>odl-neutron-northbound</feature>
+    <feature version='${networkconfig.neutron.version}'>odl-neutron-implementation</feature>
+  </feature>
+  <feature name='odl-neutron-northbound' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: Northbound">
+    <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version}</bundle>
+    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version}</bundle>
+    <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
+    <bundle>mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
+    <bundle>mvn:com.sun.jersey/jersey-servlet/${jersey.version}</bundle>
+    <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
+  </feature>
+
+  <feature name='odl-neutron-api' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: API">
+    <bundle>mvn:org.opendaylight.controller/networkconfig.neutron/${networkconfig.neutron.version}</bundle>
+    <bundle>mvn:commons-net/commons-net/${commons.net.version}</bundle>
+    <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
+  </feature>
+  <feature name='odl-neutron-implementation' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: Implementation">
+    <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+    <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version}</bundle>
+    <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
+  </feature>
+</features>
\ No newline at end of file
index 8be9f55..4f9ff72 100644 (file)
@@ -24,5 +24,6 @@
     <module>netconf-connector</module>
     <module>restconf</module>
     <module>extras</module>
+    <module>neutron</module>
   </modules>
 </project>
index f4ca221..4c8f9c5 100644 (file)
       <type>xml</type>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>features-neutron</artifactId>
+      <version>${networkconfig.neutron.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
     <!-- Netconf connector features. When this is included, users can test the netconf connector using netconf-testtool -->
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index a9061d5..1607408 100644 (file)
     <enunciate.version>1.26.2</enunciate.version>
   </properties>
   <dependencies>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>clustering.services</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>configuration</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>networkconfig.neutron</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>org.opendaylight.controller.clustering.services,
-              org.opendaylight.controller.configuration,
-              org.opendaylight.controller.sal.core,
-              org.opendaylight.controller.sal.utils,
-              org.apache.felix.dm,
-              org.apache.commons.net.util,
-              org.osgi.service.component,
-              org.opendaylight.controller.networkconfig.neutron,
-              org.slf4j,
-              javax.xml.bind.annotation</Import-Package>
+            <Import-Package>*</Import-Package>
             <Bundle-Activator>org.opendaylight.controller.networkconfig.neutron.implementation.Activator</Bundle-Activator>
           </instructions>
           <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
index 2723a3c..0fbf933 100644 (file)
@@ -8,14 +8,12 @@
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
@@ -27,321 +25,111 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator implements BundleActivator {
     protected static final Logger logger = LoggerFactory
     .getLogger(Activator.class);
+    private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
 
-    /**
-     * Function called when the activator starts just after some
-     * initializations are done by the
-     * ComponentActivatorAbstractBase.
-     *
-     */
-    @Override
-    public void init() {
-
-    }
-
-    /**
-     * Function called when the activator stops just before the
-     * cleanup done by ComponentActivatorAbstractBase
-     *
-     */
-    @Override
-    public void destroy() {
-
-    }
-
-    /**
-     * Function that is used to communicate to dependency manager the
-     * list of known implementations for services inside a container
-     *
-     *
-     * @return An array containing all the CLASS objects that will be
-     * instantiated in order to get an fully working implementation
-     * Object
-     */
-    @Override
-    public Object[] getImplementations() {
-        Object[] res = { NeutronFloatingIPInterface.class,
-                NeutronRouterInterface.class,
-                NeutronPortInterface.class,
-                NeutronSubnetInterface.class,
-                NeutronNetworkInterface.class,
-                NeutronSecurityGroupInterface.class,
-                NeutronSecurityRuleInterface.class,
-                NeutronFirewallInterface.class,
-                NeutronFirewallPolicyInterface.class,
-                NeutronFirewallRuleInterface.class,
-                NeutronLoadBalancerInterface.class,
-                NeutronLoadBalancerPoolInterface.class,
-                NeutronLoadBalancerListenerInterface.class,
-                NeutronLoadBalancerHealthMonitorInterface.class,
-                NeutronLoadBalancerPoolMemberInterface.class};
-        return res;
-    }
-
-    /**
-     * Function that is called when configuration of the dependencies
-     * is required.
-     *
-     * @param c dependency manager Component object, used for
-     * configuring the dependencies exported and imported
-     * @param imp Implementation class that is being configured,
-     * needed as long as the same routine can configure multiple
-     * implementations
-     * @param containerName The containerName being configured, this allow
-     * also optional per-container different behavior if needed, usually
-     * should not be the case though.
-     */
     @Override
-    public void configureInstance(Component c, Object imp, String containerName) {
-        if (imp.equals(NeutronFloatingIPInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronFloatingIPCRUD.class.getName(),
-                                   IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
-        }
-        if (imp.equals(NeutronRouterInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronRouterCRUD.class.getName(),
-                                   IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+    public void start(BundleContext context) throws Exception {
+        NeutronRouterInterface neutronRouterInterface = new NeutronRouterInterface();
+        ServiceRegistration<INeutronRouterCRUD> neutronRouterInterfaceRegistration = context.registerService(INeutronRouterCRUD.class, neutronRouterInterface, null);
+        if(neutronRouterInterfaceRegistration != null) {
+            registrations.add(neutronRouterInterfaceRegistration);
         }
-        if (imp.equals(NeutronPortInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronPortCRUD.class.getName(),
-                                   IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+        NeutronPortInterface neutronPortInterface = new NeutronPortInterface();
+        ServiceRegistration<INeutronPortCRUD> neutronPortInterfaceRegistration = context.registerService(INeutronPortCRUD.class, neutronPortInterface, null);
+        if(neutronPortInterfaceRegistration != null) {
+            registrations.add(neutronPortInterfaceRegistration);
         }
-        if (imp.equals(NeutronSubnetInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronSubnetCRUD.class.getName(),
-                                   IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronSubnetInterface neutronSubnetInterface = new NeutronSubnetInterface();
+        ServiceRegistration<INeutronSubnetCRUD> neutronSubnetInterfaceRegistration = context.registerService(INeutronSubnetCRUD.class, neutronSubnetInterface, null);
+        if(neutronSubnetInterfaceRegistration != null) {
+            registrations.add(neutronSubnetInterfaceRegistration);
         }
-        if (imp.equals(NeutronNetworkInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronNetworkCRUD.class.getName(),
-                                   IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronNetworkInterface neutronNetworkInterface = new NeutronNetworkInterface();
+        ServiceRegistration<INeutronNetworkCRUD> neutronNetworkInterfaceRegistration = context.registerService(INeutronNetworkCRUD.class, neutronNetworkInterface, null);
+        if(neutronNetworkInterfaceRegistration != null) {
+            registrations.add(neutronNetworkInterfaceRegistration);
         }
-        if (imp.equals(NeutronSecurityGroupInterface.class)) {
-            // export the service
-            c.setInterface(
-                new String[] { INeutronSecurityGroupCRUD.class.getName(),
-                    IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                .setService(IClusterContainerServices.class)
-                .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                IConfigurationContainerService.class).setCallbacks(
-                "setConfigurationContainerService",
-                "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronSecurityGroupInterface neutronSecurityGroupInterface = new NeutronSecurityGroupInterface();
+        ServiceRegistration<INeutronSecurityGroupCRUD> neutronSecurityGroupInterfaceRegistration = context.registerService(INeutronSecurityGroupCRUD.class, neutronSecurityGroupInterface, null);
+        if(neutronSecurityGroupInterfaceRegistration != null) {
+            registrations.add(neutronSecurityGroupInterfaceRegistration);
         }
-        if (imp.equals(NeutronSecurityRuleInterface.class)) {
-            // export the service
-            c.setInterface(
-                new String[] { INeutronSecurityRuleCRUD.class.getName(),
-                    IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                .setService(IClusterContainerServices.class)
-                .setCallbacks("setClusterContainerService",
-                    "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                IConfigurationContainerService.class).setCallbacks(
-                "setConfigurationContainerService",
-                "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronSecurityRuleInterface neutronSecurityRuleInterface = new NeutronSecurityRuleInterface();
+        ServiceRegistration<INeutronSecurityRuleCRUD> neutronSecurityRuleInterfaceRegistration = context.registerService(INeutronSecurityRuleCRUD.class, neutronSecurityRuleInterface, null);
+        if(neutronSecurityRuleInterfaceRegistration != null) {
+            registrations.add(neutronSecurityRuleInterfaceRegistration);
         }
-        if (imp.equals(NeutronFirewallInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronFirewallCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronFirewallInterface neutronFirewallInterface = new NeutronFirewallInterface();
+        ServiceRegistration<INeutronFirewallCRUD> neutronFirewallInterfaceRegistration = context.registerService(INeutronFirewallCRUD.class, neutronFirewallInterface, null);
+        if(neutronFirewallInterfaceRegistration != null) {
+            registrations.add(neutronFirewallInterfaceRegistration);
         }
-        if (imp.equals(NeutronFirewallPolicyInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronFirewallPolicyCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronFirewallPolicyInterface neutronFirewallPolicyInterface = new NeutronFirewallPolicyInterface();
+        ServiceRegistration<INeutronFirewallPolicyCRUD> neutronFirewallPolicyInterfaceRegistration = context.registerService(INeutronFirewallPolicyCRUD.class, neutronFirewallPolicyInterface, null);
+        if(neutronFirewallPolicyInterfaceRegistration != null) {
+            registrations.add(neutronFirewallPolicyInterfaceRegistration);
         }
-        if (imp.equals(NeutronFirewallRuleInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronFirewallRuleCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronFirewallRuleInterface neutronFirewallRuleInterface = new NeutronFirewallRuleInterface();
+        ServiceRegistration<INeutronFirewallRuleCRUD> neutronFirewallRuleInterfaceRegistration = context.registerService(INeutronFirewallRuleCRUD.class, neutronFirewallRuleInterface, null);
+        if(neutronFirewallRuleInterfaceRegistration != null) {
+            registrations.add(neutronFirewallRuleInterfaceRegistration);
         }
-        if (imp.equals(NeutronLoadBalancerInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronLoadBalancerCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronLoadBalancerInterface neutronLoadBalancerInterface = new NeutronLoadBalancerInterface();
+        ServiceRegistration<INeutronLoadBalancerCRUD> neutronLoadBalancerInterfaceRegistration = context.registerService(INeutronLoadBalancerCRUD.class, neutronLoadBalancerInterface, null);
+        if(neutronFirewallInterfaceRegistration != null) {
+            registrations.add(neutronLoadBalancerInterfaceRegistration);
         }
-        if (imp.equals(NeutronLoadBalancerListenerInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronLoadBalancerListenerCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronLoadBalancerPoolInterface neutronLoadBalancerPoolInterface = new NeutronLoadBalancerPoolInterface();
+        ServiceRegistration<INeutronLoadBalancerPoolCRUD> neutronLoadBalancerPoolInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolCRUD.class, neutronLoadBalancerPoolInterface, null);
+        if(neutronLoadBalancerPoolInterfaceRegistration != null) {
+            registrations.add(neutronLoadBalancerPoolInterfaceRegistration);
         }
-        if (imp.equals(NeutronLoadBalancerPoolInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronLoadBalancerPoolCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronLoadBalancerListenerInterface neutronLoadBalancerListenerInterface = new NeutronLoadBalancerListenerInterface();
+        ServiceRegistration<INeutronLoadBalancerListenerCRUD> neutronLoadBalancerListenerInterfaceRegistration = context.registerService(INeutronLoadBalancerListenerCRUD.class, neutronLoadBalancerListenerInterface, null);
+        if(neutronLoadBalancerListenerInterfaceRegistration != null) {
+            registrations.add(neutronLoadBalancerListenerInterfaceRegistration);
         }
-        if (imp.equals(NeutronLoadBalancerHealthMonitorInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronLoadBalancerHealthMonitorCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronLoadBalancerHealthMonitorInterface neutronLoadBalancerHealthMonitorInterface = new NeutronLoadBalancerHealthMonitorInterface();
+        ServiceRegistration<INeutronLoadBalancerHealthMonitorCRUD> neutronLoadBalancerHealthMonitorInterfaceRegistration = context.registerService(INeutronLoadBalancerHealthMonitorCRUD.class, neutronLoadBalancerHealthMonitorInterface, null);
+        if(neutronLoadBalancerHealthMonitorInterfaceRegistration != null) {
+            registrations.add(neutronLoadBalancerHealthMonitorInterfaceRegistration);
         }
-        if (imp.equals(NeutronLoadBalancerPoolMemberInterface.class)) {
-            // export the service
-            c.setInterface(
-                    new String[] { INeutronLoadBalancerPoolMemberCRUD.class.getName(),
-                            IConfigurationContainerAware.class.getName()}, null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("salListenerName", "neutron");
-            c.add(createContainerServiceDependency(containerName)
-                    .setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService",
-                            "unsetClusterContainerService").setRequired(true));
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IConfigurationContainerService.class).setCallbacks(
-                    "setConfigurationContainerService",
-                    "unsetConfigurationContainerService").setRequired(true));
+
+        NeutronLoadBalancerPoolMemberInterface neutronLoadBalancerPoolMemberInterface = new NeutronLoadBalancerPoolMemberInterface();
+        ServiceRegistration<INeutronLoadBalancerPoolMemberCRUD> neutronLoadBalancerPoolMemberInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolMemberCRUD.class, neutronLoadBalancerPoolMemberInterface, null);
+        if(neutronLoadBalancerPoolMemberInterfaceRegistration != null) {
+            registrations.add(neutronLoadBalancerPoolMemberInterfaceRegistration);
         }
+
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+       for(ServiceRegistration registration : registrations) {
+           if(registration != null) {
+               registration.unregister();
+           }
+       }
+
     }
-}
+}
\ No newline at end of file
index 60476a1..421f850 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronFirewallInterface implements INeutronFirewallCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronFirewallInterface implements INeutronFirewallCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallInterface.class);
-    private static final String FILE_NAME = "neutron.firewall.conf";
-    private String containerName = null;
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronFirewall> firewallDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Firewall");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronFirewalls",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Firewall -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Firewall already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Firewall");
-    }
-
-    @SuppressWarnings ({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Firewall");
-        firewallDB = (ConcurrentMap<String, NeutronFirewall>) clusterContainerService
-                .getCache("neutronFirewalls");
-        if (firewallDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Firewall");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Firewall");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        clusterContainerService.destroyCache("neutronFirewalls");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
+    private ConcurrentMap<String, NeutronFirewall> firewallDB  = new ConcurrentHashMap<String, NeutronFirewall>();
 
     // this method uses reflection to update an object from it's delta.
 
@@ -243,22 +113,5 @@ public class NeutronFirewallInterface implements INeutronFirewallCRUD, IConfigur
         return !neutronFirewallExists(firewallUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronFirewall nn = (NeutronFirewall) conf;
-            firewallDB.put(nn.getFirewallUUID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(firewallDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 
 }
\ No newline at end of file
index 8459262..886d7fd 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallPolicyInterface.class);
-    private static final String FILE_NAME ="neutron.firewallpolicy.conf";
-    private String containerName = null;
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronFirewallPolicy> firewallPolicyDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Firewall Rule");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronFirewallPolicies",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Firewall Rule -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Firewall Rule already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Firewall Rule");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Firewall Rule");
-        firewallPolicyDB = (ConcurrentMap<String, NeutronFirewallPolicy>) clusterContainerService
-                .getCache("neutronFirewallPolicies");
-        if (firewallPolicyDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Firewall Rule");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Firewall Rule");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        clusterContainerService.destroyCache("neutronFirewallPolicies");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
+    private ConcurrentMap<String, NeutronFirewallPolicy> firewallPolicyDB  = new ConcurrentHashMap<String, NeutronFirewallPolicy>();
 
     // this method uses reflection to update an object from it's delta.
 
@@ -247,22 +113,4 @@ public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRU
         return !neutronFirewallPolicyExists(firewallPolicyUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronFirewallPolicy nn = (NeutronFirewallPolicy) conf;
-            firewallPolicyDB.put(nn.getFirewallPolicyUUID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(firewallPolicyDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
\ No newline at end of file
index ba84500..cd0f39a 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallRuleInterface.class);
-    private static final String FILE_NAME ="neutron.firewallrules.conf";
-    private String containerName = null;
-
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronFirewallRule> firewallRuleDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Firewall Rule");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronFirewallRules",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Firewall Rule -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Firewall Rule already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Firewall Rule");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Firewall Rule");
-        firewallRuleDB = (ConcurrentMap<String, NeutronFirewallRule>) clusterContainerService
-                .getCache("neutronFirewallRules");
-        if (firewallRuleDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Firewall Rule");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Firewall Rule");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        clusterContainerService.destroyCache("neutronFirewallRules");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
 
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
+    private ConcurrentMap<String, NeutronFirewallRule> firewallRuleDB = new ConcurrentHashMap<String, NeutronFirewallRule>();
 
     // this method uses reflection to update an object from it's delta.
 
@@ -246,22 +113,4 @@ public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD, I
         return !neutronFirewallRuleExists(firewallRuleUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronFirewallRule nn = (NeutronFirewallRule) conf;
-            firewallRuleDB.put(nn.getFirewallRuleUUID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(firewallRuleDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
\ No newline at end of file
index 5cbe5cd..51824d6 100644 (file)
@@ -8,27 +8,15 @@
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
@@ -37,137 +25,13 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;
 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD, IConfigurationContainerAware,
-                                                   IObjectReader {
+public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronFloatingIPInterface.class);
-    private static final String FILE_NAME = "neutron.floatingip.conf";
-    private String containerName = null;
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronFloatingIP> floatingIPDB;
-
-    // methods needed for creating caches
-
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        this.clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (this.clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            this.clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        this.configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        this.configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron FloatingIPs");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronFloatingIPs",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for NeutronFloatingIps");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron FloatingIPs");
-        floatingIPDB = (ConcurrentMap<String, NeutronFloatingIP>) this.clusterContainerService
-        .getCache("neutronFloatingIPs");
-        if (floatingIPDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron FloatingIPs");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron FloatingIPs");
-    }
-
-    private void destroyCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        this.clusterContainerService.destroyCache("neutronFloatingIPs");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
+    private ConcurrentMap<String, NeutronFloatingIP> floatingIPDB  = new ConcurrentHashMap<String, NeutronFloatingIP>();
 
     // this method uses reflection to update an object from it's delta.
 
@@ -295,22 +159,4 @@ public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD, IConf
         target.setFixedIPAddress(delta.getFixedIPAddress());
         return true;
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronFloatingIP nfIP = (NeutronFloatingIP) conf;
-            floatingIPDB.put(nfIP.getID(), nfIP);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(floatingIPDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 }
index b0beddf..ecf3994 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBalancerHealthMonitorCRUD, IConfigurationContainerAware,
-        IObjectReader {
+public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBalancerHealthMonitorCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerHealthMonitorInterface.class);
-    private static final String FILE_NAME = "neutron.loadBalancerHealthMonitor.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronLoadBalancerHealthMonitor> loadBalancerHealthMonitorDB = new ConcurrentHashMap<String, NeutronLoadBalancerHealthMonitor>();
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronLoadBalancerHealthMonitor> loadBalancerHealthMonitorDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron LoadBalancerHealthMonitor");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronLoadBalancerHealthMonitors",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron LoadBalancerHealthMonitor -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron LoadBalancerHealthMonitor already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron LoadBalancerHealthMonitor");
-    }
-
-    @SuppressWarnings ({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron LoadBalancerHealthMonitor");
-        loadBalancerHealthMonitorDB = (ConcurrentMap<String, NeutronLoadBalancerHealthMonitor>) clusterContainerService
-                .getCache("neutronLoadBalancerHealthMonitors");
-        if (loadBalancerHealthMonitorDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron LoadBalancerHealthMonitor");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron LoadBalancerHealthMonitor");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for LoadBalancerHealthMonitor");
-        clusterContainerService.destroyCache("neutronLoadBalancerHealthMonitors");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -245,22 +114,4 @@ public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBa
     public boolean neutronLoadBalancerHealthMonitorInUse(String loadBalancerHealthMonitorUUID) {
         return !neutronLoadBalancerHealthMonitorExists(loadBalancerHealthMonitorUUID);
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronLoadBalancerHealthMonitor nn = (NeutronLoadBalancerHealthMonitor) conf;
-            loadBalancerHealthMonitorDB.put(nn.getLoadBalancerHealthMonitorID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerHealthMonitorDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 }
index aa7280b..472de90 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD, IConfigurationContainerAware,
-        IObjectReader {
+public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerInterface.class);
-    private static final String FILE_NAME = "neutron.loadBalancer.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronLoadBalancer> loadBalancerDB  = new ConcurrentHashMap<String, NeutronLoadBalancer>();
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronLoadBalancer> loadBalancerDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron LoadBalancer");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronLoadBalancers",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron LoadBalancer -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron LoadBalancer already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron LoadBalancer");
-    }
-
-    @SuppressWarnings ({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron LoadBalancer");
-        loadBalancerDB = (ConcurrentMap<String, NeutronLoadBalancer>) clusterContainerService
-                .getCache("neutronLoadBalancers");
-        if (loadBalancerDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron LoadBalancer");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron LoadBalancer");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for LoadBalancer");
-        clusterContainerService.destroyCache("neutronLoadBalancers");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -246,21 +115,4 @@ public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD, I
         return !neutronLoadBalancerExists(loadBalancerUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronLoadBalancer nn = (NeutronLoadBalancer) conf;
-            loadBalancerDB.put(nn.getLoadBalancerID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 }
index 3779863..6acc06d 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalancerListenerCRUD, IConfigurationContainerAware,
-        IObjectReader {
+public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalancerListenerCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerListenerInterface.class);
-    private static final String FILE_NAME = "neutron.loadBalancerListener.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronLoadBalancerListener> loadBalancerListenerDB  = new ConcurrentHashMap<String, NeutronLoadBalancerListener>();
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronLoadBalancerListener> loadBalancerListenerDB;
 
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron LoadBalancerListener");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronLoadBalancerListeners",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron LoadBalancerListener -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron LoadBalancerListener already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron LoadBalancerListener");
-    }
-
-    @SuppressWarnings ({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron LoadBalancerListener");
-        loadBalancerListenerDB = (ConcurrentMap<String, NeutronLoadBalancerListener>) clusterContainerService
-                .getCache("neutronLoadBalancerListeners");
-        if (loadBalancerListenerDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron LoadBalancerListener");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron LoadBalancerListener");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for LoadBalancerListener");
-        clusterContainerService.destroyCache("neutronLoadBalancerListeners");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -245,22 +115,4 @@ public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalance
     public boolean neutronLoadBalancerListenerInUse(String loadBalancerListenerUUID) {
         return !neutronLoadBalancerListenerExists(loadBalancerListenerUUID);
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronLoadBalancerListener nn = (NeutronLoadBalancerListener) conf;
-            loadBalancerListenerDB.put(nn.getLoadBalancerListenerID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerListenerDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 }
index 34cdba3..03c9cd9 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoolCRUD, IConfigurationContainerAware,
-        IObjectReader {
+public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoolCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerPoolInterface.class);
-    private static final String FILE_NAME = "neutron.loadBalancerPool.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronLoadBalancerPool> loadBalancerPoolDB = new ConcurrentHashMap<String, NeutronLoadBalancerPool>();
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronLoadBalancerPool> loadBalancerPoolDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron LoadBalancerPool");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronLoadBalancerPools",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron LoadBalancerPool -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron LoadBalancerPool already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron LoadBalancerPool");
-    }
-
-    @SuppressWarnings ({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron LoadBalancerPool");
-        loadBalancerPoolDB = (ConcurrentMap<String, NeutronLoadBalancerPool>) clusterContainerService
-                .getCache("neutronLoadBalancerPools");
-        if (loadBalancerPoolDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron LoadBalancerPool");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron LoadBalancerPool");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for LoadBalancerPool");
-        clusterContainerService.destroyCache("neutronLoadBalancerPools");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -246,21 +115,4 @@ public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoo
         return !neutronLoadBalancerPoolExists(loadBalancerPoolUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronLoadBalancerPool nn = (NeutronLoadBalancerPool) conf;
-            loadBalancerPoolDB.put(nn.getLoadBalancerPoolID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerPoolDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 }
index 7418bb2..8ed3a36 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
 public class NeutronLoadBalancerPoolMemberInterface
-        implements INeutronLoadBalancerPoolMemberCRUD, IConfigurationContainerAware,
-        IObjectReader {
+        implements INeutronLoadBalancerPoolMemberCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerPoolMemberInterface.class);
-    private static final String FILE_NAME = "neutron.loadBalancerPoolMember.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronLoadBalancerPoolMember> loadBalancerPoolMemberDB  = new ConcurrentHashMap<String, NeutronLoadBalancerPoolMember>();
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronLoadBalancerPoolMember> loadBalancerPoolMemberDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron LoadBalancerPoolMember");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronLoadBalancerPoolMembers",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch(CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron LoadBalancerPoolMember -  check cache mode");
-        } catch(CacheExistException cce) {
-            logger.error("Cache for Neutron LoadBalancerPoolMember already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron LoadBalancerPoolMember");
-    }
-
-    @SuppressWarnings({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron LoadBalancerPoolMember");
-        loadBalancerPoolMemberDB = (ConcurrentMap<String, NeutronLoadBalancerPoolMember>) clusterContainerService
-                .getCache("neutronLoadBalancerPoolMembers");
-        if (loadBalancerPoolMemberDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron LoadBalancerPoolMember");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron LoadBalancerPoolMember");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        clusterContainerService.destroyCache("neutronLoadBalancerPoolMembers");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -245,23 +114,4 @@ public class NeutronLoadBalancerPoolMemberInterface
     public boolean neutronLoadBalancerPoolMemberInUse(String loadBalancerPoolMemberID) {
         return !neutronLoadBalancerPoolMemberExists(loadBalancerPoolMemberID);
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronLoadBalancerPoolMember nn = (NeutronLoadBalancerPoolMember) conf;
-            loadBalancerPoolMemberDB.put(nn.getPoolMemberID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(
-                new ArrayList<ConfigurationObject>(loadBalancerPoolMemberDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
 }
index c6e161b..c9e1549 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NeutronNetworkInterface implements INeutronNetworkCRUD, IConfigurationContainerAware,
-                                                IObjectReader {
+public class NeutronNetworkInterface implements INeutronNetworkCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronNetworkInterface.class);
-    private static final String FILE_NAME ="neutron.network.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronNetwork> networkDB = new ConcurrentHashMap<String, NeutronNetwork>();
 
-    private ConcurrentMap<String, NeutronNetwork> networkDB;
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
 
-    // methods needed for creating caches
 
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        this.clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (this.clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            this.clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        this.configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        this.configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Networks");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronNetworks",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Networks -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Networks already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Networks");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-        logger.debug("Retrieving cache for Neutron Networks");
-        networkDB = (ConcurrentMap<String, NeutronNetwork>) this.clusterContainerService.getCache("neutronNetworks");
-        if (networkDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Networks");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Networks");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    private void destroyCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for Neutron Networks");
-        this.clusterContainerService.destroyCache("Neutron Networks");
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -256,23 +124,4 @@ public class NeutronNetworkInterface implements INeutronNetworkCRUD, IConfigurat
         }
         return false;
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronNetwork nn = (NeutronNetwork) conf;
-            networkDB.put(nn.getID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(networkDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
index 3294474..5c87800 100644 (file)
@@ -8,28 +8,16 @@
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
@@ -38,137 +26,14 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
 import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NeutronPortInterface implements INeutronPortCRUD, IConfigurationContainerAware,
-                                             IObjectReader {
+public class NeutronPortInterface implements INeutronPortCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronPortInterface.class);
-    private static final String FILE_NAME ="neutron.port.conf";
-    private String containerName = null;
+    private ConcurrentMap<String, NeutronPort> portDB = new ConcurrentHashMap<String, NeutronPort>();
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronPort> portDB;
 
-    // methods needed for creating caches
-
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for OpenDOVE");
-        try {
-            // neutron caches
-            clusterContainerService.createCache("neutronPorts",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for OpenDOVE -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for OpenDOVE already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for OpenDOVE");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Ports");
-        portDB = (ConcurrentMap<String, NeutronPort>) clusterContainerService
-        .getCache("neutronPorts");
-        if (portDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Ports");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Ports");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        clusterContainerService.destroyCache("neutronPorts");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -351,23 +216,4 @@ public class NeutronPortInterface implements INeutronPortCRUD, IConfigurationCon
         }
         return null;
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronPort nn = (NeutronPort) conf;
-            portDB.put(nn.getID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(portDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
index 4e19d36..5e4c5a4 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NeutronRouterInterface implements INeutronRouterCRUD, IConfigurationContainerAware,
-                                               IObjectReader {
+public class NeutronRouterInterface implements INeutronRouterCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronRouterInterface.class);
-    private static final String FILE_NAME ="neutron.router.conf";
-    private String containerName = null;
-
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronRouter> routerDB;
+    private ConcurrentMap<String, NeutronRouter> routerDB  = new ConcurrentHashMap<String, NeutronRouter>();
     // methods needed for creating caches
 
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        this.clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (this.clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            this.clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        this.configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        this.configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Routers");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronRouters",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Routers -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Routers already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Routers");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Routers");
-        routerDB = (ConcurrentMap<String, NeutronRouter>) this.clusterContainerService
-        .getCache("neutronRouters");
-        if (routerDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Routers");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Routers");
-    }
-
-    private void destroyCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        this.clusterContainerService.destroyCache("neutronRouters");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
 
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -254,22 +121,4 @@ public class NeutronRouterInterface implements INeutronRouterCRUD, IConfiguratio
         return (target.getInterfaces().size() > 0);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronRouter nr = (NeutronRouter) conf;
-            routerDB.put(nr.getID(), nr);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(routerDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
index a991f61..d59bf9e 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Map.Entry;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
+
 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronSecurityGroupInterface.class);
-    private static final String FILE_NAME ="neutron.securitygroup.conf";
-    private String containerName = null;
-
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronSecurityGroup> securityGroupDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
+    private ConcurrentMap<String, NeutronSecurityGroup> securityGroupDB  = new ConcurrentHashMap<String, NeutronSecurityGroup>();
 
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
 
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Security Groups");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronSecurityGroups",
-                EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Security Groups -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Security Groups already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Security Groups");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Security Groups");
-        securityGroupDB = (ConcurrentMap<String, NeutronSecurityGroup>) clusterContainerService
-            .getCache("neutronSecurityGroups");
-        if (securityGroupDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Security Groups");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Security Groups");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for Neutron Security Groups");
-        clusterContainerService.destroyCache("neutronSecurityGroups");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -248,22 +116,4 @@ public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD,
         return !neutronSecurityGroupExists(securityGroupUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronSecurityGroup nn = (NeutronSecurityGroup) conf;
-            securityGroupDB.put(nn.getSecurityGroupUUID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(securityGroupDB.values()),
-            FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
\ No newline at end of file
index 5ca907b..884d15f 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Map.Entry;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronSecurityRuleInterface.class);
-    private static final String FILE_NAME = "neutron.securityrule.conf";
-    private String containerName = null;
-
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronSecurityRule> securityRuleDB;
-
-    // methods needed for creating caches
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Security Rules");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronSecurityRules",
-                EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Security Rules -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Security Rules already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Security Rules");
-    }
-
-    @SuppressWarnings({"unchecked"})
-    private void retrieveCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Security Rules");
-        securityRuleDB = (ConcurrentMap<String, NeutronSecurityRule>) clusterContainerService
-            .getCache("neutronSecurityRules");
-        if (securityRuleDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Security Rules");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Security Rules");
-    }
-
-    private void destroyCache() {
-        if (clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for Neutron Security Rules");
-        clusterContainerService.destroyCache("neutronSecurityRules");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     */
-    void stop() {
-    }
+    private ConcurrentMap<String, NeutronSecurityRule> securityRuleDB  = new ConcurrentHashMap<String, NeutronSecurityRule>();
 
     // this method uses reflection to update an object from it's delta.
     private boolean overwrite(Object target, Object delta) {
@@ -244,22 +113,4 @@ public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD, I
         return !neutronSecurityRuleExists(securityRuleUUID);
     }
 
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronSecurityRule nn = (NeutronSecurityRule) conf;
-            securityRuleDB.put(nn.getSecurityRuleUUID(), nn);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(securityRuleDB.values()),
-            FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
\ No newline at end of file
index 025c2f1..81fa107 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.implementation;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NeutronSubnetInterface implements INeutronSubnetCRUD, IConfigurationContainerAware,
-                                               IObjectReader {
+public class NeutronSubnetInterface implements INeutronSubnetCRUD {
     private static final Logger logger = LoggerFactory.getLogger(NeutronSubnetInterface.class);
-    private static final String FILE_NAME ="neutron.subnet.conf";
+    private ConcurrentMap<String, NeutronSubnet> subnetDB  = new ConcurrentHashMap<String, NeutronSubnet>();
 
-    private String containerName = null;
 
-    private IClusterContainerServices clusterContainerService = null;
-    private IConfigurationContainerService configurationService;
-    private ConcurrentMap<String, NeutronSubnet> subnetDB;
-
-    // methods needed for creating caches
-
-    void setClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service set");
-        this.clusterContainerService = s;
-    }
-
-    void unsetClusterContainerService(IClusterContainerServices s) {
-        if (this.clusterContainerService == s) {
-            logger.debug("Cluster Service removed!");
-            this.clusterContainerService = null;
-        }
-    }
-
-    public void setConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service set: {}", service);
-        this.configurationService = service;
-    }
-
-    public void unsetConfigurationContainerService(IConfigurationContainerService service) {
-        logger.trace("Configuration service removed: {}", service);
-        this.configurationService = null;
-    }
-
-    private void allocateCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
-            return;
-        }
-        logger.debug("Creating Cache for Neutron Subnets");
-        try {
-            // neutron caches
-            this.clusterContainerService.createCache("neutronSubnets",
-                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
-        } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for Neutron Subnets -  check cache mode");
-        } catch (CacheExistException cce) {
-            logger.error("Cache for Neutron Subnets already exists, destroy and recreate");
-        }
-        logger.debug("Cache successfully created for Neutron Subnets");
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private void retrieveCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
-            return;
-        }
-
-        logger.debug("Retrieving cache for Neutron Subnets");
-        subnetDB = (ConcurrentMap<String, NeutronSubnet>) this.clusterContainerService
-        .getCache("neutronSubnets");
-        if (subnetDB == null) {
-            logger.error("Cache couldn't be retrieved for Neutron Subnets");
-        }
-        logger.debug("Cache was successfully retrieved for Neutron Subnets");
-    }
-
-    private void destroyCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        this.clusterContainerService.destroyCache("neutronSubnets");
-    }
-
-    private void startUp() {
-        allocateCache();
-        retrieveCache();
-        loadConfiguration();
-    }
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init(Component c) {
-        Dictionary<?, ?> props = c.getServiceProperties();
-        if (props != null) {
-            this.containerName = (String) props.get("containerName");
-            logger.debug("Running containerName: {}", this.containerName);
-        } else {
-            // In the Global instance case the containerName is empty
-            this.containerName = "";
-        }
-        startUp();
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-        destroyCache();
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
 
     // this method uses reflection to update an object from it's delta.
 
@@ -268,23 +132,4 @@ public class NeutronSubnetInterface implements INeutronSubnetCRUD, IConfiguratio
         NeutronSubnet target = subnetDB.get(subnetUUID);
         return (target.getPortsInSubnet().size() > 0);
     }
-
-    private void loadConfiguration() {
-        for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
-            NeutronSubnet ns = (NeutronSubnet) conf;
-            subnetDB.put(ns.getID(), ns);
-        }
-    }
-
-    @Override
-    public Status saveConfiguration() {
-        return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(subnetDB.values()),
-                FILE_NAME);
-    }
-
-    @Override
-    public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
-        return ois.readObject();
-    }
-
 }
index 8111e69..0eecca0 100644 (file)
       <artifactId>jersey-core</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.enunciate</groupId>
-      <artifactId>enunciate-core-annotations</artifactId>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.eclipse.persistence</groupId>
-      <artifactId>org.eclipse.persistence.antlr</artifactId>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-servlet</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.eclipse.persistence</groupId>
-      <artifactId>org.eclipse.persistence.core</artifactId>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
     </dependency>
     <dependency>
       <groupId>org.eclipse.persistence</groupId>
       <artifactId>org.eclipse.persistence.moxy</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>commons.northbound</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>containermanager</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>networkconfig.neutron</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal</artifactId>
-    </dependency>
   </dependencies>
 
   <build>
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>org.opendaylight.controller.sal.utils,
-                            org.opendaylight.controller.containermanager,
-                            org.opendaylight.controller.northbound.commons,
-                            org.opendaylight.controller.northbound.commons.exception,
-                            org.opendaylight.controller.northbound.commons.utils,
-                            org.opendaylight.controller.networkconfig.neutron,
+            <Import-Package>org.opendaylight.controller.networkconfig.neutron,
                             org.eclipse.persistence.jaxb.rs,
                             com.sun.jersey.spi.container.servlet,
                             javax.ws.rs,
@@ -71,6 +54,7 @@
                             javax.xml.bind.annotation,
                             javax.xml.bind,
                             org.slf4j,
+                            org.osgi.framework,
                             !org.codehaus.enunciate.jaxrs</Import-Package>
             <Web-ContextPath>/controller/nb/v2/neutron</Web-ContextPath>
           </instructions>
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java
new file mode 100644 (file)
index 0000000..9db8633
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+/**
+ * Status Code 400 (Bad Request)
+ *
+ * The request could not be understood by the server due to malformed syntax.
+ * The client SHOULD NOT repeat the request without modifications.
+ */
+public class BadRequestException extends WebApplicationException {
+    private static final long serialVersionUID = 1L;
+
+    public BadRequestException(String string) {
+        super(Response.status(Response.Status.BAD_REQUEST).entity(string).type(MediaType.TEXT_PLAIN).build());
+    }
+}
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java
new file mode 100644 (file)
index 0000000..5a40a18
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 500 (Internal Server Error)
+ *
+ * The server encountered an unexpected condition which prevented
+ * it from fulfilling the request.
+ *
+ *
+ *
+ */
+public class InternalServerErrorException extends WebApplicationException {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Constructor for the INTERNAL_SERVER_ERROR custom handler
+     *
+     * @param string Error message to specify further the
+     * INTERNAL_SERVER_ERROR response
+     *
+     */
+    public InternalServerErrorException(String string) {
+        super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
+                string).type(MediaType.TEXT_PLAIN).build());
+    }
+}
index 204c9f5..33043d4 100644 (file)
@@ -16,11 +16,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -190,7 +185,7 @@ public class NeutronFirewallNorthbound {
                 throw new BadRequestException("Firewall UUID already exists");
             }
             firewallInterface.addNeutronFirewall(singleton);
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronFirewallAware service = (INeutronFirewallAware) instance;
@@ -211,7 +206,7 @@ public class NeutronFirewallNorthbound {
             List<NeutronFirewall> bulk = input.getBulk();
             Iterator<NeutronFirewall> i = bulk.iterator();
             HashMap<String, NeutronFirewall> testMap = new HashMap<String, NeutronFirewall>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
             while (i.hasNext()) {
                 NeutronFirewall test = i.next();
 
@@ -301,7 +296,7 @@ public class NeutronFirewallNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFirewallAware service = (INeutronFirewallAware) instance;
@@ -355,7 +350,7 @@ public class NeutronFirewallNorthbound {
             return Response.status(409).build();
         }
         NeutronFirewall singleton = firewallInterface.getNeutronFirewall(firewallUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFirewallAware service = (INeutronFirewallAware) instance;
index cc45d6d..08e5631 100644 (file)
@@ -9,17 +9,10 @@
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -32,10 +25,13 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy;
 
 /**
  * Neutron Northbound REST APIs for Firewall Policies.<br>
@@ -186,7 +182,7 @@ public class NeutronFirewallPolicyNorthbound {
             }
             firewallPolicyInterface.addNeutronFirewallPolicy(singleton);
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance;
@@ -207,7 +203,7 @@ public class NeutronFirewallPolicyNorthbound {
             List<NeutronFirewallPolicy> bulk = input.getBulk();
             Iterator<NeutronFirewallPolicy> i = bulk.iterator();
             HashMap<String, NeutronFirewallPolicy> testMap = new HashMap<String, NeutronFirewallPolicy>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
             while (i.hasNext()) {
                 NeutronFirewallPolicy test = i.next();
 
@@ -297,7 +293,7 @@ public class NeutronFirewallPolicyNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance;
@@ -351,7 +347,7 @@ public class NeutronFirewallPolicyNorthbound {
             return Response.status(409).build();
         }
         NeutronFirewallPolicy singleton = firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance;
index 9911b4d..5e51711 100644 (file)
@@ -9,18 +9,10 @@
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -33,10 +25,14 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule;
 
 /**
  * Neutron Northbound REST APIs for Firewall Rule.<br>
@@ -222,7 +218,7 @@ public class NeutronFirewallRulesNorthbound {
                 throw new BadRequestException("Firewall Rule UUID already exists");
             }
             firewallRuleInterface.addNeutronFirewallRule(singleton);
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance;
@@ -245,7 +241,7 @@ public class NeutronFirewallRulesNorthbound {
             List<NeutronFirewallRule> bulk = input.getBulk();
             Iterator<NeutronFirewallRule> i = bulk.iterator();
             HashMap<String, NeutronFirewallRule> testMap = new HashMap<String, NeutronFirewallRule>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
             while (i.hasNext()) {
                 NeutronFirewallRule test = i.next();
 
@@ -344,7 +340,7 @@ public class NeutronFirewallRulesNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance;
@@ -401,7 +397,7 @@ public class NeutronFirewallRulesNorthbound {
             return Response.status(409).build();
         }
         NeutronFirewallRule singleton = firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance;
index af7cfd1..812a09a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.networkconfig.neutron.northbound;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -36,12 +37,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
 import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 /**
  * Neutron Northbound REST APIs.<br>
@@ -245,7 +240,7 @@ public class NeutronFloatingIPsNorthbound {
                     throw new ResourceConflictException("fixed IP is in use.");
                 singleton.setFixedIPAddress(fixedIP);
             }
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronFloatingIPAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
@@ -366,7 +361,7 @@ public class NeutronFloatingIPsNorthbound {
             singleton.setFixedIPAddress(fixedIP);
         }
         NeutronFloatingIP target = floatingIPInterface.getFloatingIP(floatingipUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFloatingIPAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
@@ -409,7 +404,7 @@ public class NeutronFloatingIPsNorthbound {
             throw new ResourceNotFoundException("Floating IP UUID doesn't exist.");
         // TODO: need to undo port association if it exists
         NeutronFloatingIP singleton = floatingIPInterface.getFloatingIP(floatingipUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronFloatingIPAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
index 6cd2673..85aba5d 100644 (file)
@@ -9,20 +9,10 @@
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -35,10 +25,16 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Neutron Northbound REST APIs for Load Balancer HealthMonitor.<br>
@@ -212,7 +208,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound {
             }
             loadBalancerHealthMonitorInterface.addNeutronLoadBalancerHealthMonitor(singleton);
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance;
@@ -233,7 +229,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound {
             List<NeutronLoadBalancerHealthMonitor> bulk = input.getBulk();
             Iterator<NeutronLoadBalancerHealthMonitor> i = bulk.iterator();
             HashMap<String, NeutronLoadBalancerHealthMonitor> testMap = new HashMap<String, NeutronLoadBalancerHealthMonitor>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
             while (i.hasNext()) {
                 NeutronLoadBalancerHealthMonitor test = i.next();
 
@@ -330,7 +326,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance;
@@ -388,7 +384,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound {
             return Response.status(409).build();
         }
         NeutronLoadBalancerHealthMonitor singleton = loadBalancerHealthMonitorInterface.getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance;
index f3ef39f..345c7ee 100644 (file)
@@ -9,17 +9,10 @@
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -32,10 +25,13 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener;
 
 /**
  * Neutron Northbound REST APIs for LoadBalancerListener Policies.<br>
@@ -200,7 +196,7 @@ public class NeutronLoadBalancerListenerNorthbound {
             }
             loadBalancerListenerInterface.addNeutronLoadBalancerListener(singleton);
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance;
@@ -221,7 +217,7 @@ public class NeutronLoadBalancerListenerNorthbound {
             List<NeutronLoadBalancerListener> bulk = input.getBulk();
             Iterator<NeutronLoadBalancerListener> i = bulk.iterator();
             HashMap<String, NeutronLoadBalancerListener> testMap = new HashMap<String, NeutronLoadBalancerListener>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
             while (i.hasNext()) {
                 NeutronLoadBalancerListener test = i.next();
 
@@ -314,7 +310,7 @@ public class NeutronLoadBalancerListenerNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance;
@@ -368,7 +364,7 @@ public class NeutronLoadBalancerListenerNorthbound {
             return Response.status(409).build();
         }
         NeutronLoadBalancerListener singleton = loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance;
index 863b3cb..308041f 100644 (file)
@@ -9,17 +9,10 @@
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -32,10 +25,13 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
 
 /**
  * Neutron Northbound REST APIs for LoadBalancers.<br>
@@ -188,7 +184,7 @@ public class NeutronLoadBalancerNorthbound {
             if (loadBalancerInterface.neutronLoadBalancerExists(singleton.getLoadBalancerID())) {
                 throw new BadRequestException("LoadBalancer UUID already exists");
             }
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance;
@@ -209,7 +205,7 @@ public class NeutronLoadBalancerNorthbound {
             List<NeutronLoadBalancer> bulk = input.getBulk();
             Iterator<NeutronLoadBalancer> i = bulk.iterator();
             HashMap<String, NeutronLoadBalancer> testMap = new HashMap<String, NeutronLoadBalancer>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
             while (i.hasNext()) {
                 NeutronLoadBalancer test = i.next();
 
@@ -300,7 +296,7 @@ public class NeutronLoadBalancerNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance;
@@ -357,7 +353,7 @@ public class NeutronLoadBalancerNorthbound {
             return Response.status(409).build();
         }
         NeutronLoadBalancer singleton = loadBalancerInterface.getNeutronLoadBalancer(loadBalancerID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance;
index f8f3cd8..f954067 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberAware;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -34,10 +26,13 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberAware;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
 
 @Path("/pools/{loadBalancerPoolUUID}/members")
 public class NeutronLoadBalancerPoolMembersNorthbound {
@@ -203,7 +198,7 @@ public Response createLoadBalancerPoolMember(
                 throw new BadRequestException("LoadBalancerPoolMember UUID already exists");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolMemberAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance;
@@ -229,7 +224,7 @@ public Response createLoadBalancerPoolMember(
         List<NeutronLoadBalancerPoolMember> bulk = input.getBulk();
         Iterator<NeutronLoadBalancerPoolMember> i = bulk.iterator();
         HashMap<String, NeutronLoadBalancerPoolMember> testMap = new HashMap<String, NeutronLoadBalancerPoolMember>();
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolMemberAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
         while (i.hasNext()) {
             NeutronLoadBalancerPoolMember test = i.next();
             String loadBalancerPoolMemberUUID = test.getPoolMemberID();
@@ -337,7 +332,7 @@ public Response deleteLoadBalancerPoolMember(
     if (singleton == null)
         throw new BadRequestException("LoadBalancerPoolMember UUID does not exist.");
 
-    Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolMemberAware.class, this, null);
+    Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
     if (instances != null) {
         for (Object instance : instances) {
             INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance;
index f0ae609..77bb525 100644 (file)
 package org.opendaylight.controller.networkconfig.neutron.northbound;
 
 
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -36,10 +28,13 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
 
 /**
  * Neutron Northbound REST APIs for LoadBalancerPool Policies.<br>
@@ -200,7 +195,8 @@ public class NeutronLoadBalancerPoolNorthbound {
             if (loadBalancerPoolInterface.neutronLoadBalancerPoolExists(singleton.getLoadBalancerPoolID())) {
                 throw new BadRequestException("LoadBalancerPool UUID already exists");
             }
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance;
@@ -221,7 +217,7 @@ public class NeutronLoadBalancerPoolNorthbound {
             List<NeutronLoadBalancerPool> bulk = input.getBulk();
             Iterator<NeutronLoadBalancerPool> i = bulk.iterator();
             HashMap<String, NeutronLoadBalancerPool> testMap = new HashMap<String, NeutronLoadBalancerPool>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
             while (i.hasNext()) {
                 NeutronLoadBalancerPool test = i.next();
 
@@ -313,7 +309,7 @@ public class NeutronLoadBalancerPoolNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance;
@@ -368,7 +364,7 @@ public class NeutronLoadBalancerPoolNorthbound {
             return Response.status(409).build();
         }
         NeutronLoadBalancerPool singleton = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance;
index 9de5aef..9c99f34 100644 (file)
@@ -25,23 +25,16 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 
 import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
-
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 /**
  * Neutron Northbound REST APIs for Network.<br>
@@ -209,7 +202,7 @@ public class NeutronNetworksNorthbound {
                 throw new BadRequestException("network UUID already exists");
             }
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronNetworkAware service = (INeutronNetworkAware) instance;
@@ -234,7 +227,7 @@ public class NeutronNetworksNorthbound {
             List<NeutronNetwork> bulk = input.getBulk();
             Iterator<NeutronNetwork> i = bulk.iterator();
             HashMap<String, NeutronNetwork> testMap = new HashMap<String, NeutronNetwork>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
             while (i.hasNext()) {
                 NeutronNetwork test = i.next();
 
@@ -317,7 +310,7 @@ public class NeutronNetworksNorthbound {
             throw new BadRequestException("attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronNetworkAware service = (INeutronNetworkAware) instance;
@@ -371,7 +364,7 @@ public class NeutronNetworksNorthbound {
         }
 
         NeutronNetwork singleton = networkInterface.getNetwork(netUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronNetworkAware service = (INeutronNetworkAware) instance;
index 5451fbf..23f4979 100644 (file)
@@ -38,12 +38,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
 import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 /**
  * Neutron Northbound REST APIs.<br>
@@ -263,7 +257,7 @@ public class NeutronPortsNorthbound {
                 }
             }
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronPortAware service = (INeutronPortAware) instance;
@@ -287,7 +281,7 @@ public class NeutronPortsNorthbound {
             List<NeutronPort> bulk = input.getBulk();
             Iterator<NeutronPort> i = bulk.iterator();
             HashMap<String, NeutronPort> testMap = new HashMap<String, NeutronPort>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
             while (i.hasNext()) {
                 NeutronPort test = i.next();
 
@@ -433,7 +427,7 @@ public class NeutronPortsNorthbound {
             throw new BadRequestException("attribute change blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronPortAware service = (INeutronPortAware) instance;
@@ -515,7 +509,7 @@ public class NeutronPortsNorthbound {
             Response.status(403).build();
         }
         NeutronPort singleton = portInterface.getPort(portUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronPortAware service = (INeutronPortAware) instance;
index 0c02ada..45e84f4 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.networkconfig.neutron.northbound;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -36,12 +37,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 
 /**
@@ -197,7 +192,7 @@ public class NeutronRoutersNorthbound {
                 if (!externNetwork.isRouterExternal())
                     throw new BadRequestException("External Network Pointer isn't marked as router:external");
             }
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
@@ -273,7 +268,7 @@ public class NeutronRoutersNorthbound {
                 singleton.getStatus() != null)
             throw new BadRequestException("Request attribute change not allowed");
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
@@ -338,7 +333,7 @@ public class NeutronRoutersNorthbound {
         if (routerInterface.routerInUse(routerUUID))
             throw new ResourceConflictException("Router UUID in Use");
         NeutronRouter singleton = routerInterface.getRouter(routerUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
@@ -418,7 +413,7 @@ public class NeutronRoutersNorthbound {
         if (targetPort.getDeviceID() != null ||
                 targetPort.getDeviceOwner() != null)
             throw new ResourceConflictException("Target Port already allocated");
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
@@ -496,7 +491,7 @@ public class NeutronRoutersNorthbound {
             input.setID(target.getID());
             input.setTenantID(target.getTenantID());
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
@@ -537,7 +532,7 @@ public class NeutronRoutersNorthbound {
             port.setDeviceID(null);
             port.setDeviceOwner(null);
             target.removeInterface(input.getPortUUID());
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
                 service.neutronRouterInterfaceDetached(target, input);
@@ -567,7 +562,7 @@ public class NeutronRoutersNorthbound {
                 throw new ResourceConflictException("Target Port IP not in Target Subnet");
             input.setID(target.getID());
             input.setTenantID(target.getTenantID());
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
index 5e9a331..bce4de7 100644 (file)
@@ -14,6 +14,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -32,11 +33,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupAw
 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -180,7 +176,7 @@ public class NeutronSecurityGroupsNorthbound {
                 throw new BadRequestException("Security Group UUID already exists");
             }
 
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
@@ -202,7 +198,7 @@ public class NeutronSecurityGroupsNorthbound {
             List<NeutronSecurityGroup> bulk = input.getBulk();
             Iterator<NeutronSecurityGroup> i = bulk.iterator();
             HashMap<String, NeutronSecurityGroup> testMap = new HashMap<String, NeutronSecurityGroup>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
             while (i.hasNext()) {
                 NeutronSecurityGroup test = i.next();
 
@@ -280,7 +276,7 @@ public class NeutronSecurityGroupsNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+        Object[] instances =  NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
@@ -335,7 +331,7 @@ public class NeutronSecurityGroupsNorthbound {
             return Response.status(409).build();
         }
         NeutronSecurityGroup singleton = securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
index b2c05e0..762317a 100644 (file)
@@ -14,6 +14,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -33,11 +34,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleAwa
 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -203,7 +199,7 @@ public class NeutronSecurityRulesNorthbound {
             if (securityRuleInterface.neutronSecurityRuleExists(singleton.getSecurityRuleUUID())) {
                 throw new BadRequestException("Security Rule UUID already exists");
             }
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance;
@@ -235,7 +231,7 @@ public class NeutronSecurityRulesNorthbound {
             List<NeutronSecurityRule> bulk = input.getBulk();
             Iterator<NeutronSecurityRule> i = bulk.iterator();
             HashMap<String, NeutronSecurityRule> testMap = new HashMap<String, NeutronSecurityRule>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
             while (i.hasNext()) {
                 NeutronSecurityRule test = i.next();
 
@@ -330,7 +326,7 @@ public class NeutronSecurityRulesNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance;
@@ -385,7 +381,7 @@ public class NeutronSecurityRulesNorthbound {
             return Response.status(409).build();
         }
         NeutronSecurityRule singleton = securityRuleInterface.getNeutronSecurityRule(securityRuleUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance;
index 8f20269..142b09f 100644 (file)
@@ -36,13 +36,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 /**
  * Neutron Northbound REST APIs for Subnets.<br>
@@ -224,7 +217,7 @@ public class NeutronSubnetsNorthbound {
             if (singleton.gatewayIP_Pool_overlap()) {
                 throw new ResourceConflictException("IP pool overlaps with gateway");
             }
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronSubnetAware service = (INeutronSubnetAware) instance;
@@ -245,7 +238,7 @@ public class NeutronSubnetsNorthbound {
             List<NeutronSubnet> bulk = input.getBulk();
             Iterator<NeutronSubnet> i = bulk.iterator();
             HashMap<String, NeutronSubnet> testMap = new HashMap<String, NeutronSubnet>();
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+            Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
             while (i.hasNext()) {
                 NeutronSubnet test = i.next();
 
@@ -349,7 +342,7 @@ public class NeutronSubnetsNorthbound {
             throw new BadRequestException("Attribute edit blocked by Neutron");
         }
 
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronSubnetAware service = (INeutronSubnetAware) instance;
@@ -404,7 +397,7 @@ public class NeutronSubnetsNorthbound {
             return Response.status(409).build();
         }
         NeutronSubnet singleton = subnetInterface.getSubnet(subnetUUID);
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+        Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronSubnetAware service = (INeutronSubnetAware) instance;
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java
new file mode 100644 (file)
index 0000000..481d95a
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NeutronUtil {
+    private static final Logger logger = LoggerFactory
+            .getLogger(NeutronUtil.class);
+    public static Object[] getInstances(Class<?> clazz,Object bundle) {
+        Object instances[] = null;
+        try {
+            BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass())
+                    .getBundleContext();
+
+            ServiceReference<?>[] services = null;
+                services = bCtx.getServiceReferences(clazz.getName(),
+                        null);
+            if (services != null) {
+                instances = new Object[services.length];
+                for (int i = 0; i < services.length; i++) {
+                    instances[i] = bCtx.getService(services[i]);
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Instance reference is NULL");
+        }
+        return instances;
+    }
+}
index 7f6c296..25b5da1 100644 (file)
@@ -15,12 +15,11 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import javax.ws.rs.core.UriInfo;
+
 import org.opendaylight.controller.networkconfig.neutron.INeutronObject;
 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
 
 public class PaginatedRequestFactory {
     private static final Comparator<INeutronObject> NEUTRON_OBJECT_COMPARATOR = new Comparator<INeutronObject>() {
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java
new file mode 100644 (file)
index 0000000..d9644df
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 409 (Conflict)
+ *
+ * The request could not be completed due to a conflict with the
+ * current state of the resource. This code is only allowed in
+ * situations where it is expected that the user might be able to
+ * resolve the conflict and resubmit the request. The response body
+ * SHOULD include enough information for the user to recognize the
+ * source of the conflict. Ideally, the response entity would include
+ * enough information for the user or user agent to fix the problem;
+ * however, that might not be possible and is not required.
+ *
+ *
+ *
+ */
+public class ResourceConflictException extends WebApplicationException {
+    private static final long serialVersionUID = 1L;
+
+    public ResourceConflictException(String string) {
+        super(Response.status(Response.Status.CONFLICT).entity(string).type(
+                MediaType.TEXT_PLAIN).build());
+    }
+}
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java
new file mode 100644 (file)
index 0000000..3f39eb7
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 404 (Not Found)
+ *
+ * The server has not found anything matching the Request-URI.
+ * No indication is given of whether the condition is temporary or permanent.
+ * The 410 (Gone) status code SHOULD be used if the server knows,
+ * through some internally configurable mechanism, that an old resource
+ * is permanently unavailable and has no forwarding address.
+ * This status code is commonly used when the server does not wish to
+ * reveal exactly why the request has been refused, or when no other
+ * response is applicable.
+ *
+ *
+ *
+ */
+public class ResourceNotFoundException extends WebApplicationException {
+    private static final long serialVersionUID = 1L;
+
+    public ResourceNotFoundException(String string) {
+        super(Response.status(Response.Status.NOT_FOUND).entity(string).type(
+                MediaType.TEXT_PLAIN).build());
+    }
+}
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java
new file mode 100644 (file)
index 0000000..e619974
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+public enum RestMessages {
+    SUCCESS("Success"), NOCONTAINER("Container does not exist"), NOSUBNET("Subnet does not exist"), NOSTATICROUTE(
+            "Static Route does not exist"), NOHOST("Host does not exist"), NOFLOW("Flow does not exist"), NONODE(
+            "Node does not exist"), NOPOLICY("Policy does not exist"), NORESOURCE("Resource does not exist"), RESOURCECONFLICT(
+            "Operation failed due to Resource Conflict"), NODEFAULT("Container default is not a custom container"), DEFAULTDISABLED(
+            "Container(s) are configured. Container default is not operational"), NOTALLOWEDONDEFAULT(
+            "Container default is a static resource, no modification allowed on it"), UNKNOWNACTION("Unknown action"), INVALIDJSON(
+            "JSON message is invalid"), INVALIDADDRESS("Invalid InetAddress"), AVAILABLESOON(
+            "Resource is not implemented yet"), INTERNALERROR("Internal Error"), SERVICEUNAVAILABLE(
+            "Service is not available. Could be down for maintanence"), INVALIDDATA(
+            "Data is invalid or conflicts with URI");
+
+    private String message;
+
+    private RestMessages(String msg) {
+        message = msg;
+    }
+
+    @Override
+    public String toString() {
+        return message;
+    }
+}
diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java
new file mode 100644 (file)
index 0000000..2d899a0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 503 (Service Unavailable Error)
+ *
+ * The server is currently unable to handle the request due to a temporary
+ * overloading or maintenance of the server.
+ * The implication is that this is a temporary condition which will be alleviated
+ * after some delay.
+ *
+ *
+ */
+public class ServiceUnavailableException extends WebApplicationException {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Constructor for the SERVICE_UNAVAILABLE custom handler
+     *
+     * @param string Error message to specify further the
+     * SERVICE_UNAVAILABLE response
+     *
+     */
+    public ServiceUnavailableException(String string) {
+        super(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(
+                string).type(MediaType.TEXT_PLAIN).build());
+    }
+}
index 75ab281..a9ead67 100644 (file)
       <artifactId>commons-net</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>clustering.services</artifactId>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>configuration</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
   </dependencies>
   <build>
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>org.opendaylight.controller.configuration,
-              org.opendaylight.controller.clustering.services,
-              org.opendaylight.controller.sal.core,
-              org.opendaylight.controller.sal.utils,
-              org.apache.felix.dm,
-              org.apache.commons.net.util,
-              org.osgi.service.component,
-              org.slf4j,
-              javax.xml.bind.annotation</Import-Package>
+            <Import-Package>*</Import-Package>
           </instructions>
           <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
         </configuration>
index 472debe..0ae523a 100644 (file)
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NeutronCRUDInterfaces {
+    private static final Logger logger = LoggerFactory
+            .getLogger(NeutronCRUDInterfaces.class);
 
     public static INeutronNetworkCRUD getINeutronNetworkCRUD(Object o) {
-        INeutronNetworkCRUD answer = (INeutronNetworkCRUD) ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, o);
+        INeutronNetworkCRUD answer = (INeutronNetworkCRUD) getInstances(INeutronNetworkCRUD.class, o);
         return answer;
     }
 
     public static INeutronSubnetCRUD getINeutronSubnetCRUD(Object o) {
-        INeutronSubnetCRUD answer = (INeutronSubnetCRUD) ServiceHelper.getGlobalInstance(INeutronSubnetCRUD.class, o);
+        INeutronSubnetCRUD answer = (INeutronSubnetCRUD) getInstances(INeutronSubnetCRUD.class, o);
         return answer;
     }
 
     public static INeutronPortCRUD getINeutronPortCRUD(Object o) {
-        INeutronPortCRUD answer = (INeutronPortCRUD) ServiceHelper.getGlobalInstance(INeutronPortCRUD.class, o);
+        INeutronPortCRUD answer = (INeutronPortCRUD) getInstances(INeutronPortCRUD.class, o);
         return answer;
     }
 
     public static INeutronRouterCRUD getINeutronRouterCRUD(Object o) {
-        INeutronRouterCRUD answer = (INeutronRouterCRUD) ServiceHelper.getGlobalInstance(INeutronRouterCRUD.class, o);
+        INeutronRouterCRUD answer = (INeutronRouterCRUD) getInstances(INeutronRouterCRUD.class, o);
         return answer;
     }
 
     public static INeutronFloatingIPCRUD getINeutronFloatingIPCRUD(Object o) {
-        INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) ServiceHelper.getGlobalInstance(INeutronFloatingIPCRUD.class, o);
+        INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) getInstances(INeutronFloatingIPCRUD.class, o);
         return answer;
     }
 
     public static INeutronSecurityGroupCRUD getINeutronSecurityGroupCRUD(Object o) {
-        INeutronSecurityGroupCRUD answer = (INeutronSecurityGroupCRUD) ServiceHelper.getGlobalInstance(INeutronSecurityGroupCRUD.class, o);
+        INeutronSecurityGroupCRUD answer = (INeutronSecurityGroupCRUD) getInstances(INeutronSecurityGroupCRUD.class, o);
         return answer;
     }
 
     public static INeutronSecurityRuleCRUD getINeutronSecurityRuleCRUD(Object o) {
-        INeutronSecurityRuleCRUD answer = (INeutronSecurityRuleCRUD) ServiceHelper.getGlobalInstance(INeutronSecurityRuleCRUD.class, o);
+        INeutronSecurityRuleCRUD answer = (INeutronSecurityRuleCRUD) getInstances(INeutronSecurityRuleCRUD.class, o);
         return answer;
     }
 
     public static INeutronFirewallCRUD getINeutronFirewallCRUD(Object o) {
-        INeutronFirewallCRUD answer = (INeutronFirewallCRUD) ServiceHelper.getGlobalInstance(INeutronFirewallCRUD.class, o);
+        INeutronFirewallCRUD answer = (INeutronFirewallCRUD) getInstances(INeutronFirewallCRUD.class, o);
         return answer;
     }
 
     public static INeutronFirewallPolicyCRUD getINeutronFirewallPolicyCRUD(Object o) {
-        INeutronFirewallPolicyCRUD answer = (INeutronFirewallPolicyCRUD) ServiceHelper.getGlobalInstance(INeutronFirewallPolicyCRUD.class, o);
+        INeutronFirewallPolicyCRUD answer = (INeutronFirewallPolicyCRUD) getInstances(INeutronFirewallPolicyCRUD.class, o);
         return answer;
     }
 
     public static INeutronFirewallRuleCRUD getINeutronFirewallRuleCRUD(Object o) {
-        INeutronFirewallRuleCRUD answer = (INeutronFirewallRuleCRUD) ServiceHelper.getGlobalInstance(INeutronFirewallRuleCRUD.class, o);
+        INeutronFirewallRuleCRUD answer = (INeutronFirewallRuleCRUD) getInstances(INeutronFirewallRuleCRUD.class, o);
         return answer;
     }
 
     public static INeutronLoadBalancerCRUD getINeutronLoadBalancerCRUD(Object o) {
-        INeutronLoadBalancerCRUD answer = (INeutronLoadBalancerCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerCRUD.class, o);
+        INeutronLoadBalancerCRUD answer = (INeutronLoadBalancerCRUD) getInstances(INeutronLoadBalancerCRUD.class, o);
         return answer;
     }
 
     public static INeutronLoadBalancerPoolCRUD getINeutronLoadBalancerPoolCRUD(Object o) {
-        INeutronLoadBalancerPoolCRUD answer = (INeutronLoadBalancerPoolCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerPoolCRUD.class, o);
+        INeutronLoadBalancerPoolCRUD answer = (INeutronLoadBalancerPoolCRUD) getInstances(INeutronLoadBalancerPoolCRUD.class, o);
         return answer;
     }
 
     public static INeutronLoadBalancerListenerCRUD getINeutronLoadBalancerListenerCRUD(Object o) {
-        INeutronLoadBalancerListenerCRUD answer = (INeutronLoadBalancerListenerCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerListenerCRUD.class, o);
+        INeutronLoadBalancerListenerCRUD answer = (INeutronLoadBalancerListenerCRUD) getInstances(INeutronLoadBalancerListenerCRUD.class, o);
         return answer;
     }
 
     public static INeutronLoadBalancerHealthMonitorCRUD getINeutronLoadBalancerHealthMonitorCRUD(Object o) {
-        INeutronLoadBalancerHealthMonitorCRUD answer = (INeutronLoadBalancerHealthMonitorCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerHealthMonitorCRUD.class, o);
+        INeutronLoadBalancerHealthMonitorCRUD answer = (INeutronLoadBalancerHealthMonitorCRUD) getInstances(INeutronLoadBalancerHealthMonitorCRUD.class, o);
         return answer;
     }
 
     public static INeutronLoadBalancerPoolMemberCRUD getINeutronLoadBalancerPoolMemberCRUD(Object o) {
-        INeutronLoadBalancerPoolMemberCRUD answer = (INeutronLoadBalancerPoolMemberCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerPoolMemberCRUD.class, o);
+        INeutronLoadBalancerPoolMemberCRUD answer = (INeutronLoadBalancerPoolMemberCRUD) getInstances(INeutronLoadBalancerPoolMemberCRUD.class, o);
         return answer;
     }
+
+    public static Object getInstances(Class<?> clazz,Object bundle) {
+        try {
+            BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass())
+                    .getBundleContext();
+
+            ServiceReference<?>[] services = null;
+                services = bCtx.getServiceReferences(clazz.getName(),
+                        null);
+            if (services != null) {
+                return bCtx.getService(services[0]);
+            }
+        } catch (Exception e) {
+            logger.error("Instance reference is NULL");
+        }
+        return null;
+    }
 }
\ No newline at end of file
index 39f04c9..5d427ef 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -38,7 +36,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronFirewall extends ConfigurationObject implements Serializable {
+public class NeutronFirewall implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name="id")
index 46436b5..782e18b 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -38,7 +36,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronFirewallPolicy extends ConfigurationObject implements Serializable {
+public class NeutronFirewallPolicy implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name="id")
index 63a65a2..d4c2393 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -47,7 +45,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronFirewallRule extends ConfigurationObject implements Serializable {
+public class NeutronFirewallRule implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "id")
index 9e5aa2d..9c8c91b 100644 (file)
@@ -17,12 +17,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronFloatingIP extends ConfigurationObject implements Serializable {
+public class NeutronFloatingIP implements Serializable {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
index 15544f0..58f0eb4 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -37,7 +35,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronLoadBalancer extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancer implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name="id")
index 0e9e1af..d23fe11 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +43,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronLoadBalancerHealthMonitor extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerHealthMonitor implements Serializable {
     private static final long serialVersionUID = 1L;
     private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancer.class);
 
index 3989709..8b4ada3 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -42,7 +40,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronLoadBalancerListener extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerListener implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name="id")
index a2df680..363de41 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -41,7 +39,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronLoadBalancerPool extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerPool implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name="id")
index 683d45f..313a951 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -22,7 +20,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronLoadBalancerPoolMember  extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerPoolMember implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
index a3c38a9..1cbbb36 100644 (file)
@@ -18,12 +18,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 @XmlRootElement(name = "network")
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronNetwork extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronNetwork implements Serializable, INeutronObject {
     // See OpenStack Network API v2.0 Reference for description of
     // annotated attributes
 
index 803e5e8..a529599 100644 (file)
@@ -19,13 +19,11 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronPort extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronPort implements Serializable, INeutronObject {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
index ae5aa0f..9d5ee38 100644 (file)
@@ -18,12 +18,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronRouter extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronRouter implements Serializable, INeutronObject {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
index 0f0a14c..ca56c7b 100644 (file)
@@ -9,8 +9,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -35,7 +33,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronSecurityGroup extends ConfigurationObject implements Serializable {
+public class NeutronSecurityGroup implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "id")
index 3fad4fe..6247691 100644 (file)
@@ -9,8 +9,6 @@
 
 package org.opendaylight.controller.networkconfig.neutron;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -39,7 +37,7 @@ import java.util.List;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronSecurityRule extends ConfigurationObject implements Serializable {
+public class NeutronSecurityRule implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "id")
index b0d9bf4..2a44d8b 100644 (file)
@@ -22,12 +22,11 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.commons.net.util.SubnetUtils;
 import org.apache.commons.net.util.SubnetUtils.SubnetInfo;
-import org.opendaylight.controller.configuration.ConfigurationObject;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 
-public class NeutronSubnet extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronSubnet implements Serializable, INeutronObject {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
index 1292c29..fe5d45b 100644 (file)
@@ -15,11 +15,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.opendaylight.controller.configuration.ConfigurationObject;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
-public class Neutron_IPs extends ConfigurationObject implements Serializable {
+public class Neutron_IPs implements Serializable {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of