You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/11/20 16:35:32 UTC
[45/51] [partial] Reformat all source code. Added checkstyle to check
the source code
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index b9a9f6d..729d876 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -31,7 +31,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "enableAccount", description="Enables an account", responseObject=AccountResponse.class)
+@APICommand(name = "enableAccount", description = "Enables an account", responseObject = AccountResponse.class)
public class EnableAccountCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(EnableAccountCmd.class.getName());
private static final String s_name = "enableaccountresponse";
@@ -39,18 +39,17 @@ public class EnableAccountCmd extends BaseCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=AccountResponse.class,
- description="Account id")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
private Long id;
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Enables specified account.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Enables specified account.")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="Enables specified account in this domain.")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Enables specified account in this domain.")
private Long domainId;
- @Inject RegionService _regionService;
+ @Inject
+ RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -93,9 +92,9 @@ public class EnableAccountCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
Account result = _regionService.enableAccount(this);
- if (result != null){
+ if (result != null) {
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
index f4aa3af..e098b39 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -26,7 +26,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "lockAccount", description="Locks an account", responseObject=AccountResponse.class)
+@APICommand(name = "lockAccount", description = "Locks an account", responseObject = AccountResponse.class)
public class LockAccountCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName());
@@ -36,11 +36,14 @@ public class LockAccountCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Locks the specified account.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, required = true, description = "Locks the specified account.")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- required=true, description="Locks the specified account on this domain.")
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.UUID,
+ entityType = DomainResponse.class,
+ required = true,
+ description = "Locks the specified account on this domain.")
private Long domainId;
/////////////////////////////////////////////////////
@@ -75,7 +78,7 @@ public class LockAccountCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
// Account result = null;
//result = _accountService.lockAccount(this);
// if (result != null){
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index 60d1a97..6542ebc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@ -34,8 +34,8 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "updateAccount", description="Updates account information for the authenticated user", responseObject=AccountResponse.class)
-public class UpdateAccountCmd extends BaseCmd{
+@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class)
+public class UpdateAccountCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateAccountCmd.class.getName());
private static final String s_name = "updateaccountresponse";
@@ -43,27 +43,28 @@ public class UpdateAccountCmd extends BaseCmd{
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=AccountResponse.class,
- description="Account id")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
private Long id;
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the current account name")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the current account name")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="the ID of the domain where the account exists")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the ID of the domain where the account exists")
private Long domainId;
- @Parameter(name=ApiConstants.NEW_NAME, type=CommandType.STRING, required=true, description="new name for the account")
+ @Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, required = true, description = "new name for the account")
private String newName;
- @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the account's networks; empty string will update domainName with NULL value")
+ @Parameter(name = ApiConstants.NETWORK_DOMAIN,
+ type = CommandType.STRING,
+ description = "Network domain for the account's networks; empty string will update domainName with NULL value")
private String networkDomain;
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map details;
- @Inject RegionService _regionService;
+ @Inject
+ RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -95,7 +96,7 @@ public class UpdateAccountCmd extends BaseCmd{
}
Collection paramsCollection = details.values();
- Map params = (Map) (paramsCollection.toArray())[0];
+ Map params = (Map)(paramsCollection.toArray())[0];
return params;
}
@@ -123,9 +124,9 @@ public class UpdateAccountCmd extends BaseCmd{
}
@Override
- public void execute(){
+ public void execute() {
Account result = _regionService.updateAccount(this);
- if (result != null){
+ if (result != null) {
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
index ebab8b5..3eb7679 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
@@ -114,5 +114,4 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd {
return Account.ACCOUNT_ID_SYSTEM;
}
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
index c5fe881..b9b6dd1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
@@ -41,8 +41,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=CounterResponse.class,
- required=true, description="the ID of the counter")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = CounterResponse.class, required = true, description = "the ID of the counter")
private Long id;
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index e8cb10b..67d2501 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -37,39 +37,40 @@ import com.cloud.exception.ResourceInUseException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
-@APICommand(name = "addCluster", description="Adds a new cluster", responseObject=ClusterResponse.class)
+@APICommand(name = "addCluster", description = "Adds a new cluster", responseObject = ClusterResponse.class)
public class AddClusterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName());
private static final String s_name = "addclusterresponse";
- @Parameter(name=ApiConstants.CLUSTER_NAME, type=CommandType.STRING, required=true, description="the cluster name")
+ @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, required = true, description = "the cluster name")
private String clusterName;
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=false, description="the password for the host")
+ @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = false, description = "the password for the host")
private String password;
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
- required=true, description="the Pod ID for the host")
+ @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "the Pod ID for the host")
private Long podId;
- @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the URL")
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, description = "the URL")
private String url;
- @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=false, description="the username for the cluster")
+ @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = false, description = "the username for the cluster")
private String username;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
- required=true, description="the Zone ID for the cluster")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the Zone ID for the cluster")
private Long zoneId;
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")
+ @Parameter(name = ApiConstants.HYPERVISOR,
+ type = CommandType.STRING,
+ required = true,
+ description = "hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")
private String hypervisor;
- @Parameter(name=ApiConstants.CLUSTER_TYPE, type=CommandType.STRING, required=true, description="type of the cluster: CloudManaged, ExternalManaged")
+ @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, required = true, description = "type of the cluster: CloudManaged, ExternalManaged")
private String clusterType;
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this cluster for allocation of new resources")
+ @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this cluster for allocation of new resources")
private String allocationState;
@Parameter(name = ApiConstants.VSM_USERNAME, type = CommandType.STRING, required = false, description = "the username for the VSM associated with this cluster")
@@ -81,16 +82,28 @@ public class AddClusterCmd extends BaseCmd {
@Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the VSM associated with this cluster")
private String vsmipaddress;
- @Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
+ @Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC,
+ type = CommandType.STRING,
+ required = false,
+ description = "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypeGuestTraffic;
- @Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
+ @Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC,
+ type = CommandType.STRING,
+ required = false,
+ description = "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypePublicTraffic;
- @Parameter(name = ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.")
+ @Parameter(name = ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC,
+ type = CommandType.STRING,
+ required = false,
+ description = "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.")
private String vSwitchNameGuestTraffic;
- @Parameter(name = ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.")
+ @Parameter(name = ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC,
+ type = CommandType.STRING,
+ required = false,
+ description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.")
private String vSwitchNamePublicTraffic;
public String getVSwitchTypeGuestTraffic() {
@@ -176,7 +189,7 @@ public class AddClusterCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
try {
List<? extends Cluster> result = _resourceService.discoverCluster(this);
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
index 4fece0c..12eb9bc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
@@ -28,7 +28,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "deleteCluster", description="Deletes a cluster.", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteCluster", description = "Deletes a cluster.", responseObject = SuccessResponse.class)
public class DeleteClusterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteClusterCmd.class.getName());
@@ -38,8 +38,7 @@ public class DeleteClusterCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ClusterResponse.class,
- required=true, description="the cluster ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "the cluster ID")
private Long id;
/////////////////////////////////////////////////////
@@ -65,7 +64,7 @@ public class DeleteClusterCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
boolean result = _resourceService.deleteCluster(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 0417b18..b74054a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -33,7 +33,7 @@ import org.apache.log4j.Logger;
import com.cloud.org.Cluster;
import com.cloud.utils.Pair;
-@APICommand(name = "listClusters", description="Lists clusters.", responseObject=ClusterResponse.class)
+@APICommand(name = "listClusters", description = "Lists clusters.", responseObject = ClusterResponse.class)
public class ListClustersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
@@ -43,34 +43,31 @@ public class ListClustersCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ClusterResponse.class,
- description="lists clusters by the cluster ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "lists clusters by the cluster ID")
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="lists clusters by the cluster name")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists clusters by the cluster name")
private String clusterName;
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
- description="lists clusters by Pod ID")
+ @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "lists clusters by Pod ID")
private Long podId;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
- description="lists clusters by Zone ID")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "lists clusters by Zone ID")
private Long zoneId;
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="lists clusters by hypervisor type")
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "lists clusters by hypervisor type")
private String hypervisorType;
- @Parameter(name=ApiConstants.CLUSTER_TYPE, type=CommandType.STRING, description="lists clusters by cluster type")
+ @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, description = "lists clusters by cluster type")
private String clusterType;
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="lists clusters by allocation state")
+ @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "lists clusters by allocation state")
private String allocationState;
- @Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
+ @Parameter(name = ApiConstants.MANAGED_STATE, type = CommandType.STRING, description = "whether this cluster is managed by cloudstack")
private String managedState;
- @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the clusters")
+ @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the clusters")
private Boolean showCapacities;
/////////////////////////////////////////////////////
@@ -105,7 +102,6 @@ public class ListClustersCmd extends BaseListCmd {
return allocationState;
}
-
public String getManagedstate() {
return managedState;
}
@@ -114,7 +110,6 @@ public class ListClustersCmd extends BaseListCmd {
this.managedState = managedstate;
}
-
public Boolean getShowCapacities() {
return showCapacities;
}
@@ -129,12 +124,12 @@ public class ListClustersCmd extends BaseListCmd {
}
@Override
- public void execute(){
+ public void execute() {
Pair<List<? extends Cluster>, Integer> result = _mgr.searchForClusters(this);
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();
for (Cluster cluster : result.first()) {
- ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster,showCapacities);
+ ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, showCapacities);
clusterResponse.setObjectName("cluster");
clusterResponses.add(clusterResponse);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index 34d05c0..7f5fa1f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -29,32 +29,30 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
-@APICommand(name = "updateCluster", description="Updates an existing cluster", responseObject=ClusterResponse.class)
+@APICommand(name = "updateCluster", description = "Updates an existing cluster", responseObject = ClusterResponse.class)
public class UpdateClusterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName());
private static final String s_name = "updateclusterresponse";
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ClusterResponse.class,
- required=true, description="the ID of the Cluster")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "the ID of the Cluster")
private Long id;
- @Parameter(name=ApiConstants.CLUSTER_NAME, type=CommandType.STRING, description="the cluster name")
+ @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, description = "the cluster name")
private String clusterName;
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="hypervisor type of the cluster")
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "hypervisor type of the cluster")
private String hypervisor;
- @Parameter(name=ApiConstants.CLUSTER_TYPE, type=CommandType.STRING, description="hypervisor type of the cluster")
+ @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, description = "hypervisor type of the cluster")
private String clusterType;
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this cluster for allocation of new resources")
+ @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this cluster for allocation of new resources")
private String allocationState;
- @Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
+ @Parameter(name = ApiConstants.MANAGED_STATE, type = CommandType.STRING, description = "whether this cluster is managed by cloudstack")
private String managedState;
-
public String getClusterName() {
return clusterName;
}
@@ -102,16 +100,16 @@ public class UpdateClusterCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
Cluster cluster = _resourceService.getCluster(getId());
if (cluster == null) {
throw new InvalidParameterValueException("Unable to find the cluster by id=" + getId());
}
- Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate());
- if (result != null) {
- ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false);
- clusterResponse.setResponseName(getCommandName());
- this.setResponseObject(clusterResponse);
+ Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate());
+ if (result != null) {
+ ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false);
+ clusterResponse.setResponseName(getCommandName());
+ this.setResponseObject(clusterResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update cluster");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
index bf80437..d6fe5e7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
@@ -46,19 +46,30 @@ public class ListCfgsByCmd extends BaseListCmd {
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name")
private String configName;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
+ @Parameter(name = ApiConstants.ZONE_ID,
+ type = CommandType.UUID,
+ entityType = ZoneResponse.class,
+ description = "the ID of the Zone to update the parameter value for corresponding zone")
private Long zone_id;
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
+ @Parameter(name = ApiConstants.CLUSTER_ID,
+ type = CommandType.UUID,
+ entityType = ClusterResponse.class,
+ description = "the ID of the Cluster to update the parameter value for corresponding cluster")
private Long cluster_id;
- @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ description = "the ID of the Storage pool to update the parameter value for corresponding storage pool")
private Long storagepool_id;
- @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
+ @Parameter(name = ApiConstants.ACCOUNT_ID,
+ type = CommandType.UUID,
+ entityType = AccountResponse.class,
+ description = "the ID of the Account to update the parameter value for corresponding account")
private Long account_id;
-
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -118,16 +129,16 @@ public class ListCfgsByCmd extends BaseListCmd {
for (Configuration cfg : result.first()) {
ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
cfgResponse.setObjectName("configuration");
- if(getZoneId() != null) {
+ if (getZoneId() != null) {
cfgResponse.setScope("zone");
}
- if(getClusterId() != null) {
+ if (getClusterId() != null) {
cfgResponse.setScope("cluster");
}
- if(getStoragepoolId() != null) {
+ if (getStoragepoolId() != null) {
cfgResponse.setScope("storagepool");
}
- if(getAccountId() != null) {
+ if (getAccountId() != null) {
cfgResponse.setScope("account");
}
configResponses.add(cfgResponse);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
index 598b620..237eb7a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
@@ -35,12 +35,10 @@ public class ListDeploymentPlannersCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -51,7 +49,7 @@ public class ListDeploymentPlannersCmd extends BaseListCmd {
}
@Override
- public void execute(){
+ public void execute() {
List<String> planners = _mgr.listDeploymentPlanners();
ListResponse<DeploymentPlannersResponse> response = new ListResponse<DeploymentPlannersResponse>();
List<DeploymentPlannersResponse> plannerResponses = new ArrayList<DeploymentPlannersResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
index f222027..184758a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
@@ -31,7 +31,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.utils.Pair;
-@APICommand(name = "listHypervisorCapabilities", description="Lists all hypervisor capabilities.", responseObject=HypervisorCapabilitiesResponse.class, since="3.0.0")
+@APICommand(name = "listHypervisorCapabilities", description = "Lists all hypervisor capabilities.", responseObject = HypervisorCapabilitiesResponse.class, since = "3.0.0")
public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListHypervisorCapabilitiesCmd.class.getName());
@@ -41,11 +41,10 @@ public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=HypervisorCapabilitiesResponse.class,
- description="ID of the hypervisor capability")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HypervisorCapabilitiesResponse.class, description = "ID of the hypervisor capability")
private Long id;
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search")
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor for which to restrict the search")
private String hypervisor;
/////////////////////////////////////////////////////
@@ -57,9 +56,9 @@ public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
}
public HypervisorType getHypervisor() {
- if(hypervisor != null){
+ if (hypervisor != null) {
return HypervisorType.getType(hypervisor);
- }else{
+ } else {
return null;
}
}
@@ -74,9 +73,9 @@ public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
}
@Override
- public void execute(){
- Pair<List<? extends HypervisorCapabilities>, Integer> hpvCapabilities = _mgr.listHypervisorCapabilities(getId(),
- getHypervisor(), getKeyword(), this.getStartIndex(), this.getPageSizeVal());
+ public void execute() {
+ Pair<List<? extends HypervisorCapabilities>, Integer> hpvCapabilities = _mgr.listHypervisorCapabilities(getId(), getHypervisor(), getKeyword(), this.getStartIndex(),
+ this.getPageSizeVal());
ListResponse<HypervisorCapabilitiesResponse> response = new ListResponse<HypervisorCapabilitiesResponse>();
List<HypervisorCapabilitiesResponse> hpvCapabilitiesResponses = new ArrayList<HypervisorCapabilitiesResponse>();
for (HypervisorCapabilities capability : hpvCapabilities.first()) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 3ebf804..c279478 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -29,7 +29,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "updateConfiguration", description="Updates a configuration.", responseObject=ConfigurationResponse.class)
+@APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class)
public class UpdateCfgCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateCfgCmd.class.getName());
private static final String s_name = "updateconfigurationresponse";
@@ -38,22 +38,34 @@ public class UpdateCfgCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the configuration")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the configuration")
private String cfgName;
- @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, description="the value of the configuration", length=4095)
+ @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "the value of the configuration", length = 4095)
private String value;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
+ @Parameter(name = ApiConstants.ZONE_ID,
+ type = CommandType.UUID,
+ entityType = ZoneResponse.class,
+ description = "the ID of the Zone to update the parameter value for corresponding zone")
private Long zone_id;
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
+ @Parameter(name = ApiConstants.CLUSTER_ID,
+ type = CommandType.UUID,
+ entityType = ClusterResponse.class,
+ description = "the ID of the Cluster to update the parameter value for corresponding cluster")
private Long cluster_id;
- @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ description = "the ID of the Storage pool to update the parameter value for corresponding storage pool")
private Long storagepool_id;
- @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
+ @Parameter(name = ApiConstants.ACCOUNT_ID,
+ type = CommandType.UUID,
+ entityType = AccountResponse.class,
+ description = "the ID of the Account to update the parameter value for corresponding account")
private Long account_id;
/////////////////////////////////////////////////////
@@ -99,21 +111,21 @@ public class UpdateCfgCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
Configuration cfg = _configService.updateConfiguration(this);
if (cfg != null) {
ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
response.setResponseName(getCommandName());
- if(getZoneId() != null) {
+ if (getZoneId() != null) {
response.setScope("zone");
}
- if(getClusterId() != null) {
+ if (getClusterId() != null) {
response.setScope("cluster");
}
- if(getStoragepoolId() != null) {
+ if (getStoragepoolId() != null) {
response.setScope("storagepool");
}
- if(getAccountId() != null) {
+ if (getAccountId() != null) {
response.setScope("account");
}
response.setValue(value);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
index 8728f91..1f2c852 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
@@ -27,7 +27,7 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
import org.apache.log4j.Logger;
-@APICommand(name = "updateHypervisorCapabilities", description="Updates a hypervisor capabilities.", responseObject=HypervisorCapabilitiesResponse.class, since="3.0.0")
+@APICommand(name = "updateHypervisorCapabilities", description = "Updates a hypervisor capabilities.", responseObject = HypervisorCapabilitiesResponse.class, since = "3.0.0")
public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateHypervisorCapabilitiesCmd.class.getName());
private static final String s_name = "updatehypervisorcapabilitiesresponse";
@@ -36,14 +36,13 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=HypervisorCapabilitiesResponse.class,
- description="ID of the hypervisor capability")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HypervisorCapabilitiesResponse.class, description = "ID of the hypervisor capability")
private Long id;
- @Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="set true to enable security group for this hypervisor.")
+ @Parameter(name = ApiConstants.SECURITY_GROUP_EANBLED, type = CommandType.BOOLEAN, description = "set true to enable security group for this hypervisor.")
private Boolean securityGroupEnabled;
- @Parameter(name=ApiConstants.MAX_GUESTS_LIMIT, type=CommandType.LONG, description="the max number of Guest VMs per host for this hypervisor.")
+ @Parameter(name = ApiConstants.MAX_GUESTS_LIMIT, type = CommandType.LONG, description = "the max number of Guest VMs per host for this hypervisor.")
private Long maxGuestsLimit;
/////////////////////////////////////////////////////
@@ -66,7 +65,6 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
@Override
public String getCommandName() {
return s_name;
@@ -78,9 +76,9 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
HypervisorCapabilities result = _mgr.updateHypervisorCapabilities(getId(), getMaxGuestsLimit(), getSecurityGroupEnabled());
- if (result != null){
+ if (result != null) {
HypervisorCapabilitiesResponse response = _responseGenerator.createHypervisorCapabilitiesResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
index c46318e..caac5bb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
@@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
import com.cloud.domain.Domain;
import com.cloud.user.Account;
-@APICommand(name = "createDomain", description="Creates a domain", responseObject=DomainResponse.class)
+@APICommand(name = "createDomain", description = "Creates a domain", responseObject = DomainResponse.class)
public class CreateDomainCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateDomainCmd.class.getName());
@@ -40,17 +40,19 @@ public class CreateDomainCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="creates domain with this name")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "creates domain with this name")
private String domainName;
- @Parameter(name=ApiConstants.PARENT_DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.")
+ @Parameter(name = ApiConstants.PARENT_DOMAIN_ID,
+ type = CommandType.UUID,
+ entityType = DomainResponse.class,
+ description = "assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.")
private Long parentDomainId;
- @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for networks in the domain")
+ @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for networks in the domain")
private String networkDomain;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.STRING, description="Domain UUID, required for adding domain from another Region")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.STRING, description = "Domain UUID, required for adding domain from another Region")
private String domainUUID;
/////////////////////////////////////////////////////
@@ -88,8 +90,8 @@ public class CreateDomainCmd extends BaseCmd {
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Domain Name: "+getDomainName()+((getParentDomainId()!=null)?", Parent DomainId :"+getParentDomainId():""));
+ public void execute() {
+ CallContext.current().setEventDetails("Domain Name: " + getDomainName() + ((getParentDomainId() != null) ? ", Parent DomainId :" + getParentDomainId() : ""));
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID());
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
index 6302c2e..a3adb61 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
@@ -35,7 +35,7 @@ import com.cloud.domain.Domain;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deleteDomain", description="Deletes a specified domain", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteDomain", description = "Deletes a specified domain", responseObject = SuccessResponse.class)
public class DeleteDomainCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteDomainCmd.class.getName());
private static final String s_name = "deletedomainresponse";
@@ -44,14 +44,16 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainResponse.class,
- required=true, description="ID of domain to delete")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, required = true, description = "ID of domain to delete")
private Long id;
- @Parameter(name=ApiConstants.CLEANUP, type=CommandType.BOOLEAN, description="true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise")
+ @Parameter(name = ApiConstants.CLEANUP,
+ type = CommandType.BOOLEAN,
+ description = "true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise")
private Boolean cleanup;
- @Inject RegionService _regionService;
+ @Inject
+ RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -91,12 +93,12 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "deleting domain: " + getId();
+ return "deleting domain: " + getId();
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Domain Id: "+getId());
+ public void execute() {
+ CallContext.current().setEventDetails("Domain Id: " + getId());
boolean result = _regionService.deleteDomain(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
index 26d8bbf..f8851da 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
@@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
import com.cloud.domain.Domain;
import com.cloud.utils.Pair;
-@APICommand(name = "listDomainChildren", description="Lists all children domains belonging to a specified domain", responseObject=DomainResponse.class)
+@APICommand(name = "listDomainChildren", description = "Lists all children domains belonging to a specified domain", responseObject = DomainResponse.class)
public class ListDomainChildrenCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDomainChildrenCmd.class.getName());
@@ -40,17 +40,20 @@ public class ListDomainChildrenCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="list children domain by parent domain ID.")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "list children domain by parent domain ID.")
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list children domains by name")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list children domains by name")
private String domainName;
- @Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="to return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".")
+ @Parameter(name = ApiConstants.IS_RECURSIVE,
+ type = CommandType.BOOLEAN,
+ description = "to return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".")
private Boolean recursive;
- @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN, description="If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
+ @Parameter(name = ApiConstants.LIST_ALL,
+ type = CommandType.BOOLEAN,
+ description = "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
private Boolean listAll;
/////////////////////////////////////////////////////
@@ -83,7 +86,7 @@ public class ListDomainChildrenCmd extends BaseListCmd {
}
@Override
- public void execute(){
+ public void execute() {
Pair<List<? extends Domain>, Integer> result = _domainService.searchForDomainChildren(this);
ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
index ed14194..3e09aa9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
@@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
import com.cloud.domain.Domain;
import com.cloud.utils.Pair;
-@APICommand(name = "listDomains", description="Lists domains and provides detailed information for listed domains", responseObject=DomainResponse.class)
+@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class)
public class ListDomainsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDomainsCmd.class.getName());
@@ -40,17 +40,18 @@ public class ListDomainsCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="List domain by domain ID.")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "List domain by domain ID.")
private Long id;
- @Parameter(name=ApiConstants.LEVEL, type=CommandType.INTEGER, description="List domains by domain level.")
+ @Parameter(name = ApiConstants.LEVEL, type = CommandType.INTEGER, description = "List domains by domain level.")
private Integer level;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List domain by domain name.")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List domain by domain name.")
private String domainName;
- @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN, description="If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
+ @Parameter(name = ApiConstants.LIST_ALL,
+ type = CommandType.BOOLEAN,
+ description = "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
private Boolean listAll;
/////////////////////////////////////////////////////
@@ -83,7 +84,7 @@ public class ListDomainsCmd extends BaseListCmd {
}
@Override
- public void execute(){
+ public void execute() {
Pair<List<? extends Domain>, Integer> result = _domainService.searchForDomains(this);
ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
index e4962d6..cac425f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
@@ -34,7 +34,7 @@ import com.cloud.domain.Domain;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
-@APICommand(name = "updateDomain", description="Updates a domain with a new name", responseObject=DomainResponse.class)
+@APICommand(name = "updateDomain", description = "Updates a domain with a new name", responseObject = DomainResponse.class)
public class UpdateDomainCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateDomainCmd.class.getName());
private static final String s_name = "updatedomainresponse";
@@ -43,17 +43,19 @@ public class UpdateDomainCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainResponse.class,
- required=true, description="ID of domain to update")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, required = true, description = "ID of domain to update")
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates domain with this name")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "updates domain with this name")
private String domainName;
- @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the domain's networks; empty string will update domainName with NULL value")
+ @Parameter(name = ApiConstants.NETWORK_DOMAIN,
+ type = CommandType.STRING,
+ description = "Network domain for the domain's networks; empty string will update domainName with NULL value")
private String networkDomain;
- @Inject RegionService _regionService;
+ @Inject
+ RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -86,9 +88,9 @@ public class UpdateDomainCmd extends BaseCmd {
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Domain Id: "+getId());
- Domain domain = _regionService.updateDomain(this);
+ public void execute() {
+ CallContext.current().setEventDetails("Domain Id: " + getId());
+ Domain domain = _regionService.updateDomain(this);
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
index 3a2f414..2ce1462 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
@@ -36,7 +36,7 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "addHost", description="Adds a new host.", responseObject=HostResponse.class)
+@APICommand(name = "addHost", description = "Adds a new host.", responseObject = HostResponse.class)
public class AddHostCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddHostCmd.class.getName());
@@ -46,37 +46,34 @@ public class AddHostCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class,
- description="the cluster ID for the host")
+ @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "the cluster ID for the host")
private Long clusterId;
- @Parameter(name=ApiConstants.CLUSTER_NAME, type=CommandType.STRING, description="the cluster name for the host")
+ @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, description = "the cluster name for the host")
private String clusterName;
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="the password for the host")
+ @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "the password for the host")
private String password;
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
- required=true, description="the Pod ID for the host")
+ @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "the Pod ID for the host")
private Long podId;
- @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the host URL")
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the host URL")
private String url;
- @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="the username for the host")
+ @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "the username for the host")
private String username;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
- required=true, description="the Zone ID for the host")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the Zone ID for the host")
private Long zoneId;
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the host")
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "hypervisor type of the host")
private String hypervisor;
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Host for allocation of new resources")
+ @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this Host for allocation of new resources")
private String allocationState;
- @Parameter(name=ApiConstants.HOST_TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="list of tags to be added to the host")
+ @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list of tags to be added to the host")
private List<String> hostTags;
/////////////////////////////////////////////////////
@@ -138,7 +135,7 @@ public class AddHostCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
try {
List<? extends Host> result = _resourceService.discoverHosts(this);
ListResponse<HostResponse> response = new ListResponse<HostResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
index 69a4a49..9e582d7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
@@ -31,7 +31,7 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
-@APICommand(name = "addSecondaryStorage", description="Adds secondary storage.", responseObject=ImageStoreResponse.class)
+@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class)
public class AddSecondaryStorageCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName());
private static final String s_name = "addsecondarystorageresponse";
@@ -40,15 +40,12 @@ public class AddSecondaryStorageCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL for the secondary storage")
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for the secondary storage")
protected String url;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
- description="the Zone ID for the secondary storage")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the secondary storage")
protected Long zoneId;
-
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -61,7 +58,6 @@ public class AddSecondaryStorageCmd extends BaseCmd {
return zoneId;
}
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -77,20 +73,20 @@ public class AddSecondaryStorageCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
AddImageStoreCmd cmd = new AddImageStoreCmd();
cmd.setUrl(this.getUrl());
cmd.setZoneId(this.getZoneId());
cmd.setProviderName("NFS");
- try{
+ try {
ImageStore result = _storageService.discoverImageStore(cmd);
ImageStoreResponse storeResponse = null;
- if (result != null ) {
- storeResponse = _responseGenerator.createImageStoreResponse(result);
- storeResponse.setResponseName(getCommandName());
- storeResponse.setObjectName("secondarystorage");
- this.setResponseObject(storeResponse);
+ if (result != null) {
+ storeResponse = _responseGenerator.createImageStoreResponse(result);
+ storeResponse.setResponseName(getCommandName());
+ storeResponse.setObjectName("secondarystorage");
+ this.setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
index 3179e50..8c22508 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
@@ -32,8 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "cancelHostMaintenance", description="Cancels host maintenance.", responseObject=HostResponse.class)
-public class CancelMaintenanceCmd extends BaseAsyncCmd {
+@APICommand(name = "cancelHostMaintenance", description = "Cancels host maintenance.", responseObject = HostResponse.class)
+public class CancelMaintenanceCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CancelMaintenanceCmd.class.getName());
private static final String s_name = "cancelhostmaintenanceresponse";
@@ -42,8 +42,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=HostResponse.class,
- required=true, description="the host ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID")
private Long id;
/////////////////////////////////////////////////////
@@ -84,7 +83,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "canceling maintenance for host: " + getId();
+ return "canceling maintenance for host: " + getId();
}
@Override
@@ -98,7 +97,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
}
@Override
- public void execute(){
+ public void execute() {
Host result = _resourceService.cancelMaintenance(this);
if (result != null) {
HostResponse response = _responseGenerator.createHostResponse(result);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
index e1cef62..d1747da 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
@@ -38,14 +38,17 @@ public class DeleteHostCmd extends BaseCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class,
- required = true, description = "the host ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID")
private Long id;
- @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, description = "Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped")
+ @Parameter(name = ApiConstants.FORCED,
+ type = CommandType.BOOLEAN,
+ description = "Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped")
private Boolean forced;
- @Parameter(name = ApiConstants.FORCED_DESTROY_LOCAL_STORAGE, type = CommandType.BOOLEAN, description = "Force destroy local storage on this host. All VMs created on this local storage will be destroyed")
+ @Parameter(name = ApiConstants.FORCED_DESTROY_LOCAL_STORAGE,
+ type = CommandType.BOOLEAN,
+ description = "Force destroy local storage on this host. All VMs created on this local storage will be destroyed")
private Boolean forceDestroyLocalStorage;
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
index e902e65..97229f4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
@@ -33,8 +33,7 @@ import com.cloud.host.Host;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
-@APICommand(name = "findHostsForMigration", description="Find hosts suitable for migrating a virtual machine.",
- responseObject=HostForMigrationResponse.class)
+@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class)
public class FindHostsForMigrationCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(FindHostsForMigrationCmd.class.getName());
@@ -44,9 +43,11 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
- required=true, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
- "CPU/RAM to host the VM")
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
+ required = true,
+ description = "find hosts to which this VM can be migrated and flag the hosts with enough " + "CPU/RAM to host the VM")
private Long virtualMachineId;
/////////////////////////////////////////////////////
@@ -69,11 +70,11 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
@Override
public void execute() {
ListResponse<HostForMigrationResponse> response = null;
- Pair<List<? extends Host>,Integer> result;
+ Pair<List<? extends Host>, Integer> result;
Map<Host, Boolean> hostsRequiringStorageMotion;
- Ternary<Pair<List<? extends Host>,Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
- _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
+ Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(),
+ this.getStartIndex(), this.getPageSizeVal());
result = hostsForMigration.first();
List<? extends Host> hostsWithCapacity = hostsForMigration.second();
hostsRequiringStorageMotion = hostsForMigration.third();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
index c6f1e70..3cee0d8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
@@ -41,7 +41,7 @@ import com.cloud.host.Host;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
-@APICommand(name = "listHosts", description="Lists hosts.", responseObject=HostResponse.class)
+@APICommand(name = "listHosts", description = "Lists hosts.", responseObject = HostResponse.class)
public class ListHostsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListHostsCmd.class.getName());
@@ -51,45 +51,49 @@ public class ListHostsCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType = ClusterResponse.class,
- description="lists hosts existing in particular cluster")
+ @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "lists hosts existing in particular cluster")
private Long clusterId;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = HostResponse.class,
- description="the id of the host")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the id of the host")
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the host")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the host")
private String hostName;
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = PodResponse.class,
- description="the Pod ID for the host")
+ @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID for the host")
private Long podId;
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the host")
+ @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "the state of the host")
private String state;
- @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the host type")
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the host type")
private String type;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- description="the Zone ID for the host")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the host")
private Long zoneId;
-
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
- required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
+ required = false,
+ description = "lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
private Long virtualMachineId;
- @Parameter(name=ApiConstants.RESOURCE_STATE, type=CommandType.STRING, description="list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]")
+ @Parameter(name = ApiConstants.RESOURCE_STATE,
+ type = CommandType.STRING,
+ description = "list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]")
private String resourceState;
- @Parameter(name=ApiConstants.DETAILS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]" )
+ @Parameter(name = ApiConstants.DETAILS,
+ type = CommandType.LIST,
+ collectionType = CommandType.STRING,
+ description = "comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]")
private List<String> viewDetails;
- @Parameter(name=ApiConstants.HA_HOST, type=CommandType.BOOLEAN, description="if true, list only hosts dedicated to HA")
+ @Parameter(name = ApiConstants.HA_HOST, type = CommandType.BOOLEAN, description = "if true, list only hosts dedicated to HA")
private Boolean haHost;
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")
private String hypervisor;
/////////////////////////////////////////////////////
@@ -127,7 +131,7 @@ public class ListHostsCmd extends BaseListCmd {
public Long getZoneId() {
return zoneId;
}
-
+
public Long getVirtualMachineId() {
return virtualMachineId;
}
@@ -138,18 +142,16 @@ public class ListHostsCmd extends BaseListCmd {
public EnumSet<HostDetails> getDetails() throws InvalidParameterValueException {
EnumSet<HostDetails> dv;
- if (viewDetails==null || viewDetails.size() <=0){
+ if (viewDetails == null || viewDetails.size() <= 0) {
dv = EnumSet.of(HostDetails.all);
- }
- else {
+ } else {
try {
ArrayList<HostDetails> dc = new ArrayList<HostDetails>();
- for (String detail: viewDetails){
+ for (String detail : viewDetails) {
dc.add(HostDetails.valueOf(detail));
}
dv = EnumSet.copyOf(dc);
- }
- catch (IllegalArgumentException e){
+ } catch (IllegalArgumentException e) {
throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(HostDetails.class));
}
}
@@ -159,6 +161,7 @@ public class ListHostsCmd extends BaseListCmd {
public String getResourceState() {
return resourceState;
}
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -173,14 +176,14 @@ public class ListHostsCmd extends BaseListCmd {
}
@Override
- public void execute(){
+ public void execute() {
ListResponse<HostResponse> response = null;
if (getVirtualMachineId() == null) {
response = _queryService.searchForServers(this);
} else {
- Pair<List<? extends Host>,Integer> result;
- Ternary<Pair<List<? extends Host>,Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
- _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
+ Pair<List<? extends Host>, Integer> result;
+ Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(),
+ this.getStartIndex(), this.getPageSizeVal());
result = hostsForMigration.first();
List<? extends Host> hostsWithCapacity = hostsForMigration.second();