northbound: introduce a base class for nortubhound classes
[neutron.git] / northbound-api / src / main / java / org / opendaylight / neutron / northbound / api / NeutronVPNServicesNorthbound.java
index 0825b0a25a227873a3027923fc5ce426873081d0..59a33161360eb75c63d06a12e4ed62532e5a5ecb 100644 (file)
@@ -55,14 +55,9 @@ import org.opendaylight.neutron.spi.NeutronVPNService;
  */
 
 @Path("/vpn/vpnservices")
-public class NeutronVPNServicesNorthbound {
+public class NeutronVPNServicesNorthbound extends AbstractNeutronNorthbound {
 
-    private static final int HTTP_OK_BOTTOM = 200;
-    private static final int HTTP_OK_TOP = 299;
-    private static final String INTERFACE_NAME = "VPNService CRUD Interface";
-    private static final String UUID_NO_EXIST = "VPNService UUID does not exist.";
-    private static final String NO_PROVIDERS = "No providers registered.  Please try again later";
-    private static final String NO_PROVIDER_LIST = "Couldn't get providers list.  Please try again later";
+    private static final String RESOURCE_NAME = "VPNService";
 
     private NeutronVPNService extractFields(NeutronVPNService o, List<String> fields) {
         return o.extractFields(fields);
@@ -74,8 +69,7 @@ public class NeutronVPNServicesNorthbound {
     private NeutronCRUDInterfaces getNeutronInterfaces() {
         NeutronCRUDInterfaces answer = new NeutronCRUDInterfaces().fetchINeutronVPNServiceCRUD(this);
         if (answer.getVPNServiceInterface() == null) {
-            throw new ServiceUnavailableException(INTERFACE_NAME
-                + RestMessages.SERVICEUNAVAILABLE.toString());
+            throw new ServiceUnavailableException(serviceUnavailable(RESOURCE_NAME));
         }
         return answer;
     }
@@ -148,7 +142,7 @@ public class NeutronVPNServicesNorthbound {
             @QueryParam("fields") List<String> fields) {
         INeutronVPNServiceCRUD VPNServiceInterface = getNeutronInterfaces().getVPNServiceInterface();
         if (!VPNServiceInterface.neutronVPNServiceExists(serviceID)) {
-            throw new ResourceNotFoundException(UUID_NO_EXIST);
+            throw new ResourceNotFoundException(uuidNoExist(RESOURCE_NAME));
         }
         if (fields.size() > 0) {
             NeutronVPNService ans = VPNServiceInterface.getVPNService(serviceID);