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
[31/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/DeletePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java
index 19112a7..0ca9435 100644
--- a/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java
+++ b/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java
@@ -56,7 +56,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
public Long getId() {
return id;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -64,7 +64,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_NET_RULE_DELETE;
@@ -74,7 +74,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
public String getEventDescription() {
return ("Deleting port forwarding rule for id=" + id);
}
-
+
@Override
public long getEntityOwnerId() {
if (ownerId == null) {
@@ -84,18 +84,18 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
} else {
ownerId = _entityMgr.findById(PortForwardingRule.class, id).getAccountId();
}
-
+
}
return ownerId;
}
-
+
@Override
public void execute(){
UserContext.current().setEventDetails("Rule Id: "+id);
//revoke corresponding firewall rule first
boolean result = _firewallService.revokeRelatedFirewallRule(id, true);
result = result && _rulesService.revokePortForwardingRule(id, true);
-
+
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
@@ -103,8 +103,8 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete port forwarding rule");
}
}
-
-
+
+
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
@@ -114,7 +114,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
public Long getSyncObjId() {
return _rulesService.getPortForwardigRule(id).getNetworkId();
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.FirewallRule;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeletePrivateGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeletePrivateGatewayCmd.java b/api/src/com/cloud/api/commands/DeletePrivateGatewayCmd.java
index 005b471..1fac808 100644
--- a/api/src/com/cloud/api/commands/DeletePrivateGatewayCmd.java
+++ b/api/src/com/cloud/api/commands/DeletePrivateGatewayCmd.java
@@ -55,7 +55,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
public Long getId() {
return id;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -63,7 +63,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_PRIVATE_GATEWAY_DELETE;
@@ -73,16 +73,16 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
public String getEventDescription() {
return ("Deleting private gateway id=" + id);
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
UserContext.current().setEventDetails("Network ACL Id: " + id);
- boolean result = _vpcService.deleteVpcPrivateGateway(id);
+ boolean result = _vpcService.deleteVpcPrivateGateway(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
@@ -90,8 +90,8 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete private gateway");
}
}
-
-
+
+
@Override
public String getSyncObjType() {
return BaseAsyncCmd.vpcSyncObject;
@@ -105,10 +105,10 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
}
return gateway.getVpcId();
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.PrivateGateway;
}
-
-}
\ No newline at end of file
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteProjectCmd.java b/api/src/com/cloud/api/commands/DeleteProjectCmd.java
deleted file mode 100644
index b9e7685..0000000
--- a/api/src/com/cloud/api/commands/DeleteProjectCmd.java
+++ /dev/null
@@ -1,99 +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.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.projects.Project;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Deletes a project", responseObject=SuccessResponse.class, since="3.0.0")
-public class DeleteProjectCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName());
-
- private static final String s_name = "deleteprojectresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be deleted")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Long geId() {
- return id;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute(){
- UserContext.current().setEventDetails("Project Id: " + id);
- boolean result = _projectService.deleteProject(id);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete project");
- }
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_PROJECT_DELETE;
- }
-
- @Override
- public String getEventDescription() {
- return "Deleting 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/DeleteProjectInvitationCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java b/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java
deleted file mode 100644
index 620d22f..0000000
--- a/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java
+++ /dev/null
@@ -1,89 +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.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0")
-public class DeleteProjectInvitationCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteProjectInvitationCmd.class.getName());
- private static final String s_name = "deleteprojectinvitationresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
- @IdentityMapper(entityTableName = "project_invitations")
- @Parameter(name = ApiConstants.ID, required = true, type = CommandType.LONG, description = "id of the invitation")
- private Long id;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
- public Long getId() {
- return id;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
- @Override
- public long getEntityOwnerId() {
- // TODO - return project entity ownerId
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
-// tracked
- }
-
- @Override
- public void execute() {
- UserContext.current().setEventDetails("Project invitation id " + id);
- boolean result = _projectService.deleteProjectInvitation(id);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete the project invitation");
- }
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_PROJECT_INVITATION_REMOVE;
- }
-
- @Override
- public String getEventDescription() {
- return "Project invitatino id " + id + " is being removed";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java b/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java
index 029915c..a39ceb1 100644
--- a/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java
@@ -27,68 +27,68 @@ import com.cloud.api.response.SuccessResponse;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
-@Implementation(description="Deletes a keypair by name", responseObject=SuccessResponse.class)
+@Implementation(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";
-
-
+
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the keypair")
- private String name;
-
+
+ @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.")
private String accountName;
-
+
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the keypair")
private Long domainId;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="the project associated with keypair")
private Long projectId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getName() {
- return name;
- }
-
- public String getAccountName() {
- return accountName;
+ /////////////////////////////////////////////////////
+
+ public String getName() {
+ return name;
+ }
+
+ public String getAccountName() {
+ return accountName;
}
public Long getDomainId() {
return domainId;
}
-
+
public Long getProjectId() {
return projectId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() {
+ boolean result = _mgr.deleteSSHKeyPair(this);
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ response.setSuccess(result);
+ this.setResponseObject(response);
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
@Override
- public void execute() {
- boolean result = _mgr.deleteSSHKeyPair(this);
- SuccessResponse response = new SuccessResponse(getCommandName());
- response.setSuccess(result);
- this.setResponseObject(response);
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
public long getEntityOwnerId() {
Account account = UserContext.current().getCaller();
if ((account == null) || isAdmin(account.getType())) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java b/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java
index 2086369..27d1270 100644
--- a/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java
@@ -44,7 +44,7 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID of account owning the security group")
private Long domainId;
-
+
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="the project of the security group")
private Long projectId;
@@ -52,7 +52,7 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
@IdentityMapper(entityTableName="security_group")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="The ID of the security group. Mutually exclusive with name parameter")
private Long id;
-
+
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="The ID of the security group. Mutually exclusive with id parameter")
private String name;
@@ -68,7 +68,7 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
public Long getDomainId() {
return domainId;
}
-
+
public Long getProjectId() {
return projectId;
}
@@ -77,18 +77,18 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
if (id != null && name != null) {
throw new InvalidParameterValueException("name and id parameters are mutually exclusive");
}
-
+
if (name != null) {
id = _responseGenerator.getSecurityGroupId(name, getEntityOwnerId());
if (id == null) {
throw new InvalidParameterValueException("Unable to find security group by name " + name + " for the account id=" + getEntityOwnerId());
}
}
-
+
if (id == null) {
throw new InvalidParameterValueException("Either id or name parameter is requred by deleteSecurityGroup command");
}
-
+
return id;
}
@@ -102,17 +102,17 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
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(){
try{
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java b/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java
index 1e3ef86..e2d0d51 100644
--- a/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java
@@ -58,12 +58,12 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
boolean result = _configService.deleteServiceOffering(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java b/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java
index 33d76f8..df0fa56 100644
--- a/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java
@@ -82,13 +82,13 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "deleting snapshot: " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Snapshot;
+ return AsyncJob.Type.Snapshot;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java b/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java
index 5ff9d4d..96f9de0 100755
--- a/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java
@@ -34,7 +34,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSnapshotPoliciesCmd.class.getName());
private static final String s_name = "deletesnapshotpoliciesresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -69,7 +69,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteStorageNetworkIpRangeCmd.java b/api/src/com/cloud/api/commands/DeleteStorageNetworkIpRangeCmd.java
index 9ad8a13..6b50add 100755
--- a/api/src/com/cloud/api/commands/DeleteStorageNetworkIpRangeCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteStorageNetworkIpRangeCmd.java
@@ -35,10 +35,10 @@ import com.cloud.user.Account;
@Implementation(description="Deletes a storage network IP Range.", responseObject=SuccessResponse.class, since="3.0.0")
public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteStorageNetworkIpRangeCmd.class);
-
- private static final String s_name = "deletestoragenetworkiprangeresponse";
-
+ public static final Logger s_logger = Logger.getLogger(DeleteStorageNetworkIpRangeCmd.class);
+
+ private static final String s_name = "deletestoragenetworkiprangeresponse";
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -46,7 +46,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="dc_storage_network_ip_range")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the uuid of the storage network ip range")
private Long id;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -54,38 +54,38 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
public Long getId() {
return id;
}
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_STORAGE_IP_RANGE_DELETE;
- }
- @Override
- public String getEventDescription() {
- return "Deleting storage ip range " + getId();
- }
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_STORAGE_IP_RANGE_DELETE;
+ }
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
- try {
- _storageNetworkService.deleteIpRange(this);
+ @Override
+ public String getEventDescription() {
+ return "Deleting storage ip range " + getId();
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException {
+ try {
+ _storageNetworkService.deleteIpRange(this);
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
- } catch (Exception e) {
- s_logger.warn("Failed to delete storage network ip range " + getId(), e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
- }
- }
+ } catch (Exception e) {
+ s_logger.warn("Failed to delete storage network ip range " + getId(), e);
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ }
+ }
- @Override
- public String getCommandName() {
- return s_name;
- }
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteTagsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteTagsCmd.java b/api/src/com/cloud/api/commands/DeleteTagsCmd.java
index 25f6294..81a76e5 100644
--- a/api/src/com/cloud/api/commands/DeleteTagsCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteTagsCmd.java
@@ -43,14 +43,14 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
-
+
@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")
private String resourceType;
-
- @Parameter(name=ApiConstants.RESOURCE_IDS, type=CommandType.LIST, required=true,
+
+ @Parameter(name=ApiConstants.RESOURCE_IDS, type=CommandType.LIST, required=true,
collectionType=CommandType.STRING, description="Delete tags for resource id(s)")
private List<String> resourceIds;
@@ -58,11 +58,11 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public TaggedResourceType getResourceType(){
return _taggedResourceService.getResourceType(resourceType);
- }
-
+ }
+
public Map<String, String> getTags() {
Map<String, String> tagsMap = null;
if (tag != null && !tag.isEmpty()) {
@@ -78,7 +78,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
}
return tagsMap;
}
-
+
public List<String> getResourceIds() {
return resourceIds;
}
@@ -101,7 +101,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
@Override
public void execute() {
boolean success = _taggedResourceService.deleteTags(getResourceIds(), getResourceType(), getTags());
-
+
if (success) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteTemplateCmd.java b/api/src/com/cloud/api/commands/DeleteTemplateCmd.java
index 49881e2..e3c995f 100755
--- a/api/src/com/cloud/api/commands/DeleteTemplateCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteTemplateCmd.java
@@ -34,7 +34,7 @@ import com.cloud.user.UserContext;
@Implementation(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());
+ public static final Logger s_logger = Logger.getLogger(DeleteTemplateCmd.class.getName());
private static final String s_name = "deletetemplateresponse";
/////////////////////////////////////////////////////
@@ -66,12 +66,12 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
-
+
@Override
public String getCommandName() {
return s_name;
}
-
+
public static String getStaticName() {
return s_name;
}
@@ -95,15 +95,15 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Deleting template " + getId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Template;
+ return AsyncJob.Type.Template;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
UserContext.current().setEventDetails("Template Id: "+getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java b/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java
index b1fbca5..1a67e84 100644
--- a/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java
@@ -42,16 +42,16 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="physical_network_traffic_types")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="traffic type id")
private Long id;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
public Long getId() {
return id;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -60,12 +60,12 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
boolean result = _networkService.deletePhysicalNetworkTrafficType(getId());
@@ -81,7 +81,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Deleting Traffic Type: " + getId();
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_TRAFFIC_TYPE_DELETE;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteUserCmd.java b/api/src/com/cloud/api/commands/DeleteUserCmd.java
index 2b6e3c9..0f913e8 100644
--- a/api/src/com/cloud/api/commands/DeleteUserCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteUserCmd.java
@@ -59,7 +59,7 @@ public class DeleteUserCmd 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 DeleteUserCmd 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(){
UserContext.current().setEventDetails("UserId: "+getId());
@@ -81,4 +81,4 @@ public class DeleteUserCmd extends BaseCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user");
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java b/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java
index c41a78d..f9159e2 100644
--- a/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java
@@ -57,7 +57,7 @@ public class DeleteVMGroupCmd extends BaseCmd{
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
InstanceGroup group = _entityMgr.findById(InstanceGroup.class, getId());
@@ -67,7 +67,7 @@ public class DeleteVMGroupCmd 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(){
boolean result = _userVmService.deleteVmGroup(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java b/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
index 3e4806b..2944cf3 100644
--- a/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
@@ -60,12 +60,12 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
boolean result = _vpcService.deleteVpcOffering(getId());
@@ -76,7 +76,7 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC offering");
}
}
-
+
@Override
public String getEventType(){
return EventTypes.EVENT_VPC_OFFERING_DELETE;
@@ -87,6 +87,6 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
public String getEventDescription() {
return "Deleting VPC offering id=" + getId();
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java b/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
index be4498c..9f58e39 100644
--- a/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java
@@ -29,7 +29,7 @@ import com.cloud.user.Account;
@Implementation(description="Creates a VLAN IP range.", responseObject=SuccessResponse.class)
public class DeleteVlanIpRangeCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
private static final String s_name = "deletevlaniprangeresponse";
@@ -57,12 +57,12 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
boolean result = _configService.deleteVlanIpRange(this);
@@ -73,4 +73,4 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vlan ip range");
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVolumeCmd.java b/api/src/com/cloud/api/commands/DeleteVolumeCmd.java
index 495fb2e..7692cae 100644
--- a/api/src/com/cloud/api/commands/DeleteVolumeCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteVolumeCmd.java
@@ -32,7 +32,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Deletes a detached disk volume.", responseObject=SuccessResponse.class)
public class DeleteVolumeCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteVolumeCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(DeleteVolumeCmd.class.getName());
private static final String s_name = "deletevolumeresponse";
/////////////////////////////////////////////////////
@@ -63,9 +63,9 @@ public class DeleteVolumeCmd extends BaseCmd {
}
public static String getResultObjectName() {
- return "volume";
+ return "volume";
}
-
+
@Override
public long getEntityOwnerId() {
Volume volume = _entityMgr.findById(Volume.class, getId());
@@ -75,7 +75,7 @@ public class DeleteVolumeCmd 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() throws ConcurrentOperationException {
UserContext.current().setEventDetails("Volume Id: "+getId());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DeleteZoneCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteZoneCmd.java b/api/src/com/cloud/api/commands/DeleteZoneCmd.java
index fa76367..5a61a93 100644
--- a/api/src/com/cloud/api/commands/DeleteZoneCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteZoneCmd.java
@@ -60,7 +60,7 @@ public class DeleteZoneCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
@@ -68,8 +68,8 @@ public class DeleteZoneCmd extends BaseCmd {
@Override
public void execute(){
- UserContext.current().setEventDetails("Zone Id: "+getId());
- boolean result = _configService.deleteZone(this);
+ UserContext.current().setEventDetails("Zone Id: "+getId());
+ boolean result = _configService.deleteZone(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
index c9a1043..7e5db63 100644
--- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
+++ b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
@@ -31,10 +31,10 @@ import com.cloud.user.UserContext;
@Implementation(description="Destroys console proxy", responseObject=SuccessResponse.class)
public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
private static final String s_name = "destroyconsoleproxyresponse";
-
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -80,7 +80,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "destroying console proxy: " + getId();
}
-
+
@Override
public void execute(){
boolean result = _consoleProxyService.destroyConsoleProxy(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DestroySystemVmCmd.java b/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
index 3b0232e..9f2abbe 100644
--- a/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
+++ b/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
@@ -35,13 +35,13 @@ import com.cloud.vm.VirtualMachine;
@Implementation(responseObject=SystemVmResponse.class, description="Destroyes a system virtual machine.")
public class DestroySystemVmCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DestroySystemVmCmd.class.getName());
-
+
private static final String s_name = "destroysystemvmresponse";
@IdentityMapper(entityTableName="vm_instance")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
private Long id;
-
+
public Long getId() {
return id;
}
@@ -50,9 +50,9 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "systemvm";
+ return "systemvm";
}
@Override
@@ -75,22 +75,22 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
return EventTypes.EVENT_SSVM_DESTROY;
}
}
-
+
@Override
public String getEventDescription() {
return "destroying system vm: " + getId();
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.SystemVm;
}
-
+
@Override
public Long getInstanceId() {
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/DetachIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DetachIsoCmd.java b/api/src/com/cloud/api/commands/DetachIsoCmd.java
index 4bdc9dd..954c5f1 100755
--- a/api/src/com/cloud/api/commands/DetachIsoCmd.java
+++ b/api/src/com/cloud/api/commands/DetachIsoCmd.java
@@ -69,7 +69,7 @@ public class DetachIsoCmd extends BaseAsyncCmd {
return vm.getAccountId();
} else {
throw new InvalidParameterValueException("Unable to find vm by id " + getVirtualMachineId());
- }
+ }
}
@Override
@@ -81,13 +81,13 @@ public class DetachIsoCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "detaching ISO from vm: " + getVirtualMachineId();
}
-
+
@Override
public void execute(){
boolean result = _templateService.detachIso(virtualMachineId);
if (result) {
- UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId);
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
+ UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId);
+ UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
response.setResponseName(DeployVMCmd.getResultObjectName());
this.setResponseObject(response);
} else {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DetachVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DetachVolumeCmd.java b/api/src/com/cloud/api/commands/DetachVolumeCmd.java
index d086159..377bc0e 100755
--- a/api/src/com/cloud/api/commands/DetachVolumeCmd.java
+++ b/api/src/com/cloud/api/commands/DetachVolumeCmd.java
@@ -35,7 +35,7 @@ import com.cloud.uservm.UserVm;
@Implementation(description="Detaches a disk volume from a virtual machine.", responseObject=VolumeResponse.class)
public class DetachVolumeCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DetachVolumeCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(DetachVolumeCmd.class.getName());
private static final String s_name = "detachvolumeresponse";
/////////////////////////////////////////////////////
@@ -77,17 +77,17 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
public static String getResultObjectName() {
- return "volume";
+ return "volume";
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Volume;
+ return AsyncJob.Type.Volume;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
@Override
@@ -139,4 +139,4 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach volume");
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DisableAccountCmd.java b/api/src/com/cloud/api/commands/DisableAccountCmd.java
index 539eaa5..6693786 100644
--- a/api/src/com/cloud/api/commands/DisableAccountCmd.java
+++ b/api/src/com/cloud/api/commands/DisableAccountCmd.java
@@ -35,7 +35,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Disables an account", responseObject=AccountResponse.class)
public class DisableAccountCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName());
private static final String s_name = "disableaccountresponse";
/////////////////////////////////////////////////////
@@ -44,7 +44,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="account")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Account id")
private Long id;
-
+
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Disables specified account.")
private String accountName;
@@ -62,7 +62,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
public Long getId() {
return id;
}
-
+
public String getAccountName() {
return accountName;
}
@@ -91,7 +91,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
if (account != null) {
return account.getAccountId();
}
-
+
account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
if (account != null) {
return account.getAccountId();
@@ -108,11 +108,11 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
- Account result = null;
- if(lockRequested)
- result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
- else
- result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
+ Account result = null;
+ if(lockRequested)
+ result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
+ else
+ result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
@@ -121,7 +121,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
}
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.Account;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DisableStaticNatCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DisableStaticNatCmd.java b/api/src/com/cloud/api/commands/DisableStaticNatCmd.java
index d594991..10c77c6 100644
--- a/api/src/com/cloud/api/commands/DisableStaticNatCmd.java
+++ b/api/src/com/cloud/api/commands/DisableStaticNatCmd.java
@@ -45,7 +45,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="user_ip_address")
@Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the public IP address id for which static nat feature is being disableed")
private Long ipAddressId;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -53,7 +53,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
public Long getIpAddress() {
return ipAddressId;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -61,7 +61,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_DISABLE_STATIC_NAT;
@@ -71,16 +71,16 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
public String getEventDescription() {
return ("Disabling static nat for ip id=" + ipAddressId);
}
-
+
@Override
public long getEntityOwnerId() {
return _entityMgr.findById(IpAddress.class, ipAddressId).getAccountId();
}
-
+
@Override
public void execute() throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException {
boolean result = _rulesService.disableStaticNat(ipAddressId);
-
+
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
@@ -88,8 +88,8 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable static nat");
}
}
-
-
+
+
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DisableUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DisableUserCmd.java b/api/src/com/cloud/api/commands/DisableUserCmd.java
index 9a5b614..c4997c2 100644
--- a/api/src/com/cloud/api/commands/DisableUserCmd.java
+++ b/api/src/com/cloud/api/commands/DisableUserCmd.java
@@ -35,7 +35,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Disables a user account", responseObject=UserResponse.class)
public class DisableUserCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DisableUserCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(DisableUserCmd.class.getName());
private static final String s_name = "disableuserresponse";
/////////////////////////////////////////////////////
@@ -83,20 +83,20 @@ public class DisableUserCmd extends BaseAsyncCmd {
return "disabling user: " + getId();
}
-
+
@Override
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
UserAccount user = _accountService.disableUser(getId());
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
- response.setResponseName(getCommandName());
+ response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable user");
}
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.User;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java b/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java
index 9ba3cd1..cbf3d7a 100644
--- a/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java
+++ b/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java
@@ -46,7 +46,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="user_ip_address")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the public ip address" +
- " to disassociate")
+ " to disassociate")
private Long id;
// unexposed parameter needed for events logging
@@ -81,7 +81,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disassociate ip address");
}
}
-
+
@Override
public String getEventType() {
return EventTypes.EVENT_NET_IP_RELEASE;
@@ -91,7 +91,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
public String getEventDescription() {
return ("Disassociating ip address with id=" + id);
}
-
+
@Override
public long getEntityOwnerId() {
if (ownerId == null) {
@@ -101,13 +101,13 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
}
ownerId = ip.getAccountId();
}
-
+
if (ownerId == null) {
return Account.ACCOUNT_ID_SYSTEM;
}
return ownerId;
}
-
+
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
@@ -118,22 +118,22 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
IpAddress ip = getIpAddress(id);
return ip.getAssociatedWithNetworkId();
}
-
+
private IpAddress getIpAddress(long id) {
IpAddress ip = _entityMgr.findById(IpAddress.class, id);
-
+
if (ip == null) {
throw new InvalidParameterValueException("Unable to find ip address by id=" + id);
} else {
return ip;
}
}
-
+
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.IpAddress;
}
-
+
@Override
public Long getInstanceId() {
return getIpAddressId();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/EnableAccountCmd.java b/api/src/com/cloud/api/commands/EnableAccountCmd.java
index d476ed6..36d9b7b 100644
--- a/api/src/com/cloud/api/commands/EnableAccountCmd.java
+++ b/api/src/com/cloud/api/commands/EnableAccountCmd.java
@@ -53,7 +53,7 @@ public class EnableAccountCmd extends BaseCmd {
public Long getId() {
return id;
}
-
+
public String getAccountName() {
return accountName;
}
@@ -70,14 +70,14 @@ public class EnableAccountCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
Account account = _entityMgr.findById(Account.class, getId());
if (account != null) {
return account.getAccountId();
}
-
+
account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
if (account != null) {
return account.getAccountId();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/EnableStaticNatCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/EnableStaticNatCmd.java b/api/src/com/cloud/api/commands/EnableStaticNatCmd.java
index f211366..b27566c 100644
--- a/api/src/com/cloud/api/commands/EnableStaticNatCmd.java
+++ b/api/src/com/cloud/api/commands/EnableStaticNatCmd.java
@@ -44,18 +44,18 @@ public class EnableStaticNatCmd extends BaseCmd{
@IdentityMapper(entityTableName="user_ip_address")
@Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the public IP " +
- "address id for which static nat feature is being enabled")
+ "address id for which static nat feature is being enabled")
private Long ipAddressId;
@IdentityMapper(entityTableName="vm_instance")
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of " +
- "the virtual machine for enabling static nat feature")
+ "the virtual machine for enabling static nat feature")
private Long virtualMachineId;
-
+
@IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG,
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG,
description="The network of the vm the static nat will be enabled for." +
- " Required when public Ip address is not associated with any Guest network yet (VPC case)")
+ " Required when public Ip address is not associated with any Guest network yet (VPC case)")
private Long networkId;
/////////////////////////////////////////////////////
@@ -69,18 +69,18 @@ public class EnableStaticNatCmd extends BaseCmd{
public Long getVirtualMachineId() {
return virtualMachineId;
}
-
+
public long getNetworkId() {
IpAddress ip = _entityMgr.findById(IpAddress.class, getIpAddressId());
Long ntwkId = null;
-
+
if (ip.getAssociatedWithNetworkId() != null) {
ntwkId = ip.getAssociatedWithNetworkId();
} else {
ntwkId = networkId;
}
if (ntwkId == null) {
- throw new InvalidParameterValueException("Unable to enable static nat for the ipAddress id=" + ipAddressId +
+ throw new InvalidParameterValueException("Unable to enable static nat for the ipAddress id=" + ipAddressId +
" as ip is not associated with any network and no networkId is passed in");
}
return ntwkId;
@@ -94,7 +94,7 @@ public class EnableStaticNatCmd extends BaseCmd{
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
UserVm userVm = _entityMgr.findById(UserVm.class, getVirtualMachineId());
@@ -106,7 +106,7 @@ public class EnableStaticNatCmd extends BaseCmd{
}
@Override
- public void execute() throws ResourceUnavailableException{
+ public void execute() throws ResourceUnavailableException{
try {
boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), false);
if (result) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/EnableUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/EnableUserCmd.java b/api/src/com/cloud/api/commands/EnableUserCmd.java
index 90843e2..6c445f7 100644
--- a/api/src/com/cloud/api/commands/EnableUserCmd.java
+++ b/api/src/com/cloud/api/commands/EnableUserCmd.java
@@ -60,7 +60,7 @@ public class EnableUserCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
User user = _entityMgr.findById(User.class, getId());
@@ -70,14 +70,14 @@ public class EnableUserCmd 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(){
UserContext.current().setEventDetails("UserId: "+getId());
UserAccount user = _accountService.enableUser(getId());
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
- response.setResponseName(getCommandName());
+ response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable user");
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ExtractIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ExtractIsoCmd.java b/api/src/com/cloud/api/commands/ExtractIsoCmd.java
index cb180f2..39c7673 100755
--- a/api/src/com/cloud/api/commands/ExtractIsoCmd.java
+++ b/api/src/com/cloud/api/commands/ExtractIsoCmd.java
@@ -35,7 +35,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Extracts an ISO", responseObject=ExtractResponse.class)
public class ExtractIsoCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(ExtractIsoCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ExtractIsoCmd.class.getName());
private static final String s_name = "extractisoresponse";
@@ -53,7 +53,7 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, 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")
private String mode;
@@ -109,19 +109,19 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
public static String getStaticName() {
return s_name;
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Iso;
+ return AsyncJob.Type.Iso;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
try {
- UserContext.current().setEventDetails(getEventDescription());
+ UserContext.current().setEventDetails(getEventDescription());
Long uploadId = _templateService.extract(this);
if (uploadId != null){
ExtractResponse response = _responseGenerator.createExtractResponse(uploadId, id, zoneId, getEntityOwnerId(), mode);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ExtractTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ExtractTemplateCmd.java b/api/src/com/cloud/api/commands/ExtractTemplateCmd.java
index c2e22d0..eacd0f6 100755
--- a/api/src/com/cloud/api/commands/ExtractTemplateCmd.java
+++ b/api/src/com/cloud/api/commands/ExtractTemplateCmd.java
@@ -35,7 +35,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Extracts a template", responseObject=ExtractResponse.class)
public class ExtractTemplateCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(ExtractTemplateCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ExtractTemplateCmd.class.getName());
private static final String s_name = "extracttemplateresponse";
@@ -49,14 +49,14 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the url to which the ISO would be extracted")
private String url;
-
+
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, 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")
private String mode;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -76,16 +76,16 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
public String getMode() {
return mode;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
public static String getStaticName() {
return s_name;
}
@@ -110,19 +110,19 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "extracting template: " + getId() + " from zone: " + getZoneId();
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Template;
+ return AsyncJob.Type.Template;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
-
+
@Override
public void execute(){
try {
- UserContext.current().setEventDetails(getEventDescription());
+ UserContext.current().setEventDetails(getEventDescription());
Long uploadId = _templateService.extract(this);
if (uploadId != null){
ExtractResponse response = _responseGenerator.createExtractResponse(uploadId, id, zoneId, getEntityOwnerId(), mode);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ExtractVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ExtractVolumeCmd.java b/api/src/com/cloud/api/commands/ExtractVolumeCmd.java
index 2b82b06..4de2175 100755
--- a/api/src/com/cloud/api/commands/ExtractVolumeCmd.java
+++ b/api/src/com/cloud/api/commands/ExtractVolumeCmd.java
@@ -38,7 +38,7 @@ import com.cloud.user.UserContext;
@Implementation(description="Extracts volume", responseObject=ExtractResponse.class)
public class ExtractVolumeCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(ExtractVolumeCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ExtractVolumeCmd.class.getName());
private static final String s_name = "extractvolumeresponse";
@@ -57,7 +57,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone where the volume is located")
private Long zoneId;
-
+
@Parameter(name=ApiConstants.MODE, type=CommandType.STRING, required=true, description="the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD")
private String mode;
@@ -76,7 +76,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
public Long getZoneId() {
return zoneId;
}
-
+
public String getMode() {
return mode;
}
@@ -86,20 +86,20 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
@Override
- public String getCommandName() {
- return s_name;
- }
-
+ public String getCommandName() {
+ return s_name;
+ }
+
public static String getStaticName() {
return s_name;
}
-
+
public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Volume;
+ return AsyncJob.Type.Volume;
}
-
+
public Long getInstanceId() {
- return getId();
+ return getId();
}
@Override
@@ -122,7 +122,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Extraction job";
}
-
+
@Override
public void execute(){
try {
@@ -135,13 +135,13 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
response.setObjectName("volume");
response.setIdentityTableName("volumes");
response.setId(id);
- response.setName(_entityMgr.findById(Volume.class, id).getName());
+ response.setName(_entityMgr.findById(Volume.class, id).getName());
response.setZoneId(zoneId);
response.setZoneName(_entityMgr.findById(DataCenter.class, zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
- response.setAccountId(getEntityOwnerId());
+ response.setAccountId(getEntityOwnerId());
response.setUrl(uploadInfo.getUploadUrl());
this.setResponseObject(response);
} else {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java b/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
index e934ddf..f3bdab5 100644
--- a/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
+++ b/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
@@ -59,12 +59,12 @@ public class GetCloudIdentifierCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
ArrayList<String> result = _mgr.getCloudIdentifierResponse(userid);
@@ -78,6 +78,6 @@ public class GetCloudIdentifierCmd extends BaseCmd {
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
}
-
+
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/GetUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/GetUserCmd.java b/api/src/com/cloud/api/commands/GetUserCmd.java
index 8f5d6b4..4628f1c 100644
--- a/api/src/com/cloud/api/commands/GetUserCmd.java
+++ b/api/src/com/cloud/api/commands/GetUserCmd.java
@@ -43,32 +43,32 @@ public class GetUserCmd extends BaseCmd {
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
- public String getApiKey() {
- return apiKey;
- }
+ public String getApiKey() {
+ return apiKey;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
- @Override
+ @Override
public String getCommandName() {
return s_name;
}
- @Override
- public long getEntityOwnerId() {
- return 0;
- }
-
+ @Override
+ public long getEntityOwnerId() {
+ return 0;
+ }
+
@Override
public void execute(){
UserAccount result = _accountService.getUserByApiKey(getApiKey());
if(result != null){
- UserResponse response = _responseGenerator.createUserResponse(result);
- response.setResponseName(getCommandName());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ UserResponse response = _responseGenerator.createUserResponse(result);
+ response.setResponseName(getCommandName());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
} else {
throw new InvalidParameterValueException("User with specified API key does not exist");
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LDAPConfigCmd.java b/api/src/com/cloud/api/commands/LDAPConfigCmd.java
index b0a9e5b..5b4572b 100644
--- a/api/src/com/cloud/api/commands/LDAPConfigCmd.java
+++ b/api/src/com/cloud/api/commands/LDAPConfigCmd.java
@@ -45,10 +45,10 @@ public class LDAPConfigCmd extends BaseCmd {
@Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, description="Hostname or ip address of the ldap server eg: my.ldap.com")
private String hostname;
-
+
@Parameter(name=ApiConstants.PORT, type=CommandType.INTEGER, description="Specify the LDAP port if required, default is 389.")
private Integer port=0;
-
+
@Parameter(name=ApiConstants.USE_SSL, type=CommandType.BOOLEAN, description="Check Use SSL if the external LDAP server is configured for LDAP over SSL.")
private Boolean useSSL;
@@ -60,10 +60,10 @@ public class LDAPConfigCmd extends BaseCmd {
@Parameter(name=ApiConstants.BIND_DN, type=CommandType.STRING, description="Specify the distinguished name of a user with the search permission on the directory.")
private String bindDN;
-
+
@Parameter(name=ApiConstants.BIND_PASSWORD, type=CommandType.STRING, description="Enter the password.")
private String bindPassword;
-
+
@Parameter(name=ApiConstants.TRUST_STORE, type=CommandType.STRING, description="Enter the path to trust certificates store.")
private String trustStore;
@@ -132,14 +132,14 @@ public class LDAPConfigCmd extends BaseCmd {
catch (NamingException ne){
ne.printStackTrace();
}
-
+
}
@Override
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/LDAPRemoveCmd.java b/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
index 9d5a5d8..f56c24d 100644
--- a/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
+++ b/api/src/com/cloud/api/commands/LDAPRemoveCmd.java
@@ -35,12 +35,12 @@ public class LDAPRemoveCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -50,10 +50,10 @@ public class LDAPRemoveCmd extends BaseCmd {
public void execute(){
boolean result = _configService.removeLDAP(this);
if (result){
- LDAPRemoveResponse lr = new LDAPRemoveResponse();
+ LDAPRemoveResponse lr = new LDAPRemoveResponse();
lr.setObjectName("ldapremove");
lr.setResponseName(getCommandName());
- this.setResponseObject(lr);
+ this.setResponseObject(lr);
}
}
@@ -61,7 +61,7 @@ public class LDAPRemoveCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAccountsCmd.java b/api/src/com/cloud/api/commands/ListAccountsCmd.java
index cf4bcd0..ddf18cc 100755
--- a/api/src/com/cloud/api/commands/ListAccountsCmd.java
+++ b/api/src/com/cloud/api/commands/ListAccountsCmd.java
@@ -33,7 +33,7 @@ import com.cloud.utils.Pair;
@Implementation(description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class)
public class ListAccountsCmd extends BaseListDomainResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName());
private static final String s_name = "listaccountsresponse";
/////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ public class ListAccountsCmd extends BaseListDomainResourcesCmd {
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list accounts by state. Valid states are enabled, disabled, and locked.")
private String state;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -79,7 +79,7 @@ public class ListAccountsCmd extends BaseListDomainResourcesCmd {
public String getState() {
return state;
}
-
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -102,7 +102,7 @@ public class ListAccountsCmd extends BaseListDomainResourcesCmd {
}
response.setResponses(accountResponses, accounts.second());
response.setResponseName(getCommandName());
-
+
this.setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java b/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
index 6218323..a1aa3bb 100644
--- a/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
+++ b/api/src/com/cloud/api/commands/ListCapabilitiesCmd.java
@@ -27,7 +27,7 @@ import com.cloud.user.Account;
@Implementation(description="Lists capabilities", responseObject=CapabilitiesResponse.class)
public class ListCapabilitiesCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(ListCapabilitiesCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ListCapabilitiesCmd.class.getName());
private static final String s_name = "listcapabilitiesresponse";
@@ -35,12 +35,12 @@ public class ListCapabilitiesCmd extends BaseCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
+
@Override
public void execute(){
Map<String, Object> capabilities = _mgr.listCapabilities(this);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/api/commands/ListCapacityCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListCapacityCmd.java b/api/src/com/cloud/api/commands/ListCapacityCmd.java
index a7899f6..ecb590a 100755
--- a/api/src/com/cloud/api/commands/ListCapacityCmd.java
+++ b/api/src/com/cloud/api/commands/ListCapacityCmd.java
@@ -42,7 +42,7 @@ public class ListCapacityCmd extends BaseListCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists capacity by the Zone ID")
private Long zoneId;
@@ -50,28 +50,28 @@ public class ListCapacityCmd extends BaseListCmd {
@IdentityMapper(entityTableName="host_pod_ref")
@Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists capacity by the Pod ID")
private Long podId;
-
+
@IdentityMapper(entityTableName="cluster")
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, since="3.0.0", description="lists capacity by the Cluster ID")
private Long clusterId;
@Parameter(name=ApiConstants.FETCH_LATEST, type=CommandType.BOOLEAN, since="3.0.0", description="recalculate capacities and fetch the latest")
private Boolean fetchLatest;
-
+
@Parameter(name=ApiConstants.TYPE, type=CommandType.INTEGER, description="lists capacity by type" +
- "* CAPACITY_TYPE_MEMORY = 0" +
- "* CAPACITY_TYPE_CPU = 1" +
- "* CAPACITY_TYPE_STORAGE = 2" +
- "* CAPACITY_TYPE_STORAGE_ALLOCATED = 3" +
- "* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4" +
- "* CAPACITY_TYPE_PRIVATE_IP = 5" +
- "* CAPACITY_TYPE_SECONDARY_STORAGE = 6" +
- "* CAPACITY_TYPE_VLAN = 7" +
- "* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8" +
- "* CAPACITY_TYPE_LOCAL_STORAGE = 9.")
+ "* CAPACITY_TYPE_MEMORY = 0" +
+ "* CAPACITY_TYPE_CPU = 1" +
+ "* CAPACITY_TYPE_STORAGE = 2" +
+ "* CAPACITY_TYPE_STORAGE_ALLOCATED = 3" +
+ "* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4" +
+ "* CAPACITY_TYPE_PRIVATE_IP = 5" +
+ "* CAPACITY_TYPE_SECONDARY_STORAGE = 6" +
+ "* CAPACITY_TYPE_VLAN = 7" +
+ "* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8" +
+ "* CAPACITY_TYPE_LOCAL_STORAGE = 9.")
private Integer type;
-
+
@Parameter(name=ApiConstants.SORT_BY, type=CommandType.STRING, since="3.0.0", description="Sort the results. Available values: Usage")
private String sortBy;
@@ -82,23 +82,23 @@ public class ListCapacityCmd extends BaseListCmd {
public Long getZoneId() {
return zoneId;
}
-
+
public Long getPodId() {
return podId;
}
public Long getClusterId() {
- return clusterId;
- }
+ return clusterId;
+ }
- public Boolean getFetchLatest() {
- return fetchLatest;
- }
+ public Boolean getFetchLatest() {
+ return fetchLatest;
+ }
- public Integer getType() {
+ public Integer getType() {
return type;
}
-
+
public String getSortBy() {
if (sortBy != null) {
if (sortBy.equalsIgnoreCase("usage")) {
@@ -107,7 +107,7 @@ public class ListCapacityCmd extends BaseListCmd {
throw new InvalidParameterValueException("Only value supported for sortBy parameter is : usage");
}
}
-
+
return null;
}
@@ -119,7 +119,7 @@ public class ListCapacityCmd extends BaseListCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public void execute(){
List<? extends Capacity> result = null;
@@ -128,7 +128,7 @@ public class ListCapacityCmd extends BaseListCmd {
} else {
result = _mgr.listCapacities(this);
}
-
+
ListResponse<CapacityResponse> response = new ListResponse<CapacityResponse>();
List<CapacityResponse> capacityResponses = _responseGenerator.createCapacityResponse(result, s_percentFormat);
response.setResponses(capacityResponses);