You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/11/20 16:35:33 UTC
[46/51] [partial] Reformat all source code. Added checkstyle to check
the source code
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index 9a8d883..db58e7d 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -33,23 +33,20 @@ import com.cloud.utils.fsm.StateObject;
*/
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
- public enum PowerState {
- PowerUnknown,
- PowerOn,
- PowerOff,
+ public enum PowerState {
+ PowerUnknown, PowerOn, PowerOff,
}
public enum State {
- Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."),
- Running(false, "VM is running. host id has the host that it is running on."),
- Stopping(true, "VM is being stopped. host id has the host that it is being stopped on."),
- Stopped(false, "VM is stopped. host id should be null."),
- Destroyed(false, "VM is marked for destroy."),
- Expunging(true, "VM is being expunged."),
- Migrating(true, "VM is being migrated. host id holds to from host"),
- Error(false, "VM is in error"),
- Unknown(false, "VM state is unknown."),
- Shutdowned(false, "VM is shutdowned from inside");
+ Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."), Running(
+ false,
+ "VM is running. host id has the host that it is running on."), Stopping(true, "VM is being stopped. host id has the host that it is being stopped on."), Stopped(
+ false,
+ "VM is stopped. host id should be null."), Destroyed(false, "VM is marked for destroy."), Expunging(true, "VM is being expunged."), Migrating(
+ true,
+ "VM is being migrated. host id holds to from host"), Error(false, "VM is in error"), Unknown(false, "VM state is unknown."), Shutdowned(
+ false,
+ "VM is shutdowned from inside");
private final boolean _transitional;
String _description;
@@ -117,7 +114,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
s_fsm.addTransition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging);
s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
-
+
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
@@ -127,7 +124,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
}
-
+
public static boolean isVmStarted(State oldState, Event e, State newState) {
if (oldState == State.Starting && newState == State.Running) {
return true;
@@ -194,20 +191,14 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
AgentReportMigrated,
RevertRequested,
SnapshotRequested,
-
+
// added for new VMSync logic
FollowAgentPowerOnReport,
- FollowAgentPowerOffReport,
+ FollowAgentPowerOffReport,
};
public enum Type {
- User(false),
- DomainRouter(true),
- ConsoleProxy(true),
- SecondaryStorageVm(true),
- ElasticIpVm(true),
- ElasticLoadBalancerVm(true),
- InternalLoadBalancerVm(true),
+ User(false), DomainRouter(true), ConsoleProxy(true), SecondaryStorageVm(true), ElasticIpVm(true), ElasticLoadBalancerVm(true), InternalLoadBalancerVm(true),
/*
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
@@ -265,8 +256,6 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
*/
long getTemplateId();
-
-
/**
* returns the guest OS ID
*
@@ -308,7 +297,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
Date getCreated();
long getServiceOfferingId();
-
+
Long getDiskOfferingId();
Type getType();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/VirtualMachineName.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachineName.java b/api/src/com/cloud/vm/VirtualMachineName.java
index 1279fd6..86f5f8e 100755
--- a/api/src/com/cloud/vm/VirtualMachineName.java
+++ b/api/src/com/cloud/vm/VirtualMachineName.java
@@ -25,18 +25,18 @@ import com.cloud.dc.Vlan;
*/
public class VirtualMachineName {
public static final String SEPARATOR = "-";
-
+
public static String getVnetName(long vnetId) {
StringBuilder vnet = new StringBuilder();
Formatter formatter = new Formatter(vnet);
formatter.format("%04x", vnetId);
return vnet.toString();
}
-
+
public static boolean isValidVmName(String vmName) {
return isValidVmName(vmName, null);
}
-
+
public static boolean isValidVmName(String vmName, String instance) {
String[] tokens = vmName.split(SEPARATOR);
/*Some vms doesn't have vlan/vnet id*/
@@ -47,140 +47,140 @@ public class VirtualMachineName {
if (!tokens[0].equals("i")) {
return false;
}
-
+
try {
Long.parseLong(tokens[1]);
Long.parseLong(tokens[2]);
if (tokens.length == 5 && !Vlan.UNTAGGED.equalsIgnoreCase(tokens[4])) {
- Long.parseLong(tokens[4], 16);
+ Long.parseLong(tokens[4], 16);
}
} catch (NumberFormatException e) {
return false;
}
-
+
return instance == null || instance.equals(tokens[3]);
}
-
+
public static String getVmName(long vmId, long userId, String instance) {
StringBuilder vmName = new StringBuilder("i");
vmName.append(SEPARATOR).append(userId).append(SEPARATOR).append(vmId);
vmName.append(SEPARATOR).append(instance);
return vmName.toString();
}
-
+
public static long getVmId(String vmName) {
int begin = vmName.indexOf(SEPARATOR);
begin = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
return Long.parseLong(vmName.substring(begin + 1, end));
}
-
+
public static long getRouterId(String routerName) {
int begin = routerName.indexOf(SEPARATOR);
int end = routerName.indexOf(SEPARATOR, begin + SEPARATOR.length());
return Long.parseLong(routerName.substring(begin + 1, end));
}
-
+
public static long getConsoleProxyId(String vmName) {
int begin = vmName.indexOf(SEPARATOR);
int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
return Long.parseLong(vmName.substring(begin + 1, end));
}
-
+
public static long getSystemVmId(String vmName) {
int begin = vmName.indexOf(SEPARATOR);
int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
return Long.parseLong(vmName.substring(begin + 1, end));
}
-
+
public static String getRouterName(long routerId, String instance) {
StringBuilder builder = new StringBuilder("r");
builder.append(SEPARATOR).append(routerId).append(SEPARATOR).append(instance);
return builder.toString();
}
-
+
public static String getConsoleProxyName(long vmId, String instance) {
StringBuilder builder = new StringBuilder("v");
builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance);
return builder.toString();
}
-
+
public static String getSystemVmName(long vmId, String instance, String prefix) {
StringBuilder builder = new StringBuilder(prefix);
builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance);
return builder.toString();
}
-
+
public static String attachVnet(String name, String vnet) {
return name + SEPARATOR + vnet;
}
-
+
public static boolean isValidRouterName(String name) {
return isValidRouterName(name, null);
}
-
+
public static boolean isValidRouterName(String name, String instance) {
String[] tokens = name.split(SEPARATOR);
- if (tokens.length != 3 && tokens.length != 4 ) {
+ if (tokens.length != 3 && tokens.length != 4) {
return false;
}
-
+
if (!tokens[0].equals("r")) {
return false;
}
-
+
try {
Long.parseLong(tokens[1]);
} catch (NumberFormatException ex) {
return false;
}
-
+
return instance == null || tokens[2].equals(instance);
}
-
+
public static boolean isValidConsoleProxyName(String name) {
- return isValidConsoleProxyName(name, null);
+ return isValidConsoleProxyName(name, null);
}
-
+
public static boolean isValidConsoleProxyName(String name, String instance) {
String[] tokens = name.split(SEPARATOR);
if (tokens.length != 3) {
return false;
}
-
+
if (!tokens[0].equals("v")) {
return false;
}
-
+
try {
Long.parseLong(tokens[1]);
} catch (NumberFormatException ex) {
return false;
}
-
+
return instance == null || tokens[2].equals(instance);
}
-
+
public static boolean isValidSecStorageVmName(String name, String instance) {
- return isValidSystemVmName(name, instance, "s");
+ return isValidSystemVmName(name, instance, "s");
}
-
+
public static boolean isValidSystemVmName(String name, String instance, String prefix) {
String[] tokens = name.split(SEPARATOR);
if (tokens.length != 3) {
return false;
}
-
+
if (!tokens[0].equals(prefix)) {
return false;
}
-
+
try {
Long.parseLong(tokens[1]);
} catch (NumberFormatException ex) {
return false;
}
-
+
return instance == null || tokens[2].equals(instance);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/VirtualMachineProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 3da8397..c098e85 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -42,7 +42,6 @@ public interface VirtualMachineProfile {
public static final Param PxeSeverType = new Param("PxeSeverType");
public static final Param HaTag = new Param("HaTag");
-
private String name;
public Param(String name) {
@@ -139,5 +138,4 @@ public interface VirtualMachineProfile {
Float getMemoryOvercommitRatio();
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/VmDetailConstants.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VmDetailConstants.java b/api/src/com/cloud/vm/VmDetailConstants.java
index 87f4b5d..bd6f0e2 100644
--- a/api/src/com/cloud/vm/VmDetailConstants.java
+++ b/api/src/com/cloud/vm/VmDetailConstants.java
@@ -17,9 +17,9 @@
package com.cloud.vm;
public interface VmDetailConstants {
- public static final String KEYBOARD = "keyboard";
- public static final String NIC_ADAPTER = "nicAdapter";
- public static final String ROOK_DISK_CONTROLLER = "rootDiskController";
- public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
- public static final String HYPERVISOR_TOOLS_VERSION = "hypervisortoolsversion";
+ public static final String KEYBOARD = "keyboard";
+ public static final String NIC_ADAPTER = "nicAdapter";
+ public static final String ROOK_DISK_CONTROLLER = "rootDiskController";
+ public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
+ public static final String HYPERVISOR_TOOLS_VERSION = "hypervisortoolsversion";
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/VmDiskStats.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VmDiskStats.java b/api/src/com/cloud/vm/VmDiskStats.java
index 0551011..2323f0f 100644
--- a/api/src/com/cloud/vm/VmDiskStats.java
+++ b/api/src/com/cloud/vm/VmDiskStats.java
@@ -22,7 +22,7 @@ public interface VmDiskStats {
public long getIORead();
public long getIOWrite();
-
+
public long getBytesRead();
public long getBytesWrite();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/VmStats.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VmStats.java b/api/src/com/cloud/vm/VmStats.java
index d284db0..2b79438 100644
--- a/api/src/com/cloud/vm/VmStats.java
+++ b/api/src/com/cloud/vm/VmStats.java
@@ -23,11 +23,11 @@ public interface VmStats {
public double getNetworkReadKBs();
public double getNetworkWriteKBs();
-
+
public double getDiskReadIOs();
public double getDiskWriteIOs();
-
+
public double getDiskReadKBs();
public double getDiskWriteKBs();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/snapshot/VMSnapshot.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
index f0ee7ee..3cd52c2 100644
--- a/api/src/com/cloud/vm/snapshot/VMSnapshot.java
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
@@ -26,7 +26,7 @@ import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
-public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity,StateObject<VMSnapshot.State> {
+public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity, StateObject<VMSnapshot.State> {
enum State {
Allocated("The VM snapshot is allocated but has not been created yet."),
@@ -34,8 +34,8 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
Ready("The VM snapshot is ready to be used."),
Reverting("The VM snapshot is being used to revert"),
Expunging("The volume is being expunging"),
- Removed("The volume is destroyed, and can't be recovered."),
- Error ("The volume is in error state, and can't be recovered");
+ Removed("The volume is destroyed, and can't be recovered."),
+ Error("The volume is in error state, and can't be recovered");
String _description;
@@ -56,28 +56,24 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
s_fsm.addTransition(Allocated, Event.CreateRequested, Creating);
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
s_fsm.addTransition(Creating, Event.OperationFailed, Error);
- s_fsm.addTransition(Ready, Event.RevertRequested, Reverting);
+ s_fsm.addTransition(Ready, Event.RevertRequested, Reverting);
s_fsm.addTransition(Reverting, Event.OperationSucceeded, Ready);
s_fsm.addTransition(Reverting, Event.OperationFailed, Ready);
s_fsm.addTransition(Ready, Event.ExpungeRequested, Expunging);
- s_fsm.addTransition(Error, Event.ExpungeRequested, Expunging);
- s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging);
- s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);
+ s_fsm.addTransition(Error, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);
}
}
-
- enum Type{
+
+ enum Type {
Disk, DiskAndMemory
}
-
+
enum Event {
- CreateRequested,
- OperationFailed,
- OperationSucceeded,
- RevertRequested,
- ExpungeRequested,
+ CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested,
}
-
+
long getId();
public String getName();
@@ -93,18 +89,18 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
public String getDisplayName();
public Long getParent();
-
+
public Boolean getCurrent();
-
+
public Type getType();
-
+
public long getUpdatedCount();
public void incrUpdatedCount();
public Date getUpdated();
-
+
public Date getRemoved();
-
+
public long getAccountId();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
index 1ae7edc..839da73 100644
--- a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
@@ -37,12 +37,12 @@ public interface VMSnapshotService {
VMSnapshot creatVMSnapshot(Long vmId, Long vmSnapshotId, Boolean quiescevm);
- VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory)
- throws ResourceAllocationException;
+ VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory) throws ResourceAllocationException;
boolean deleteVMSnapshot(Long vmSnapshotId);
- UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException;
+ UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityException, InsufficientCapacityException, ResourceUnavailableException,
+ ConcurrentOperationException;
VirtualMachine getVMBySnapshotId(Long id);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/acl/ControlledEntity.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/ControlledEntity.java b/api/src/org/apache/cloudstack/acl/ControlledEntity.java
index 3e04126..5957576 100644
--- a/api/src/org/apache/cloudstack/acl/ControlledEntity.java
+++ b/api/src/org/apache/cloudstack/acl/ControlledEntity.java
@@ -26,8 +26,7 @@ import com.cloud.user.OwnedBy;
*/
public interface ControlledEntity extends OwnedBy, PartOf {
public enum ACLType {
- Account,
- Domain
+ Account, Domain
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/acl/Role.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/Role.java b/api/src/org/apache/cloudstack/acl/Role.java
index d039a6f..947a8c2 100644
--- a/api/src/org/apache/cloudstack/acl/Role.java
+++ b/api/src/org/apache/cloudstack/acl/Role.java
@@ -29,5 +29,6 @@ public interface Role {
public static final short CHILD_DOMAIN_USER = 7;
public long getId();
+
public short getRoleType();
- }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/acl/RoleType.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/RoleType.java b/api/src/org/apache/cloudstack/acl/RoleType.java
index 0d1c446..8505256 100644
--- a/api/src/org/apache/cloudstack/acl/RoleType.java
+++ b/api/src/org/apache/cloudstack/acl/RoleType.java
@@ -19,11 +19,7 @@ package org.apache.cloudstack.acl;
// Enum for default roles in CloudStack
public enum RoleType {
- Admin(1),
- ResourceAdmin(2),
- DomainAdmin(4),
- User(8),
- Unknown(0);
+ Admin(1), ResourceAdmin(2), DomainAdmin(4), User(8), Unknown(0);
private int mask;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/acl/SecurityChecker.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/org/apache/cloudstack/acl/SecurityChecker.java
index 3a721fe..ab3f7c5 100644
--- a/api/src/org/apache/cloudstack/acl/SecurityChecker.java
+++ b/api/src/org/apache/cloudstack/acl/SecurityChecker.java
@@ -31,10 +31,7 @@ import com.cloud.utils.component.Adapter;
public interface SecurityChecker extends Adapter {
public enum AccessType {
- ListEntry,
- ModifyEntry,
- ModifyProject,
- UseNetwork
+ ListEntry, ModifyEntry, ModifyProject, UseNetwork
}
/**
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
index e1bad93..91b07b2 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
@@ -36,8 +36,7 @@ public interface AffinityGroupProcessor extends Adapter {
* @param avoid
* avoid these data centers, pods, clusters, or hosts.
*/
- void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
- throws AffinityConflictException;
+ void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws AffinityConflictException;
/**
* getType() should return the affinity/anti-affinity group being
@@ -56,8 +55,7 @@ public interface AffinityGroupProcessor extends Adapter {
* @param plannedDestination
* deployment destination where VM is planned to be deployed
*/
- boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination)
- throws AffinityConflictException;
+ boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination) throws AffinityConflictException;
/**
* isAdminControlledGroup() should return true if the affinity/anti-affinity
@@ -67,7 +65,6 @@ public interface AffinityGroupProcessor extends Adapter {
*/
boolean isAdminControlledGroup();
-
/**
* canBeSharedDomainWide() should return true if the affinity/anti-affinity
* group can be created for a domain and shared by all accounts under the
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
index b6d4ff6..82807fe 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
@@ -37,22 +37,28 @@ import com.google.gson.annotations.SerializedName;
@EntityReference(value = AffinityGroup.class)
public class AffinityGroupResponse extends BaseResponse implements ControlledViewEntityResponse {
- @SerializedName(ApiConstants.ID) @Param(description="the ID of the affinity group")
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "the ID of the affinity group")
private String id;
- @SerializedName(ApiConstants.NAME) @Param(description="the name of the affinity group")
+ @SerializedName(ApiConstants.NAME)
+ @Param(description = "the name of the affinity group")
private String name;
- @SerializedName(ApiConstants.DESCRIPTION) @Param(description="the description of the affinity group")
+ @SerializedName(ApiConstants.DESCRIPTION)
+ @Param(description = "the description of the affinity group")
private String description;
- @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account owning the affinity group")
+ @SerializedName(ApiConstants.ACCOUNT)
+ @Param(description = "the account owning the affinity group")
private String accountName;
- @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the affinity group")
+ @SerializedName(ApiConstants.DOMAIN_ID)
+ @Param(description = "the domain ID of the affinity group")
private String domainId;
- @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the affinity group")
+ @SerializedName(ApiConstants.DOMAIN)
+ @Param(description = "the domain name of the affinity group")
private String domainName;
@SerializedName(ApiConstants.TYPE)
@@ -71,16 +77,14 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
return this.getId();
}
-
public String getId() {
return id;
- }
+ }
public void setId(String id) {
this.id = id;
}
-
public void setName(String name) {
this.name = name;
}
@@ -122,7 +126,7 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
return false;
if (getClass() != obj.getClass())
return false;
- AffinityGroupResponse other = (AffinityGroupResponse) obj;
+ AffinityGroupResponse other = (AffinityGroupResponse)obj;
if (id == null) {
if (other.id != null)
return false;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java
index 0c4374c..4f65af4 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java
@@ -34,8 +34,7 @@ public interface AffinityGroupService {
* @return AffinityGroup
*/
- AffinityGroup createAffinityGroup(String account, Long domainId, String affinityGroupName,
- String affinityGroupType, String description);
+ AffinityGroup createAffinityGroup(String account, Long domainId, String affinityGroupName, String affinityGroupType, String description);
/**
* Creates an affinity/anti-affinity group.
@@ -58,9 +57,8 @@ public interface AffinityGroupService {
* @param pageSize
* @return
*/
- Pair<List<? extends AffinityGroup>, Integer> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
- String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
-
+ Pair<List<? extends AffinityGroup>, Integer> listAffinityGroups(Long affinityGroupId, String affinityGroupName, String affinityGroupType, Long vmId, Long startIndex,
+ Long pageSize);
/**
* List group types available in deployment
@@ -79,7 +77,6 @@ public interface AffinityGroupService {
boolean isAffinityGroupAvailableInDomain(long affinityGroupId, long domainId);
- AffinityGroup createAffinityGroupInternal(String account, Long domainId, String affinityGroupName,
- String affinityGroupType, String description);
+ AffinityGroup createAffinityGroupInternal(String account, Long domainId, String affinityGroupName, String affinityGroupType, String description);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
index 2d1cd25..8d8e103 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
@@ -37,7 +37,6 @@ public class AffinityGroupTypeResponse extends BaseResponse {
@Param(description = "the type of the affinity group")
private String type;
-
public AffinityGroupTypeResponse() {
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
index 0be014e..d4e8e41 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
@@ -28,8 +28,7 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
protected String _type;
@Override
- public void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
- throws AffinityConflictException {
+ public void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws AffinityConflictException {
}
@@ -43,8 +42,7 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
}
@Override
- public boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination)
- throws AffinityConflictException {
+ public boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination) throws AffinityConflictException {
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ACL.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ACL.java b/api/src/org/apache/cloudstack/api/ACL.java
index ce93b6a..4955120 100644
--- a/api/src/org/apache/cloudstack/api/ACL.java
+++ b/api/src/org/apache/cloudstack/api/ACL.java
@@ -25,11 +25,12 @@ import java.lang.annotation.Target;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
@Retention(RetentionPolicy.RUNTIME)
-@Target({ FIELD })
+@Target({FIELD})
public @interface ACL {
AccessType accessType() default AccessType.ListEntry;
boolean checkKeyAccess() default false;
+
boolean checkValueAccess() default false;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/APICommand.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/APICommand.java b/api/src/org/apache/cloudstack/api/APICommand.java
index 7c9e6fe..5587a48 100644
--- a/api/src/org/apache/cloudstack/api/APICommand.java
+++ b/api/src/org/apache/cloudstack/api/APICommand.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
import org.apache.cloudstack.acl.RoleType;
@Retention(RetentionPolicy.RUNTIME)
-@Target({ TYPE })
+@Target({TYPE})
public @interface APICommand {
Class<? extends BaseResponse> responseObject();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index ea3137d..523bb60 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api;
-
public class ApiConstants {
public static final String ACCOUNT = "account";
public static final String ACCOUNTS = "accounts";
@@ -248,7 +247,7 @@ public class ApiConstants {
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
public static final String VLAN = "vlan";
public static final String VLAN_RANGE = "vlanrange";
- public static final String REMOVE_VLAN="removevlan";
+ public static final String REMOVE_VLAN = "removevlan";
public static final String VLAN_ID = "vlanid";
public static final String ISOLATED_PVLAN = "isolatedpvlan";
public static final String VM_AVAILABLE = "vmavailable";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ApiErrorCode.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
index 69bd028..fc196cf 100644
--- a/api/src/org/apache/cloudstack/api/ApiErrorCode.java
+++ b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
@@ -38,7 +38,7 @@ public enum ApiErrorCode {
private int httpCode;
- private ApiErrorCode(int httpStatusCode){
+ private ApiErrorCode(int httpStatusCode) {
httpCode = httpStatusCode;
}
@@ -50,9 +50,8 @@ public enum ApiErrorCode {
this.httpCode = httpCode;
}
- public String toString(){
+ public String toString() {
return String.valueOf(this.httpCode);
}
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
index 0b09400..ae0f5d7 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
@@ -54,7 +54,6 @@ public abstract class BaseAsyncCmd extends BaseCmd {
*/
public abstract String getEventDescription();
-
public void setJob(Object job) {
this.job = job;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 01d9b53..3ca5dd4 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -104,55 +104,98 @@ public abstract class BaseCmd {
public enum HTTPMethod {
GET, POST, PUT, DELETE
}
+
private HTTPMethod httpMethod;
@Parameter(name = "response", type = CommandType.STRING)
private String responseType;
- @Inject public ConfigurationService _configService;
- @Inject public AccountService _accountService;
- @Inject public UserVmService _userVmService;
- @Inject public ManagementService _mgr;
- @Inject public StorageService _storageService;
- @Inject public VolumeApiService _volumeService;
- @Inject public ResourceService _resourceService;
- @Inject public NetworkService _networkService;
- @Inject public TemplateApiService _templateService;
- @Inject public SecurityGroupService _securityGroupService;
- @Inject public SnapshotApiService _snapshotService;
- @Inject public VpcVirtualNetworkApplianceService _routerService;
- @Inject public ResponseGenerator _responseGenerator;
- @Inject public EntityManager _entityMgr;
- @Inject public RulesService _rulesService;
- @Inject public AutoScaleService _autoScaleService;
- @Inject public LoadBalancingRulesService _lbService;
- @Inject public RemoteAccessVpnService _ravService;
- @Inject public ProjectService _projectService;
- @Inject public FirewallService _firewallService;
- @Inject public DomainService _domainService;
- @Inject public ResourceLimitService _resourceLimitService;
- @Inject public IdentityService _identityService;
- @Inject public StorageNetworkService _storageNetworkService;
- @Inject public TaggedResourceService _taggedResourceService;
- @Inject public ResourceMetaDataService _resourceMetaDataService;
- @Inject public VpcService _vpcService;
- @Inject public NetworkACLService _networkACLService;
- @Inject public Site2SiteVpnService _s2sVpnService;
-
- @Inject public QueryService _queryService;
- @Inject public UsageService _usageService;
- @Inject public NetworkUsageService _networkUsageService;
- @Inject public VMSnapshotService _vmSnapshotService;
- @Inject public DataStoreProviderApiService dataStoreProviderApiService;
- @Inject public VpcProvisioningService _vpcProvSvc;
- @Inject public ApplicationLoadBalancerService _newLbSvc;
- @Inject public ApplicationLoadBalancerService _appLbService;
- @Inject public AffinityGroupService _affinityGroupService;
- @Inject public InternalLoadBalancerElementService _internalLbElementSvc;
- @Inject public InternalLoadBalancerVMService _internalLbSvc;
- @Inject public NetworkModel _ntwkModel;
-
- public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
+ @Inject
+ public ConfigurationService _configService;
+ @Inject
+ public AccountService _accountService;
+ @Inject
+ public UserVmService _userVmService;
+ @Inject
+ public ManagementService _mgr;
+ @Inject
+ public StorageService _storageService;
+ @Inject
+ public VolumeApiService _volumeService;
+ @Inject
+ public ResourceService _resourceService;
+ @Inject
+ public NetworkService _networkService;
+ @Inject
+ public TemplateApiService _templateService;
+ @Inject
+ public SecurityGroupService _securityGroupService;
+ @Inject
+ public SnapshotApiService _snapshotService;
+ @Inject
+ public VpcVirtualNetworkApplianceService _routerService;
+ @Inject
+ public ResponseGenerator _responseGenerator;
+ @Inject
+ public EntityManager _entityMgr;
+ @Inject
+ public RulesService _rulesService;
+ @Inject
+ public AutoScaleService _autoScaleService;
+ @Inject
+ public LoadBalancingRulesService _lbService;
+ @Inject
+ public RemoteAccessVpnService _ravService;
+ @Inject
+ public ProjectService _projectService;
+ @Inject
+ public FirewallService _firewallService;
+ @Inject
+ public DomainService _domainService;
+ @Inject
+ public ResourceLimitService _resourceLimitService;
+ @Inject
+ public IdentityService _identityService;
+ @Inject
+ public StorageNetworkService _storageNetworkService;
+ @Inject
+ public TaggedResourceService _taggedResourceService;
+ @Inject
+ public ResourceMetaDataService _resourceMetaDataService;
+ @Inject
+ public VpcService _vpcService;
+ @Inject
+ public NetworkACLService _networkACLService;
+ @Inject
+ public Site2SiteVpnService _s2sVpnService;
+
+ @Inject
+ public QueryService _queryService;
+ @Inject
+ public UsageService _usageService;
+ @Inject
+ public NetworkUsageService _networkUsageService;
+ @Inject
+ public VMSnapshotService _vmSnapshotService;
+ @Inject
+ public DataStoreProviderApiService dataStoreProviderApiService;
+ @Inject
+ public VpcProvisioningService _vpcProvSvc;
+ @Inject
+ public ApplicationLoadBalancerService _newLbSvc;
+ @Inject
+ public ApplicationLoadBalancerService _appLbService;
+ @Inject
+ public AffinityGroupService _affinityGroupService;
+ @Inject
+ public InternalLoadBalancerElementService _internalLbElementSvc;
+ @Inject
+ public InternalLoadBalancerVMService _internalLbSvc;
+ @Inject
+ public NetworkModel _ntwkModel;
+
+ public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException, NetworkRuleConflictException;
public void configure() {
}
@@ -173,7 +216,7 @@ public abstract class BaseCmd {
httpMethod = HTTPMethod.DELETE;
} else {
httpMethod = HTTPMethod.GET;
- }
+ }
}
public String getResponseType() {
@@ -221,15 +264,15 @@ public abstract class BaseCmd {
}
// FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Object> unpackParams(Map<String, String> params) {
Map<String, Object> lowercaseParams = new HashMap<String, Object>();
for (String key : params.keySet()) {
int arrayStartIndex = key.indexOf('[');
int arrayStartLastIndex = key.lastIndexOf('[');
if (arrayStartIndex != arrayStartLastIndex) {
- throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
- + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
if (arrayStartIndex > 0) {
@@ -237,16 +280,16 @@ public abstract class BaseCmd {
int arrayEndLastIndex = key.lastIndexOf(']');
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
// malformed parameter
- throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
- + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
// Now that we have an array object, check for a field name in the case of a complex object
int fieldIndex = key.indexOf('.');
String fieldName = null;
if (fieldIndex < arrayEndIndex) {
- throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
- + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
} else {
fieldName = key.substring(fieldIndex + 1);
}
@@ -270,8 +313,8 @@ public abstract class BaseCmd {
}
if (!parsedIndex) {
- throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
- + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
Object value = lowercaseParams.get(paramName);
@@ -281,7 +324,7 @@ public abstract class BaseCmd {
mapValue = new HashMap<String, Object>();
mapArray.put(Integer.valueOf(index), mapValue);
} else if (value instanceof Map) {
- mapArray = (HashMap) value;
+ mapArray = (HashMap)value;
mapValue = mapArray.get(Integer.valueOf(index));
if (mapValue == null) {
mapValue = new HashMap<String, Object>();
@@ -306,9 +349,7 @@ public abstract class BaseCmd {
}
public static boolean isAdmin(short accountType) {
- return ((accountType == Account.ACCOUNT_TYPE_ADMIN) ||
- (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
- (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
+ return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
}
public static boolean isRootAdmin(short accountType) {
@@ -339,7 +380,8 @@ public abstract class BaseCmd {
if (!enabledOnly || account.getState() == Account.State.enabled) {
return account.getId();
} else {
- throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
+ throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() +
+ " as it's no longer active");
}
} else {
// idList is not used anywhere, so removed it now
@@ -355,7 +397,8 @@ public abstract class BaseCmd {
if (!enabledOnly || project.getState() == Project.State.Active) {
return project.getProjectAccountId();
} else {
- PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
+ PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() +
+ " as it's no longer active");
ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseListCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java
index 071c02d..d3ebb95 100644
--- a/api/src/org/apache/cloudstack/api/BaseListCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java
@@ -43,7 +43,7 @@ public abstract class BaseListCmd extends BaseCmd {
public BaseListCmd() {
}
-
+
public String getKeyword() {
return keyword;
}
@@ -65,13 +65,13 @@ public abstract class BaseListCmd extends BaseCmd {
}
public void configure() {
- if(MAX_PAGESIZE == null) {
- if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
- MAX_PAGESIZE = _configService.getDefaultPageSize();
- } else {
- MAX_PAGESIZE = PAGESIZE_UNLIMITED;
- }
- }
+ if (MAX_PAGESIZE == null) {
+ if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
+ MAX_PAGESIZE = _configService.getDefaultPageSize();
+ } else {
+ MAX_PAGESIZE = PAGESIZE_UNLIMITED;
+ }
+ }
}
@Override
@@ -89,7 +89,7 @@ public abstract class BaseListCmd extends BaseCmd {
if (defaultPageSize.longValue() == PAGESIZE_UNLIMITED) {
defaultPageSize = null;
}
-
+
return defaultPageSize;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
index 6e50a15..b74ec2f 100644
--- a/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
@@ -20,16 +20,18 @@ import org.apache.cloudstack.api.response.DomainResponse;
public abstract class BaseListDomainResourcesCmd extends BaseListCmd {
- @Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "If set to false, " +
- "list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
+ @Parameter(name = ApiConstants.LIST_ALL,
+ type = CommandType.BOOLEAN,
+ description = "If set to false, "
+ + "list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
private Boolean listAll;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="list only resources belonging to the domain specified")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "list only resources belonging to the domain specified")
private Long domainId;
- @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false," +
- " but if true, lists all resources from the parent specified by the domainId till leaves.")
+ @Parameter(name = ApiConstants.IS_RECURSIVE,
+ type = CommandType.BOOLEAN,
+ description = "defaults to false," + " but if true, lists all resources from the parent specified by the domainId till leaves.")
private Boolean recursive;
public boolean listAll() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
index 836527f..01ebd7f 100644
--- a/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
@@ -20,8 +20,7 @@ import org.apache.cloudstack.api.response.ProjectResponse;
public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd {
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType=ProjectResponse.class,
- description="list objects by project")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "list objects by project")
private Long projectId;
public Long getProjectId() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
index 88176a5..98b88e7 100644
--- a/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
@@ -23,7 +23,7 @@ import java.util.Map;
import com.cloud.exception.InvalidParameterValueException;
-public abstract class BaseListTaggedResourcesCmd extends BaseListProjectAndAccountResourcesCmd{
+public abstract class BaseListTaggedResourcesCmd extends BaseListProjectAndAccountResourcesCmd {
@Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List resources by tags (key/value pairs)")
private Map tags;
@@ -34,7 +34,7 @@ public abstract class BaseListTaggedResourcesCmd extends BaseListProjectAndAccou
Collection<?> servicesCollection = tags.values();
Iterator<?> iter = servicesCollection.iterator();
while (iter.hasNext()) {
- HashMap<String, String> services = (HashMap<String, String>) iter.next();
+ HashMap<String, String> services = (HashMap<String, String>)iter.next();
String key = services.get("key");
String value = services.get("value");
if (value == null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
index 88732ae..67b0bfa 100644
--- a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@ -34,8 +34,7 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplatePermissionsResponse.class,
- required=true, description="the template ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplatePermissionsResponse.class, required = true, description = "the template ID")
private Long id;
/////////////////////////////////////////////////////
@@ -77,7 +76,7 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
List<String> accountNames = _templateService.listTemplatePermissions(this);
Account account = CallContext.current().getCallingAccount();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java
index 187ad94..a31a7d5 100644
--- a/api/src/org/apache/cloudstack/api/BaseResponse.java
+++ b/api/src/org/apache/cloudstack/api/BaseResponse.java
@@ -48,10 +48,12 @@ public abstract class BaseResponse implements ResponseObject {
return null;
}
- @SerializedName(ApiConstants.JOB_ID) @Param(description="the UUID of the latest async job acting on this object")
+ @SerializedName(ApiConstants.JOB_ID)
+ @Param(description = "the UUID of the latest async job acting on this object")
protected String jobId;
- @SerializedName(ApiConstants.JOB_STATUS) @Param(description="the current status of the latest async job acting on this object")
+ @SerializedName(ApiConstants.JOB_STATUS)
+ @Param(description = "the current status of the latest async job acting on this object")
private Integer jobStatus;
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
index a4c5bfa..f58f251 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -28,33 +28,36 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.BOOTABLE, type=CommandType.BOOLEAN, description="true if image is bootable, false otherwise")
+ @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if image is bootable, false otherwise")
private Boolean bootable;
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the image", length=4096)
+ @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the image", length = 4096)
private String displayText;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
- required=true, description="the ID of the image file")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the image file")
private Long id;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the image file")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the image file")
private String templateName;
- @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.UUID, entityType = GuestOSResponse.class,
- description="the ID of the OS type that best represents the OS of this image.")
+ @Parameter(name = ApiConstants.OS_TYPE_ID,
+ type = CommandType.UUID,
+ entityType = GuestOSResponse.class,
+ description = "the ID of the OS type that best represents the OS of this image.")
private Long osTypeId;
- @Parameter(name=ApiConstants.FORMAT, type=CommandType.STRING, description="the format for the image")
+ @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, description = "the format for the image")
private String format;
- @Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the image supports the password reset feature; default is false")
+ @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "true if the image supports the password reset feature; default is false")
private Boolean passwordEnabled;
- @Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the template, integer")
+ @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the template, integer")
private Integer sortKey;
- @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+ @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
+ type = CommandType.BOOLEAN,
+ description = "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
private Boolean isDynamicallyScalable;
@Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
index 5cd4881..84249fc 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
@@ -33,11 +33,13 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.")
+ @Parameter(name = ApiConstants.ACCOUNTS,
+ type = CommandType.LIST,
+ collectionType = CommandType.STRING,
+ description = "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.")
private List<String> accountNames;
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class,
- required = true, description = "the template ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the template ID")
private Long id;
@Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true for featured template/iso, false otherwise")
@@ -46,14 +48,19 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true for public template/iso, false for private templates/isos")
private Boolean isPublic;
- @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the template/iso is extractable, false other wise. Can be set only by root admin")
+ @Parameter(name = ApiConstants.IS_EXTRACTABLE,
+ type = CommandType.BOOLEAN,
+ description = "true if the template/iso is extractable, false other wise. Can be set only by root admin")
private Boolean isExtractable;
@Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)")
private String operation;
- @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectResponse.class,
- description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
+ @Parameter(name = ApiConstants.PROJECT_IDS,
+ type = CommandType.LIST,
+ collectionType = CommandType.UUID,
+ entityType = ProjectResponse.class,
+ description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
private List<Long> projectIds;
// ///////////////////////////////////////////////////
@@ -113,7 +120,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
}
@Override
- public void execute(){
+ public void execute() {
boolean result = _templateService.updateTemplateOrIsoPermissions(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/IdentityService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/IdentityService.java b/api/src/org/apache/cloudstack/api/IdentityService.java
index a2ccec2..8451945 100644
--- a/api/src/org/apache/cloudstack/api/IdentityService.java
+++ b/api/src/org/apache/cloudstack/api/IdentityService.java
@@ -18,5 +18,6 @@ package org.apache.cloudstack.api;
public interface IdentityService {
Long getIdentityId(String tableName, String identityString);
+
String getIdentityUuid(String tableName, String identityString);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/Parameter.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/Parameter.java b/api/src/org/apache/cloudstack/api/Parameter.java
index 89178f2..f1c6e1a 100644
--- a/api/src/org/apache/cloudstack/api/Parameter.java
+++ b/api/src/org/apache/cloudstack/api/Parameter.java
@@ -26,7 +26,7 @@ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.BaseCmd.CommandType;
@Retention(RetentionPolicy.RUNTIME)
-@Target({ FIELD })
+@Target({FIELD})
public @interface Parameter {
String name() default "";
@@ -49,6 +49,6 @@ public @interface Parameter {
String since() default "";
String retrieveMethod() default "getById";
-
+
RoleType[] authorized() default {};
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ResourceDetail.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResourceDetail.java b/api/src/org/apache/cloudstack/api/ResourceDetail.java
index 4914c78..de0c3fb 100644
--- a/api/src/org/apache/cloudstack/api/ResourceDetail.java
+++ b/api/src/org/apache/cloudstack/api/ResourceDetail.java
@@ -16,14 +16,14 @@
// under the License.
package org.apache.cloudstack.api;
-public interface ResourceDetail extends InternalIdentity{
-
+public interface ResourceDetail extends InternalIdentity {
+
public long getResourceId();
-
+
public String getName();
-
+
public String getValue();
-
+
public boolean isDisplay();
-
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 832f6e3..2d37b6a 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api;
-
import java.text.DecimalFormat;
import java.util.EnumSet;
import java.util.List;
@@ -243,8 +242,7 @@ public interface ResponseGenerator {
LBStickinessResponse createLBStickinessPolicyResponse(StickinessPolicy stickinessPolicy, LoadBalancer lb);
- LBHealthCheckResponse createLBHealthCheckPolicyResponse(List<? extends HealthCheckPolicy> healthcheckPolicies,
- LoadBalancer lb);
+ LBHealthCheckResponse createLBHealthCheckPolicyResponse(List<? extends HealthCheckPolicy> healthcheckPolicies, LoadBalancer lb);
LBHealthCheckResponse createLBHealthCheckPolicyResponse(HealthCheckPolicy healthcheckPolicy, LoadBalancer lb);
@@ -368,10 +366,8 @@ public interface ResponseGenerator {
*/
ResourceTagResponse createResourceTagResponse(ResourceTag resourceTag, boolean keyValueOnly);
-
Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(Site2SiteVpnGateway result);
-
/**
* @param offering
* @return
@@ -429,9 +425,11 @@ public interface ResponseGenerator {
UsageRecordResponse createUsageResponse(Usage usageRecord);
TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
+
VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result);
+
public NicResponse createNicResponse(Nic result);
ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb, Map<Ip, UserVm> lbInstances);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ResponseObject.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseObject.java b/api/src/org/apache/cloudstack/api/ResponseObject.java
index c8bd457..10867b4 100644
--- a/api/src/org/apache/cloudstack/api/ResponseObject.java
+++ b/api/src/org/apache/cloudstack/api/ResponseObject.java
@@ -56,7 +56,6 @@ public interface ResponseObject {
*/
String getJobId();
-
/**
* Sets the job id
*
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/ServerApiException.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 1a740d5..81184e3 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
+
import java.util.ArrayList;
import com.cloud.exception.CloudException;
@@ -40,12 +41,12 @@ public class ServerApiException extends CloudRuntimeException {
}
// wrap a specific CloudRuntimeException to a ServerApiException
- public ServerApiException(ApiErrorCode errorCode, String description, Throwable cause){
+ public ServerApiException(ApiErrorCode errorCode, String description, Throwable cause) {
super(description, cause);
_errorCode = errorCode;
_description = description;
if (cause instanceof CloudRuntimeException) {
- CloudRuntimeException rt = (CloudRuntimeException) cause;
+ CloudRuntimeException rt = (CloudRuntimeException)cause;
ArrayList<ExceptionProxyObject> idList = rt.getIdProxyList();
if (idList != null) {
for (int i = 0; i < idList.size(); i++) {
@@ -54,7 +55,7 @@ public class ServerApiException extends CloudRuntimeException {
}
setCSErrorCode(rt.getCSErrorCode());
} else if (cause instanceof CloudException) {
- CloudException rt = (CloudException) cause;
+ CloudException rt = (CloudException)cause;
ArrayList<String> idList = rt.getIdProxyList();
if (idList != null) {
for (int i = 0; i < idList.size(); i++) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/Validate.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/Validate.java b/api/src/org/apache/cloudstack/api/Validate.java
index deedda6..086b12d 100644
--- a/api/src/org/apache/cloudstack/api/Validate.java
+++ b/api/src/org/apache/cloudstack/api/Validate.java
@@ -23,8 +23,9 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
-@Target({ FIELD })
+@Target({FIELD})
public @interface Validate {
Class<?>[] validators() default Object.class;
+
String description() default "";
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index 94325f6..3ca8e54 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -34,7 +34,7 @@ import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.Map;
-@APICommand(name = "createAccount", description="Creates an account", responseObject=AccountResponse.class)
+@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class)
public class CreateAccountCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName());
@@ -44,44 +44,53 @@ public class CreateAccountCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
+ @Parameter(name = ApiConstants.ACCOUNT,
+ type = CommandType.STRING,
+ description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
private String accountName;
- @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.SHORT, required=true, description="Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
+ @Parameter(name = ApiConstants.ACCOUNT_TYPE,
+ type = CommandType.SHORT,
+ required = true,
+ description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
private Short accountType;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="Creates the user under the specified domain.")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
private Long domainId;
- @Parameter(name=ApiConstants.EMAIL, type=CommandType.STRING, required=true, description="email")
+ @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "email")
private String email;
- @Parameter(name=ApiConstants.FIRSTNAME, type=CommandType.STRING, required=true, description="firstname")
+ @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "firstname")
private String firstName;
- @Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, required=true, description="lastname")
+ @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "lastname")
private String lastName;
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
+ @Parameter(name = ApiConstants.PASSWORD,
+ type = CommandType.STRING,
+ required = true,
+ description = "Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
private String password;
- @Parameter(name=ApiConstants.TIMEZONE, type=CommandType.STRING, description="Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
+ @Parameter(name = ApiConstants.TIMEZONE,
+ type = CommandType.STRING,
+ description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
private String timeZone;
- @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="Unique username.")
+ @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Unique username.")
private String userName;
- @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the account's networks")
+ @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the account's networks")
private String networkDomain;
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map<String, String> details;
- @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from external provisioning system")
+ @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding account from external provisioning system")
private String accountUUID;
- @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from external provisioning system")
+ @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding account from external provisioning system")
private String userUUID;
/////////////////////////////////////////////////////
@@ -134,7 +143,7 @@ public class CreateAccountCmd extends BaseCmd {
}
Collection<String> paramsCollection = details.values();
- Map<String, String> params = (Map<String, String>) (paramsCollection.toArray())[0];
+ Map<String, String> params = (Map<String, String>)(paramsCollection.toArray())[0];
return params;
}
@@ -161,10 +170,10 @@ public class CreateAccountCmd extends BaseCmd {
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
- UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
- getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
+ public void execute() {
+ CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
+ UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(),
+ getAccountType(), getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
response.setResponseName(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index b46036b..e37846d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -36,7 +36,7 @@ import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.User;
-@APICommand(name = "deleteAccount", description="Deletes a account, and all users associated with this account", responseObject=SuccessResponse.class)
+@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class)
public class DeleteAccountCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAccountCmd.class.getName());
private static final String s_name = "deleteaccountresponse";
@@ -45,17 +45,16 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=AccountResponse.class,
- required=true, description="Account id")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, required = true, description = "Account id")
private Long id;
- @Inject RegionService _regionService;
+ @Inject
+ RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
-
public Long getId() {
return id;
}
@@ -91,14 +90,15 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
User user = _responseGenerator.findUserById(getId());
- return (user != null ? ("deleting User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId()) : "user delete, but this user does not exist in the system");
+ return (user != null ? ("deleting User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId())
+ : "user delete, but this user does not exist in the system");
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Account Id: "+getId());
+ public void execute() {
+ CallContext.current().setEventDetails("Account Id: " + getId());
- boolean result = _regionService.deleteUserAccount(this);
+ boolean result = _regionService.deleteUserAccount(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index 806a8a5..beb28dd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -37,7 +37,7 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "disableAccount", description="Disables an account", responseObject=AccountResponse.class)
+@APICommand(name = "disableAccount", description = "Disables an account", responseObject = AccountResponse.class)
public class DisableAccountCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName());
private static final String s_name = "disableaccountresponse";
@@ -45,21 +45,20 @@ public class DisableAccountCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=AccountResponse.class,
- description="Account id")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
private Long id;
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Disables specified account.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Disables specified account.")
private String accountName;
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="Disables specified account in this domain.")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Disables specified account in this domain.")
private Long domainId;
- @Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
+ @Parameter(name = ApiConstants.LOCK, type = CommandType.BOOLEAN, required = true, description = "If true, only lock the account; else disable the account")
private Boolean lockRequested;
- @Inject RegionService _regionService;
+ @Inject
+ RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -112,19 +111,19 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "disabling account: " + getAccountName() + " in domain: " + getDomainId();
+ return "disabling account: " + getAccountName() + " in domain: " + getDomainId();
}
@Override
- public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
- CallContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
+ public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
+ CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
Account result = _regionService.disableAccount(this);
- if (result != null){
+ if (result != null) {
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account");
}
}