You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2013/01/18 23:23:44 UTC
[22/50] [abbrv] Clean up ApiServer,
ApiServlet and ApiDispatcher in handling various exceptions,
and Introduced ApiErrorCode to handle CloudStack API error code to standard
Http code mapping.
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index 7f1e7ef..60b2338 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -126,7 +127,7 @@ public class UpdateVMCmd extends BaseCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
index f2c3882..6c2e0f1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -98,7 +98,7 @@ public class UpgradeVMCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
index 9c2c602..ea28497 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
@@ -99,7 +99,7 @@ public class CreateVMGroupCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vm instance group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
index 47c2f76..3e9d1a2 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
@@ -73,7 +73,7 @@ public class DeleteVMGroupCmd extends BaseCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vm group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
index 09313c0..eb0d747 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
@@ -80,7 +80,7 @@ public class UpdateVMGroupCmd extends BaseCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm instance group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm instance group");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
index e48e4e4..e565295 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -125,7 +126,7 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
index 04541b9..0a0ba54 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.*;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -153,7 +154,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
this.setEntityId(volume.getId());
this.setEntityUuid(volume.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create volume");
}
}
@@ -179,7 +180,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
index 2b2e94c..6e3b4e1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -84,7 +85,7 @@ public class DeleteVolumeCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete volume");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
index c8ecdde..db17f58 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
@@ -132,7 +132,7 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
response.setResponseName("volume");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
index 43b25a8..40e46fd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
@@ -23,6 +23,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -148,11 +149,11 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
response.setUrl(uploadInfo.getUploadUrl());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume");
}
} catch (URISyntaxException ex) {
s_logger.info(ex);
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
index 30e672a..88076db 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.user.volume;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -98,7 +99,7 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
this.setResponseObject(response);
}
} catch (ConcurrentOperationException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: ");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume: ");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
index 4167ffd..e2c2c5b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
@@ -112,7 +112,7 @@ public class UploadVolumeCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
index 96de56a..adeec0d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpc;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.BaseCmd;
@@ -71,7 +72,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network rule conflict: ", ex);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
@@ -105,7 +106,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{
} finally {
if (!success || route == null) {
_vpcService.revokeStaticRoute(getEntityId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create static route");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create static route");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
index 8a2e1f6..ccd8675 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
@@ -24,6 +24,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -126,7 +127,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
this.setEntityId(vpc.getId());
this.setEntityUuid(vpc.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC");
}
}
@@ -139,14 +140,14 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
if (vpc != null) {
@@ -154,7 +155,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
index c9e4463..02d342e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
@@ -95,7 +95,7 @@ public class DeleteStaticRouteCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete static route");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete static route");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
index ed4e754..132556c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
@@ -71,14 +71,14 @@ public class DeleteVPCCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC");
}
}catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
index 4a23e6e..f28c4cb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
@@ -78,18 +78,18 @@ public class RestartVPCCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart VPC");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
index 2dc64db..d34f7bf 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpc;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -92,7 +93,7 @@ public class UpdateVPCCmd extends BaseAsyncCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
index f2d19a7..479e990 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -119,7 +120,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
}
VpnUsersResponse vpnResponse = new VpnUsersResponse();
@@ -144,7 +145,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password);
if (vpnUser == null) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
}
setEntityId(vpnUser.getId());
setEntityUuid(vpnUser.getUuid());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
index b517af8..ae09ef7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
@@ -148,12 +148,12 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
this.setEntityUuid(ipAddr.getUuid());
}
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (NetworkRuleConflictException e) {
s_logger.info("Network rule conflict: " + e.getMessage());
s_logger.trace("Network Rule Conflict: ", e);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
}
}
@@ -166,11 +166,11 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
index 3dc334d..327f35b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
@@ -94,12 +94,12 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
this.setEntityId(conn.getId());
this.setEntityUuid(conn.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection");
}
} catch (NetworkRuleConflictException e) {
s_logger.info("Network rule conflict: " + e.getMessage());
s_logger.trace("Network Rule Conflict: ", e);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
}
}
@@ -112,11 +112,11 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
index bde98b0..a14a5ec 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -160,7 +161,7 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create customer VPN gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create customer VPN gateway");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
index 4b40554..2d2150b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -86,7 +87,7 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPN gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPN gateway");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
index 23a7793..0652102 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
@@ -86,11 +86,11 @@ public class DeleteVpnConnectionCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete site to site VPN connection");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete site to site VPN connection");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
index 181ee3b..854bb9b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
@@ -84,7 +84,7 @@ public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
index 9ac27d0..6c89f7c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
@@ -85,7 +85,7 @@ public class DeleteVpnGatewayCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
index bdad7e3..11ca651 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
@@ -110,11 +111,11 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
Account owner = _accountService.getAccount(getEntityOwnerId());
boolean result = _ravService.removeVpnUser(owner.getId(), userName, UserContext.current().getCaller());
if (!result) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove vpn user");
}
if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user removal");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply vpn user removal");
}
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
index ed28ea5..14e2f8c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
@@ -104,11 +104,11 @@ public class ResetVpnConnectionCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reset site to site VPN connection");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset site to site VPN connection");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
index 7564129..27b656d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
@@ -155,7 +155,7 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update customer VPN gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update customer VPN gateway");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
index bad7ca7..18c3976 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
@@ -20,6 +20,7 @@ import com.cloud.user.User;
import com.cloud.user.UserContext;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
@@ -48,7 +49,7 @@ public class ListApisCmd extends BaseCmd {
User user = UserContext.current().getCallerUser();
ListResponse<ApiDiscoveryResponse> response = (ListResponse<ApiDiscoveryResponse>) _apiDiscoveryService.listApis(user, name);
if (response == null) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis");
}
response.setResponseName(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
index c87c924..671b9f4 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
@@ -21,6 +21,7 @@ import java.rmi.ServerException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -39,27 +40,27 @@ public class AssociateLunCmd extends BaseCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required = true, description="LUN name.")
private String lunName;
-
+
@Parameter(name=ApiConstants.IQN, type=CommandType.STRING, required = true, description="Guest IQN to which the LUN associate.")
private String guestIqn;
-
-
+
+
///////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
-
+
+
public String getLunName() {
return lunName;
}
-
+
public String getGuestIQN() {
return guestIqn;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -68,12 +69,12 @@ public class AssociateLunCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public void execute(){
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
-
+
try {
AssociateLunCmdResponse response = new AssociateLunCmdResponse();
String returnVals[] = null;
@@ -85,9 +86,9 @@ public class AssociateLunCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
}
@@ -96,5 +97,5 @@ public class AssociateLunCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
index 8c89730..fde0dc3 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
@@ -21,6 +21,7 @@ import java.rmi.ServerException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -39,21 +40,21 @@ import com.cloud.utils.component.ComponentLocator;
public class CreateLunCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateLunCmd.class.getName());
private static final String s_name = "createlunresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
-
+
@Parameter(name=ApiConstants.SIZE, type=CommandType.LONG, required = true, description="LUN size.")
private long size;
-
+
public String getPoolName() {
return poolName;
}
-
+
public long getLunSize() {
return size;
}
@@ -64,7 +65,7 @@ public class CreateLunCmd extends BaseCmd {
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
-
+
try {
CreateLunCmdResponse response = new CreateLunCmdResponse();
String returnVals[] = null;
@@ -76,11 +77,11 @@ public class CreateLunCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
-
+
}
@Override
@@ -94,5 +95,5 @@ public class CreateLunCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
index a2d4b96..5ca187d 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
@@ -20,6 +20,7 @@ import java.net.UnknownHostException;
import java.rmi.ServerException;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -40,64 +41,64 @@ public class CreateVolumeOnFilerCmd extends BaseCmd {
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required = true, description="ip address.")
private String ipAddress;
-
+
@Parameter(name=ApiConstants.AGGREGATE_NAME, type=CommandType.STRING, required = true, description="aggregate name.")
private String aggrName;
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
-
+
@Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.")
private String volName;
-
+
@Parameter(name=ApiConstants.SIZE, type=CommandType.INTEGER, required = true, description="volume size.")
private Integer volSize;
-
+
@Parameter(name=ApiConstants.SNAPSHOT_POLICY, type=CommandType.STRING, required = false, description="snapshot policy.")
private String snapshotPolicy;
-
+
@Parameter(name=ApiConstants.SNAPSHOT_RESERVATION, type=CommandType.INTEGER, required = false, description="snapshot reservation.")
private Integer snapshotReservation;
-
+
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="user name.")
private String userName;
-
+
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="password.")
private String password;
-
+
public String getIpAddress() {
return ipAddress;
}
-
+
public String getAggrName() {
return aggrName;
}
-
+
public String getPoolName() {
return poolName;
}
-
+
public String volName() {
return volName;
}
-
+
public Integer getVolSize() {
return volSize;
}
-
+
public String getSnapshotPolicy() {
return snapshotPolicy;
}
-
+
public Integer getSnapshotReservation() {
return snapshotReservation;
}
-
+
public String getUserName() {
return userName;
}
-
+
public String getPassword() {
return password;
}
@@ -109,26 +110,26 @@ public class CreateVolumeOnFilerCmd extends BaseCmd {
//param checks
if(snapshotReservation != null && (snapshotReservation<0 || snapshotReservation>100))
throw new InvalidParameterValueException("Invalid snapshot reservation");
-
+
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
-
+
StringBuilder s = new StringBuilder(getVolSize().toString());
s.append("g");
-
+
try {
netappMgr.createVolumeOnFiler(ipAddress, aggrName, poolName, volName, s.toString(), snapshotPolicy, snapshotReservation, userName, password);
CreateVolumeOnFilerCmdResponse response = new CreateVolumeOnFilerCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (UnknownHostException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
}
-
+
}
@Override
@@ -142,5 +143,5 @@ public class CreateVolumeOnFilerCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
index 9e38c5f..107f6b0 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
@@ -19,6 +19,7 @@ package com.cloud.api.commands.netapp;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -42,11 +43,11 @@ public class CreateVolumePoolCmd extends BaseCmd {
private String poolName;
@Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required = true, description="algorithm.")
private String algorithm;
-
+
public String getPoolName() {
return poolName;
}
-
+
public String getAlgorithm() {
return algorithm;
}
@@ -57,16 +58,16 @@ public class CreateVolumePoolCmd extends BaseCmd {
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
-
+
try {
CreateVolumePoolCmdResponse response = new CreateVolumePoolCmdResponse();
netappMgr.createPool(getPoolName(), getAlgorithm());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
-
+
}
@Override
@@ -80,5 +81,5 @@ public class CreateVolumePoolCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
index 1105ea5..a70b6d4 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
@@ -20,6 +20,7 @@ package com.cloud.api.commands.netapp;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -39,7 +40,7 @@ import com.cloud.utils.component.ComponentLocator;
public class DeleteVolumePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVolumePoolCmd.class.getName());
private static final String s_name = "deletepoolresponse";
-
+
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@@ -55,9 +56,9 @@ public class DeleteVolumePoolCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ResourceInUseException e) {
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
}
}
@@ -72,5 +73,5 @@ public class DeleteVolumePoolCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
index c5f7b11..1b3e6bc 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
@@ -21,6 +21,7 @@ import java.rmi.ServerException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -37,7 +38,7 @@ import com.cloud.utils.component.ComponentLocator;
@APICommand(name = "destroyLunOnFiler", description="Destroy a LUN", responseObject = DeleteLUNCmdResponse.class)
public class DestroyLunCmd extends BaseCmd {
-
+
public static final Logger s_logger = Logger.getLogger(DestroyLunCmd.class.getName());
private static final String s_name = "destroylunresponse";
@@ -56,9 +57,9 @@ public class DestroyLunCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ServerException e) {
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
}
}
@@ -73,5 +74,5 @@ public class DestroyLunCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
index 4ddc0c9..21e10b0 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
@@ -37,17 +37,17 @@ import com.cloud.utils.component.ComponentLocator;
public class DestroyVolumeOnFilerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DestroyVolumeOnFilerCmd.class.getName());
private static final String s_name = "destroyvolumeresponse";
-
+
@Parameter(name=ApiConstants.AGGREGATE_NAME, type=CommandType.STRING, required = true, description="aggregate name.")
private String aggrName;
-
+
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required = true, description="ip address.")
private String ipAddr;
-
+
@Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.")
private String volumeName;
-
-
+
+
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
@@ -60,13 +60,13 @@ public class DestroyVolumeOnFilerCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ResourceInUseException e) {
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
} catch (ServerException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
-
+
}
@Override
@@ -80,5 +80,5 @@ public class DestroyVolumeOnFilerCmd extends BaseCmd {
// TODO Auto-generated method stub
return 0;
}
-
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
index 0a6c1a7..f373c65 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
@@ -39,10 +39,10 @@ public class DissociateLunCmd extends BaseCmd {
@Parameter(name=ApiConstants.PATH, type=CommandType.STRING, required = true, description="LUN path.")
private String path;
-
+
@Parameter(name=ApiConstants.IQN, type=CommandType.STRING, required = true, description="Guest IQN.")
private String guestIQN;
-
+
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
@@ -55,9 +55,9 @@ public class DissociateLunCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ServerException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
index 630b149..61b81db 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -39,7 +40,7 @@ import com.cloud.server.api.response.netapp.ListLunsCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@APICommand(name = "listLunsOnFiler", description="List LUN", responseObject = ListLunsCmdResponse.class)
-public class ListLunsCmd extends BaseCmd
+public class ListLunsCmd extends BaseCmd
{
public static final Logger s_logger = Logger.getLogger(ListLunsCmd.class.getName());
private static final String s_name = "listlunresponse";
@@ -70,8 +71,8 @@ public class ListLunsCmd extends BaseCmd
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
- }
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
index d77f4fa..882cf1b 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ServerApiException;
@@ -64,9 +65,9 @@ public class ListVolumePoolsCmd extends BaseCmd {
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
- }
-
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
+ }
+
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
index 66a96f3..3cc98f4 100644
--- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
@@ -39,7 +39,7 @@ import com.cloud.utils.component.ComponentLocator;
public class ListVolumesOnFilerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ListVolumesOnFilerCmd.class.getName());
private static final String s_name = "listvolumesresponse";
-
+
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@@ -49,7 +49,7 @@ public class ListVolumesOnFilerCmd extends BaseCmd {
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
-
+
try {
List<NetappVolumeVO> volumes = netappMgr.listVolumesOnFiler(poolName);
ListResponse<ListVolumesOnFilerCmdResponse> listResponse = new ListResponse<ListVolumesOnFilerCmdResponse>();
@@ -71,9 +71,9 @@ public class ListVolumesOnFilerCmd extends BaseCmd {
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
-
+
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
index df81249..e6afcc9 100755
--- a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
@@ -20,6 +20,7 @@ import org.apache.log4j.Logger;
import com.cloud.agent.manager.SimulatorManager;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -62,7 +63,7 @@ public class ConfigureSimulator extends BaseCmd {
SimulatorManager _simMgr = locator.getManager(SimulatorManager.class);
boolean result = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command, values);
if (!result) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure simulator");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure simulator");
}
SuccessResponse response = new SuccessResponse(getCommandName());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java
index 3e45ce2..1496f29 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java
@@ -20,6 +20,7 @@ package com.cloud.api.commands;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -70,7 +71,7 @@ public class DeleteCiscoNexusVSMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to delete Cisco Nexus VSM device");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Cisco Nexus VSM device");
}
}
@@ -83,7 +84,7 @@ public class DeleteCiscoNexusVSMCmd extends BaseAsyncCmd {
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
index 9a7f6ad..67a7408 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
@@ -20,6 +20,7 @@ package com.cloud.api.commands;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -70,7 +71,7 @@ public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to disable Cisco Nexus VSM device");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable Cisco Nexus VSM device");
}
}
@@ -92,5 +93,5 @@ public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd {
@Override
public String getEventType() {
return EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE;
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
index 5dc6721..5064c9f 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
@@ -66,7 +66,7 @@ public class EnableCiscoNexusVSMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to enable Cisco Nexus VSM device");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable Cisco Nexus VSM device");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java
index ee6a01b..1ac00f9 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java
@@ -21,6 +21,7 @@ import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -44,7 +45,7 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd {
/**
* This command returns a list of all the VSMs configured in the management server.
- * If a clusterId is specified, it will return a list containing only that VSM
+ * If a clusterId is specified, it will return a list containing only that VSM
* that is associated with that cluster. If a zone is specified, it will pull
* up all the clusters of type vmware in that zone, and prepare a list of VSMs
* associated with those clusters.
@@ -60,7 +61,7 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd {
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType = ClusterResponse.class,
required = false, description="Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.")
private long clusterId;
-
+
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
required = false, description="Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.")
private long zoneId;
@@ -68,11 +69,11 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd {
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public long getClusterId() {
return clusterId;
}
-
+
public long getZoneId() {
return zoneId;
}
@@ -87,7 +88,7 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends CiscoNexusVSMDevice> vsmDeviceList = _ciscoNexusVSMService.getCiscoNexusVSMs(this);
-
+
if (vsmDeviceList.size() > 0) {
ListResponse<CiscoNexusVSMResponse> response = new ListResponse<CiscoNexusVSMResponse>();
List<CiscoNexusVSMResponse> vsmResponses = new ArrayList<CiscoNexusVSMResponse>();
@@ -101,10 +102,10 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseListCmd.INTERNAL_ERROR, "No VSM found.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "No VSM found.");
}
}
-
+
@Override
public String getCommandName() {
return s_name;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java
index 69a21fc..29a2c0b 100644
--- a/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java
+++ b/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java
@@ -21,6 +21,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
@@ -38,11 +39,11 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class AddExternalLoadBalancerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddExternalLoadBalancerCmd.class.getName());
private static final String s_name = "addexternalloadbalancerresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
required = true, description="Zone in which to add the external load balancer appliance.")
private Long zoneId;
@@ -59,19 +60,19 @@ public class AddExternalLoadBalancerCmd extends BaseCmd {
///////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public Long getZoneId() {
return zoneId;
}
-
+
public String getUrl() {
return url;
}
-
+
public String getUsername() {
return username;
}
-
+
public String getPassword() {
return password;
}
@@ -102,9 +103,9 @@ public class AddExternalLoadBalancerCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException ipve) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (CloudRuntimeException cre) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java
index a5616e0..839f60f 100644
--- a/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java
+++ b/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java
@@ -54,7 +54,7 @@ public class AddF5LoadBalancerCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="Credentials to reach F5 BigIP load balancer device")
private String username;
-
+
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Credentials to reach F5 BigIP load balancer device")
private String password;
@@ -99,12 +99,12 @@ public class AddF5LoadBalancerCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add F5 Big IP load balancer due to internal error.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add F5 Big IP load balancer due to internal error.");
}
} catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
@@ -117,7 +117,7 @@ public class AddF5LoadBalancerCmd extends BaseAsyncCmd {
public String getEventType() {
return EventTypes.EVENT_EXTERNAL_LB_DEVICE_ADD;
}
-
+
@Override
public String getCommandName() {
return s_name;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java
index e796b57..cc7d1be 100644
--- a/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java
+++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java
@@ -77,12 +77,12 @@ public class ConfigureF5LoadBalancerCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to configure F5 load balancer due to internal error.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure F5 load balancer due to internal error.");
}
} catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bdcfa191/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java
index d301571..29eaa0c 100644
--- a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java
+++ b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java
@@ -32,19 +32,19 @@ import com.cloud.user.Account;
public class DeleteExternalLoadBalancerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteExternalLoadBalancerCmd.class.getName());
private static final String s_name = "deleteexternalloadbalancerresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = HostResponse.class,
required = true, description="Id of the external loadbalancer appliance.")
private Long id;
-
+
///////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public Long getId() {
return id;
}
@@ -60,12 +60,12 @@ public class DeleteExternalLoadBalancerCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
try {
@@ -75,10 +75,10 @@ public class DeleteExternalLoadBalancerCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete external load balancer.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete external load balancer.");
}
} catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to delete external load balancer.");
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to delete external load balancer.");
}
}
}