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;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name();
|
return this.name();
|
||||||
}
|
}
|
||||||
@ -56,6 +57,7 @@ public interface Snapshot extends ControlledEntity {
|
|||||||
BackedUp,
|
BackedUp,
|
||||||
Error;
|
Error;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name();
|
return this.name();
|
||||||
}
|
}
|
||||||
@ -67,8 +69,9 @@ public interface Snapshot extends ControlledEntity {
|
|||||||
|
|
||||||
public static final long MANUAL_POLICY_ID = 0L;
|
public static final long MANUAL_POLICY_ID = 0L;
|
||||||
|
|
||||||
Long getId();
|
long getId();
|
||||||
|
|
||||||
|
@Override
|
||||||
long getAccountId();
|
long getAccountId();
|
||||||
|
|
||||||
long getVolumeId();
|
long getVolumeId();
|
||||||
|
|||||||
@ -36,24 +36,24 @@ import com.google.gson.annotations.Expose;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name="snapshots")
|
@Table(name="snapshots")
|
||||||
public class SnapshotVO implements Snapshot, Identity {
|
public class SnapshotVO implements Snapshot, Identity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||||
@Column(name="id")
|
@Column(name="id")
|
||||||
private long id = -1;
|
private final long id = -1;
|
||||||
|
|
||||||
@Column(name="data_center_id")
|
@Column(name="data_center_id")
|
||||||
long dataCenterId;
|
long dataCenterId;
|
||||||
|
|
||||||
@Column(name="account_id")
|
@Column(name="account_id")
|
||||||
long accountId;
|
long accountId;
|
||||||
|
|
||||||
@Column(name="domain_id")
|
@Column(name="domain_id")
|
||||||
long domainId;
|
long domainId;
|
||||||
|
|
||||||
@Column(name="volume_id")
|
@Column(name="volume_id")
|
||||||
Long volumeId;
|
Long volumeId;
|
||||||
|
|
||||||
@Column(name="disk_offering_id")
|
@Column(name="disk_offering_id")
|
||||||
Long diskOfferingId;
|
Long diskOfferingId;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
@Expose
|
@Expose
|
||||||
@Column(name="name")
|
@Column(name="name")
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
@Column(name="status", updatable = true, nullable=false)
|
@Column(name="status", updatable = true, nullable=false)
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
@ -75,10 +75,10 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
|
|
||||||
@Column(name="type_description")
|
@Column(name="type_description")
|
||||||
String typeDescription;
|
String typeDescription;
|
||||||
|
|
||||||
@Column(name="size")
|
@Column(name="size")
|
||||||
long size;
|
long size;
|
||||||
|
|
||||||
@Column(name=GenericDao.CREATED_COLUMN)
|
@Column(name=GenericDao.CREATED_COLUMN)
|
||||||
Date created;
|
Date created;
|
||||||
|
|
||||||
@ -87,10 +87,10 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
|
|
||||||
@Column(name="backup_snap_id")
|
@Column(name="backup_snap_id")
|
||||||
String backupSnapshotId;
|
String backupSnapshotId;
|
||||||
|
|
||||||
@Column(name="swift_id")
|
@Column(name="swift_id")
|
||||||
Long swiftId;
|
Long swiftId;
|
||||||
|
|
||||||
@Column(name="sechost_id")
|
@Column(name="sechost_id")
|
||||||
Long secHostId;
|
Long secHostId;
|
||||||
|
|
||||||
@ -100,16 +100,16 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
@Column(name="hypervisor_type")
|
@Column(name="hypervisor_type")
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
HypervisorType hypervisorType;
|
HypervisorType hypervisorType;
|
||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
@Column(name="version")
|
@Column(name="version")
|
||||||
String version;
|
String version;
|
||||||
|
|
||||||
@Column(name="uuid")
|
@Column(name="uuid")
|
||||||
String uuid;
|
String uuid;
|
||||||
|
|
||||||
public SnapshotVO() {
|
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 ) {
|
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.prevSnapshotId = 0;
|
||||||
this.hypervisorType = hypervisorType;
|
this.hypervisorType = hypervisorType;
|
||||||
this.version = "2.2";
|
this.version = "2.2";
|
||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +144,7 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
return accountId;
|
return accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getDomainId() {
|
public long getDomainId() {
|
||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
@ -165,9 +166,9 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
public String getPath() {
|
public String getPath() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPath(String path) {
|
public void setPath(String path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -178,7 +179,7 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
public short getsnapshotType() {
|
public short getsnapshotType() {
|
||||||
return snapshotType;
|
return snapshotType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
if (snapshotType < 0 || snapshotType >= Type.values().length) {
|
if (snapshotType < 0 || snapshotType >= Type.values().length) {
|
||||||
@ -186,7 +187,7 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
}
|
}
|
||||||
return Type.values()[snapshotType];
|
return Type.values()[snapshotType];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getSwiftId() {
|
public Long getSwiftId() {
|
||||||
return swiftId;
|
return swiftId;
|
||||||
}
|
}
|
||||||
@ -205,13 +206,13 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HypervisorType getHypervisorType() {
|
public HypervisorType getHypervisorType() {
|
||||||
return hypervisorType;
|
return hypervisorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnapshotType(short snapshotType) {
|
public void setSnapshotType(short snapshotType) {
|
||||||
this.snapshotType = snapshotType;
|
this.snapshotType = snapshotType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecursive(){
|
public boolean isRecursive(){
|
||||||
if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
|
if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
|
||||||
@ -239,6 +240,7 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Date getCreated() {
|
public Date getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
@ -246,32 +248,32 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
public Date getRemoved() {
|
public Date getRemoved() {
|
||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Status getStatus() {
|
public Status getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Status status) {
|
public void setStatus(Status status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBackupSnapshotId(){
|
public String getBackupSnapshotId(){
|
||||||
return backupSnapshotId;
|
return backupSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPrevSnapshotId(){
|
public long getPrevSnapshotId(){
|
||||||
return prevSnapshotId;
|
return prevSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBackupSnapshotId(String backUpSnapshotId){
|
public void setBackupSnapshotId(String backUpSnapshotId){
|
||||||
this.backupSnapshotId = backUpSnapshotId;
|
this.backupSnapshotId = backUpSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrevSnapshotId(long prevSnapshotId){
|
public void setPrevSnapshotId(long prevSnapshotId){
|
||||||
this.prevSnapshotId = prevSnapshotId;
|
this.prevSnapshotId = prevSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type getSnapshotType(String snapshotType) {
|
public static Type getSnapshotType(String snapshotType) {
|
||||||
for ( Type type : Type.values()) {
|
for ( Type type : Type.values()) {
|
||||||
if ( type.equals(snapshotType)) {
|
if ( type.equals(snapshotType)) {
|
||||||
@ -280,13 +282,13 @@ public class SnapshotVO implements Snapshot, Identity {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUuid() {
|
public String getUuid() {
|
||||||
return this.uuid;
|
return this.uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUuid(String uuid) {
|
public void setUuid(String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,6 @@ public interface StorageSubSystem {
|
|||||||
String getType();
|
String getType();
|
||||||
Class<? extends Grouping> getScope();
|
Class<? extends Grouping> getScope();
|
||||||
|
|
||||||
create();
|
|
||||||
|
|
||||||
URI grantAccess(String vol, String reservationId);
|
URI grantAccess(String vol, String reservationId);
|
||||||
URI RemoveAccess(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.
|
* @return the state machine being used.
|
||||||
*/
|
*/
|
||||||
StateMachine<S, E> getStateMachine();
|
StateMachine<S, E> getStateMachine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get next state based on the event.
|
* get next state based on the event.
|
||||||
* @param event
|
* @param event
|
||||||
* @return next State
|
* @return next State
|
||||||
*/
|
*/
|
||||||
S getNextState(E event);
|
S getNextState(E event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the states that could have traveled to the current state
|
* Get the states that could have traveled to the current state
|
||||||
* via this event.
|
* via this event.
|
||||||
@ -44,11 +44,12 @@ public interface FiniteState<S, E> {
|
|||||||
* @return array of states
|
* @return array of states
|
||||||
*/
|
*/
|
||||||
List<S> getFromStates(E event);
|
List<S> getFromStates(E event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the possible events that can happen from the current state.
|
* Get the possible events that can happen from the current state.
|
||||||
* @return array of events.
|
* @return array of events.
|
||||||
*/
|
*/
|
||||||
Set<E> getPossibleEvents();
|
Set<E> getPossibleEvents();
|
||||||
|
|
||||||
String getDescription();
|
String getDescription();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user