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 2012/08/31 00:55:05 UTC
git commit: Started an object model for the orchestration platform
Updated Branches:
refs/heads/javelin 49c9f1f0a -> b9ddcf8cf
Started an object model for the orchestration platform
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/b9ddcf8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b9ddcf8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b9ddcf8c
Branch: refs/heads/javelin
Commit: b9ddcf8cfe7effdac2a2e6c5d1d7f9c82961da65
Parents: 49c9f1f
Author: Alex Huang <al...@citrix.com>
Authored: Thu Aug 30 15:54:33 2012 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Thu Aug 30 15:54:33 2012 -0700
----------------------------------------------------------------------
api/src/com/cloud/storage/Snapshot.java | 5 +-
core/src/com/cloud/storage/SnapshotVO.java | 106 ++++++++-------
.../subsystem/api/storage/StorageSubSystem.java | 2 -
utils/src/com/cloud/utils/fsm/FiniteState.java | 7 +-
4 files changed, 62 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b9ddcf8c/api/src/com/cloud/storage/Snapshot.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/Snapshot.java b/api/src/com/cloud/storage/Snapshot.java
index a37cc94..d169e64 100644
--- a/api/src/com/cloud/storage/Snapshot.java
+++ b/api/src/com/cloud/storage/Snapshot.java
@@ -40,6 +40,7 @@ public interface Snapshot extends ControlledEntity {
return max;
}
+ @Override
public String toString() {
return this.name();
}
@@ -56,6 +57,7 @@ public interface Snapshot extends ControlledEntity {
BackedUp,
Error;
+ @Override
public String toString() {
return this.name();
}
@@ -67,8 +69,9 @@ public interface Snapshot extends ControlledEntity {
public static final long MANUAL_POLICY_ID = 0L;
- Long getId();
+ long getId();
+ @Override
long getAccountId();
long getVolumeId();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b9ddcf8c/core/src/com/cloud/storage/SnapshotVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java
index 08dfafa..75f9657 100644
--- a/core/src/com/cloud/storage/SnapshotVO.java
+++ b/core/src/com/cloud/storage/SnapshotVO.java
@@ -36,24 +36,24 @@ import com.google.gson.annotations.Expose;
@Entity
@Table(name="snapshots")
public class SnapshotVO implements Snapshot, Identity {
-
+
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
- private long id = -1;
-
+ private final long id = -1;
+
@Column(name="data_center_id")
long dataCenterId;
@Column(name="account_id")
long accountId;
-
+
@Column(name="domain_id")
long domainId;
@Column(name="volume_id")
Long volumeId;
-
+
@Column(name="disk_offering_id")
Long diskOfferingId;
@@ -64,7 +64,7 @@ public class SnapshotVO implements Snapshot, Identity {
@Expose
@Column(name="name")
String name;
-
+
@Expose
@Column(name="status", updatable = true, nullable=false)
@Enumerated(value=EnumType.STRING)
@@ -75,10 +75,10 @@ public class SnapshotVO implements Snapshot, Identity {
@Column(name="type_description")
String typeDescription;
-
+
@Column(name="size")
long size;
-
+
@Column(name=GenericDao.CREATED_COLUMN)
Date created;
@@ -87,10 +87,10 @@ public class SnapshotVO implements Snapshot, Identity {
@Column(name="backup_snap_id")
String backupSnapshotId;
-
+
@Column(name="swift_id")
Long swiftId;
-
+
@Column(name="sechost_id")
Long secHostId;
@@ -100,16 +100,16 @@ public class SnapshotVO implements Snapshot, Identity {
@Column(name="hypervisor_type")
@Enumerated(value=EnumType.STRING)
HypervisorType hypervisorType;
-
+
@Expose
@Column(name="version")
String version;
-
+
@Column(name="uuid")
String uuid;
-
+
public SnapshotVO() {
- this.uuid = UUID.randomUUID().toString();
+ this.uuid = UUID.randomUUID().toString();
}
public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) {
@@ -127,11 +127,11 @@ public class SnapshotVO implements Snapshot, Identity {
this.prevSnapshotId = 0;
this.hypervisorType = hypervisorType;
this.version = "2.2";
- this.uuid = UUID.randomUUID().toString();
+ this.uuid = UUID.randomUUID().toString();
}
-
+
@Override
- public Long getId() {
+ public long getId() {
return id;
}
@@ -144,6 +144,7 @@ public class SnapshotVO implements Snapshot, Identity {
return accountId;
}
+ @Override
public long getDomainId() {
return domainId;
}
@@ -165,9 +166,9 @@ public class SnapshotVO implements Snapshot, Identity {
public String getPath() {
return path;
}
-
+
public void setPath(String path) {
- this.path = path;
+ this.path = path;
}
@Override
@@ -178,7 +179,7 @@ public class SnapshotVO implements Snapshot, Identity {
public short getsnapshotType() {
return snapshotType;
}
-
+
@Override
public Type getType() {
if (snapshotType < 0 || snapshotType >= Type.values().length) {
@@ -186,7 +187,7 @@ public class SnapshotVO implements Snapshot, Identity {
}
return Type.values()[snapshotType];
}
-
+
public Long getSwiftId() {
return swiftId;
}
@@ -205,13 +206,13 @@ public class SnapshotVO implements Snapshot, Identity {
@Override
public HypervisorType getHypervisorType() {
- return hypervisorType;
+ return hypervisorType;
}
-
+
public void setSnapshotType(short snapshotType) {
this.snapshotType = snapshotType;
}
-
+
@Override
public boolean isRecursive(){
if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
@@ -239,6 +240,7 @@ public class SnapshotVO implements Snapshot, Identity {
this.version = version;
}
+ @Override
public Date getCreated() {
return created;
}
@@ -246,32 +248,32 @@ public class SnapshotVO implements Snapshot, Identity {
public Date getRemoved() {
return removed;
}
-
- @Override
+
+ @Override
public Status getStatus() {
- return status;
- }
-
- public void setStatus(Status status) {
- this.status = status;
- }
-
- public String getBackupSnapshotId(){
- return backupSnapshotId;
- }
-
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public String getBackupSnapshotId(){
+ return backupSnapshotId;
+ }
+
public long getPrevSnapshotId(){
- return prevSnapshotId;
- }
-
- public void setBackupSnapshotId(String backUpSnapshotId){
- this.backupSnapshotId = backUpSnapshotId;
- }
-
- public void setPrevSnapshotId(long prevSnapshotId){
- this.prevSnapshotId = prevSnapshotId;
- }
-
+ return prevSnapshotId;
+ }
+
+ public void setBackupSnapshotId(String backUpSnapshotId){
+ this.backupSnapshotId = backUpSnapshotId;
+ }
+
+ public void setPrevSnapshotId(long prevSnapshotId){
+ this.prevSnapshotId = prevSnapshotId;
+ }
+
public static Type getSnapshotType(String snapshotType) {
for ( Type type : Type.values()) {
if ( type.equals(snapshotType)) {
@@ -280,13 +282,13 @@ public class SnapshotVO implements Snapshot, Identity {
}
return null;
}
-
+
@Override
public String getUuid() {
- return this.uuid;
+ return this.uuid;
}
-
+
public void setUuid(String uuid) {
- this.uuid = uuid;
+ this.uuid = uuid;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b9ddcf8c/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
index bef7586..e12ff79 100755
--- a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
@@ -8,8 +8,6 @@ public interface StorageSubSystem {
String getType();
Class<? extends Grouping> getScope();
- create();
-
URI grantAccess(String vol, String reservationId);
URI RemoveAccess(String vol, String reservationId);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b9ddcf8c/utils/src/com/cloud/utils/fsm/FiniteState.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/fsm/FiniteState.java b/utils/src/com/cloud/utils/fsm/FiniteState.java
index 21ef711..d501b43 100644
--- a/utils/src/com/cloud/utils/fsm/FiniteState.java
+++ b/utils/src/com/cloud/utils/fsm/FiniteState.java
@@ -29,14 +29,14 @@ public interface FiniteState<S, E> {
* @return the state machine being used.
*/
StateMachine<S, E> getStateMachine();
-
+
/**
* get next state based on the event.
* @param event
* @return next State
*/
S getNextState(E event);
-
+
/**
* Get the states that could have traveled to the current state
* via this event.
@@ -44,11 +44,12 @@ public interface FiniteState<S, E> {
* @return array of states
*/
List<S> getFromStates(E event);
-
+
/**
* Get the possible events that can happen from the current state.
* @return array of events.
*/
Set<E> getPossibleEvents();
+
String getDescription();
}