mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
feature #1617: Datastore types for JAVA OCA
This commit is contained in:
parent
8a2822b33d
commit
04c0abd844
@ -36,6 +36,10 @@ public class Datastore extends PoolElement
|
||||
private static final String CHOWN = METHOD_PREFIX + "chown";
|
||||
private static final String CHMOD = METHOD_PREFIX + "chmod";
|
||||
|
||||
private static final String[] DATASTORE_TYPES = {"IMAGE", "SYSTEM", "FILE"};
|
||||
|
||||
private static final String[] SHORT_DATASTORE_TYPES = {"img", "sys", "fil"};
|
||||
|
||||
/**
|
||||
* Creates a new Datastore representation.
|
||||
* @param id The datastore id.
|
||||
@ -358,6 +362,38 @@ public class Datastore extends PoolElement
|
||||
// =================================
|
||||
// Helpers
|
||||
// =================================
|
||||
/**
|
||||
* Returns the type of the Datastore.
|
||||
*
|
||||
* @return The type of the Datastore.
|
||||
*/
|
||||
public int type()
|
||||
{
|
||||
String state = xpath("TYPE");
|
||||
return state != null ? Integer.parseInt( state ) : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the Datastore as a String.
|
||||
*
|
||||
* @return The type of the Datastore as a String.
|
||||
*/
|
||||
public String typeStr()
|
||||
{
|
||||
int type = type();
|
||||
return type != -1 ? DATASTORE_TYPES[type] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the Datastore as a short String.
|
||||
*
|
||||
* @return The type of the Datastore as a short String.
|
||||
*/
|
||||
public String shortTypeStr()
|
||||
{
|
||||
int type = type();
|
||||
return type != -1 ? SHORT_DATASTORE_TYPES[type] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the image is part of this datastore
|
||||
|
Loading…
x
Reference in New Issue
Block a user