You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/04 11:02:56 UTC
[33/55] [abbrv] api_refactor: refactor project apis
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListSwiftsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSwiftsCmd.java b/api/src/com/cloud/api/commands/ListSwiftsCmd.java
index ec030c8..5c4563a 100644
--- a/api/src/com/cloud/api/commands/ListSwiftsCmd.java
+++ b/api/src/com/cloud/api/commands/ListSwiftsCmd.java
@@ -35,7 +35,7 @@ import com.cloud.user.Account;
public class ListSwiftsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
private static final String s_name = "listswiftsresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -54,14 +54,14 @@ public class ListSwiftsCmd extends BaseListCmd {
@Override
public String getCommandName() {
- return s_name;
+ return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
List<? extends Swift> result = _resourceService.listSwifts(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
index e8c01cc..1378e98 100644
--- a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
+++ b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
@@ -66,7 +66,7 @@ public class ListSystemVMsCmd extends BaseListCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the system VM")
private Long zoneId;
-
+
@IdentityMapper(entityTableName="storage_pool")
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to", since="3.0.1")
private Long storageId;
@@ -102,7 +102,7 @@ public class ListSystemVMsCmd extends BaseListCmd {
public Long getZoneId() {
return zoneId;
}
-
+
public Long getStorageId() {
return storageId;
}
@@ -115,11 +115,11 @@ public class ListSystemVMsCmd extends BaseListCmd {
public String getCommandName() {
return s_name;
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.SystemVm;
+ return AsyncJob.Type.SystemVm;
}
-
+
@Override
public void execute(){
Pair<List<? extends VirtualMachine>, Integer> systemVMs = _mgr.searchForSystemVm(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListTagsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTagsCmd.java b/api/src/com/cloud/api/commands/ListTagsCmd.java
index 5fe49d4..8b61b66 100644
--- a/api/src/com/cloud/api/commands/ListTagsCmd.java
+++ b/api/src/com/cloud/api/commands/ListTagsCmd.java
@@ -32,30 +32,30 @@ import com.cloud.utils.Pair;
@Implementation(description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "Burbank")
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")
private String resourceType;
-
+
@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")
private String key;
-
+
@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")
private String customer;
-
-
+
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
-
+
Pair<List<? extends ResourceTag>, Integer> tags = _taggedResourceService.listTags(this);
ListResponse<ResourceTagResponse> response = new ListResponse<ResourceTagResponse>();
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
@@ -64,7 +64,7 @@ public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd{
tagResponses.add(tagResponse);
}
response.setResponses(tagResponses, tags.second());
-
+
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
@@ -89,7 +89,7 @@ public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd{
public String getCommandName() {
return s_name;
}
-
+
public String getCustomer() {
return customer;
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java b/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
index bb3be6a..bbae302 100644
--- a/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
@@ -32,7 +32,7 @@ import com.cloud.user.UserContext;
@Implementation(description="List template visibility and all accounts that have permissions to view this template.", responseObject=TemplatePermissionsResponse.class)
public class ListTemplateOrIsoPermissionsCmd extends BaseCmd {
- public Logger s_logger = getLogger();
+ public Logger s_logger = getLogger();
protected String s_name = "listtemplatepermissionsresponse";
/////////////////////////////////////////////////////
@@ -68,23 +68,23 @@ public class ListTemplateOrIsoPermissionsCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
- return true;
+ return true;
}
-
+
public String getMediaType() {
- return "templateOrIso";
+ return "templateOrIso";
}
-
+
protected Logger getLogger() {
- return Logger.getLogger(UpdateTemplateOrIsoPermissionsCmd.class.getName());
+ return Logger.getLogger(UpdateTemplateOrIsoPermissionsCmd.class.getName());
}
-
+
@Override
public void execute(){
List<String> accountNames = _templateService.listTemplatePermissions(this);
-
+
Account account = UserContext.current().getCaller();
boolean isAdmin = (isAdmin(account.getType()));
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java b/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
index af90df9..6e118d9 100644
--- a/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
+++ b/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
@@ -25,17 +25,17 @@ public class ListTemplatePermissionsCmd extends ListTemplateOrIsoPermissionsCmd
protected String getResponseName() {
return "listtemplatepermissionsresponse";
}
-
+
@Override
public String getMediaType() {
return "template";
}
-
+
@Override
protected Logger getLogger() {
- return Logger.getLogger(ListTemplatePermissionsCmd.class.getName());
+ return Logger.getLogger(ListTemplatePermissionsCmd.class.getName());
}
-
+
protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
return !template.getFormat().equals(ImageFormat.ISO);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTemplatesCmd.java b/api/src/com/cloud/api/commands/ListTemplatesCmd.java
index 362a27c..ca5dd73 100755
--- a/api/src/com/cloud/api/commands/ListTemplatesCmd.java
+++ b/api/src/com/cloud/api/commands/ListTemplatesCmd.java
@@ -56,10 +56,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
private String templateName;
@Parameter(name=ApiConstants.TEMPLATE_FILTER, type=CommandType.STRING, required=true, description="possible values are \"featured\", \"self\", \"self-executable\", \"executable\", and \"community\"." +
- "* featured-templates that are featured and are public" +
- "* self-templates that have been registered/created by the owner" +
- "* selfexecutable-templates that have been registered/created by the owner that can be used to deploy a new VM" +
- "* executable-all templates that can be used to deploy a new VM* community-templates that are public.")
+ "* featured-templates that are featured and are public" +
+ "* self-templates that have been registered/created by the owner" +
+ "* selfexecutable-templates that have been registered/created by the owner that can be used to deploy a new VM" +
+ "* executable-all templates that can be used to deploy a new VM* community-templates that are public.")
private String templateFilter;
@IdentityMapper(entityTableName="data_center")
@@ -88,9 +88,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
public Long getZoneId() {
return zoneId;
}
-
+
public boolean listInReadyState() {
-
+
Account account = UserContext.current().getCaller();
// It is account specific if account is admin type and domainId and accountName are not null
boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
@@ -109,11 +109,11 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
public String getCommandName() {
return s_name;
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Template;
+ return AsyncJob.Type.Template;
}
-
+
@Override
public void execute(){
Set<Pair<Long, Long>> templateZonePairSet = _mgr.listTemplates(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java b/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
index afff055..ed1ec43 100755
--- a/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
+++ b/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
@@ -38,49 +38,49 @@ import com.cloud.utils.Pair;
@Implementation(description="Lists implementors of implementor of a network traffic type or implementors of all network traffic types", responseObject=TrafficTypeImplementorResponse.class, since="3.0.0")
public class ListTrafficTypeImplementorsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListTrafficTypeImplementorsCmd.class);
- private static final String _name = "listtraffictypeimplementorsresponse";
-
+ public static final Logger s_logger = Logger.getLogger(ListTrafficTypeImplementorsCmd.class);
+ private static final String _name = "listtraffictypeimplementorsresponse";
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor")
private String trafficType;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public String getTrafficType() {
- return trafficType;
+ return trafficType;
}
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
- List<Pair<TrafficType, String>> results = _networkService.listTrafficTypeImplementor(this);
- ListResponse<TrafficTypeImplementorResponse> response = new ListResponse<TrafficTypeImplementorResponse>();
- List<TrafficTypeImplementorResponse> responses= new ArrayList<TrafficTypeImplementorResponse>();
- for (Pair<TrafficType, String> r : results) {
- TrafficTypeImplementorResponse p = new TrafficTypeImplementorResponse();
- p.setTrafficType(r.first().toString());
- p.setImplementor(r.second());
- p.setObjectName("traffictypeimplementorresponse");
- responses.add(p);
- }
-
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException {
+ List<Pair<TrafficType, String>> results = _networkService.listTrafficTypeImplementor(this);
+ ListResponse<TrafficTypeImplementorResponse> response = new ListResponse<TrafficTypeImplementorResponse>();
+ List<TrafficTypeImplementorResponse> responses= new ArrayList<TrafficTypeImplementorResponse>();
+ for (Pair<TrafficType, String> r : results) {
+ TrafficTypeImplementorResponse p = new TrafficTypeImplementorResponse();
+ p.setTrafficType(r.first().toString());
+ p.setImplementor(r.second());
+ p.setObjectName("traffictypeimplementorresponse");
+ responses.add(p);
+ }
+
+ response.setResponses(responses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
- @Override
- public String getCommandName() {
- return _name;
- }
+
+ @Override
+ public String getCommandName() {
+ return _name;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java b/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
index 5f77dd4..17bd32d 100755
--- a/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
+++ b/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
@@ -45,11 +45,11 @@ public class ListTrafficTypesCmd extends BaseListCmd {
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
@@ -70,7 +70,7 @@ public class ListTrafficTypesCmd extends BaseListCmd {
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
Pair<List<? extends PhysicalNetworkTrafficType>, Integer> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListUsersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListUsersCmd.java b/api/src/com/cloud/api/commands/ListUsersCmd.java
index 53ad1d5..2305494 100644
--- a/api/src/com/cloud/api/commands/ListUsersCmd.java
+++ b/api/src/com/cloud/api/commands/ListUsersCmd.java
@@ -79,11 +79,11 @@ public class ListUsersCmd extends BaseListAccountResourcesCmd {
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
- @Override
+ @Override
public String getCommandName() {
return s_name;
}
-
+
@Override
public void execute(){
Pair<List<? extends UserAccount>, Integer> result = _accountService.searchForUsers(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVMGroupsCmd.java b/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
index 25b36e7..45648da 100644
--- a/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
+++ b/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
@@ -65,7 +65,7 @@ public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd {
/////////////////////////////////////////////////////
@Override
- public String getCommandName() {
+ public String getCommandName() {
return s_name;
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java b/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
index a8e2f0a..3a8cc97 100644
--- a/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
+++ b/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
@@ -44,25 +44,25 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
@PlugService
private VirtualRouterElementService _service;
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName = "virtual_router_providers")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list virtual router elements by id")
private Long id;
-
+
@IdentityMapper(entityTableName = "physical_network_service_providers")
@Parameter(name=ApiConstants.NSP_ID, type=CommandType.LONG, description="list virtual router elements by network service provider id")
private Long nspId;
-
+
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, description="list network offerings by enabled state")
private Boolean enabled;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public void setId(Long id) {
this.id = id;
}
@@ -91,7 +91,7 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
public String getCommandName() {
return _name;
}
-
+
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends VirtualRouterProvider> providers = _service.searchForVirtualRouterElement(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java b/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
index 0df4303..0504471 100644
--- a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
+++ b/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
@@ -33,7 +33,7 @@ import com.cloud.utils.Pair;
@Implementation(description="Lists all VLAN IP ranges.", responseObject=VlanIpRangeResponse.class)
public class ListVlanIpRangesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
private static final String s_name = "listvlaniprangesresponse";
@@ -43,7 +43,7 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the VLAN IP range is associated. Must be used with the domainId parameter.")
private String accountName;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN")
private Long projectId;
@@ -66,14 +66,14 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range")
private Long zoneId;
-
+
@IdentityMapper(entityTableName="networks")
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="network id of the VLAN IP range")
private Long networkId;
-
+
@Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
private Boolean forVirtualNetwork;
-
+
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="physical network id of the VLAN IP range")
private Long physicalNetworkId;
@@ -109,34 +109,34 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
public Long getNetworkId() {
return networkId;
}
-
+
public Boolean getForVirtualNetwork() {
- return forVirtualNetwork;
- }
-
+ return forVirtualNetwork;
+ }
+
public Long getProjectId() {
return projectId;
}
-
+
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
- @Override
+
+ @Override
public String getCommandName() {
return s_name;
}
-
+
@Override
public void execute(){
Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
ListResponse<VlanIpRangeResponse> response = new ListResponse<VlanIpRangeResponse>();
List<VlanIpRangeResponse> vlanResponses = new ArrayList<VlanIpRangeResponse>();
- for (Vlan vlan : vlans.first()) {
+ for (Vlan vlan : vlans.first()) {
VlanIpRangeResponse vlanResponse = _responseGenerator.createVlanIpRangeResponse(vlan);
vlanResponse.setObjectName("vlaniprange");
vlanResponses.add(vlanResponse);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListVolumesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVolumesCmd.java b/api/src/com/cloud/api/commands/ListVolumesCmd.java
index 5849602..fc1f8a1 100755
--- a/api/src/com/cloud/api/commands/ListVolumesCmd.java
+++ b/api/src/com/cloud/api/commands/ListVolumesCmd.java
@@ -68,7 +68,7 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the availability zone")
private Long zoneId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -101,7 +101,7 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
public Long getZoneId() {
return zoneId;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -110,12 +110,12 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Volume;
+ return AsyncJob.Type.Volume;
}
-
+
@Override
public void execute(){
Pair<List<? extends Volume>, Integer> volumes = _storageService.searchForVolumes(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListVpnUsersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVpnUsersCmd.java b/api/src/com/cloud/api/commands/ListVpnUsersCmd.java
index fbfc3e5..2f3774e 100644
--- a/api/src/com/cloud/api/commands/ListVpnUsersCmd.java
+++ b/api/src/com/cloud/api/commands/ListVpnUsersCmd.java
@@ -46,7 +46,7 @@ public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username of the vpn user.")
private String userName;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -67,7 +67,7 @@ public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public void execute(){
Pair<List<? extends VpnUser>, Integer> vpnUsers = _ravService.searchForVpnUsers(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListZonesByCmd.java b/api/src/com/cloud/api/commands/ListZonesByCmd.java
index 8d9ccb3..63822b7 100755
--- a/api/src/com/cloud/api/commands/ListZonesByCmd.java
+++ b/api/src/com/cloud/api/commands/ListZonesByCmd.java
@@ -49,14 +49,14 @@ public class ListZonesByCmd extends BaseListCmd {
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the zone")
private Long domainId;
-
+
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
private Boolean showCapacities;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public Long getId() {
return id;
}
@@ -64,19 +64,19 @@ public class ListZonesByCmd extends BaseListCmd {
public Boolean isAvailable() {
return available;
}
-
+
public Long getDomainId(){
- return domainId;
+ return domainId;
}
public Boolean getShowCapacities() {
- return showCapacities;
- }
-
+ return showCapacities;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
+
@Override
public String getCommandName() {
return s_name;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/LockAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LockAccountCmd.java b/api/src/com/cloud/api/commands/LockAccountCmd.java
index 2138ad9..9cb075f 100644
--- a/api/src/com/cloud/api/commands/LockAccountCmd.java
+++ b/api/src/com/cloud/api/commands/LockAccountCmd.java
@@ -58,12 +58,12 @@ public class LockAccountCmd extends BaseCmd {
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
+
@Override
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
Account account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/LockUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LockUserCmd.java b/api/src/com/cloud/api/commands/LockUserCmd.java
index 5a56bcb..7ce4efe 100644
--- a/api/src/com/cloud/api/commands/LockUserCmd.java
+++ b/api/src/com/cloud/api/commands/LockUserCmd.java
@@ -59,7 +59,7 @@ public class LockUserCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
User user = _entityMgr.findById(User.class, getId());
@@ -69,7 +69,7 @@ public class LockUserCmd extends BaseCmd {
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
-
+
@Override
public void execute(){
UserAccount user = _accountService.lockUser(getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/MarkDefaultZoneForAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/MarkDefaultZoneForAccountCmd.java b/api/src/com/cloud/api/commands/MarkDefaultZoneForAccountCmd.java
index 09f0e1c..1af9445 100644
--- a/api/src/com/cloud/api/commands/MarkDefaultZoneForAccountCmd.java
+++ b/api/src/com/cloud/api/commands/MarkDefaultZoneForAccountCmd.java
@@ -68,47 +68,47 @@ public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
public Long getDefaultZoneId() {
return defaultZoneId;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
+
@Override
public String getCommandName() {
- return s_name;
+ return s_name;
}
@Override
public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
+ return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public String getEventType() {
- return EventTypes.EVENT_ACCOUNT_MARK_DEFAULT_ZONE;
+ return EventTypes.EVENT_ACCOUNT_MARK_DEFAULT_ZONE;
}
-
+
@Override
public String getEventDescription() {
- return "Marking account with the default zone: " + getDefaultZoneId();
+ return "Marking account with the default zone: " + getDefaultZoneId();
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.Account;
}
-
+
@Override
public void execute(){
- Account result = _configService.markDefaultZone(getAccountName(),getDomainId(), getDefaultZoneId());
- if (result != null) {
- AccountResponse response = _responseGenerator.createAccountResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
- else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to mark the account with the default zone");
- }
+ Account result = _configService.markDefaultZone(getAccountName(),getDomainId(), getDefaultZoneId());
+ if (result != null) {
+ AccountResponse response = _responseGenerator.createAccountResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+ else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to mark the account with the default zone");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
index a919795..73240cd 100644
--- a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
+++ b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
@@ -77,7 +77,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
Account account = UserContext.current().getCaller();
@@ -97,38 +97,38 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId();
}
-
+
@Override
public void execute(){
-
+
Host destinationHost = _resourceService.getHost(getHostId());
if (destinationHost == null) {
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
}
try{
- UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId());
- //FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
- VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
- if (migratedVm != null) {
- // return the generic system VM instance response
- SystemVmInstanceResponse response = _responseGenerator.createSystemVmInstanceResponse(migratedVm);
+ UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId());
+ //FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
+ VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
+ if (migratedVm != null) {
+ // return the generic system VM instance response
+ SystemVmInstanceResponse response = _responseGenerator.createSystemVmInstanceResponse(migratedVm);
response.setResponseName(getCommandName());
this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm");
- }
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm");
+ }
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException e) {
s_logger.warn("Exception: ", e);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
- } catch (ManagementServerException e) {
+ } catch (ManagementServerException e) {
s_logger.warn("Exception: ", e);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
- } catch (VirtualMachineMigrationException e) {
+ } catch (VirtualMachineMigrationException e) {
s_logger.warn("Exception: ", e);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
- }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/MigrateVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/MigrateVolumeCmd.java b/api/src/com/cloud/api/commands/MigrateVolumeCmd.java
index ee61457..7ad8448 100644
--- a/api/src/com/cloud/api/commands/MigrateVolumeCmd.java
+++ b/api/src/com/cloud/api/commands/MigrateVolumeCmd.java
@@ -32,9 +32,9 @@ import com.cloud.user.Account;
@Implementation(description="Migrate volume", responseObject=VolumeResponse.class, since="3.0.0")
public class MigrateVolumeCmd extends BaseAsyncCmd {
- private static final String s_name = "migratevolumeresponse";
-
- /////////////////////////////////////////////////////
+ private static final String s_name = "migratevolumeresponse";
+
+ /////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -45,7 +45,7 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="storage_pool")
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, required=true, description="destination storage pool ID to migrate the volume to")
private Long storageId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
}
public Long getStoragePoolId() {
- return storageId;
+ return storageId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -65,10 +65,10 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
- Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
+ Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
if (volume != null) {
return volume.getAccountId();
}
@@ -85,22 +85,22 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Attempting to migrate volume Id: " + getVolumeId() + " to storage pool Id: "+ getStoragePoolId();
}
-
-
+
+
@Override
public void execute(){
- Volume result;
- try {
- result = _storageService.migrateVolume(getVolumeId(), getStoragePoolId());
- if (result != null) {
- VolumeResponse response = _responseGenerator.createVolumeResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
- } catch (ConcurrentOperationException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: ");
- }
-
+ Volume result;
+ try {
+ result = _storageService.migrateVolume(getVolumeId(), getStoragePoolId());
+ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+ } catch (ConcurrentOperationException e) {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: ");
+ }
+
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java b/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java
index ab7a6676..ffa56ab 100644
--- a/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java
+++ b/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java
@@ -34,8 +34,8 @@ import com.cloud.user.UserContext;
@Implementation(description="Prepares a host for maintenance.", responseObject=HostResponse.class)
public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(PrepareForMaintenanceCmd.class.getName());
-
+ public static final Logger s_logger = Logger.getLogger(PrepareForMaintenanceCmd.class.getName());
+
private static final String s_name = "preparehostformaintenanceresponse";
/////////////////////////////////////////////////////
@@ -62,9 +62,9 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "host";
+ return "host";
}
@Override
@@ -86,17 +86,17 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "preparing host: " + getId() + " for maintenance";
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Host;
+ return AsyncJob.Type.Host;
}
-
+
@Override
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
Host result = _resourceService.maintain(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java
index 488bc02..4d7342c 100644
--- a/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java
+++ b/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java
@@ -36,7 +36,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Puts storage pool into maintenance state", responseObject=StoragePoolResponse.class)
public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(PreparePrimaryStorageForMaintenanceCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(PreparePrimaryStorageForMaintenanceCmd.class.getName());
private static final String s_name = "prepareprimarystorageformaintenanceresponse";
/////////////////////////////////////////////////////
@@ -63,16 +63,16 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "primarystorage";
+ return "primarystorage";
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.StoragePool;
}
-
+
@Override
public Long getInstanceId() {
return getId();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/PrepareTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/PrepareTemplateCmd.java b/api/src/com/cloud/api/commands/PrepareTemplateCmd.java
index e1adcb7..97686a8 100644
--- a/api/src/com/cloud/api/commands/PrepareTemplateCmd.java
+++ b/api/src/com/cloud/api/commands/PrepareTemplateCmd.java
@@ -43,7 +43,7 @@ public class PrepareTemplateCmd extends BaseCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, required=true, type=CommandType.LONG, description="zone ID of the template to be prepared in primary storage(s).")
private Long zoneId;
-
+
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.TEMPLATE_ID, required=true, type=CommandType.LONG, description="template ID of the template to be prepared in primary storage(s).")
private Long templateId;
@@ -52,11 +52,11 @@ public class PrepareTemplateCmd extends BaseCmd {
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public Long getZoneId() {
- return zoneId;
+ return zoneId;
}
-
+
public Long getTemplateId() {
return templateId;
}
@@ -69,20 +69,20 @@ public class PrepareTemplateCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute() {
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
-
- VirtualMachineTemplate vmTemplate = _templateService.prepareTemplate(templateId, zoneId);
- List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(vmTemplate.getId(), zoneId, true);
+
+ VirtualMachineTemplate vmTemplate = _templateService.prepareTemplate(templateId, zoneId);
+ List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(vmTemplate.getId(), zoneId, true);
response.setResponses(templateResponses);
- response.setResponseName(getCommandName());
+ response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java b/api/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java
index e6428b1..e9f91af 100644
--- a/api/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java
+++ b/api/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java
@@ -56,12 +56,12 @@ public class QueryAsyncJobResultCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
AsyncJobResponse response = _responseGenerator.queryJobResult(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RebootRouterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RebootRouterCmd.java b/api/src/com/cloud/api/commands/RebootRouterCmd.java
index e1e30e8..5e3e87f 100644
--- a/api/src/com/cloud/api/commands/RebootRouterCmd.java
+++ b/api/src/com/cloud/api/commands/RebootRouterCmd.java
@@ -37,7 +37,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Starts a router.", responseObject=DomainRouterResponse.class)
public class RebootRouterCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(RebootRouterCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(RebootRouterCmd.class.getName());
private static final String s_name = "rebootrouterresponse";
/////////////////////////////////////////////////////
@@ -64,7 +64,7 @@ public class RebootRouterCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
@@ -84,16 +84,16 @@ public class RebootRouterCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "rebooting router: " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.DomainRouter;
+ return AsyncJob.Type.DomainRouter;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Router Id: "+getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RebootSystemVmCmd.java b/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
index 98bb5e2..fab1b9c 100644
--- a/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
+++ b/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
@@ -34,10 +34,10 @@ import com.cloud.vm.VirtualMachine;
@Implementation(description="Reboots a system VM.", responseObject=SystemVmResponse.class)
public class RebootSystemVmCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName());
private static final String s_name = "rebootsystemvmresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -57,7 +57,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
+
@Override
public String getCommandName() {
return s_name;
@@ -88,15 +88,15 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "rebooting system vm: " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.SystemVm;
+ return AsyncJob.Type.SystemVm;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
UserContext.current().setEventDetails("Vm Id: "+getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ReconnectHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ReconnectHostCmd.java b/api/src/com/cloud/api/commands/ReconnectHostCmd.java
index ba4e806..a2079f2 100755
--- a/api/src/com/cloud/api/commands/ReconnectHostCmd.java
+++ b/api/src/com/cloud/api/commands/ReconnectHostCmd.java
@@ -34,7 +34,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Reconnects a host.", responseObject=HostResponse.class)
public class ReconnectHostCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName());
private static final String s_name = "reconnecthostresponse";
@@ -62,9 +62,9 @@ public class ReconnectHostCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "host";
+ return "host";
}
@Override
@@ -86,15 +86,15 @@ public class ReconnectHostCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "reconnecting host: " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Host;
+ return AsyncJob.Type.Host;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
try {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RegisterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RegisterCmd.java b/api/src/com/cloud/api/commands/RegisterCmd.java
index 4f6e6ea..7e9b01e 100644
--- a/api/src/com/cloud/api/commands/RegisterCmd.java
+++ b/api/src/com/cloud/api/commands/RegisterCmd.java
@@ -36,7 +36,7 @@ public class RegisterCmd extends BaseCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@IdentityMapper(entityTableName="user")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="User id")
private Long id;
@@ -56,7 +56,7 @@ public class RegisterCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
User user = _entityMgr.findById(User.class, getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RegisterIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RegisterIsoCmd.java b/api/src/com/cloud/api/commands/RegisterIsoCmd.java
index 47a4514..ff7aa33 100755
--- a/api/src/com/cloud/api/commands/RegisterIsoCmd.java
+++ b/api/src/com/cloud/api/commands/RegisterIsoCmd.java
@@ -56,7 +56,7 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the iso or its derivatives are extractable; default is false")
private Boolean extractable;
-
+
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO")
private String isoName;
@@ -69,22 +69,22 @@ public class RegisterIsoCmd extends BaseCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone you wish to register the ISO to.")
- private Long zoneId;
-
+ private Long zoneId;
+
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId. If the account parameter is used, domainId must also be used.")
private Long domainId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account name. Must be used with domainId.")
private String accountName;
-
+
@Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this ISO")
private String checksum;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Register iso for the project")
private Long projectId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -108,7 +108,7 @@ public class RegisterIsoCmd extends BaseCmd {
public Boolean isExtractable() {
return extractable;
}
-
+
public String getIsoName() {
return isoName;
}
@@ -126,36 +126,36 @@ public class RegisterIsoCmd extends BaseCmd {
}
public Long getDomainId() {
- return domainId;
- }
+ return domainId;
+ }
- public String getAccountName() {
- return accountName;
- }
+ public String getAccountName() {
+ return accountName;
+ }
public String getChecksum() {
return checksum;
- }
-
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
- @Override
+ @Override
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return UserContext.current().getCaller().getId();
}
-
+
return accountId;
- }
-
+ }
+
@Override
public void execute() throws ResourceAllocationException{
VirtualMachineTemplate template = _templateService.registerIso(this);
@@ -163,11 +163,11 @@ public class RegisterIsoCmd extends BaseCmd {
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(template.getId(), zoneId, false);
response.setResponses(templateResponses);
- response.setResponseName(getCommandName());
+ response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register iso");
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java b/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java
index 4eb0abc..ae62e34 100644
--- a/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java
+++ b/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java
@@ -27,84 +27,84 @@ import com.cloud.api.response.SSHKeyPairResponse;
import com.cloud.user.SSHKeyPair;
import com.cloud.user.UserContext;
-@Implementation(description="Register a public key in a keypair under a certain name", responseObject=SSHKeyPairResponse.class)
+@Implementation(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";
-
-
+
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
- @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=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)
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.")
private String accountName;
-
+
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.")
private Long domainId;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="an optional project for the ssh key")
private Long projectId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getName() {
- return name;
- }
-
- public String getPublicKey() {
- return publicKey;
- }
-
- public String getAccountName() {
- return accountName;
- }
-
+ /////////////////////////////////////////////////////
+
+ public String getName() {
+ return name;
+ }
+
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
public Long getDomainId() {
return domainId;
}
-
+
public Long getProjectId() {
return projectId;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
+ /////////////////////////////////////////////////////
+
@Override
public long getEntityOwnerId() {
Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return UserContext.current().getCaller().getId();
}
-
+
return accountId;
- }
-
- @Override
- public void execute() {
- SSHKeyPair result = _mgr.registerSSHKeyPair(this);
+ }
+
+ @Override
+ public void execute() {
+ SSHKeyPair result = _mgr.registerSSHKeyPair(this);
SSHKeyPairResponse response = new SSHKeyPairResponse(result.getName(), result.getFingerprint());
response.setResponseName(getCommandName());
- response.setObjectName("keypair");
+ response.setObjectName("keypair");
this.setResponseObject(response);
- }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
- @Override
- public String getCommandName() {
- return s_name;
- }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RegisterTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java
index c6d9b66..c479001 100755
--- a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java
+++ b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java
@@ -73,7 +73,7 @@ public class RegisterTemplateCmd extends BaseCmd {
@Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the template supports the password reset feature; default is false")
private Boolean passwordEnabled;
-
+
@Parameter(name=ApiConstants.SSHKEY_ENABLED, type=CommandType.BOOLEAN, description="true if the template supports the sshkey upload feature; default is false")
private Boolean sshKeyEnabled;
@@ -102,11 +102,11 @@ public class RegisterTemplateCmd extends BaseCmd {
@Parameter(name=ApiConstants.TEMPLATE_TAG, type=CommandType.STRING, description="the tag for this template.")
private String templateTag;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Register template for the project")
private Long projectId;
-
+
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
protected Map details;
@@ -149,7 +149,7 @@ public class RegisterTemplateCmd extends BaseCmd {
public Boolean isPasswordEnabled() {
return passwordEnabled;
}
-
+
public Boolean isSshKeyEnabled() {
return sshKeyEnabled;
}
@@ -180,22 +180,22 @@ public class RegisterTemplateCmd extends BaseCmd {
public String getChecksum() {
return checksum;
- }
+ }
public String getTemplateTag() {
return templateTag;
}
-
+
public Map getDetails() {
- if (details == null || details.isEmpty()) {
- return null;
- }
-
- Collection paramsCollection = details.values();
- Map params = (Map) (paramsCollection.toArray())[0];
- return params;
- }
-
+ if (details == null || details.isEmpty()) {
+ return null;
+ }
+
+ Collection paramsCollection = details.values();
+ Map params = (Map) (paramsCollection.toArray())[0];
+ return params;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -215,9 +215,9 @@ public class RegisterTemplateCmd extends BaseCmd {
if (accountId == null) {
return UserContext.current().getCaller().getId();
}
-
+
return accountId;
- }
+ }
@Override
public void execute() throws ResourceAllocationException{
@@ -227,7 +227,7 @@ public class RegisterTemplateCmd extends BaseCmd {
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(template.getId(), zoneId, false);
response.setResponses(templateResponses);
- response.setResponseName(getCommandName());
+ response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register template");
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java
index 9e6fc6c..5d5d700 100644
--- a/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java
+++ b/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java
@@ -40,7 +40,7 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RemoveFromLoadBalancerRuleCmd.class.getName());
private static final String s_name = "removefromloadbalancerruleresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -104,7 +104,7 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove instance from load balancer rule");
}
}
-
+
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
@@ -112,10 +112,10 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
@Override
public Long getSyncObjId() {
- LoadBalancer lb = _lbService.findById(id);
- if(lb == null){
- throw new InvalidParameterValueException("Unable to find load balancer rule: " + id);
- }
+ LoadBalancer lb = _lbService.findById(id);
+ if(lb == null){
+ throw new InvalidParameterValueException("Unable to find load balancer rule: " + id);
+ }
return lb.getNetworkId();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
index 8e98c93..d667555 100644
--- a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
+++ b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
@@ -41,10 +41,10 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="username for the vpn user")
private String userName;
-
+
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the vpn user. Must be used with domainId.")
private String accountName;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="remove vpn user from the project")
private Long projectId;
@@ -52,58 +52,58 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.")
private Long domainId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
- public String getAccountName() {
- return accountName;
- }
+ public String getAccountName() {
+ return accountName;
+ }
- public Long getDomainId() {
- return domainId;
- }
+ public Long getDomainId() {
+ return domainId;
+ }
- public String getUserName() {
- return userName;
- }
+ public String getUserName() {
+ return userName;
+ }
+
+ public Long getProjecId() {
+ return projectId;
+ }
- public Long getProjecId() {
- return projectId;
- }
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
- @Override
+ @Override
public String getCommandName() {
return s_name;
}
- @Override
- public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ @Override
+ public long getEntityOwnerId() {
+ Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return UserContext.current().getCaller().getId();
}
-
+
return accountId;
}
- @Override
- public String getEventDescription() {
- return "Remove Remote Access VPN user for account " + getEntityOwnerId() + " username= " + getUserName();
- }
+ @Override
+ public String getEventDescription() {
+ return "Remove Remote Access VPN user for account " + getEntityOwnerId() + " username= " + getUserName();
+ }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_VPN_USER_REMOVE;
- }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VPN_USER_REMOVE;
+ }
@Override
public void execute(){
@@ -112,10 +112,10 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
if (!result) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user");
}
-
+
if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user removal");
- }
+ }
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/RestartNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RestartNetworkCmd.java b/api/src/com/cloud/api/commands/RestartNetworkCmd.java
index 978ad44..d7d124d 100644
--- a/api/src/com/cloud/api/commands/RestartNetworkCmd.java
+++ b/api/src/com/cloud/api/commands/RestartNetworkCmd.java
@@ -44,7 +44,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@IdentityMapper(entityTableName="networks")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The id of the network to restart.")
private Long id;
@@ -56,7 +56,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public Long getNetworkId() {
Network network = _networkService.getNetwork(id);
if (network == null) {
@@ -65,7 +65,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
return network.getId();
}
}
-
+
public Boolean getCleanup() {
if (cleanup != null) {
return cleanup;
@@ -87,7 +87,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
public static String getResultObjectName() {
return "addressinfo";
}
-
+
@Override
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
boolean result = _networkService.restartNetwork(this, getCleanup());
@@ -98,7 +98,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart network");
}
}
-
+
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
@@ -108,16 +108,16 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
public Long getSyncObjId() {
return id;
}
-
+
public String getEventDescription() {
return "Restarting network: " + getNetworkId();
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_NETWORK_RESTART;
}
-
+
@Override
public long getEntityOwnerId() {
Network network = _networkService.getNetwork(id);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/StartRouterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/StartRouterCmd.java b/api/src/com/cloud/api/commands/StartRouterCmd.java
index fc0115e..d4b12e8 100644
--- a/api/src/com/cloud/api/commands/StartRouterCmd.java
+++ b/api/src/com/cloud/api/commands/StartRouterCmd.java
@@ -38,7 +38,7 @@ import com.cloud.user.UserContext;
@Implementation(responseObject=DomainRouterResponse.class, description="Starts a router.")
public class StartRouterCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(StartRouterCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(StartRouterCmd.class.getName());
private static final String s_name = "startrouterresponse";
@@ -66,11 +66,11 @@ public class StartRouterCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "router";
+ return "router";
}
-
+
@Override
public long getEntityOwnerId() {
VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
@@ -90,15 +90,15 @@ public class StartRouterCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "starting router: " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.DomainRouter;
+ return AsyncJob.Type.DomainRouter;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Router Id: "+getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/StartSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/StartSystemVMCmd.java b/api/src/com/cloud/api/commands/StartSystemVMCmd.java
index 9e010f0..b6b8922 100644
--- a/api/src/com/cloud/api/commands/StartSystemVMCmd.java
+++ b/api/src/com/cloud/api/commands/StartSystemVMCmd.java
@@ -34,10 +34,10 @@ import com.cloud.vm.VirtualMachine;
@Implementation(responseObject=SystemVmResponse.class, description="Starts a system virtual machine.")
public class StartSystemVMCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName());
private static final String s_name = "startsystemvmresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -62,9 +62,9 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "systemvm";
+ return "systemvm";
}
@Override
@@ -92,15 +92,15 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "starting system vm: " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.SystemVm;
+ return AsyncJob.Type.SystemVm;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
UserContext.current().setEventDetails("Vm Id: "+getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/StopSystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/StopSystemVmCmd.java b/api/src/com/cloud/api/commands/StopSystemVmCmd.java
index 98a799c..71316ee 100644
--- a/api/src/com/cloud/api/commands/StopSystemVmCmd.java
+++ b/api/src/com/cloud/api/commands/StopSystemVmCmd.java
@@ -36,7 +36,7 @@ import com.cloud.vm.VirtualMachine;
@Implementation(description="Stops a system VM.", responseObject=SystemVmResponse.class)
public class StopSystemVmCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName());
private static final String s_name = "stopsystemvmresponse";
@@ -50,7 +50,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.FORCED, type=CommandType.BOOLEAN, required=false, description="Force stop the VM. The caller knows the VM is stopped.")
private Boolean forced;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -93,17 +93,17 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "stopping system vm: " + getId();
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.SystemVm;
+ return AsyncJob.Type.SystemVm;
}
-
+
@Override
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
public boolean isForced() {
return (forced != null) ? forced : false;
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/SuspendProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/SuspendProjectCmd.java b/api/src/com/cloud/api/commands/SuspendProjectCmd.java
deleted file mode 100644
index 0ce454a..0000000
--- a/api/src/com/cloud/api/commands/SuspendProjectCmd.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.ProjectResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.projects.Project;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Suspends a project", responseObject=ProjectResponse.class, since="3.0.0")
-public class SuspendProjectCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(SuspendProjectCmd.class.getName());
-
- private static final String s_name = "suspendprojectresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be suspended")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Long geId() {
- return id;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
- UserContext.current().setEventDetails("Project Id: " + id);
- Project project = _projectService.suspendProject(id);
- if (project != null) {
- ProjectResponse response = _responseGenerator.createProjectResponse(project);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to suspend a project");
- }
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_PROJECT_SUSPEND;
- }
-
- @Override
- public String getEventDescription() {
- return "Suspending project: " + id;
- }
-
- @Override
- public long getEntityOwnerId() {
- Project project= _projectService.getProject(id);
- //verify input parameters
- if (project == null) {
- throw new InvalidParameterValueException("Unable to find project by id " + id);
- }
-
- return _projectService.getProjectOwner(id).getId();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/UpdateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateAccountCmd.java b/api/src/com/cloud/api/commands/UpdateAccountCmd.java
index bfe8e46..ad4cbd5 100755
--- a/api/src/com/cloud/api/commands/UpdateAccountCmd.java
+++ b/api/src/com/cloud/api/commands/UpdateAccountCmd.java
@@ -34,7 +34,7 @@ import com.cloud.user.Account;
public class UpdateAccountCmd extends BaseCmd{
public static final Logger s_logger = Logger.getLogger(UpdateAccountCmd.class.getName());
private static final String s_name = "updateaccountresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -42,7 +42,7 @@ public class UpdateAccountCmd extends BaseCmd{
@IdentityMapper(entityTableName="account")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Account id")
private Long id;
-
+
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the current account name")
private String accountName;
@@ -52,11 +52,11 @@ public class UpdateAccountCmd extends BaseCmd{
@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")
private String networkDomain;
-
- @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
+
+ @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map details;
/////////////////////////////////////////////////////
@@ -66,7 +66,7 @@ public class UpdateAccountCmd extends BaseCmd{
public Long getId() {
return id;
}
-
+
public String getAccountName() {
return accountName;
}
@@ -78,19 +78,19 @@ public class UpdateAccountCmd extends BaseCmd{
public String getNewName() {
return newName;
}
-
+
public String getNetworkDomain() {
return networkDomain;
}
-
+
public Map getDetails() {
- if (details == null || details.isEmpty()) {
- return null;
- }
-
- Collection paramsCollection = details.values();
- Map params = (Map) (paramsCollection.toArray())[0];
- return params;
+ if (details == null || details.isEmpty()) {
+ return null;
+ }
+
+ Collection paramsCollection = details.values();
+ Map params = (Map) (paramsCollection.toArray())[0];
+ return params;
}
/////////////////////////////////////////////////////
@@ -101,7 +101,7 @@ public class UpdateAccountCmd extends BaseCmd{
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
Account account = _entityMgr.findById(Account.class, getId());
@@ -115,7 +115,7 @@ public class UpdateAccountCmd extends BaseCmd{
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
-
+
@Override
public void execute(){
Account result = _accountService.updateAccount(this);