Class GenericFileStorage<V extends Serializable>
- java.lang.Object
-
- science.aist.jack.persistence.filesystem.AbstractFileStorage<String,V>
-
- science.aist.jack.persistence.filesystem.implementation.GenericFileStorage<V>
-
public class GenericFileStorage<V extends Serializable> extends AbstractFileStorage<String,V>
Description: Generic Implementation of the AbstractFileStorage
- Since:
- 2.0
- Author:
- Christoph Praschl
-
-
Field Summary
-
Fields inherited from class science.aist.jack.persistence.filesystem.AbstractFileStorage
completePath, fileExtension, pathToTempFolder
-
-
Constructor Summary
Constructors Constructor Description GenericFileStorage(Class<V> clazz)
GenericFileStorage(Class<V> clazz, String fileExtension)
GenericFileStorage(Class<V> clazz, String fileExtension, String subfolder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
create(V value)
Method for storing an given objectString
create(V value, String suggestedKey)
Method for storing an given objectboolean
delete(String key)
Method for deleting a stored objectboolean
deleteAll()
Method for deleting all stored objects Attention: If corresponding folder is used by multiple users/application this method does not take response for them! Only use it if the folder is only touched by thisStorage
Collection<V>
read()
Method for reading all objects managed by the storageV
read(String key)
Method for reading an object identified by the given keyboolean
update(String key, V value)
Method for updating the stored object at a given key-
Methods inherited from class science.aist.jack.persistence.filesystem.AbstractFileStorage
buildPath, buildPath, generateStringToken, getFileExtension, getPath
-
-
-
-
Method Detail
-
create
public String create(V value)
Method for storing an given object- Parameters:
value
- Object which should be stored- Returns:
- The key of the stored object
-
create
public String create(V value, String suggestedKey)
Method for storing an given object- Parameters:
value
- Object which should be storedsuggestedKey
- Suggested Key for storing the object (does not have to be considered! check return value)- Returns:
- The key of the stored object
-
read
public V read(String key)
Method for reading an object identified by the given key- Parameters:
key
- Key to identify the object which should be read- Returns:
- The Object identified by the key or NULL if no object is identified by the given key.
-
read
public Collection<V> read()
Method for reading all objects managed by the storage- Returns:
- Collection of all managed objects
-
update
public boolean update(String key, V value)
Method for updating the stored object at a given key- Parameters:
key
- Key to identify the object which should be updatedvalue
- Object which should be restored- Returns:
- True if object was updated; else false
-
delete
public boolean delete(String key)
Method for deleting a stored object- Parameters:
key
- Key to identify the object which should be deleted- Returns:
- True if object was deleted; else false
-
deleteAll
public boolean deleteAll()
Method for deleting all stored objects Attention: If corresponding folder is used by multiple users/application this method does not take response for them! Only use it if the folder is only touched by thisStorage
- Returns:
- True if object was deleted; else false
-
-