Class ObjectStorageImpl
- java.lang.Object
-
- org.uberfire.backend.server.io.object.ObjectStorageImpl
-
- All Implemented Interfaces:
ObjectStorage
public class ObjectStorageImpl extends Object implements ObjectStorage
-
-
Constructor Summary
Constructors Constructor Description ObjectStorageImpl(org.uberfire.io.IOService ioService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voiddelete(String path)Delete a path from the object storage if exists.booleanexists(String path)Checks if a path exists into the object storage.org.uberfire.java.nio.file.PathgetPath(String first, String... paths)Return a path based on the filesystem that is implemented for storagevoidinit(URI rootURI)Initialize the object storage.<T> Tread(String path)Read the content of the path given<T> voidwrite(String path, T value)Write an object into the object storage.<T> voidwrite(String path, T value, boolean lock)Write an object into the object storage.
-
-
-
Method Detail
-
init
public void init(URI rootURI)
Description copied from interface:ObjectStorageInitialize the object storage.- Specified by:
initin interfaceObjectStorage- Parameters:
rootURI- The root URI where is going to create the file system
-
exists
public boolean exists(String path)
Description copied from interface:ObjectStorageChecks if a path exists into the object storage.- Specified by:
existsin interfaceObjectStorage- Parameters:
path- the path to the stored object.- Returns:
- true if exists that path into the storage else false.
-
read
public <T> T read(String path)
Description copied from interface:ObjectStorageRead the content of the path given- Specified by:
readin interfaceObjectStorage- Parameters:
path- The path where the content is stored- Returns:
- The content of the file unmarshalled
-
write
public <T> void write(String path, T value)
Description copied from interface:ObjectStorageWrite an object into the object storage. That object is marshalled into JSON. Lock will be enabled before write and disabled after it.- Specified by:
writein interfaceObjectStorage- Parameters:
path- The path where the object is going to be writtenvalue- The object itself
-
write
public <T> void write(String path, T value, boolean lock)
Description copied from interface:ObjectStorageWrite an object into the object storage. That object is marshalled into JSON. You can avoid FS lock- Specified by:
writein interfaceObjectStorage- Parameters:
path- The path where the object is going to be writtenvalue- The object itselflock- If the object storage should be locked while writing
-
delete
public void delete(String path)
Description copied from interface:ObjectStorageDelete a path from the object storage if exists. That path contains the object stored.- Specified by:
deletein interfaceObjectStorage- Parameters:
path- The path to delete
-
getPath
public org.uberfire.java.nio.file.Path getPath(String first, String... paths)
Description copied from interface:ObjectStorageReturn a path based on the filesystem that is implemented for storage- Specified by:
getPathin interfaceObjectStorage- Parameters:
first- the path string or initial part of the path stringpaths- additional strings to be joined to form the path string- Returns:
- the path object that represents the path.
-
close
public void close()
- Specified by:
closein interfaceObjectStorage
-
-