public class DirStorage extends Storage
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_DIR
The dictionary key for the base directory.
|
static java.lang.String |
SUFFIX_PROPS
The file suffix used for properties files.
|
KEY_MOUNT_OVERLAY_PATH, KEY_MOUNT_OVERLAY_PRIO, KEY_MOUNT_PATH, KEY_MOUNT_TIME, KEY_READWRITE, PATH_STORAGE, PATH_STORAGE_CACHE, PATH_STORAGEINFO
dict, KEY_CLASSNAME, KEY_ID, KEY_TYPE
Constructor and Description |
---|
DirStorage(java.io.File dir,
boolean readWrite)
Creates a new directory storage.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
dir()
Returns the base directory for the storage data files.
|
java.lang.Object |
load(Path path)
Loads an object from the specified location.
|
Metadata |
lookup(Path path)
Searches for an object at the specified location and returns
metadata about the object if found.
|
void |
remove(Path path)
Removes an object or an index at the specified location.
|
void |
store(Path path,
java.lang.Object data)
Stores an object at the specified location.
|
compareTo, isReadWrite, loadAll, localPath, lookupAll, mountOverlayPath, mountOverlayPrio, mountTime, path, setMountInfo
public static final java.lang.String KEY_DIR
public static final java.lang.String SUFFIX_PROPS
public DirStorage(java.io.File dir, boolean readWrite)
dir
- the base data directory to usereadWrite
- the read write flagpublic java.io.File dir()
public Metadata lookup(Path path)
public java.lang.Object load(Path path)
public void store(Path path, java.lang.Object data) throws StorageException
store
in class Storage
path
- the storage locationdata
- the data to storeStorageException
- if the data couldn't be writtenpublic void remove(Path path) throws StorageException
remove
in class Storage
path
- the storage locationStorageException
- if the data couldn't be removed