public abstract class Storage extends StorableObject implements java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_MOUNT_OVERLAY_PATH
The dictionary key for the mount overlay path.
|
static java.lang.String |
KEY_MOUNT_OVERLAY_PRIO
The dictionary key for the mount overlay priority.
|
static java.lang.String |
KEY_MOUNT_PATH
The dictionary key for the mount path.
|
static java.lang.String |
KEY_MOUNT_TIME
The dictionary key for the mount timestamp.
|
static java.lang.String |
KEY_READWRITE
The dictionary key for the read-write flag.
|
static Path |
PATH_STORAGE
The base storage path for mounting a storage to the root.
|
static Path |
PATH_STORAGE_CACHE
The base storage path for the storage caches.
|
static Path |
PATH_STORAGEINFO
The storage information path.
|
dict, KEY_CLASSNAME, KEY_ID, KEY_TYPE
Modifier | Constructor and Description |
---|---|
protected |
Storage(java.lang.String storageType,
boolean readWrite)
Creates a new storage.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object obj)
Compares this storage with another.
|
boolean |
isReadWrite()
Returns the read-write flag.
|
abstract java.lang.Object |
load(Path path)
Loads an object from the specified location.
|
java.lang.Object[] |
loadAll(Path path)
Loads all object from the specified location.
|
protected Path |
localPath(Path path)
Returns a local storage path by removing an optional base
storage path.
|
abstract Metadata |
lookup(Path path)
Searches for an object at the specified location and returns
metadata about the object if found.
|
Metadata[] |
lookupAll(Path path)
Searches for all objects at the specified location and returns
metadata about the ones found.
|
Path |
mountOverlayPath()
Returns the mount overlay path.
|
int |
mountOverlayPrio()
Returns the mount overlay priority.
|
java.util.Date |
mountTime()
Returns the storage mount time.
|
Path |
path()
Returns the storage mount path.
|
abstract void |
remove(Path path)
Removes an object or an index at the specified location.
|
void |
setMountInfo(Path path,
boolean readWrite,
Path overlay,
int prio)
Updates the mount information for this storage.
|
abstract void |
store(Path path,
java.lang.Object data)
Stores an object at the specified location.
|
public static final java.lang.String KEY_READWRITE
public static final java.lang.String KEY_MOUNT_PATH
public static final java.lang.String KEY_MOUNT_TIME
public static final java.lang.String KEY_MOUNT_OVERLAY_PATH
public static final java.lang.String KEY_MOUNT_OVERLAY_PRIO
public static final Path PATH_STORAGE
public static final Path PATH_STORAGE_CACHE
public static final Path PATH_STORAGEINFO
protected Storage(java.lang.String storageType, boolean readWrite)
storageType
- the storage type namereadWrite
- the read write flagpublic int compareTo(java.lang.Object obj) throws java.lang.ClassCastException
compareTo
in interface java.lang.Comparable
obj
- the object to compare withjava.lang.ClassCastException
- if the object wasn't comparablepublic Path path()
path
in class StorableObject
protected Path localPath(Path path)
path
- the path to adjustpublic boolean isReadWrite()
public java.util.Date mountTime()
public Path mountOverlayPath()
public int mountOverlayPrio()
public void setMountInfo(Path path, boolean readWrite, Path overlay, int prio)
path
- the mount path (or storage root path)readWrite
- the storage read-write flagoverlay
- the mount overlay pathprio
- the mount overlay prioritypublic abstract Metadata lookup(Path path)
path
- the storage locationpublic Metadata[] lookupAll(Path path)
path
- the storage locationpublic abstract java.lang.Object load(Path path)
path
- the storage locationpublic java.lang.Object[] loadAll(Path path)
path
- the storage locationpublic abstract void store(Path path, java.lang.Object data) throws StorageException
path
- the storage locationdata
- the data to storeStorageException
- if the data couldn't be writtenpublic abstract void remove(Path path) throws StorageException
path
- the storage locationStorageException
- if the data couldn't be removed