complete dependency inject CRUD implementations 77/70977/5
authorMichael Vorburger <vorburger@redhat.com>
Mon, 16 Apr 2018 10:49:13 +0000 (12:49 +0200)
committerMichael Vorburger <vorburger@redhat.com>
Thu, 19 Apr 2018 18:41:55 +0000 (20:41 +0200)
Change-Id: Ib8d2843ff7de5790a67678c645770307091b4c20
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
32 files changed:
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronBgpvpnsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFirewallNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFirewallPolicyNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFirewallRulesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFloatingIpsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronL2gatewayConnectionNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronL2gatewayNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerHealthMonitorNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerListenerNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerPoolNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelRulesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronNorthboundRSApplication.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronPortsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronQosPolicyNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSFCFlowClassifiersNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSFCPortChainsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSFCPortPairGroupsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSFCPortPairsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityGroupsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityRulesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSubnetsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronTapFlowNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronTapServiceNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronTrunksNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVpnIkePoliciesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVpnIpSecPoliciesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVpnIpSecSiteConnectionsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVpnServicesNorthbound.java

index cb1f0cd0f83324ac1e841a2448c0d66f4085b647..8d9c67edbbf0ab820fbad7b85e0079d62756d115 100644 (file)
@@ -12,30 +12,19 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.ParameterizedType;
 import java.net.HttpURLConnection;
-import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
 import javax.ws.rs.core.Response;
 import org.opendaylight.neutron.spi.INeutronCRUD;
 import org.opendaylight.neutron.spi.INeutronObject;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R extends INeutronRequest<T>,
         I extends INeutronCRUD<T>> {
 
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractNeutronNorthbound.class);
-
     // T extends INeutronObject<T> as 0th type argument
     private static final int NEUTRON_ARGUMENT_TYPE_INDEX = 0;
     // NeutronRequest extends INeutronRequest<T> as 1st type argument
     private static final int NEUTRON_REQUEST_TYPE_INDEX = 1;
-    // I extends INeutronCRUD<T> as 2nd type argument
-    private static final int NEUTRON_CRUD_TYPE_INDEX = 2;
 
     protected static final int HTTP_OK_BOTTOM = 200;
     protected static final int HTTP_OK_TOP = 299;
@@ -45,17 +34,6 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
 
     private final I neutronCRUD;
 
-    /**
-     * Default constructor.
-     *
-     * @deprecated Replace usage of this method with direct dependency injection,
-     *             see NeutronNetworksNorthbound for how-to.  This will shortly be removed.
-     */
-    @Deprecated
-    protected AbstractNeutronNorthbound() {
-        this.neutronCRUD = null;
-    }
-
     protected AbstractNeutronNorthbound(I neutronCRUD) {
         this.neutronCRUD = Objects.requireNonNull(neutronCRUD, "neutronCRUD");
     }
@@ -96,39 +74,13 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
     }
 
     protected I getNeutronCRUD() {
-        // TODO remove null check and everything below when the @deprecated default constructor is removed...
-        if (this.neutronCRUD != null) {
-            return this.neutronCRUD;
-        }
-
-        // cls = I.class
-        Class<I> cls = getActualTypeArgument(NEUTRON_CRUD_TYPE_INDEX);
-        I neutronCrud = fetchINeutronCRUD(cls, (Object) this);
-        if (neutronCrud == null) {
-            throw new ServiceUnavailableException(serviceUnavailable());
-        }
-        return neutronCrud;
-    }
-
-    private static <T extends INeutronObject<T>, I extends INeutronCRUD<T>> I fetchINeutronCRUD(Class<I> clazz,
-            Object bundle) {
-        try {
-            BundleContext bundleCtx = FrameworkUtil.getBundle(bundle.getClass()).getBundleContext();
-            Collection<ServiceReference<I>> services = bundleCtx.getServiceReferences(clazz, null);
-            for (ServiceReference<I> service : services) {
-                return bundleCtx.getService(service);
-            }
-        } catch (InvalidSyntaxException e) {
-            LOG.error("Error in getInstances", e);
-        }
-        return null;
+        return this.neutronCRUD;
     }
 
     protected Response show(String uuid,
             // return fields
             List<String> fields) {
-        I gotNeutronCRUD = getNeutronCRUD(); // TODO remove and just use new private neutronCRUD field
-        T ans = gotNeutronCRUD.get(uuid);
+        T ans = neutronCRUD.get(uuid);
         if (ans == null) {
             throw new ResourceNotFoundException(uuidNoExist());
         }
@@ -142,19 +94,18 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
     }
 
     protected Response create(final R input) {
-        I gotNeutronCRUD = getNeutronCRUD(); // TODO remove and just use new private neutronCRUD field
         if (input.isSingleton()) {
             T singleton = input.getSingleton();
 
             singleton.initDefaults();
-            gotNeutronCRUD.add(singleton);
+            neutronCRUD.add(singleton);
         } else {
             if (input.getBulk() == null) {
                 throw new BadRequestException("Invalid requests");
             }
             for (T test : input.getBulk()) {
                 test.initDefaults();
-                gotNeutronCRUD.add(test);
+                neutronCRUD.add(test);
             }
         }
         return Response.status(HttpURLConnection.HTTP_CREATED).entity(input).build();
@@ -179,12 +130,11 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
     }
 
     protected Response update(String uuid, final R input) {
-        I gotNeutronCRUD = getNeutronCRUD(); // TODO remove and just use new private neutronCRUD field
         if (!input.isSingleton()) {
             throw new BadRequestException("Only singleton edit supported");
         }
         T delta = input.getSingleton();
-        T original = gotNeutronCRUD.get(uuid);
+        T original = neutronCRUD.get(uuid);
         if (original == null) {
             throw new ResourceNotFoundException(uuidNoExist());
         }
@@ -195,20 +145,18 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
         /*
          * update the object and return it
          */
-        if (!gotNeutronCRUD.update(uuid, delta)) {
+        if (!neutronCRUD.update(uuid, delta)) {
             throw new ResourceNotFoundException(uuidNoExist());
         }
-        T updated = gotNeutronCRUD.get(uuid);
+        T updated = neutronCRUD.get(uuid);
         return Response.status(HttpURLConnection.HTTP_OK).entity(newNeutronRequest(updated)).build();
     }
 
     protected Response delete(String uuid) {
-        final I gotNeutronCRUD = getNeutronCRUD(); // TODO remove and just use new private neutronCRUD field
-
         /*
          * remove it and return 204 status
          */
-        if (!gotNeutronCRUD.remove(uuid)) {
+        if (!neutronCRUD.remove(uuid)) {
             throw new ResourceNotFoundException(uuidNoExist());
         }
 
index 7c067f46a450019e50e76bff9342ae22db3e5095..48e4a7968ffd3b5d0af31e0a188d0601838a063b 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
@@ -29,10 +31,12 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
 import org.opendaylight.neutron.spi.INeutronBgpvpnCRUD;
 import org.opendaylight.neutron.spi.NeutronBgpvpn;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Bgpvpn.
  */
+@Singleton
 @Path("/bgpvpns")
 public final class NeutronBgpvpnsNorthbound
         extends AbstractNeutronNorthbound<NeutronBgpvpn, NeutronBgpvpnRequest, INeutronBgpvpnCRUD> {
@@ -42,6 +46,11 @@ public final class NeutronBgpvpnsNorthbound
     @Context
     UriInfo uriInfo;
 
+    @Inject
+    public NeutronBgpvpnsNorthbound(@OsgiService INeutronBgpvpnCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 2a5fe93b47b8189a4175b1c070055bfc1de42d91..fcec13e8a141090b16a795fa7294abe2c2adca9a 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronFirewallCRUD;
 import org.opendaylight.neutron.spi.NeutronFirewall;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Firewall.
  */
+@Singleton
 @Path("/fw/firewalls")
 public final class NeutronFirewallNorthbound
         extends AbstractNeutronNorthbound<NeutronFirewall, NeutronFirewallRequest, INeutronFirewallCRUD> {
 
     private static final String RESOURCE_NAME = "Firewall";
 
+    @Inject
+    public NeutronFirewallNorthbound(@OsgiService INeutronFirewallCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index b0aa703af75c23a99eb5f8e70ae6aa6ecf2cb036..f2297ae1f6dc939df8e1a8cf8ddb89b211273a18 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronFirewallPolicyCRUD;
 import org.opendaylight.neutron.spi.NeutronFirewallPolicy;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Firewall Policies.
  */
+@Singleton
 @Path("/fw/firewall_policies")
 public final class NeutronFirewallPolicyNorthbound extends
         AbstractNeutronNorthbound<NeutronFirewallPolicy, NeutronFirewallPolicyRequest, INeutronFirewallPolicyCRUD> {
 
     private static final String RESOURCE_NAME = "Firewall Policy";
 
+    @Inject
+    public NeutronFirewallPolicyNorthbound(@OsgiService INeutronFirewallPolicyCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 75e1dcbbfee3e29bb53259e70f1f569ceab8de71..1b038d08f1aa79cda3785262023657b383643a1f 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronFirewallRuleCRUD;
 import org.opendaylight.neutron.spi.NeutronFirewallRule;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Firewall Rule.
  */
+@Singleton
 @Path("fw/firewall_rules")
 public final class NeutronFirewallRulesNorthbound
         extends AbstractNeutronNorthbound<NeutronFirewallRule, NeutronFirewallRuleRequest, INeutronFirewallRuleCRUD> {
 
     private static final String RESOURCE_NAME = "Firewall Rule";
 
+    @Inject
+    public NeutronFirewallRulesNorthbound(@OsgiService INeutronFirewallRuleCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index e470354400158f2b171683ffcde82485729705f1..31fb1d2ae9f5d7b77f75aef2f4984610c6c6033e 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronFloatingIpCRUD;
 import org.opendaylight.neutron.spi.NeutronFloatingIp;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for managing Neutron Floating IPs.
  */
+@Singleton
 @Path("/floatingips")
 public final class NeutronFloatingIpsNorthbound
         extends AbstractNeutronNorthbound<NeutronFloatingIp, NeutronFloatingIpRequest, INeutronFloatingIpCRUD> {
 
     private static final String RESOURCE_NAME = "Floating IP";
 
+    @Inject
+    public NeutronFloatingIpsNorthbound(@OsgiService INeutronFloatingIpCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index d035a29ec7c37cbf6669728b1635aa021f21471f..8832e026daea9f1ae5a09192de882906b5c473b4 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -24,12 +26,14 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronL2gatewayConnectionCRUD;
 import org.opendaylight.neutron.spi.NeutronL2gatewayConnection;
+import org.ops4j.pax.cdi.api.OsgiService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Neutron Northbound REST APIs for L2 gateway Connection.
  */
+@Singleton
 @Path("/l2gateway-connections")
 public final class NeutronL2gatewayConnectionNorthbound extends AbstractNeutronNorthbound<NeutronL2gatewayConnection,
         NeutronL2gatewayConnectionRequest, INeutronL2gatewayConnectionCRUD> {
@@ -38,6 +42,11 @@ public final class NeutronL2gatewayConnectionNorthbound extends AbstractNeutronN
 
     private static final String RESOURCE_NAME = "L2gatewayConnection";
 
+    @Inject
+    public NeutronL2gatewayConnectionNorthbound(@OsgiService INeutronL2gatewayConnectionCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 216ca2109ca5f3b42429f59e879a51df8a5b3db4..2d10976150fdd58f7afbf7f3e993788acf888cbd 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,12 +27,14 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronL2gatewayCRUD;
 import org.opendaylight.neutron.spi.NeutronL2gateway;
+import org.ops4j.pax.cdi.api.OsgiService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Neutron Northbound REST APIs for L2 gateway.
  */
+@Singleton
 @Path("/l2-gateways")
 public final class NeutronL2gatewayNorthbound
         extends AbstractNeutronNorthbound<NeutronL2gateway, NeutronL2gatewayRequest, INeutronL2gatewayCRUD> {
@@ -39,6 +43,11 @@ public final class NeutronL2gatewayNorthbound
 
     private static final String RESOURCE_NAME = "L2gateway";
 
+    @Inject
+    public NeutronL2gatewayNorthbound(@OsgiService INeutronL2gatewayCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 1dc12f67a87d7f0b9ce5719a811c77f19d832cdc..84b02d31a9c6ae49e8477dd3e4e93c958f82bb6d 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,11 +27,13 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronLoadBalancerHealthMonitorCRUD;
 import org.opendaylight.neutron.spi.NeutronLoadBalancerHealthMonitor;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Load Balancer HealthMonitor.
  *
  */
+@Singleton
 @Path("/lbaas/healthmonitors")
 public final class NeutronLoadBalancerHealthMonitorNorthbound
         extends AbstractNeutronNorthbound<NeutronLoadBalancerHealthMonitor, NeutronLoadBalancerHealthMonitorRequest,
@@ -37,6 +41,11 @@ public final class NeutronLoadBalancerHealthMonitorNorthbound
 
     private static final String RESOURCE_NAME = "LoadBalancerHealthMonitor";
 
+    @Inject
+    public NeutronLoadBalancerHealthMonitorNorthbound(@OsgiService INeutronLoadBalancerHealthMonitorCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 6c937d7570a2497ae38956be20a6214369d8416a..bbed2e9357dfffcb7d2a92cb4f0493a3b5d9f44b 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronLoadBalancerListenerCRUD;
 import org.opendaylight.neutron.spi.NeutronLoadBalancerListener;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for LoadBalancerListener Policies.
  */
+@Singleton
 @Path("/lbaas/listeners")
 public final class NeutronLoadBalancerListenerNorthbound extends AbstractNeutronNorthbound<NeutronLoadBalancerListener,
         NeutronLoadBalancerListenerRequest, INeutronLoadBalancerListenerCRUD> {
 
     private static final String RESOURCE_NAME = "LoadBalancerListener";
 
+    @Inject
+    public NeutronLoadBalancerListenerNorthbound(@OsgiService INeutronLoadBalancerListenerCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index eb730649ecab03675b2aafca5c06cb519c86518f..11a8e39b2bcdc5c879dd53f45598f60e13214e07 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD;
 import org.opendaylight.neutron.spi.NeutronLoadBalancer;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for LoadBalancers.<br>
  */
+@Singleton
 @Path("/lbaas/loadbalancers")
 public final class NeutronLoadBalancerNorthbound
         extends AbstractNeutronNorthbound<NeutronLoadBalancer, NeutronLoadBalancerRequest, INeutronLoadBalancerCRUD> {
 
     private static final String RESOURCE_NAME = "LoadBalancer";
 
+    @Inject
+    public NeutronLoadBalancerNorthbound(@OsgiService INeutronLoadBalancerCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index ba9bf07734c2fa2e0e6ec395ff6dcf2a6457e5e1..83ec1f3d46d0bdbd4e220cf5a7786f78d6930cb6 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -26,6 +28,7 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD;
 import org.opendaylight.neutron.spi.NeutronLoadBalancerPool;
 import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for LoadBalancerPool Policies.
@@ -33,12 +36,18 @@ import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember;
  * <p>For now, the LB pool member data is maintained with the INeutronLoadBalancerPoolCRUD,
  * and not duplicated within the INeutronLoadBalancerPoolMemberCRUD's cache.
  */
+@Singleton
 @Path("/lbaas/pools")
 public final class NeutronLoadBalancerPoolNorthbound extends AbstractNeutronNorthbound<NeutronLoadBalancerPool,
         NeutronLoadBalancerPoolRequest, INeutronLoadBalancerPoolCRUD> {
 
     private static final String RESOURCE_NAME = "LoadBalancerPool";
 
+    @Inject
+    public NeutronLoadBalancerPoolNorthbound(@OsgiService INeutronLoadBalancerPoolCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 572d1d8b9c411426dc1f1944eb2ad553a61be48d..dd1b6ad9cdaf2b62bfdf56ace50d1b542fc0642d 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -24,16 +26,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronMeteringLabelRuleCRUD;
 import org.opendaylight.neutron.spi.NeutronMeteringLabelRule;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Metering Lable Rules.<br>
  */
+@Singleton
 @Path("/metering/metering-label-rules")
 public final class NeutronMeteringLabelRulesNorthbound extends AbstractNeutronNorthbound<NeutronMeteringLabelRule,
         NeutronMeteringLabelRuleRequest, INeutronMeteringLabelRuleCRUD> {
 
     private static final String RESOURCE_NAME = "Metering Label Rule";
 
+    @Inject
+    public NeutronMeteringLabelRulesNorthbound(@OsgiService INeutronMeteringLabelRuleCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 343704536b87a39b3e57b41fdbef9acb11c40406..aaf7d6e4dcd6b8ae4607892618672d9e81a0e0b8 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -24,16 +26,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronMeteringLabelCRUD;
 import org.opendaylight.neutron.spi.NeutronMeteringLabel;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Metering Lables.
  */
+@Singleton
 @Path("/metering/metering-labels")
 public final class NeutronMeteringLabelsNorthbound extends
         AbstractNeutronNorthbound<NeutronMeteringLabel, NeutronMeteringLabelRequest, INeutronMeteringLabelCRUD> {
 
     private static final String RESOURCE_NAME = "Metering Label";
 
+    @Inject
+    public NeutronMeteringLabelsNorthbound(@OsgiService INeutronMeteringLabelCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index f63e47b132f3f9a025c380127b2ce5a770b235df..e5b4096e5117bc125d65974362d82d30e8e8fa4c 100644 (file)
@@ -28,10 +28,102 @@ public final class NeutronNorthboundRSApplication extends Application {
     private static final int HASHMAP_SIZE = 3;
 
     private final NeutronNetworksNorthbound neutronNetworksNorthbound;
+    private final NeutronSubnetsNorthbound neutronSubnetsNorthbound;
+    private final NeutronPortsNorthbound neutronPortsNorthbound;
+    private final NeutronRoutersNorthbound neutronRoutersNorthbound;
+    private final NeutronFloatingIpsNorthbound neutronFloatingIpsNorthbound;
+    private final NeutronSecurityGroupsNorthbound neutronSecurityGroupsNorthbound;
+    private final NeutronSecurityRulesNorthbound neutronSecurityRulesNorthbound;
+    private final NeutronFirewallNorthbound neutronFirewallNorthbound;
+    private final NeutronFirewallPolicyNorthbound neutronFirewallPolicyNorthbound;
+    private final NeutronFirewallRulesNorthbound neutronFirewallRulesNorthbound;
+    private final NeutronLoadBalancerNorthbound neutronLoadBalancerNorthbound;
+    private final NeutronLoadBalancerListenerNorthbound neutronLoadBalancerListenerNorthbound;
+    private final NeutronLoadBalancerPoolNorthbound neutronLoadBalancerPoolNorthbound;
+    private final NeutronBgpvpnsNorthbound neutronBgpvpnsNorthbound;
+    private final NeutronL2gatewayNorthbound neutronL2gatewayNorthbound;
+    private final NeutronL2gatewayConnectionNorthbound neutronL2gatewayConnectionNorthbound;
+    private final NeutronLoadBalancerHealthMonitorNorthbound neutronLoadBalancerHealthMonitorNorthbound;
+    private final NeutronMeteringLabelsNorthbound neutronMeteringLabelsNorthbound;
+    private final NeutronMeteringLabelRulesNorthbound neutronMeteringLabelRulesNorthbound;
+    private final NeutronVpnServicesNorthbound neutronVpnServicesNorthbound;
+    private final NeutronVpnIkePoliciesNorthbound neutronVpnIkePoliciesNorthbound;
+    private final NeutronVpnIpSecPoliciesNorthbound neutronVpnIpSecPoliciesNorthbound;
+    private final NeutronVpnIpSecSiteConnectionsNorthbound neutronVpnIpSecSiteConnectionsNorthbound;
+    private final NeutronSFCFlowClassifiersNorthbound neutronSFCFlowClassifiersNorthbound;
+    private final NeutronSFCPortChainsNorthbound neutronSFCPortChainsNorthbound;
+    private final NeutronSFCPortPairGroupsNorthbound neutronSFCPortPairGroupsNorthbound;
+    private final NeutronSFCPortPairsNorthbound neutronSFCPortPairsNorthbound;
+    private final NeutronQosPolicyNorthbound neutronQosPolicyNorthbound;
+    private final NeutronTrunksNorthbound neutronTrunksNorthbound;
+    private final NeutronTapServiceNorthbound neutronTapServiceNorthbound;
+    private final NeutronTapFlowNorthbound neutronTapFlowNorthbound;
 
     @Inject
-    public NeutronNorthboundRSApplication(NeutronNetworksNorthbound neutronNetworksNorthbound) {
+    public NeutronNorthboundRSApplication(
+            NeutronNetworksNorthbound neutronNetworksNorthbound,
+            NeutronSubnetsNorthbound neutronSubnetsNorthbound,
+            NeutronPortsNorthbound neutronPortsNorthbound,
+            NeutronRoutersNorthbound neutronRoutersNorthbound,
+            NeutronFloatingIpsNorthbound neutronFloatingIpsNorthbound,
+            NeutronSecurityGroupsNorthbound neutronSecurityGroupsNorthbound,
+            NeutronSecurityRulesNorthbound neutronSecurityRulesNorthbound,
+            NeutronFirewallNorthbound neutronFirewallNorthbound,
+            NeutronFirewallPolicyNorthbound neutronFirewallPolicyNorthbound,
+            NeutronFirewallRulesNorthbound neutronFirewallRulesNorthbound,
+            NeutronLoadBalancerListenerNorthbound neutronLoadBalancerListenerNorthbound,
+            NeutronLoadBalancerNorthbound neutronLoadBalancerNorthbound,
+            NeutronLoadBalancerPoolNorthbound neutronLoadBalancerPoolNorthbound,
+            NeutronBgpvpnsNorthbound neutronBgpvpnsNorthbound,
+            NeutronL2gatewayNorthbound neutronL2gatewayNorthbound,
+            NeutronL2gatewayConnectionNorthbound neutronL2gatewayConnectionNorthbound,
+            NeutronLoadBalancerHealthMonitorNorthbound neutronLoadBalancerHealthMonitorNorthbound,
+            NeutronMeteringLabelsNorthbound neutronMeteringLabelsNorthbound,
+            NeutronMeteringLabelRulesNorthbound neutronMeteringLabelRulesNorthbound,
+            NeutronVpnServicesNorthbound neutronVpnServicesNorthbound,
+            NeutronVpnIkePoliciesNorthbound neutronVpnIkePoliciesNorthbound,
+            NeutronVpnIpSecSiteConnectionsNorthbound neutronVpnIpSecSiteConnectionsNorthbound,
+            NeutronVpnIpSecPoliciesNorthbound neutronVpnIpSecPoliciesNorthbound,
+            NeutronSFCFlowClassifiersNorthbound neutronSFCFlowClassifiersNorthbound,
+            NeutronSFCPortChainsNorthbound neutronSFCPortChainsNorthbound,
+            NeutronSFCPortPairGroupsNorthbound neutronSFCPortPairGroupsNorthbound,
+            NeutronSFCPortPairsNorthbound neutronSFCPortPairsNorthbound,
+            NeutronQosPolicyNorthbound neutronQosPolicyNorthbound,
+            NeutronTrunksNorthbound neutronTrunksNorthbound,
+            NeutronTapServiceNorthbound neutronTapServiceNorthbound,
+            NeutronTapFlowNorthbound neutronTapFlowNorthbound) {
+
         this.neutronNetworksNorthbound = neutronNetworksNorthbound;
+        this.neutronSubnetsNorthbound = neutronSubnetsNorthbound;
+        this.neutronPortsNorthbound = neutronPortsNorthbound;
+        this.neutronRoutersNorthbound = neutronRoutersNorthbound;
+        this.neutronFloatingIpsNorthbound = neutronFloatingIpsNorthbound;
+        this.neutronSecurityGroupsNorthbound = neutronSecurityGroupsNorthbound;
+        this.neutronSecurityRulesNorthbound = neutronSecurityRulesNorthbound;
+        this.neutronFirewallNorthbound = neutronFirewallNorthbound;
+        this.neutronFirewallRulesNorthbound = neutronFirewallRulesNorthbound;
+        this.neutronLoadBalancerListenerNorthbound = neutronLoadBalancerListenerNorthbound;
+        this.neutronLoadBalancerNorthbound = neutronLoadBalancerNorthbound;
+        this.neutronFirewallPolicyNorthbound = neutronFirewallPolicyNorthbound;
+        this.neutronLoadBalancerPoolNorthbound = neutronLoadBalancerPoolNorthbound;
+        this.neutronBgpvpnsNorthbound = neutronBgpvpnsNorthbound;
+        this.neutronL2gatewayNorthbound = neutronL2gatewayNorthbound;
+        this.neutronL2gatewayConnectionNorthbound = neutronL2gatewayConnectionNorthbound;
+        this.neutronLoadBalancerHealthMonitorNorthbound = neutronLoadBalancerHealthMonitorNorthbound;
+        this.neutronMeteringLabelsNorthbound = neutronMeteringLabelsNorthbound;
+        this.neutronMeteringLabelRulesNorthbound = neutronMeteringLabelRulesNorthbound;
+        this.neutronVpnServicesNorthbound = neutronVpnServicesNorthbound;
+        this.neutronVpnIkePoliciesNorthbound = neutronVpnIkePoliciesNorthbound;
+        this.neutronVpnIpSecSiteConnectionsNorthbound = neutronVpnIpSecSiteConnectionsNorthbound;
+        this.neutronVpnIpSecPoliciesNorthbound = neutronVpnIpSecPoliciesNorthbound;
+        this.neutronSFCFlowClassifiersNorthbound = neutronSFCFlowClassifiersNorthbound;
+        this.neutronSFCPortChainsNorthbound = neutronSFCPortChainsNorthbound;
+        this.neutronSFCPortPairGroupsNorthbound = neutronSFCPortPairGroupsNorthbound;
+        this.neutronSFCPortPairsNorthbound = neutronSFCPortPairsNorthbound;
+        this.neutronQosPolicyNorthbound = neutronQosPolicyNorthbound;
+        this.neutronTrunksNorthbound = neutronTrunksNorthbound;
+        this.neutronTapServiceNorthbound = neutronTapServiceNorthbound;
+        this.neutronTapFlowNorthbound = neutronTapFlowNorthbound;
     }
 
     @Override
@@ -45,36 +137,36 @@ public final class NeutronNorthboundRSApplication extends Application {
                 .add(getMOXyJsonProvider())
                 // Northbound URIs JAX RS Resources:
                 .add(neutronNetworksNorthbound)
-                .add(new NeutronSubnetsNorthbound())
-                .add(new NeutronPortsNorthbound())
-                .add(new NeutronRoutersNorthbound())
-                .add(new NeutronFloatingIpsNorthbound())
-                .add(new NeutronSecurityGroupsNorthbound())
-                .add(new NeutronSecurityRulesNorthbound())
-                .add(new NeutronFirewallNorthbound())
-                .add(new NeutronFirewallPolicyNorthbound())
-                .add(new NeutronFirewallRulesNorthbound())
-                .add(new NeutronLoadBalancerNorthbound())
-                .add(new NeutronLoadBalancerListenerNorthbound())
-                .add(new NeutronLoadBalancerPoolNorthbound())
-                .add(new NeutronLoadBalancerHealthMonitorNorthbound())
-                .add(new NeutronMeteringLabelsNorthbound())
-                .add(new NeutronMeteringLabelRulesNorthbound())
-                .add(new NeutronVpnServicesNorthbound())
-                .add(new NeutronVpnIkePoliciesNorthbound())
-                .add(new NeutronVpnIpSecPoliciesNorthbound())
-                .add(new NeutronVpnIpSecSiteConnectionsNorthbound())
-                .add(new NeutronBgpvpnsNorthbound())
-                .add(new NeutronL2gatewayNorthbound())
-                .add(new NeutronL2gatewayConnectionNorthbound())
-                .add(new NeutronSFCFlowClassifiersNorthbound())
-                .add(new NeutronSFCPortPairsNorthbound())
-                .add(new NeutronSFCPortPairGroupsNorthbound())
-                .add(new NeutronSFCPortChainsNorthbound())
-                .add(new NeutronQosPolicyNorthbound())
-                .add(new NeutronTrunksNorthbound())
-                .add(new NeutronTapServiceNorthbound())
-                .add(new NeutronTapFlowNorthbound())
+                .add(neutronSubnetsNorthbound)
+                .add(neutronPortsNorthbound)
+                .add(neutronRoutersNorthbound)
+                .add(neutronFloatingIpsNorthbound)
+                .add(neutronSecurityGroupsNorthbound)
+                .add(neutronSecurityRulesNorthbound)
+                .add(neutronFirewallNorthbound)
+                .add(neutronFirewallPolicyNorthbound)
+                .add(neutronFirewallRulesNorthbound)
+                .add(neutronLoadBalancerNorthbound)
+                .add(neutronLoadBalancerListenerNorthbound)
+                .add(neutronLoadBalancerPoolNorthbound)
+                .add(neutronLoadBalancerHealthMonitorNorthbound)
+                .add(neutronMeteringLabelsNorthbound)
+                .add(neutronMeteringLabelRulesNorthbound)
+                .add(neutronVpnServicesNorthbound)
+                .add(neutronVpnIkePoliciesNorthbound)
+                .add(neutronVpnIpSecPoliciesNorthbound)
+                .add(neutronVpnIpSecSiteConnectionsNorthbound)
+                .add(neutronBgpvpnsNorthbound)
+                .add(neutronL2gatewayNorthbound)
+                .add(neutronL2gatewayConnectionNorthbound)
+                .add(neutronSFCFlowClassifiersNorthbound)
+                .add(neutronSFCPortPairsNorthbound)
+                .add(neutronSFCPortPairGroupsNorthbound)
+                .add(neutronSFCPortChainsNorthbound)
+                .add(neutronQosPolicyNorthbound)
+                .add(neutronTrunksNorthbound)
+                .add(neutronTapServiceNorthbound)
+                .add(neutronTapFlowNorthbound)
                 .build();
     }
 
index cab8108c541e84eb1f983fa8567ae77e27e5353a..3a47f3b233c7c9f0b1b57e2987effa75b7828e13 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
@@ -28,16 +30,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronPortCRUD;
 import org.opendaylight.neutron.spi.NeutronPort;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for managing neutron port objects.
  */
+@Singleton
 @Path("/ports")
 public final class NeutronPortsNorthbound
         extends AbstractNeutronNorthbound<NeutronPort, NeutronPortRequest, INeutronPortCRUD> {
 
     private static final String RESOURCE_NAME = "Port";
 
+    @Inject
+    public NeutronPortsNorthbound(@OsgiService INeutronPortCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 9c7e7d1fbd64f7fb88fb6ad0b509692f1388d9a4..ed46ec3bdd49c51d164d516e3ea4f52849fcdbf9 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,13 +27,20 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronQosPolicyCRUD;
 import org.opendaylight.neutron.spi.NeutronQosPolicy;
+import org.ops4j.pax.cdi.api.OsgiService;
 
+@Singleton
 @Path("/qos/policies")
 public final class NeutronQosPolicyNorthbound
         extends AbstractNeutronNorthbound<NeutronQosPolicy, NeutronQosPolicyRequest, INeutronQosPolicyCRUD> {
 
     private static final String RESOURCE_NAME = "Qos Policy";
 
+    @Inject
+    public NeutronQosPolicyNorthbound(@OsgiService INeutronQosPolicyCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index a192f074239b27a13d9c2e1701a9962a3a858271..66b68253c378a92b6d07eb92289c0bf7170d5ff4 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -26,16 +28,23 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronRouterCRUD;
 import org.opendaylight.neutron.spi.NeutronRouter;
 import org.opendaylight.neutron.spi.NeutronRouterInterface;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for managing neutron routers.
  */
+@Singleton
 @Path("/routers")
 public final class NeutronRoutersNorthbound
         extends AbstractNeutronNorthbound<NeutronRouter, NeutronRouterRequest, INeutronRouterCRUD> {
 
     private static final String RESOURCE_NAME = "Router";
 
+    @Inject
+    public NeutronRoutersNorthbound(@OsgiService INeutronRouterCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 41f31efac4384088f2f6762f7af67772df1b1c64..ce381f688a981840c03edf03ffa00c4ee4c6555e 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSFCFlowClassifierCRUD;
 import org.opendaylight.neutron.spi.NeutronSFCFlowClassifier;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for OpenStack SFC Flow Classifier.
  */
+@Singleton
 @Path("/sfc/flowclassifiers")
 public final class NeutronSFCFlowClassifiersNorthbound extends AbstractNeutronNorthbound<NeutronSFCFlowClassifier,
         NeutronSFCFlowClassifierRequest, INeutronSFCFlowClassifierCRUD> {
 
     private static final String RESOURCE_NAME = "Sfc Flow Classifier";
 
+    @Inject
+    public NeutronSFCFlowClassifiersNorthbound(@OsgiService INeutronSFCFlowClassifierCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index d5038b6d09c78abf24d1837ebb43928f2c432e04..52b19f6b65764c63d6ce82b501aa265ff74b78d3 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSFCPortChainCRUD;
 import org.opendaylight.neutron.spi.NeutronSFCPortChain;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for OpenStack SFC Port Chain.
  */
+@Singleton
 @Path("/sfc/portchains")
 public final class NeutronSFCPortChainsNorthbound
         extends AbstractNeutronNorthbound<NeutronSFCPortChain, NeutronSFCPortChainRequest, INeutronSFCPortChainCRUD> {
 
     private static final String RESOURCE_NAME = "Sfc Port Chain";
 
+    @Inject
+    public NeutronSFCPortChainsNorthbound(@OsgiService INeutronSFCPortChainCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 54c61c5e784650dbaef3ecadc1821595043b2ea8..60527595ed822c451ad76942a3504db7bce4cee1 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSFCPortPairGroupCRUD;
 import org.opendaylight.neutron.spi.NeutronSFCPortPairGroup;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for OpenStack SFC Port Pair.
  */
+@Singleton
 @Path("/sfc/portpairgroups")
 public final class NeutronSFCPortPairGroupsNorthbound extends AbstractNeutronNorthbound<NeutronSFCPortPairGroup,
         NeutronSFCPortPairGroupRequest, INeutronSFCPortPairGroupCRUD> {
 
     private static final String RESOURCE_NAME = "Sfc Port Pair Group";
 
+    @Inject
+    public NeutronSFCPortPairGroupsNorthbound(@OsgiService INeutronSFCPortPairGroupCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 35ca4484f94250f6ce0ffdbfa1085592033abf33..4e03b4915d3771f9ecce677e54288575b4a8c79f 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSFCPortPairCRUD;
 import org.opendaylight.neutron.spi.NeutronSFCPortPair;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for OpenStack SFC Port Pair.
  */
+@Singleton
 @Path("/sfc/portpairs")
 public final class NeutronSFCPortPairsNorthbound
         extends AbstractNeutronNorthbound<NeutronSFCPortPair, NeutronSFCPortPairRequest, INeutronSFCPortPairCRUD> {
 
     private static final String RESOURCE_NAME = "Sfc Port Pair";
 
+    @Inject
+    public NeutronSFCPortPairsNorthbound(@OsgiService INeutronSFCPortPairCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 5edc05ecd6489d5f588d063079a450f5ca0fc000..c464a81509f2ee90227cb23acfc47e4172fcdcff 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSecurityGroupCRUD;
 import org.opendaylight.neutron.spi.NeutronSecurityGroup;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Security Group.
  */
+@Singleton
 @Path("/security-groups")
 public final class NeutronSecurityGroupsNorthbound extends
         AbstractNeutronNorthbound<NeutronSecurityGroup, NeutronSecurityGroupRequest, INeutronSecurityGroupCRUD> {
 
     private static final String RESOURCE_NAME = "Security Group";
 
+    @Inject
+    public NeutronSecurityGroupsNorthbound(@OsgiService INeutronSecurityGroupCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 11eb9385cd2d1dbcadc931709c4b1426b58bca17..7d793e71a684a4fc031d3f5b7be349c1b0dd242f 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,16 +27,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSecurityRuleCRUD;
 import org.opendaylight.neutron.spi.NeutronSecurityRule;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Security Rule.<br>
  */
+@Singleton
 @Path("/security-group-rules")
 public final class NeutronSecurityRulesNorthbound
         extends AbstractNeutronNorthbound<NeutronSecurityRule, NeutronSecurityRuleRequest, INeutronSecurityRuleCRUD> {
 
     private static final String RESOURCE_NAME = "Security Rule";
 
+    @Inject
+    public NeutronSecurityRulesNorthbound(@OsgiService INeutronSecurityRuleCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index ba8f5c1b9b15697119c4562a3781a4f36d2e73d4..f29e98a22052b581b093819f084e92dc54b57e73 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
@@ -28,16 +30,23 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
 import org.opendaylight.neutron.spi.NeutronSubnet;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for Subnets.<br>
  */
+@Singleton
 @Path("/subnets")
 public final class NeutronSubnetsNorthbound
         extends AbstractNeutronNorthbound<NeutronSubnet, NeutronSubnetRequest, INeutronSubnetCRUD> {
 
     private static final String RESOURCE_NAME = "Subnet";
 
+    @Inject
+    public NeutronSubnetsNorthbound(@OsgiService INeutronSubnetCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 4b38bce2b898772dc3afd4c361e4d6ac019befb0..ee8429c833c3a07dc5410f166c2af26ad53d8109 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,13 +27,20 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronTapFlowCRUD;
 import org.opendaylight.neutron.spi.NeutronTapFlow;
+import org.ops4j.pax.cdi.api.OsgiService;
 
+@Singleton
 @Path("/tap/flows")
 public final class NeutronTapFlowNorthbound
         extends AbstractNeutronNorthbound<NeutronTapFlow, NeutronTapFlowRequest, INeutronTapFlowCRUD> {
 
     private static final String RESOURCE_NAME = "Tap Flow";
 
+    @Inject
+    public NeutronTapFlowNorthbound(@OsgiService INeutronTapFlowCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index a8ca5c9f53e7f310884033410a795643da47e35e..40fca7acc454caf9fced641a9d49c7851554857d 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,13 +27,20 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronTapServiceCRUD;
 import org.opendaylight.neutron.spi.NeutronTapService;
+import org.ops4j.pax.cdi.api.OsgiService;
 
+@Singleton
 @Path("/tap/services")
 public final class NeutronTapServiceNorthbound
         extends AbstractNeutronNorthbound<NeutronTapService, NeutronTapServiceRequest, INeutronTapServiceCRUD> {
 
     private static final String RESOURCE_NAME = "Tap Service";
 
+    @Inject
+    public NeutronTapServiceNorthbound(@OsgiService INeutronTapServiceCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index f63654713849e8dd94daf9c3d9997208b0894fd5..66384e0bafe28cdc2c6df20e8f0a0ddfb4401e21 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -25,13 +27,20 @@ import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.neutron.spi.INeutronTrunkCRUD;
 import org.opendaylight.neutron.spi.NeutronTrunk;
+import org.ops4j.pax.cdi.api.OsgiService;
 
+@Singleton
 @Path("/trunks")
 public final class NeutronTrunksNorthbound
         extends AbstractNeutronNorthbound<NeutronTrunk, NeutronTrunkRequest, INeutronTrunkCRUD> {
 
     private static final String RESOURCE_NAME = "Trunk";
 
+    @Inject
+    public NeutronTrunksNorthbound(@OsgiService INeutronTrunkCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 2630c014d4ab5d9b6b6684efceece0fa9cf16838..7c6780ab6c2bf66d00ad41b7bdbc79d58d5321e9 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -26,16 +28,23 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
 import org.opendaylight.neutron.spi.INeutronVpnIkePolicyCRUD;
 import org.opendaylight.neutron.spi.NeutronVpnIkePolicy;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for VPN IKE Policy.
  */
+@Singleton
 @Path("/vpn/ikepolicies")
 public final class NeutronVpnIkePoliciesNorthbound
         extends AbstractNeutronNorthbound<NeutronVpnIkePolicy, NeutronVpnIkePolicyRequest, INeutronVpnIkePolicyCRUD> {
 
     private static final String RESOURCE_NAME = "VPNIKEPolicy";
 
+    @Inject
+    public NeutronVpnIkePoliciesNorthbound(@OsgiService INeutronVpnIkePolicyCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index e281e25efd3dcd33c95cbe455a7b2bbd0f830f3b..f557f5e8bba34560d15efad7ab7b7e72a29a281c 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -26,16 +28,23 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
 import org.opendaylight.neutron.spi.INeutronVpnIpSecPolicyCRUD;
 import org.opendaylight.neutron.spi.NeutronVpnIpSecPolicy;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for VPN IPSEC Policy.
  */
+@Singleton
 @Path("/vpn/ipsecpolicies")
 public final class NeutronVpnIpSecPoliciesNorthbound extends
         AbstractNeutronNorthbound<NeutronVpnIpSecPolicy, NeutronVpnIpSecPolicyRequest, INeutronVpnIpSecPolicyCRUD> {
 
     private static final String RESOURCE_NAME = "VPNIPSECPolicy";
 
+    @Inject
+    public NeutronVpnIpSecPoliciesNorthbound(@OsgiService INeutronVpnIpSecPolicyCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index 208919f828cd0474ec473cecb8e0ac24e51c0def..1a487801d91d3f91d742233b517f3cfa899891e1 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -26,10 +28,12 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
 import org.opendaylight.neutron.spi.INeutronVpnIpSecSiteConnectionsCRUD;
 import org.opendaylight.neutron.spi.NeutronVpnIpSecSiteConnection;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for VPN IPSEC SiteConnection.<br>
  */
+@Singleton
 @Path("/vpn/ipsecsiteconnections")
 public final class NeutronVpnIpSecSiteConnectionsNorthbound
         extends AbstractNeutronNorthbound<NeutronVpnIpSecSiteConnection,
@@ -37,6 +41,11 @@ public final class NeutronVpnIpSecSiteConnectionsNorthbound
 
     private static final String RESOURCE_NAME = "VPNIPSECSiteConnections";
 
+    @Inject
+    public NeutronVpnIpSecSiteConnectionsNorthbound(@OsgiService INeutronVpnIpSecSiteConnectionsCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;
index fec9fed615d543a65a96bbc2aee064add6bc1a24..8a1e75d1843ae616a0624dd5784e3ba511abb63b 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.neutron.northbound.api;
 import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -26,16 +28,23 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
 import org.opendaylight.neutron.spi.INeutronVpnServiceCRUD;
 import org.opendaylight.neutron.spi.NeutronVpnService;
+import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Neutron Northbound REST APIs for VPN Service.
  */
+@Singleton
 @Path("/vpn/vpnservices")
 public final class NeutronVpnServicesNorthbound
         extends AbstractNeutronNorthbound<NeutronVpnService, NeutronVpnServiceRequest, INeutronVpnServiceCRUD> {
 
     private static final String RESOURCE_NAME = "VpnService";
 
+    @Inject
+    public NeutronVpnServicesNorthbound(@OsgiService INeutronVpnServiceCRUD neutronCRUD) {
+        super(neutronCRUD);
+    }
+
     @Override
     protected String getResourceName() {
         return RESOURCE_NAME;