mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Started an object model for the orchestration platform
This commit is contained in:
parent
49c9f1f0ab
commit
b9ddcf8cfe
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user