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:20 UTC
[33/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/user/securitygroup/DeleteSecurityGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
index 43be88d..3e65811 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
@@ -33,7 +33,7 @@ import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceInUseException;
-@APICommand(name = "deleteSecurityGroup", description="Deletes security group", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteSecurityGroup", description = "Deletes security group", responseObject = SuccessResponse.class)
public class DeleteSecurityGroupCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSecurityGroupCmd.class.getName());
private static final String s_name = "deletesecuritygroupresponse";
@@ -42,22 +42,24 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the security group. Must be specified with domain ID")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the security group. Must be specified with domain ID")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, description="the domain ID of account owning the security group", entityType=DomainResponse.class)
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, description = "the domain ID of account owning the security group", entityType = DomainResponse.class)
private Long domainId;
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, description="the project of the security group", entityType=ProjectResponse.class)
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "the project of the security group", entityType = ProjectResponse.class)
private Long projectId;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with name parameter", entityType=SecurityGroupResponse.class)
+ @Parameter(name = ApiConstants.ID,
+ type = CommandType.UUID,
+ description = "The ID of the security group. Mutually exclusive with name parameter",
+ entityType = SecurityGroupResponse.class)
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="The ID of the security group. Mutually exclusive with id parameter")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The ID of the security group. Mutually exclusive with id parameter")
private String name;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -93,8 +95,6 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
return id;
}
-
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -115,8 +115,8 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
}
@Override
- public void execute(){
- try{
+ public void execute() {
+ try {
boolean result = _securityGroupService.deleteSecurityGroup(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/user/securitygroup/ListSecurityGroupsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
index 1cd09c9..950dd80 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
@@ -26,8 +26,7 @@ import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-
-@APICommand(name = "listSecurityGroups", description="Lists security groups", responseObject=SecurityGroupResponse.class)
+@APICommand(name = "listSecurityGroups", description = "Lists security groups", responseObject = SecurityGroupResponse.class)
public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListSecurityGroupsCmd.class.getName());
@@ -37,13 +36,13 @@ public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="lists security groups by name")
+ @Parameter(name = ApiConstants.SECURITY_GROUP_NAME, type = CommandType.STRING, description = "lists security groups by name")
private String securityGroupName;
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, description="lists security groups by virtual machine id", entityType=UserVmResponse.class)
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, description = "lists security groups by virtual machine id", entityType = UserVmResponse.class)
private Long virtualMachineId;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, description="list the security group by the id provided", entityType=SecurityGroupResponse.class)
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "list the security group by the id provided", entityType = SecurityGroupResponse.class)
private Long id;
/////////////////////////////////////////////////////
@@ -57,7 +56,7 @@ public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
return virtualMachineId;
}
- public Long getId(){
+ public Long getId() {
return id;
}
@@ -71,7 +70,7 @@ public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
}
@Override
- public void execute(){
+ public void execute() {
ListResponse<SecurityGroupResponse> response = _queryService.searchForSecurityGroups(this);
response.setResponseName(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
index c0a5295..79521cf 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
@@ -32,7 +32,7 @@ import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.user.Account;
-@APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since="3.0.0")
+@APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since = "3.0.0")
public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupEgressCmd.class.getName());
@@ -42,7 +42,7 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the egress rule", entityType=SecurityGroupRuleResponse.class)
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the egress rule", entityType = SecurityGroupRuleResponse.class)
private Long id;
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
index b96427b9..9433a3e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
@@ -42,7 +42,7 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the ingress rule", entityType=SecurityGroupRuleResponse.class)
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the ingress rule", entityType = SecurityGroupRuleResponse.class)
private Long id;
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index fc40fb2..233d4c4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -53,16 +53,19 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The account of the snapshot. The account parameter must be used with the domainId parameter.")
private String accountName;
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class,
- description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.UUID,
+ entityType = DomainResponse.class,
+ description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
private Long domainId;
- @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class,
- required = true, description = "The ID of the disk volume")
+ @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume")
private Long volumeId;
- @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class,
- description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
+ @Parameter(name = ApiConstants.POLICY_ID,
+ type = CommandType.UUID,
+ entityType = SnapshotPolicyResponse.class,
+ description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
private Long policyId;
@Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true")
@@ -110,7 +113,6 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
return _snapshotService.getHostIdForSnapshotOperation(volume);
}
-
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -175,7 +177,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Override
public void execute() {
s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
- CallContext.current().setEventDetails("Volume Id: "+getVolumeId());
+ CallContext.current().setEventDetails("Volume Id: " + getVolumeId());
Snapshot snapshot;
try {
snapshot = _volumeService.takeSnapshot(this.getVolumeId(), this.getPolicyId(), this.getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm());
@@ -191,7 +193,6 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
}
}
-
@Override
public String getSyncObjType() {
if (getSyncObjId() != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
index 14c2ee1..01c19b8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
@@ -33,7 +33,7 @@ import com.cloud.storage.Volume;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.user.Account;
-@APICommand(name = "createSnapshotPolicy", description="Creates a snapshot policy for the account.", responseObject=SnapshotPolicyResponse.class)
+@APICommand(name = "createSnapshotPolicy", description = "Creates a snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class)
public class CreateSnapshotPolicyCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSnapshotPolicyCmd.class.getName());
@@ -43,28 +43,26 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.INTERVAL_TYPE, type=CommandType.STRING, required=true, description="valid values are HOURLY, DAILY, WEEKLY, and MONTHLY")
+ @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, required = true, description = "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY")
private String intervalType;
- @Parameter(name=ApiConstants.MAX_SNAPS, type=CommandType.INTEGER, required=true, description="maximum number of snapshots to retain")
+ @Parameter(name = ApiConstants.MAX_SNAPS, type = CommandType.INTEGER, required = true, description = "maximum number of snapshots to retain")
private Integer maxSnaps;
- @Parameter(name=ApiConstants.SCHEDULE, type=CommandType.STRING, required=true, description="time the snapshot is scheduled to be taken. " +
- "Format is:" +
- "* if HOURLY, MM" +
- "* if DAILY, MM:HH" +
- "* if WEEKLY, MM:HH:DD (1-7)" +
- "* if MONTHLY, MM:HH:DD (1-28)")
+ @Parameter(name = ApiConstants.SCHEDULE, type = CommandType.STRING, required = true, description = "time the snapshot is scheduled to be taken. " + "Format is:"
+ + "* if HOURLY, MM" + "* if DAILY, MM:HH" + "* if WEEKLY, MM:HH:DD (1-7)"
+ + "* if MONTHLY, MM:HH:DD (1-28)")
private String schedule;
- @Parameter(name=ApiConstants.TIMEZONE, type=CommandType.STRING, required=true, description="Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
+ @Parameter(name = ApiConstants.TIMEZONE,
+ type = CommandType.STRING,
+ required = true,
+ description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
private String timezone;
- @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
- required=true, description="the ID of the disk volume")
+ @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume")
private Long volumeId;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -89,7 +87,6 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
return volumeId;
}
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -111,7 +108,8 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
Project project = _projectService.findByProjectAccountId(volume.getAccountId());
if (project.getState() != Project.State.Active) {
- PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() + " as it's no longer active");
+ PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() +
+ " as it's no longer active");
ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
@@ -123,7 +121,7 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
SnapshotPolicy result = _snapshotService.createPolicy(this, _accountService.getAccount(getEntityOwnerId()));
if (result != null) {
SnapshotPolicyResponse response = _responseGenerator.createSnapshotPolicyResponse(result);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
index 7892261..d8bd46f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
@@ -33,7 +33,7 @@ import com.cloud.event.EventTypes;
import com.cloud.storage.Snapshot;
import com.cloud.user.Account;
-@APICommand(name = "deleteSnapshot", description="Deletes a snapshot of a disk volume.", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class)
public class DeleteSnapshotCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSnapshotCmd.class.getName());
private static final String s_name = "deletesnapshotresponse";
@@ -42,8 +42,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotResponse.class,
- required=true, description="The ID of the snapshot")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotResponse.class, required = true, description = "The ID of the snapshot")
private Long id;
/////////////////////////////////////////////////////
@@ -80,7 +79,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "deleting snapshot: " + getId();
+ return "deleting snapshot: " + getId();
}
public ApiCommandJobType getInstanceType() {
@@ -92,8 +91,8 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Snapshot Id: "+getId());
+ public void execute() {
+ CallContext.current().setEventDetails("Snapshot Id: " + getId());
boolean result = _snapshotService.deleteSnapshot(getId());
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/user/snapshot/DeleteSnapshotPoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
index 5a75ea0..2e29d26 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
@@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "deleteSnapshotPolicies", description="Deletes snapshot policies for the account.", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteSnapshotPolicies", description = "Deletes snapshot policies for the account.", responseObject = SuccessResponse.class)
public class DeleteSnapshotPoliciesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSnapshotPoliciesCmd.class.getName());
@@ -40,12 +40,14 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotPolicyResponse.class,
- description="the Id of the snapshot policy")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class, description = "the Id of the snapshot policy")
private Long id;
- @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType = SnapshotPolicyResponse.class,
- description="list of snapshots policy IDs separated by comma")
+ @Parameter(name = ApiConstants.IDS,
+ type = CommandType.LIST,
+ collectionType = CommandType.UUID,
+ entityType = SnapshotPolicyResponse.class,
+ description = "list of snapshots policy IDs separated by comma")
private List<Long> ids;
/////////////////////////////////////////////////////
@@ -75,7 +77,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
boolean result = _snapshotService.deleteSnapshotPolicies(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/user/snapshot/ListSnapshotPoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
index f1c6010..077ed84 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
@@ -31,7 +31,7 @@ import org.apache.log4j.Logger;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.utils.Pair;
-@APICommand(name = "listSnapshotPolicies", description="Lists snapshot policies.", responseObject=SnapshotPolicyResponse.class)
+@APICommand(name = "listSnapshotPolicies", description = "Lists snapshot policies.", responseObject = SnapshotPolicyResponse.class)
public class ListSnapshotPoliciesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSnapshotPoliciesCmd.class.getName());
@@ -41,8 +41,7 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
- required=true, description="the ID of the disk volume")
+ @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume")
private Long volumeId;
/////////////////////////////////////////////////////
@@ -63,7 +62,7 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd {
}
@Override
- public void execute(){
+ public void execute() {
Pair<List<? extends SnapshotPolicy>, Integer> result = _snapshotService.listPoliciesforVolume(this);
ListResponse<SnapshotPolicyResponse> response = new ListResponse<SnapshotPolicyResponse>();
List<SnapshotPolicyResponse> policyResponses = new ArrayList<SnapshotPolicyResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index b101bb3..040cb05 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -33,7 +33,7 @@ import org.apache.log4j.Logger;
import com.cloud.storage.Snapshot;
import com.cloud.utils.Pair;
-@APICommand(name = "listSnapshots", description="Lists all available snapshots for the account.", responseObject=SnapshotResponse.class)
+@APICommand(name = "listSnapshots", description = "Lists all available snapshots for the account.", responseObject = SnapshotResponse.class)
public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListSnapshotsCmd.class.getName());
@@ -43,27 +43,24 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotResponse.class,
- description="lists snapshot by snapshot ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotResponse.class, description = "lists snapshot by snapshot ID")
private Long id;
- @Parameter(name=ApiConstants.INTERVAL_TYPE, type=CommandType.STRING, description="valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.")
+ @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, description = "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.")
private String intervalType;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="lists snapshot by snapshot name")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name")
private String snapshotName;
- @Parameter(name=ApiConstants.SNAPSHOT_TYPE, type=CommandType.STRING, description="valid values are MANUAL or RECURRING.")
+ @Parameter(name = ApiConstants.SNAPSHOT_TYPE, type = CommandType.STRING, description = "valid values are MANUAL or RECURRING.")
private String snapshotType;
- @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
- description="the ID of the disk volume")
+ @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "the ID of the disk volume")
private Long volumeId;
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id")
private Long zoneId;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -90,7 +87,7 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
public Long getZoneId() {
return zoneId;
- }
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -106,7 +103,7 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
}
@Override
- public void execute(){
+ public void execute() {
Pair<List<? extends Snapshot>, Integer> result = _snapshotService.listSnapshots(this);
ListResponse<SnapshotResponse> response = new ListResponse<SnapshotResponse>();
List<SnapshotResponse> snapshotResponses = new ArrayList<SnapshotResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
index 6e790e1..f11fa3f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
@@ -37,15 +37,13 @@ import com.cloud.user.Account;
@APICommand(name = "revertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class)
public class RevertSnapshotCmd extends BaseAsyncCmd {
private static final String s_name = "revertsnapshotresponse";
- @Parameter(name= ApiConstants.ID, type= BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class,
- required=true, description="The ID of the snapshot")
+ @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class, required = true, description = "The ID of the snapshot")
private Long id;
public Long getId() {
return id;
}
-
@Override
public String getCommandName() {
return s_name;
@@ -68,7 +66,7 @@ public class RevertSnapshotCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "revert snapshot: " + getId();
+ return "revert snapshot: " + getId();
}
@Override
@@ -82,8 +80,8 @@ public class RevertSnapshotCmd extends BaseAsyncCmd {
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Snapshot Id: "+getId());
+ public void execute() {
+ CallContext.current().setEventDetails("Snapshot Id: " + getId());
boolean result = _snapshotService.revertSnapshot(getId());
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/user/ssh/CreateSSHKeyPairCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
index e36bd73..b790efa 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
@@ -29,32 +29,31 @@ import org.apache.log4j.Logger;
import com.cloud.user.SSHKeyPair;
-@APICommand(name = "createSSHKeyPair", description="Create a new keypair and returns the private key", responseObject=CreateSSHKeyPairResponse.class)
+@APICommand(name = "createSSHKeyPair", description = "Create a new keypair and returns the private key", responseObject = CreateSSHKeyPairResponse.class)
public class CreateSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName());
private static final String s_name = "createsshkeypairresponse";
-
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the keypair")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the keypair")
private String name;
//Owner information
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the ssh key. Must be used with domainId.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
- description="an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.")
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.UUID,
+ entityType = DomainResponse.class,
+ description = "an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.")
private Long domainId;
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
- description="an optional project for the ssh key")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key")
private Long projectId;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
index eb2d237..4a58ee5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
@@ -29,7 +29,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
-@APICommand(name = "deleteSSHKeyPair", description="Deletes a keypair by name", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteSSHKeyPair", description = "Deletes a keypair by name", responseObject = SuccessResponse.class)
public class DeleteSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName());
private static final String s_name = "deletesshkeypairresponse";
@@ -38,18 +38,16 @@ public class DeleteSSHKeyPairCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the keypair")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the keypair")
private String name;
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the keypair. Must be used with the domainId parameter.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account associated with the keypair. Must be used with the domainId parameter.")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
- description="the domain ID associated with the keypair")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID associated with the keypair")
private Long domainId;
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
- description="the project associated with keypair")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "the project associated with keypair")
private Long projectId;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
index e1788ce..0136717 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
@@ -30,23 +30,21 @@ import org.apache.log4j.Logger;
import com.cloud.user.SSHKeyPair;
import com.cloud.utils.Pair;
-@APICommand(name = "listSSHKeyPairs", description="List registered keypairs", responseObject=SSHKeyPairResponse.class)
+@APICommand(name = "listSSHKeyPairs", description = "List registered keypairs", responseObject = SSHKeyPairResponse.class)
public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListSSHKeyPairsCmd.class.getName());
private static final String s_name = "listsshkeypairsresponse";
-
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="A key pair name to look for")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "A key pair name to look for")
private String name;
- @Parameter(name="fingerprint", type=CommandType.STRING, description="A public key fingerprint to look for")
+ @Parameter(name = "fingerprint", type = CommandType.STRING, description = "A public key fingerprint to look for")
private String fingerprint;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -59,7 +57,6 @@ public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd {
return fingerprint;
}
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
index 8530375..9bb3654 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
@@ -29,7 +29,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.SSHKeyPair;
-@APICommand(name = "registerSSHKeyPair", description="Register a public key in a keypair under a certain name", responseObject=SSHKeyPairResponse.class)
+@APICommand(name = "registerSSHKeyPair", description = "Register a public key in a keypair under a certain name", responseObject = SSHKeyPairResponse.class)
public class RegisterSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RegisterSSHKeyPairCmd.class.getName());
private static final String s_name = "registersshkeypairresponse";
@@ -38,22 +38,23 @@ public class RegisterSSHKeyPairCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the keypair")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the keypair")
private String name;
- @Parameter(name="publickey", type=CommandType.STRING, required=true, description="Public key material of the keypair", length=5120)
+ @Parameter(name = "publickey", type = CommandType.STRING, required = true, description = "Public key material of the keypair", length = 5120)
private String publicKey;
//Owner information
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the ssh key. Must be used with domainId.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
- description="an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.")
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.UUID,
+ entityType = DomainResponse.class,
+ description = "an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.")
private Long domainId;
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
- description="an optional project for the ssh key")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key")
private Long projectId;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
index 84226d7..346173c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
@@ -35,8 +35,9 @@ import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceTag.ResourceObjectType;
+
@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
-public class CreateTagsCmd extends BaseAsyncCmd{
+public class CreateTagsCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CreateTagsCmd.class.getName());
private static final String s_name = "createtagsresponse";
@@ -45,26 +46,28 @@ public class CreateTagsCmd extends BaseAsyncCmd{
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, required=true, description = "Map of tags (key/value pairs)")
+ @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, required = true, description = "Map of tags (key/value pairs)")
private Map tag;
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, required=true, description="type of the resource")
+ @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, description = "type of the resource")
private String resourceType;
- @Parameter(name=ApiConstants.RESOURCE_IDS, type=CommandType.LIST, required=true,
- collectionType=CommandType.STRING, description="list of resources to create the tags for")
+ @Parameter(name = ApiConstants.RESOURCE_IDS,
+ type = CommandType.LIST,
+ required = true,
+ collectionType = CommandType.STRING,
+ description = "list of resources to create the tags for")
private List<String> resourceIds;
- @Parameter(name=ApiConstants.CUSTOMER, type=CommandType.STRING, description="identifies client specific tag. " +
- "When the value is not null, the tag can't be used by cloudStack code internally")
+ @Parameter(name = ApiConstants.CUSTOMER, type = CommandType.STRING, description = "identifies client specific tag. "
+ + "When the value is not null, the tag can't be used by cloudStack code internally")
private String customer;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
- public ResourceObjectType getResourceType(){
+ public ResourceObjectType getResourceType() {
return _taggedResourceService.getResourceType(resourceType);
}
@@ -75,7 +78,7 @@ public class CreateTagsCmd extends BaseAsyncCmd{
Collection<?> servicesCollection = tag.values();
Iterator<?> iter = servicesCollection.iterator();
while (iter.hasNext()) {
- HashMap<String, String> services = (HashMap<String, String>) iter.next();
+ HashMap<String, String> services = (HashMap<String, String>)iter.next();
String key = services.get("key");
String value = services.get("value");
tagsMap.put(key, value);
@@ -104,7 +107,7 @@ public class CreateTagsCmd extends BaseAsyncCmd{
@Override
public long getEntityOwnerId() {
//FIXME - validate the owner here
- return 1;
+ return 1;
}
@Override
@@ -112,8 +115,8 @@ public class CreateTagsCmd extends BaseAsyncCmd{
List<ResourceTag> tags = _taggedResourceService.createTags(getResourceIds(), getResourceType(), getTags(), getCustomer());
if (tags != null && !tags.isEmpty()) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create tags");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
index 5ce2e37..1eaa9a3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
@@ -34,8 +34,9 @@ import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.server.ResourceTag.ResourceObjectType;
+
@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
-public class DeleteTagsCmd extends BaseAsyncCmd{
+public class DeleteTagsCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTagsCmd.class.getName());
private static final String s_name = "deletetagsresponse";
@@ -47,19 +48,17 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
@Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "Delete tags matching key/value pairs")
private Map tag;
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, required=true, description="Delete tag by resource type")
+ @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, description = "Delete tag by resource type")
private String resourceType;
- @Parameter(name=ApiConstants.RESOURCE_IDS, type=CommandType.LIST, required=true,
- collectionType=CommandType.STRING, description="Delete tags for resource id(s)")
+ @Parameter(name = ApiConstants.RESOURCE_IDS, type = CommandType.LIST, required = true, collectionType = CommandType.STRING, description = "Delete tags for resource id(s)")
private List<String> resourceIds;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
- public ResourceObjectType getResourceType(){
+ public ResourceObjectType getResourceType() {
return _taggedResourceService.getResourceType(resourceType);
}
@@ -70,7 +69,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
Collection<?> servicesCollection = tag.values();
Iterator<?> iter = servicesCollection.iterator();
while (iter.hasNext()) {
- HashMap<String, String> services = (HashMap<String, String>) iter.next();
+ HashMap<String, String> services = (HashMap<String, String>)iter.next();
String key = services.get("key");
String value = services.get("value");
tagsMap.put(key, value);
@@ -95,7 +94,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
@Override
public long getEntityOwnerId() {
//FIXME - validate the owner here
- return 1;
+ return 1;
}
@Override
@@ -103,8 +102,8 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
boolean success = _taggedResourceService.deleteTags(getResourceIds(), getResourceType(), getTags());
if (success) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete tags");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
index f80da20..893f6df 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
@@ -25,25 +25,24 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse;
@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "4.0.0")
-public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd{
+public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd {
private static final String s_name = "listtagsresponse";
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, description="list by resource type")
+ @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type")
private String resourceType;
- @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, description="list by resource id")
+ @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id")
private String resourceId;
- @Parameter(name=ApiConstants.KEY, type=CommandType.STRING, description="list by key")
+ @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key")
private String key;
- @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, description="list by value")
+ @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "list by value")
private String value;
- @Parameter(name=ApiConstants.CUSTOMER, type=CommandType.STRING, description="list by customer name")
+ @Parameter(name = ApiConstants.CUSTOMER, type = CommandType.STRING, description = "list by customer name")
private String customer;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -51,9 +50,9 @@ public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd{
@Override
public void execute() {
- ListResponse<ResourceTagResponse> response = _queryService.listTags(this);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ ListResponse<ResourceTagResponse> response = _queryService.listTags(this);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
}
public String getResourceType() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
index a25bd65..83fd4e7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
@@ -38,7 +38,7 @@ import com.cloud.exception.StorageUnavailableException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "copyTemplate", description="Copies a template from one zone to another.", responseObject=TemplateResponse.class)
+@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class)
public class CopyTemplateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CopyTemplateCmd.class.getName());
private static final String s_name = "copytemplateresponse";
@@ -47,19 +47,23 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.DESTINATION_ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- required=true, description="ID of the zone the template is being copied to.")
+ @Parameter(name = ApiConstants.DESTINATION_ZONE_ID,
+ type = CommandType.UUID,
+ entityType = ZoneResponse.class,
+ required = true,
+ description = "ID of the zone the template is being copied to.")
private Long destZoneId;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
- required=true, description="Template ID.")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "Template ID.")
private Long id;
- @Parameter(name=ApiConstants.SOURCE_ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- required=true, description="ID of the zone the template is currently hosted on.")
+ @Parameter(name = ApiConstants.SOURCE_ZONE_ID,
+ type = CommandType.UUID,
+ entityType = ZoneResponse.class,
+ required = true,
+ description = "ID of the zone the template is currently hosted on.")
private Long sourceZoneId;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -107,7 +111,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "copying template: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
+ return "copying template: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
}
public ApiCommandJobType getInstanceType() {
@@ -119,12 +123,12 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
}
@Override
- public void execute() throws ResourceAllocationException{
+ public void execute() throws ResourceAllocationException {
try {
CallContext.current().setEventDetails(getEventDescription());
VirtualMachineTemplate template = _templateService.copyTemplate(this);
- if (template != null){
+ if (template != null) {
List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(template, getDestinationZoneId(), false);
TemplateResponse response = new TemplateResponse();
if (listResponse != null && !listResponse.isEmpty()) {
@@ -142,4 +146,3 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
}
}
}
-
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index 6116a4e..3f05f6c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -46,9 +46,11 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
-@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
- + "A template created from this command is automatically designated as a private template visible to the account that created it.")
- public class CreateTemplateCmd extends BaseAsyncCreateCmd {
+@APICommand(name = "createTemplate",
+ responseObject = TemplateResponse.class,
+ description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
+ + "A template created from this command is automatically designated as a private template visible to the account that created it.")
+public class CreateTemplateCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateTemplateCmd.class.getName());
private static final String s_name = "createtemplateresponse";
@@ -59,7 +61,11 @@ import java.util.Map;
@Parameter(name = ApiConstants.BITS, type = CommandType.INTEGER, description = "32 or 64 bit")
private Integer bits;
- @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "the display text of the template. This is usually used for display purposes.", length=4096)
+ @Parameter(name = ApiConstants.DISPLAY_TEXT,
+ type = CommandType.STRING,
+ required = true,
+ description = "the display text of the template. This is usually used for display purposes.",
+ length = 4096)
private String displayText;
@Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if this template is a featured template, false otherwise")
@@ -71,8 +77,11 @@ import java.util.Map;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the template")
private String templateName;
- @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class,
- required = true, description = "the ID of the OS Type that best represents the OS of this template.")
+ @Parameter(name = ApiConstants.OS_TYPE_ID,
+ type = CommandType.UUID,
+ entityType = GuestOSResponse.class,
+ required = true,
+ description = "the ID of the OS Type that best represents the OS of this template.")
private Long osTypeId;
@Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the password reset feature; default is false")
@@ -81,35 +90,42 @@ import java.util.Map;
@Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requres HVM, false otherwise")
private Boolean requiresHvm;
- @Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.UUID, entityType = SnapshotResponse.class,
- description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
+ @Parameter(name = ApiConstants.SNAPSHOT_ID,
+ type = CommandType.UUID,
+ entityType = SnapshotResponse.class,
+ description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
private Long snapshotId;
- @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class,
- description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
+ @Parameter(name = ApiConstants.VOLUME_ID,
+ type = CommandType.UUID,
+ entityType = VolumeResponse.class,
+ description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
private Long volumeId;
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
- description="Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal")
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
+ description = "Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal")
private Long vmId;
- @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server")
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server")
private String url;
- @Parameter(name=ApiConstants.TEMPLATE_TAG, type=CommandType.STRING, description="the tag for this template.")
+ @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.")
private String templateTag;
- @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
+ @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Template details in key/value pairs.")
protected Map details;
- @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+ @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
+ type = CommandType.BOOLEAN,
+ description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
protected Boolean isDynamicallyScalable;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
-
public Integer getBits() {
return bits;
}
@@ -168,7 +184,7 @@ import java.util.Map;
}
Collection paramsCollection = details.values();
- Map params = (Map) (paramsCollection.toArray())[0];
+ Map params = (Map)(paramsCollection.toArray())[0];
return params;
}
@@ -215,7 +231,8 @@ import java.util.Map;
if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
Project project = _projectService.findByProjectAccountId(accountId);
if (project.getState() != Project.State.Active) {
- PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() + " as it's no longer active");
+ PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() +
+ " as it's no longer active");
ex.addProxyObject(project.getUuid(), "projectId");
}
} else if (account.getState() == Account.State.disabled) {
@@ -252,19 +269,19 @@ import java.util.Map;
this.setEntityId(template.getId());
this.setEntityUuid(template.getUuid());
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
- "Failed to create a template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a template");
}
}
@Override
public void execute() {
- CallContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
+ CallContext.current().setEventDetails(
+ "Template Id: " + getEntityId() + ((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
VirtualMachineTemplate template = null;
template = this._templateService.createPrivateTemplate(this);
- if (template != null){
+ if (template != null) {
List<TemplateResponse> templateResponses;
if (isBareMetal()) {
templateResponses = _responseGenerator.createTemplateResponses(template.getId(), vmId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
index bfaff99..043eb9f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
@@ -34,7 +34,9 @@ import com.cloud.event.EventTypes;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "deleteTemplate", responseObject=SuccessResponse.class, description="Deletes a template from the system. All virtual machines using the deleted template will not be affected.")
+@APICommand(name = "deleteTemplate",
+ responseObject = SuccessResponse.class,
+ description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.")
public class DeleteTemplateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTemplateCmd.class.getName());
private static final String s_name = "deletetemplateresponse";
@@ -43,15 +45,12 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
- required=true, description="the ID of the template")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template")
private Long id;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- description="the ID of zone of the template")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of zone of the template")
private Long zoneId;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -64,7 +63,6 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
return zoneId;
}
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -107,8 +105,8 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Template Id: "+getId());
+ public void execute() {
+ CallContext.current().setEventDetails("Template Id: " + getId());
boolean result = _templateService.deleteTemplate(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/user/template/ExtractTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
index 0f1b3c6..69c304f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
@@ -36,7 +36,7 @@ import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
-@APICommand(name = "extractTemplate", description="Extracts a template", responseObject=ExtractResponse.class)
+@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class)
public class ExtractTemplateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ExtractTemplateCmd.class.getName());
@@ -46,18 +46,20 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
- required=true, description="the ID of the template")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template")
private Long id;
- @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the url to which the ISO would be extracted")
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, description = "the url to which the ISO would be extracted")
private String url;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- required=false, description="the ID of the zone where the ISO is originally located" )
+ @Parameter(name = ApiConstants.ZONE_ID,
+ type = CommandType.UUID,
+ entityType = ZoneResponse.class,
+ required = false,
+ description = "the ID of the zone where the ISO is originally located")
private Long zoneId;
- @Parameter(name=ApiConstants.MODE, type=CommandType.STRING, required=true, description="the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD")
+ @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD")
private String mode;
/////////////////////////////////////////////////////
@@ -111,7 +113,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "extracting template: " + getId() + " from zone: " + getZoneId();
+ return "extracting template: " + getId() + " from zone: " + getZoneId();
}
public ApiCommandJobType getInstanceType() {
@@ -123,7 +125,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
}
@Override
- public void execute(){
+ public void execute() {
try {
CallContext.current().setEventDetails(getEventDescription());
String uploadUrl = _templateService.extract(this);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
index d727a33..c739bba 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
@@ -24,7 +24,9 @@ import org.apache.log4j.Logger;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.template.VirtualMachineTemplate;
-@APICommand(name = "listTemplatePermissions", description="List template visibility and all accounts that have permissions to view this template.", responseObject=TemplatePermissionsResponse.class)
+@APICommand(name = "listTemplatePermissions",
+ description = "List template visibility and all accounts that have permissions to view this template.",
+ responseObject = TemplatePermissionsResponse.class)
public class ListTemplatePermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd {
protected String getResponseName() {
return "listtemplatepermissionsresponse";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index 4b34909..aa1e6b3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -37,7 +37,7 @@ import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
-@APICommand(name = "listTemplates", description="List all public, private, and privileged templates.", responseObject=TemplateResponse.class)
+@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class)
public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListTemplatesCmd.class.getName());
@@ -47,29 +47,30 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @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;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=TemplateResponse.class,
- description="the template ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the template ID")
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the template name")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the template name")
private String templateName;
- @Parameter(name=ApiConstants.TEMPLATE_FILTER, type=CommandType.STRING, required=true, description="possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " +
- "* featured : templates that have been marked as featured and public. " +
- "* self : templates that have been registered or created by the calling user. " +
- "* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. " +
- "* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. " +
- "* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. " +
- "* community : templates that have been marked as public but not featured. " +
- "* all : all templates (only usable by admins).")
+ @Parameter(name = ApiConstants.TEMPLATE_FILTER,
+ type = CommandType.STRING,
+ required = true,
+ description = "possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". "
+ + "* featured : templates that have been marked as featured and public. "
+ + "* self : templates that have been registered or created by the calling user. "
+ + "* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. "
+ + "* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. "
+ + "* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. "
+ + "* community : templates that have been marked as public but not featured. " + "* all : all templates (only usable by admins).")
private String templateFilter;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- description="list templates by zoneId")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list templates by zoneId")
private Long zoneId;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -101,8 +102,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
// Show only those that are downloaded.
TemplateFilter templateFilter = TemplateFilter.valueOf(getTemplateFilter());
- boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable)
- || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
+ boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) ||
+ (templateFilter == TemplateFilter.sharedexecutable) || (templateFilter == TemplateFilter.executable && isAccountSpecific) ||
+ (templateFilter == TemplateFilter.community);
return onlyReady;
}
@@ -120,7 +122,7 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
}
@Override
- public void execute(){
+ public void execute() {
ListResponse<TemplateResponse> response = _queryService.listTemplates(this);
response.setResponseName(getCommandName());
this.setResponseObject(response);