Modified all api calls to throw ApiServerException if null object is returned by the manager.

This commit is contained in:
alena 2010-11-15 15:07:18 -08:00
parent d5ab597fcf
commit 1a8d9a92a7
163 changed files with 988 additions and 763 deletions

View File

@ -114,7 +114,7 @@ public class AddHostCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
List<HostVO> result = BaseCmd._agentMgr.discoverHosts(this);
List<HostVO> result = _agentMgr.discoverHosts(this);
ListResponse<HostResponse> response = new ListResponse<HostResponse>();
List<HostResponse> hostResponses = new ArrayList<HostResponse>();
if (result != null) {

View File

@ -76,7 +76,7 @@ public class AddSecondaryStorageCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
List<HostVO> result = BaseCmd._agentMgr.discoverHosts(this);
List<HostVO> result = _agentMgr.discoverHosts(this);
HostResponse hostResponse = null;
if (result != null && result.size() > 0) {
for (HostVO host : result) {

View File

@ -128,20 +128,24 @@ public class AddVpnUserCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
VpnUserVO vpnUser = BaseCmd._networkMgr.addVpnUser(this);
VpnUsersResponse vpnResponse = new VpnUsersResponse();
vpnResponse.setId(vpnUser.getId());
vpnResponse.setUserName(vpnUser.getUsername());
vpnResponse.setAccountName(vpnUser.getAccountName());
Account accountTemp = ApiDBUtils.findAccountById(vpnUser.getAccountId());
if (accountTemp != null) {
vpnResponse.setDomainId(accountTemp.getDomainId());
vpnResponse.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
VpnUserVO vpnUser = _networkMgr.addVpnUser(this);
if (vpnUser != null) {
VpnUsersResponse vpnResponse = new VpnUsersResponse();
vpnResponse.setId(vpnUser.getId());
vpnResponse.setUserName(vpnUser.getUsername());
vpnResponse.setAccountName(vpnUser.getAccountName());
Account accountTemp = ApiDBUtils.findAccountById(vpnUser.getAccountId());
if (accountTemp != null) {
vpnResponse.setDomainId(accountTemp.getDomainId());
vpnResponse.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
}
vpnResponse.setResponseName(getName());
vpnResponse.setObjectName("vpnuser");
this.setResponseObject(vpnResponse);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
}
vpnResponse.setResponseName(getName());
vpnResponse.setObjectName("vpnuser");
this.setResponseObject(vpnResponse);
}
}

View File

@ -105,7 +105,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
boolean result = BaseCmd._networkMgr.assignToLoadBalancer(this);
boolean result = _networkMgr.assignToLoadBalancer(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -86,10 +86,14 @@ public class AssociateIPAddrCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
IPAddressVO result = BaseCmd._networkMgr.associateIP(this);
IPAddressResponse ipResponse = ApiResponseHelper.createIPAddressResponse(result);
ipResponse.setResponseName(getName());
this.setResponseObject(ipResponse);
IPAddressVO result = _networkMgr.associateIP(this);
if (result != null) {
IPAddressResponse ipResponse = ApiResponseHelper.createIPAddressResponse(result);
ipResponse.setResponseName(getName());
this.setResponseObject(ipResponse);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign ip address");
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -98,12 +98,16 @@ public class AttachIsoCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._templateMgr.attachIso(this);
boolean result = _templateMgr.attachIso(this);
if (result) {
UserVm userVm = ApiDBUtils.findUserVmById(virtualMachineId);
UserVmResponse response = ApiResponseHelper.createUserVmResponse(userVm);
response.setResponseName(DeployVMCmd.getResultObjectName());
this.setResponseObject(response);
UserVm userVm = ApiDBUtils.findUserVmById(virtualMachineId);
if (userVm != null) {
UserVmResponse response = ApiResponseHelper.createUserVmResponse(userVm);
response.setResponseName(DeployVMCmd.getResultObjectName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso");
}
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso");
}

View File

@ -115,9 +115,13 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Volume result = BaseCmd._userVmService.attachVolumeToVM(this);
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
Volume result = _userVmService.attachVolumeToVM(this);
if (result != null) {
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume");
}
}
}

View File

@ -214,7 +214,7 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<IngressRuleVO> ingressRules = BaseCmd._networkGroupMgr.authorizeNetworkGroupIngress(this);
List<IngressRuleVO> ingressRules = _networkGroupMgr.authorizeNetworkGroupIngress(this);
ListResponse<IngressRuleResponse> response = new ListResponse<IngressRuleResponse>();
if ((ingressRules != null) && !ingressRules.isEmpty()) {
List<IngressRuleResponse> responses = new ArrayList<IngressRuleResponse>();
@ -242,8 +242,11 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseAsyncCmd {
responses.add(ingressData);
}
response.setResponses(responses);
response.setResponseName("securitygroupingressrule");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize network group ingress rule");
}
response.setResponseName("securitygroupingressrule");
this.setResponseObject(response);
}
}

View File

@ -96,9 +96,13 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
HostVO result = BaseCmd._agentMgr.cancelMaintenance(this);
HostResponse response = ApiResponseHelper.createHostResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
HostVO result = _agentMgr.cancelMaintenance(this);
if (result != null) {
HostResponse response = ApiResponseHelper.createHostResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel host maintenance");
}
}
}

View File

@ -96,9 +96,13 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
StoragePoolVO result = BaseCmd._storageMgr.cancelPrimaryStorageForMaintenance(this);
StoragePoolResponse response = ApiResponseHelper.createStoragePoolResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
StoragePoolVO result = _storageMgr.cancelPrimaryStorageForMaintenance(this);
if (result != null) {
StoragePoolResponse response = ApiResponseHelper.createStoragePoolResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel primary storage maintenance");
}
}
}

View File

@ -113,7 +113,7 @@ public class CopyIsoCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
VMTemplateVO iso = BaseCmd._templateMgr.copyIso(this);
VMTemplateVO iso = _templateMgr.copyIso(this);
TemplateResponse isoResponse = new TemplateResponse();
if (iso != null) {
isoResponse.setId(iso.getId());

View File

@ -114,7 +114,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
VMTemplateVO template = BaseCmd._templateMgr.copyTemplate(this);
VMTemplateVO template = _templateMgr.copyTemplate(this);
TemplateResponse templateResponse = new TemplateResponse();
if (template != null) {
templateResponse.setId(template.getId());

View File

@ -102,7 +102,7 @@ public class CreateCfgCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Configuration cfg = BaseCmd._configService.addConfig(this);
Configuration cfg = _configService.addConfig(this);
if (cfg != null) {
ConfigurationResponse response = ApiResponseHelper.createConfigurationResponse((ConfigurationVO)cfg);
response.setResponseName(getName());

View File

@ -93,7 +93,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
DiskOffering offering = BaseCmd._configService.createDiskOffering(this);
DiskOffering offering = _configService.createDiskOffering(this);
if (offering != null) {
DiskOfferingResponse response = ApiResponseHelper.createDiskOfferingResponse((DiskOfferingVO)offering);
response.setResponseName(getName());

View File

@ -74,7 +74,7 @@ public class CreateDomainCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
DomainVO domain = BaseCmd._mgr.createDomain(this);
DomainVO domain = _mgr.createDomain(this);
if (domain != null) {
DomainResponse response = ApiResponseHelper.createDomainResponse(domain);
response.setResponseName(getName());

View File

@ -80,7 +80,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
FirewallRuleVO result = BaseCmd._networkMgr.createIpForwardingRuleOnDomr(this.getId());
FirewallRuleVO result = _networkMgr.createIpForwardingRuleOnDomr(this.getId());
if (result != null) {
FirewallRuleResponse fwResponse = ApiResponseHelper.createFirewallRuleResponse(result);
fwResponse.setResponseName(getName());
@ -93,8 +93,12 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd {
@Override
public void callCreate() throws ServerApiException,InvalidParameterValueException, PermissionDeniedException,InsufficientAddressCapacityException,InsufficientCapacityException, ResourceUnavailableException,ConcurrentOperationException, ResourceAllocationException{
FirewallRuleVO rule = BaseCmd._networkMgr.createIpForwardingRuleInDb(ipAddress,virtualMachineId);
this.setId(rule.getId());
FirewallRuleVO rule = _networkMgr.createIpForwardingRuleInDb(ipAddress,virtualMachineId);
if (rule != null){
this.setId(rule.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create ip forwarding rule");
}
}
@Override

View File

@ -102,9 +102,13 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
LoadBalancerVO result = BaseCmd._networkMgr.createLoadBalancerRule(this);
LoadBalancerResponse response = ApiResponseHelper.createLoadBalancerResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
LoadBalancerVO result = _networkMgr.createLoadBalancerRule(this);
if (result != null) {
LoadBalancerResponse response = ApiResponseHelper.createLoadBalancerResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create load balancer rule");
}
}
}

View File

@ -88,17 +88,21 @@ public class CreateNetworkGroupCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
NetworkGroupVO group = BaseCmd._networkGroupMgr.createNetworkGroup(this);
NetworkGroupResponse response = new NetworkGroupResponse();
response.setAccountName(group.getAccountName());
response.setDescription(group.getDescription());
response.setDomainId(group.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(group.getDomainId()).getName());
response.setId(group.getId());
response.setName(group.getName());
response.setResponseName(getName());
response.setObjectName("securitygroup");
this.setResponseObject(response);
NetworkGroupVO group = _networkGroupMgr.createNetworkGroup(this);
if (group != null) {
NetworkGroupResponse response = new NetworkGroupResponse();
response.setAccountName(group.getAccountName());
response.setDescription(group.getDescription());
response.setDomainId(group.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(group.getDomainId()).getName());
response.setId(group.getId());
response.setName(group.getName());
response.setResponseName(getName());
response.setObjectName("securitygroup");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network group");
}
}
}

View File

@ -103,9 +103,13 @@ public class CreatePodCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Pod result = BaseCmd._configService.createPod(this);
PodResponse response = ApiResponseHelper.createPodResponse((HostPodVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
Pod result = _configService.createPod(this);
if (result != null) {
PodResponse response = ApiResponseHelper.createPodResponse((HostPodVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod");
}
}
}

View File

@ -98,7 +98,7 @@ public class CreatePortForwardingRuleCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
FirewallRuleVO result = BaseCmd._networkMgr.createPortForwardingRule(this);
FirewallRuleVO result = _networkMgr.createPortForwardingRule(this);
if (result != null) {
FirewallRuleResponse fwResponse = ApiResponseHelper.createFirewallRuleResponse(result);
fwResponse.setResponseName(getName());

View File

@ -138,27 +138,33 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
@Override
public void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException{
RemoteAccessVpnVO vpn = BaseCmd._networkMgr.createRemoteAccessVpn(this);
RemoteAccessVpnVO vpn = _networkMgr.createRemoteAccessVpn(this);
if (vpn != null) {
this.setId(vpn.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
}
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
RemoteAccessVpnVO result = BaseCmd._networkMgr.startRemoteAccessVpn(this);
RemoteAccessVpnResponse response = new RemoteAccessVpnResponse();
response.setId(result.getId());
response.setPublicIp(result.getVpnServerAddress());
response.setIpRange(result.getIpRange());
response.setAccountName(result.getAccountName());
response.setDomainId(result.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(result.getDomainId()).getName());
response.setObjectName("remoteaccessvpn");
response.setResponseName(getName());
response.setPresharedKey(result.getIpsecPresharedKey());
this.setResponseObject(response);
RemoteAccessVpnVO result = _networkMgr.startRemoteAccessVpn(this);
if (result != null) {
RemoteAccessVpnResponse response = new RemoteAccessVpnResponse();
response.setId(result.getId());
response.setPublicIp(result.getVpnServerAddress());
response.setIpRange(result.getIpRange());
response.setAccountName(result.getAccountName());
response.setDomainId(result.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(result.getDomainId()).getName());
response.setObjectName("remoteaccessvpn");
response.setResponseName(getName());
response.setPresharedKey(result.getIpsecPresharedKey());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (ResourceUnavailableException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -122,9 +122,13 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
ServiceOffering result = BaseCmd._configService.createServiceOffering(this);
ServiceOfferingResponse response = ApiResponseHelper.createServiceOfferingResponse((ServiceOfferingVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
ServiceOffering result = _configService.createServiceOffering(this);
if (result != null) {
ServiceOfferingResponse response = ApiResponseHelper.createServiceOfferingResponse((ServiceOfferingVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create service offering");
}
}
}

View File

@ -111,13 +111,14 @@ public class CreateSnapshotCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
SnapshotVO snapshot = BaseCmd._snapshotMgr.createSnapshot(this);
SnapshotVO snapshot = _snapshotMgr.createSnapshot(this);
if (snapshot != null) {
SnapshotResponse response = ApiResponseHelper.createSnapshotResponse(snapshot);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
}
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -103,28 +103,32 @@ public class CreateSnapshotInternalCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
SnapshotVO snapshot = BaseCmd._snapshotMgr.createSnapshotInternal(this);
SnapshotResponse response = new SnapshotResponse();
response.setId(snapshot.getId());
Account account = ApiDBUtils.findAccountById(snapshot.getAccountId());
if (account != null) {
response.setAccountName(account.getAccountName());
response.setDomainId(account.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(account.getDomainId()).getName());
SnapshotVO snapshot = _snapshotMgr.createSnapshotInternal(this);
if (snapshot != null) {
SnapshotResponse response = new SnapshotResponse();
response.setId(snapshot.getId());
Account account = ApiDBUtils.findAccountById(snapshot.getAccountId());
if (account != null) {
response.setAccountName(account.getAccountName());
response.setDomainId(account.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(account.getDomainId()).getName());
}
VolumeVO volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
String snapshotTypeStr = SnapshotType.values()[snapshot.getSnapshotType()].name();
response.setSnapshotType(snapshotTypeStr);
response.setVolumeId(snapshot.getVolumeId());
response.setVolumeName(volume.getName());
response.setVolumeType(volume.getVolumeType().toString());
response.setCreated(snapshot.getCreated());
response.setName(snapshot.getName());
response.setObjectName("snapshot");
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot");
}
VolumeVO volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
String snapshotTypeStr = SnapshotType.values()[snapshot.getSnapshotType()].name();
response.setSnapshotType(snapshotTypeStr);
response.setVolumeId(snapshot.getVolumeId());
response.setVolumeName(volume.getName());
response.setVolumeType(volume.getVolumeType().toString());
response.setCreated(snapshot.getCreated());
response.setName(snapshot.getName());
response.setObjectName("snapshot");
response.setResponseName(getName());
this.setResponseObject(response);
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -115,9 +115,13 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
SnapshotPolicyVO result = BaseCmd._snapshotMgr.createPolicy(this);
SnapshotPolicyResponse response = ApiResponseHelper.createSnapshotPolicyResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
SnapshotPolicyVO result = _snapshotMgr.createPolicy(this);
if (result != null) {
SnapshotPolicyResponse response = ApiResponseHelper.createSnapshotPolicyResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot policy");
}
}
}

View File

@ -115,13 +115,13 @@ public class CreateStoragePoolCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
StoragePoolVO result = BaseCmd._storageMgr.createPool(this);
StoragePoolVO result = _storageMgr.createPool(this);
if (result != null) {
StoragePoolResponse response = ApiResponseHelper.createStoragePoolResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add host");
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool");
}
} catch (ResourceAllocationException ex1) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex1.getMessage());

View File

@ -175,60 +175,66 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
@Override
public void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
VMTemplateVO template = BaseCmd._userVmService.createPrivateTemplateRecord(this);
if (template != null)
VMTemplateVO template = _userVmService.createPrivateTemplateRecord(this);
if (template != null){
this.setId(template.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a template");
}
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
VMTemplateVO template = BaseCmd._userVmService.createPrivateTemplate(this);
TemplateResponse response = new TemplateResponse();
response.setId(template.getId());
response.setName(template.getName());
response.setDisplayText(template.getDisplayText());
response.setPublic(template.isPublicTemplate());
response.setPasswordEnabled(template.getEnablePassword());
response.setCrossZones(template.isCrossZones());
VolumeVO volume = null;
if (snapshotId != null) {
Snapshot snapshot = ApiDBUtils.findSnapshotById(snapshotId);
volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
VMTemplateVO template = _userVmService.createPrivateTemplate(this);
if (template != null) {
TemplateResponse response = new TemplateResponse();
response.setId(template.getId());
response.setName(template.getName());
response.setDisplayText(template.getDisplayText());
response.setPublic(template.isPublicTemplate());
response.setPasswordEnabled(template.getEnablePassword());
response.setCrossZones(template.isCrossZones());
VolumeVO volume = null;
if (snapshotId != null) {
Snapshot snapshot = ApiDBUtils.findSnapshotById(snapshotId);
volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
} else {
volume = ApiDBUtils.findVolumeById(volumeId);
}
VMTemplateHostVO templateHostRef = ApiDBUtils.findTemplateHostRef(template.getId(), volume.getDataCenterId());
response.setCreated(templateHostRef.getCreated());
response.setReady(templateHostRef != null && templateHostRef.getDownloadState() == Status.DOWNLOADED);
GuestOS os = ApiDBUtils.findGuestOSById(template.getGuestOSId());
if (os != null) {
response.setOsTypeId(os.getId());
response.setOsTypeName(os.getDisplayName());
} else {
response.setOsTypeId(-1L);
response.setOsTypeName("");
}
Account owner = ApiDBUtils.findAccountById(template.getAccountId());
if (owner != null) {
response.setAccount(owner.getAccountName());
response.setDomainId(owner.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(owner.getDomainId()).getName());
}
DataCenterVO zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
if (zone != null) {
response.setZoneId(zone.getId());
response.setZoneName(zone.getName());
}
response.setObjectName("template");
response.setResponseName(getName());
this.setResponseObject(response);
} else {
volume = ApiDBUtils.findVolumeById(volumeId);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create template");
}
VMTemplateHostVO templateHostRef = ApiDBUtils.findTemplateHostRef(template.getId(), volume.getDataCenterId());
response.setCreated(templateHostRef.getCreated());
response.setReady(templateHostRef != null && templateHostRef.getDownloadState() == Status.DOWNLOADED);
GuestOS os = ApiDBUtils.findGuestOSById(template.getGuestOSId());
if (os != null) {
response.setOsTypeId(os.getId());
response.setOsTypeName(os.getDisplayName());
} else {
response.setOsTypeId(-1L);
response.setOsTypeName("");
}
Account owner = ApiDBUtils.findAccountById(template.getAccountId());
if (owner != null) {
response.setAccount(owner.getAccountName());
response.setDomainId(owner.getDomainId());
response.setDomainName(ApiDBUtils.findDomainById(owner.getDomainId()).getName());
}
DataCenterVO zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
if (zone != null) {
response.setZoneId(zone.getId());
response.setZoneName(zone.getName());
}
response.setObjectName("template");
response.setResponseName(getName());
this.setResponseObject(response);
}
}

View File

@ -129,9 +129,13 @@ public class CreateUserCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
UserAccount user = BaseCmd._accountService.createUser(this);
UserResponse response = ApiResponseHelper.createUserResponse(user);
response.setResponseName(getName());
this.setResponseObject(response);
UserAccount user = _accountService.createUser(this);
if (user != null) {
UserResponse response = ApiResponseHelper.createUserResponse(user);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user");
}
}
}

View File

@ -79,9 +79,13 @@ public class CreateVMGroupCmd extends BaseCmd{
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
InstanceGroupVO result = BaseCmd._userVmService.createVmGroup(this);
InstanceGroupResponse response = ApiResponseHelper.createInstanceGroupResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
InstanceGroupVO result = _userVmService.createVmGroup(this);
if (result != null) {
InstanceGroupResponse response = ApiResponseHelper.createInstanceGroupResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vm instance group");
}
}
}

View File

@ -131,9 +131,13 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Vlan result = BaseCmd._configService.createVlanAndPublicIpRange(this);
VlanIpRangeResponse response = ApiResponseHelper.createVlanIpRangeResponse((VlanVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
Vlan result = _configService.createVlanAndPublicIpRange(this);
if (result != null) {
VlanIpRangeResponse response = ApiResponseHelper.createVlanIpRangeResponse((VlanVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range");
}
}
}

View File

@ -148,19 +148,25 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
@Override
public void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
Volume volume = BaseCmd._storageMgr.allocVolume(this);
Volume volume = _storageMgr.allocVolume(this);
if (volume != null) {
this.setId(volume.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
}
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Volume volume = BaseCmd._storageMgr.createVolume(this);
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)volume);
//FIXME - have to be moved to ApiResponseHelper
response.setSnapshotId(getSnapshotId()); // if the volume was created from a snapshot, snapshotId will be set so we pass it back in the response
response.setResponseName(getName());
this.setResponseObject(response);
Volume volume = _storageMgr.createVolume(this);
if (volume != null) {
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)volume);
//FIXME - have to be moved to ApiResponseHelper
response.setSnapshotId(getSnapshotId()); // if the volume was created from a snapshot, snapshotId will be set so we pass it back in the response
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a volume");
}
}
}

View File

@ -123,9 +123,13 @@ public class CreateZoneCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
DataCenter result = BaseCmd._configService.createZone(this);
ZoneResponse response = ApiResponseHelper.createZoneResponse((DataCenterVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
DataCenter result = _configService.createZone(this);
if (result != null){
ZoneResponse response = ApiResponseHelper.createZoneResponse((DataCenterVO)result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a zone");
}
}
}

View File

@ -63,7 +63,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._configService.deleteDiskOffering(this);
boolean result = _configService.deleteDiskOffering(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -95,7 +95,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._mgr.deleteDomain(this);
boolean result = _mgr.deleteDomain(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -67,7 +67,7 @@ public class DeleteHostCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._agentMgr.deleteHost(this);
boolean result = _agentMgr.deleteHost(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -67,17 +67,13 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try {
boolean result = false;
result = BaseCmd._networkMgr.deleteIpForwardingRule(id);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete ip forwarding rule");
}
} catch (Exception ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
boolean result = false;
result = _networkMgr.deleteIpForwardingRule(id);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete ip forwarding rule");
}
}

View File

@ -99,7 +99,7 @@ public class DeleteIsoCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._templateMgr.deleteIso(this);
boolean result = _templateMgr.deleteIso(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -87,7 +87,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._networkMgr.deleteLoadBalancerRule(this);
boolean result = _networkMgr.deleteLoadBalancerRule(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -63,7 +63,7 @@ public class DeleteNetworkGroupCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
try{
boolean result = BaseCmd._networkGroupMgr.deleteNetworkGroup(this);
boolean result = _networkGroupMgr.deleteNetworkGroup(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -64,7 +64,7 @@ public class DeletePodCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._configService.deletePod(this);
boolean result = _configService.deletePod(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -47,7 +47,7 @@ public class DeletePoolCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._storageMgr.deletePool(this);
boolean result = _storageMgr.deletePool(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -63,7 +63,7 @@ public class DeletePortForwardingRuleCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._networkMgr.deletePortForwardingRule(id,false);
boolean result = _networkMgr.deletePortForwardingRule(id,false);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -59,7 +59,7 @@ public class DeletePreallocatedLunCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._mgr.unregisterPreallocatedLun(this);
boolean result = _mgr.unregisterPreallocatedLun(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -113,7 +113,7 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._networkMgr.destroyRemoteAccessVpn(this);
boolean result = _networkMgr.destroyRemoteAccessVpn(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -65,7 +65,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._configService.deleteServiceOffering(this);
boolean result = _configService.deleteServiceOffering(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -89,7 +89,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._snapshotMgr.deleteSnapshot(this);
boolean result = _snapshotMgr.deleteSnapshot(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -75,7 +75,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._snapshotMgr.deleteSnapshotPolicies(this);
boolean result = _snapshotMgr.deleteSnapshotPolicies(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -101,7 +101,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._templateMgr.deleteTemplate(this);
boolean result = _templateMgr.deleteTemplate(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -96,7 +96,7 @@ public class DeleteUserCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._accountService.deleteUser(this);
boolean result = _accountService.deleteUser(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -62,7 +62,7 @@ public class DeleteVMGroupCmd extends BaseCmd{
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._userVmService.deleteVmGroup(this);
boolean result = _userVmService.deleteVmGroup(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -64,7 +64,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._configService.deleteVlanIpRange(this);
boolean result = _configService.deleteVlanIpRange(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -69,7 +69,7 @@ public class DeleteVolumeCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._storageMgr.deleteVolume(this);
boolean result = _storageMgr.deleteVolume(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -66,7 +66,7 @@ public class DeleteZoneCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._configService.deleteZone(this);
boolean result = _configService.deleteZone(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -201,19 +201,22 @@ public class DeployVMCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, StorageUnavailableException{
try {
String password = null;
if (templateId != null ) {
VMTemplateVO template = ApiDBUtils.findTemplateById(templateId);
if (template.getEnablePassword()) {
password = BaseCmd._mgr.generateRandomPassword();
password = _mgr.generateRandomPassword();
}
}
UserVm result = BaseCmd._mgr.deployVirtualMachine(this, password);
UserVmResponse response = ApiResponseHelper.createUserVmResponse(result);
response.setPassword(password);
response.setResponseName(getName());
this.setResponseObject(response);
UserVm result = _mgr.deployVirtualMachine(this, password);
if (result != null){
UserVmResponse response = ApiResponseHelper.createUserVmResponse(result);
response.setPassword(password);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} catch (ExecutionException ex1) {

View File

@ -159,17 +159,25 @@ public class DeployVm2Cmd extends BaseAsyncCreateCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
UserVm result;
result = BaseCmd._userVmService.startVirtualMachine(this);
UserVmResponse response = ApiResponseHelper.createUserVm2Response(result);
response.setPassword(password);
response.setResponseName(getName());
this.setResponseObject(response);
result = _userVmService.startVirtualMachine(this);
if (result != null) {
UserVmResponse response = ApiResponseHelper.createUserVm2Response(result);
response.setPassword(password);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
}
}
@Override
public void callCreate() throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
UserVm vm = BaseCmd._userVmService.createVirtualMachine(this);
this.setId(vm.getId());
UserVm vm = _userVmService.createVirtualMachine(this);
if (vm != null) {
this.setId(vm.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
}
}

View File

@ -90,7 +90,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._consoleProxyMgr.destroyConsoleProxy(this);
boolean result = _consoleProxyMgr.destroyConsoleProxy(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -90,9 +90,13 @@ public class DestroyVMCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, StorageUnavailableException{
UserVm result = BaseCmd._userVmService.destroyVm(this);
UserVmResponse response = ApiResponseHelper.createUserVmResponse(result);
response.setResponseName("virtualmachine");
this.setResponseObject(response);
UserVm result = _userVmService.destroyVm(this);
if (result != null) {
UserVmResponse response = ApiResponseHelper.createUserVmResponse(result);
response.setResponseName("virtualmachine");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy vm");
}
}
}

View File

@ -27,7 +27,6 @@ import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@ -35,7 +34,6 @@ import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@ -91,7 +89,7 @@ public class DetachIsoCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._templateMgr.detachIso(this);
boolean result = _templateMgr.detachIso(this);
if (result) {
UserVm userVm = ApiDBUtils.findUserVmById(virtualMachineId);
UserVmResponse response = ApiResponseHelper.createUserVmResponse(userVm);

View File

@ -125,9 +125,13 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Volume result = BaseCmd._userVmService.detachVolumeFromVM(this);
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)result);
response.setResponseName("volume");
this.setResponseObject(response);
Volume result = _userVmService.detachVolumeFromVM(this);
if (result != null){
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)result);
response.setResponseName("volume");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach volume");
}
}
}

View File

@ -94,9 +94,13 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Account result = BaseCmd._accountService.disableAccount(this);
AccountResponse response = ApiResponseHelper.createAccountResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
Account result = _accountService.disableAccount(this);
if (result != null){
AccountResponse response = ApiResponseHelper.createAccountResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable account");
}
}
}

View File

@ -89,9 +89,13 @@ public class DisableUserCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
UserAccount user = BaseCmd._accountService.disableUser(this);
UserResponse response = ApiResponseHelper.createUserResponse(user);
response.setResponseName(getName());
this.setResponseObject(response);
UserAccount user = _accountService.disableUser(this);
if (user != null){
UserResponse response = ApiResponseHelper.createUserResponse(user);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable user");
}
}
}

View File

@ -63,7 +63,7 @@ public class DisassociateIPAddrCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
boolean result = BaseCmd._networkMgr.disassociateIpAddress(this);
boolean result = _networkMgr.disassociateIpAddress(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
this.setResponseObject(response);

View File

@ -71,9 +71,13 @@ public class EnableAccountCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Account result = BaseCmd._accountService.enableAccount(this);
AccountResponse response = ApiResponseHelper.createAccountResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
Account result = _accountService.enableAccount(this);
if (result != null){
AccountResponse response = ApiResponseHelper.createAccountResponse(result);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable account");
}
}
}

View File

@ -66,9 +66,13 @@ public class EnableUserCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
UserAccount user = BaseCmd._accountService.enableUser(this);
UserResponse response = ApiResponseHelper.createUserResponse(user);
response.setResponseName(getName());
this.setResponseObject(response);
UserAccount user = _accountService.enableUser(this);
if (user != null){
UserResponse response = ApiResponseHelper.createUserResponse(user);
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable user");
}
}
}

View File

@ -117,23 +117,27 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
try {
Long uploadId = BaseCmd._templateMgr.extract(this);
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
ExtractResponse response = new ExtractResponse();
response.setId(id);
response.setName(ApiDBUtils.findTemplateById(id).getName());
response.setZoneId(zoneId);
response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
response.setAccountId(getAccountId());
//FIX ME - Need to set the url once the gson jar is upgraded since it is throwing an error right now due to a bug.
//response.setUrl(uploadInfo.getUploadUrl());
response.setUrl(uploadInfo.getUploadUrl().replaceAll("/", "%2F"));
response.setResponseName(getName());
response.setObjectName("iso");
this.setResponseObject(response);
Long uploadId = _templateMgr.extract(this);
if (uploadId != null){
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
ExtractResponse response = new ExtractResponse();
response.setId(id);
response.setName(ApiDBUtils.findTemplateById(id).getName());
response.setZoneId(zoneId);
response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
response.setAccountId(getAccountId());
//FIX ME - Need to set the url once the gson jar is upgraded since it is throwing an error right now due to a bug.
//response.setUrl(uploadInfo.getUploadUrl());
response.setUrl(uploadInfo.getUploadUrl().replaceAll("/", "%2F"));
response.setResponseName(getName());
response.setObjectName("iso");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract iso");
}
} catch (InternalErrorException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -118,24 +118,27 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
try {
Long uploadId = BaseCmd._templateMgr.extract(this);
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
ExtractResponse response = new ExtractResponse();
response.setResponseName(getName());
response.setObjectName("template");
response.setId(id);
response.setName(ApiDBUtils.findTemplateById(id).getName());
response.setZoneId(zoneId);
response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
response.setAccountId(getAccountId());
//FIX ME - Need to set the url once the gson jar is upgraded since it is throwing an error right now.
//response.setUrl(uploadInfo.getUploadUrl());
response.setUrl(uploadInfo.getUploadUrl().replaceAll("/", "%2F"));
this.setResponseObject(response);
Long uploadId = _templateMgr.extract(this);
if (uploadId != null){
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
ExtractResponse response = new ExtractResponse();
response.setResponseName(getName());
response.setObjectName("template");
response.setId(id);
response.setName(ApiDBUtils.findTemplateById(id).getName());
response.setZoneId(zoneId);
response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
response.setAccountId(getAccountId());
//FIX ME - Need to set the url once the gson jar is upgraded since it is throwing an error right now.
//response.setUrl(uploadInfo.getUploadUrl());
response.setUrl(uploadInfo.getUploadUrl().replaceAll("/", "%2F"));
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract template");
}
} catch (InternalErrorException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -122,23 +122,26 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
try {
Long uploadId = BaseCmd._mgr.extractVolume(this);
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
ExtractResponse response = new ExtractResponse();
response.setResponseName(getName());
response.setObjectName("volume");
response.setId(id);
response.setName(ApiDBUtils.findVolumeById(id).getName());
response.setZoneId(zoneId);
response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
response.setAccountId(getAccountId());
//FIX ME - Need to set the url once the gson jar is upgraded since it is throwing an error right now.
response.setUrl(uploadInfo.getUploadUrl().replaceAll("/", "%2F"));
this.setResponseObject(response);
Long uploadId = _mgr.extractVolume(this);
if (uploadId != null){
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
ExtractResponse response = new ExtractResponse();
response.setResponseName(getName());
response.setObjectName("volume");
response.setId(id);
response.setName(ApiDBUtils.findVolumeById(id).getName());
response.setZoneId(zoneId);
response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
response.setMode(mode);
response.setUploadId(uploadId);
response.setState(uploadInfo.getUploadState().toString());
response.setAccountId(getAccountId());
//FIX ME - Need to set the url once the gson jar is upgraded since it is throwing an error right now.
response.setUrl(uploadInfo.getUploadUrl().replaceAll("/", "%2F"));
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract volume");
}
} catch (URISyntaxException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}

View File

@ -66,14 +66,14 @@ public class GetCloudIdentifierCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
ArrayList<String> result = BaseCmd._mgr.getCloudIdentifierResponse(this);
ArrayList<String> result = _mgr.getCloudIdentifierResponse(this);
CloudIdentifierResponse response = new CloudIdentifierResponse();
if (result != null) {
response.setCloudIdentifier(result.get(0));
response.setSignature(result.get(1));
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add config");
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
}
response.setObjectName("cloudidentifier");
response.setResponseName(getName());

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -112,7 +111,7 @@ public class ListAccountsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<AccountVO> accounts = BaseCmd._mgr.searchForAccounts(this);
List<AccountVO> accounts = _mgr.searchForAccounts(this);
ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
List<AccountResponse> accountResponses = new ArrayList<AccountResponse>();
for (AccountVO account : accounts) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.alert.AlertVO;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -70,7 +69,7 @@ public class ListAlertsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<AlertVO> result = BaseCmd._mgr.searchForAlerts(this);
List<AlertVO> result = _mgr.searchForAlerts(this);
ListResponse<AlertResponse> response = new ListResponse<AlertResponse>();
List<AlertResponse> alertResponseList = new ArrayList<AlertResponse>();
for (AlertVO alert : result) {

View File

@ -23,7 +23,6 @@ import java.util.List;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiSerializerHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -82,7 +81,7 @@ public class ListAsyncJobsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<AsyncJobVO> result = BaseCmd._mgr.searchForAsyncJobs(this);
List<AsyncJobVO> result = _mgr.searchForAsyncJobs(this);
ListResponse<AsyncJobResponse> response = new ListResponse<AsyncJobResponse>();
List<AsyncJobResponse> jobResponses = new ArrayList<AsyncJobResponse>();
for (AsyncJobVO job : result) {

View File

@ -44,7 +44,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
Map<String, String> capabilities = BaseCmd._mgr.listCapabilities(this);
Map<String, String> capabilities = _mgr.listCapabilities(this);
CapabilitiesResponse response = new CapabilitiesResponse();
response.setNetworkGroupsEnabled(capabilities.get("networkGroupsEnabled"));
response.setCloudStackVersion(capabilities.get("cloudStackVersion"));

View File

@ -31,7 +31,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -202,7 +201,7 @@ public class ListCapacityCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<CapacityVO> result = BaseCmd._mgr.listCapacities(this);
List<CapacityVO> result = _mgr.listCapacities(this);
ListResponse<CapacityResponse> response = new ListResponse<CapacityResponse>();
List<CapacityResponse> capacityResponses = new ArrayList<CapacityResponse>();
List<CapacityVO> summedCapacities = sumCapacities(result);

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -80,7 +79,7 @@ public class ListCfgsByCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<ConfigurationVO> result = BaseCmd._mgr.searchForConfigurations(this);
List<ConfigurationVO> result = _mgr.searchForConfigurations(this);
ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();
for (ConfigurationVO cfg : result) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -93,7 +92,7 @@ public class ListClustersCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<ClusterVO> result = BaseCmd._mgr.searchForClusters(this);
List<ClusterVO> result = _mgr.searchForClusters(this);
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();
for (ClusterVO cluster : result) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -84,7 +83,7 @@ public class ListDiskOfferingsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<DiskOfferingVO> result = BaseCmd._mgr.searchForDiskOfferings(this);
List<DiskOfferingVO> result = _mgr.searchForDiskOfferings(this);
ListResponse<DiskOfferingResponse> response = new ListResponse<DiskOfferingResponse>();
List<DiskOfferingResponse> diskOfferingResponses = new ArrayList<DiskOfferingResponse>();
for (DiskOfferingVO offering : result) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -84,7 +83,7 @@ public class ListDomainChildrenCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<DomainVO> result = BaseCmd._mgr.searchForDomainChildren(this);
List<DomainVO> result = _mgr.searchForDomainChildren(this);
ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
for (DomainVO domain : result) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -84,7 +83,7 @@ public class ListDomainsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<DomainVO> result = BaseCmd._mgr.searchForDomains(this);
List<DomainVO> result = _mgr.searchForDomains(this);
ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
for (DomainVO domain : result) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -121,7 +120,7 @@ public class ListEventsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<EventVO> result = BaseCmd._mgr.searchForEvents(this);
List<EventVO> result = _mgr.searchForEvents(this);
ListResponse<EventResponse> response = new ListResponse<EventResponse>();
List<EventResponse> eventResponses = new ArrayList<EventResponse>();
for (EventVO event : result) {

View File

@ -24,7 +24,6 @@ import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -72,7 +71,7 @@ public class ListGuestOsCategoriesCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<GuestOSCategoryVO> result = BaseCmd._mgr.listGuestOSCategoriesByCriteria(this);
List<GuestOSCategoryVO> result = _mgr.listGuestOSCategoriesByCriteria(this);
ListResponse<GuestOSCategoryResponse> response = new ListResponse<GuestOSCategoryResponse>();
List<GuestOSCategoryResponse> osCatResponses = new ArrayList<GuestOSCategoryResponse>();
for (GuestOSCategoryVO osCategory : result) {

View File

@ -24,7 +24,6 @@ import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -89,7 +88,7 @@ public class ListGuestOsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<GuestOSVO> result = BaseCmd._mgr.listGuestOSByCriteria(this);
List<GuestOSVO> result = _mgr.listGuestOSByCriteria(this);
ListResponse<GuestOSResponse> response = new ListResponse<GuestOSResponse>();
List<GuestOSResponse> osResponses = new ArrayList<GuestOSResponse>();
for (GuestOSVO guestOS : result) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -115,7 +114,7 @@ public class ListHostsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<HostVO> result = BaseCmd._mgr.searchForServers(this);
List<HostVO> result = _mgr.searchForServers(this);
ListResponse<HostResponse> response = new ListResponse<HostResponse>();
List<HostResponse> hostResponses = new ArrayList<HostResponse>();

View File

@ -44,7 +44,7 @@ public class ListHypervisorsCmd extends BaseCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
String[] result = BaseCmd._mgr.getHypervisors(this);
String[] result = _mgr.getHypervisors(this);
ListResponse<HypervisorResponse> response = new ListResponse<HypervisorResponse>();
ArrayList<HypervisorResponse> responses = new ArrayList<HypervisorResponse>();
for (String hypervisor : result) {

View File

@ -27,7 +27,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -149,7 +148,7 @@ public class ListIsosCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<VMTemplateVO> isos = BaseCmd._mgr.listIsos(this);
List<VMTemplateVO> isos = _mgr.listIsos(this);
TemplateFilter isoFilterObj = null;
try {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -77,7 +76,7 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<UserVmVO> result = BaseCmd._mgr.listLoadBalancerInstances(this);
List<UserVmVO> result = _mgr.listLoadBalancerInstances(this);
ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
for (UserVmVO instance : result) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -106,7 +105,7 @@ public class ListLoadBalancerRulesCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<LoadBalancerVO> loadBalancers = BaseCmd._mgr.searchForLoadBalancers(this);
List<LoadBalancerVO> loadBalancers = _mgr.searchForLoadBalancers(this);
ListResponse<LoadBalancerResponse> response = new ListResponse<LoadBalancerResponse>();
List<LoadBalancerResponse> lbResponses = new ArrayList<LoadBalancerResponse>();
for (LoadBalancerVO loadBalancer : loadBalancers) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -94,7 +93,7 @@ public class ListNetworkGroupsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<NetworkGroupRulesVO> networkGroups = BaseCmd._networkGroupMgr.searchForNetworkGroupRules(this);
List<NetworkGroupRulesVO> networkGroups = _networkGroupMgr.searchForNetworkGroupRules(this);
List<NetworkGroupResultObject> groupResultObjs = NetworkGroupResultObject.transposeNetworkGroups(networkGroups);
ListResponse<NetworkGroupResponse> response = new ListResponse<NetworkGroupResponse>();

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -86,7 +85,7 @@ public class ListPodsByCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<HostPodVO> result = BaseCmd._mgr.searchForPods(this);
List<HostPodVO> result = _mgr.searchForPods(this);
ListResponse<PodResponse> response = new ListResponse<PodResponse>();
List<PodResponse> podResponses = new ArrayList<PodResponse>();
for (HostPodVO pod : result) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -70,7 +69,7 @@ public class ListPortForwardingRulesCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<FirewallRuleVO> result = BaseCmd._networkMgr.listPortForwardingRules(this);
List<FirewallRuleVO> result = _networkMgr.listPortForwardingRules(this);
ListResponse<FirewallRuleResponse> response = new ListResponse<FirewallRuleResponse>();
List<FirewallRuleResponse> fwResponses = new ArrayList<FirewallRuleResponse>();

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -80,7 +79,7 @@ public class ListPreallocatedLunsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<PreallocatedLunVO> preallocatedLuns = BaseCmd._mgr.getPreAllocatedLuns(this);
List<PreallocatedLunVO> preallocatedLuns = _mgr.getPreAllocatedLuns(this);
ListResponse<PreallocatedLunResponse> response = new ListResponse<PreallocatedLunResponse>();
List<PreallocatedLunResponse> lunResponses = new ArrayList<PreallocatedLunResponse>();
for (PreallocatedLunVO preallocatedLun : preallocatedLuns) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -113,7 +112,7 @@ public class ListPublicIpAddressesCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<IPAddressVO> result = BaseCmd._mgr.searchForIPAddresses(this);
List<IPAddressVO> result = _mgr.searchForIPAddresses(this);
ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();
for (IPAddressVO ipAddress : result) {

View File

@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.List;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -72,7 +71,7 @@ public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<SnapshotScheduleVO> snapshotSchedules = BaseCmd._snapshotMgr.findRecurringSnapshotSchedule(this);
List<SnapshotScheduleVO> snapshotSchedules = _snapshotMgr.findRecurringSnapshotSchedule(this);
ListResponse<SnapshotScheduleResponse> response = new ListResponse<SnapshotScheduleResponse>();
List<SnapshotScheduleResponse> snapshotScheduleResponses = new ArrayList<SnapshotScheduleResponse>();
for (SnapshotScheduleVO snapshotSchedule : snapshotSchedules) {

View File

@ -24,7 +24,6 @@ import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -105,7 +104,7 @@ public class ListRemoteAccessVpnsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<RemoteAccessVpnVO> vpns = BaseCmd._mgr.searchForRemoteAccessVpns(this);
List<RemoteAccessVpnVO> vpns = _mgr.searchForRemoteAccessVpns(this);
ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();
for (RemoteAccessVpnVO vpn : vpns) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -97,7 +96,7 @@ public class ListResourceLimitsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<ResourceLimitVO> result = BaseCmd._accountService.searchForLimits(this);
List<ResourceLimitVO> result = _accountService.searchForLimits(this);
ListResponse<ResourceLimitResponse> response = new ListResponse<ResourceLimitResponse>();
List<ResourceLimitResponse> limitResponses = new ArrayList<ResourceLimitResponse>();
for (ResourceLimit limit : result) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -114,7 +113,7 @@ public class ListRoutersCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<DomainRouterVO> result = BaseCmd._mgr.searchForRouters(this);
List<DomainRouterVO> result = _mgr.searchForRouters(this);
ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
List<DomainRouterResponse> routerResponses = new ArrayList<DomainRouterResponse>();
for (DomainRouter router : result) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -84,7 +83,7 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<ServiceOfferingVO> offerings = BaseCmd._mgr.searchForServiceOfferings(this);
List<ServiceOfferingVO> offerings = _mgr.searchForServiceOfferings(this);
ListResponse<ServiceOfferingResponse> response = new ListResponse<ServiceOfferingResponse>();
List<ServiceOfferingResponse> offeringResponses = new ArrayList<ServiceOfferingResponse>();
for (ServiceOfferingVO offering : offerings) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -85,7 +84,7 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<SnapshotPolicyVO> result = BaseCmd._snapshotMgr.listPoliciesforVolume(this);
List<SnapshotPolicyVO> result = _snapshotMgr.listPoliciesforVolume(this);
ListResponse<SnapshotPolicyResponse> response = new ListResponse<SnapshotPolicyResponse>();
List<SnapshotPolicyResponse> policyResponses = new ArrayList<SnapshotPolicyResponse>();
for (SnapshotPolicyVO policy : result) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -113,7 +112,7 @@ public class ListSnapshotsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<SnapshotVO> result = BaseCmd._mgr.listSnapshots(this);
List<SnapshotVO> result = _mgr.listSnapshots(this);
ListResponse<SnapshotResponse> response = new ListResponse<SnapshotResponse>();
List<SnapshotResponse> snapshotResponses = new ArrayList<SnapshotResponse>();
for (Snapshot snapshot : result) {

View File

@ -25,7 +25,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -106,7 +105,7 @@ public class ListStoragePoolsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<? extends StoragePoolVO> pools = BaseCmd._mgr.searchForStoragePools(this);
List<? extends StoragePoolVO> pools = _mgr.searchForStoragePools(this);
ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
for (StoragePoolVO pool : pools) {

View File

@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
@ -112,7 +111,7 @@ public class ListSystemVMsCmd extends BaseListCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
List<? extends VMInstanceVO> systemVMs = BaseCmd._mgr.searchForSystemVm(this);
List<? extends VMInstanceVO> systemVMs = _mgr.searchForSystemVm(this);
ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
for (VMInstanceVO systemVM : systemVMs) {

Some files were not shown because too many files have changed in this diff Show More