Class FileSystemBLOBStore
- java.lang.Object
-
- org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore
-
- All Implemented Interfaces:
BLOBStore
,ResourceBasedBLOBStore
- Direct Known Subclasses:
BundleDbPersistenceManager.FSBlobStore
public class FileSystemBLOBStore extends Object implements ResourceBasedBLOBStore
FileSystemBLOBStore
is aResourceBasedBLOBStore
implementation that stores BLOB data in aFileSystem
.Note that The DataStore should nowadays be used instead of the BLOBStore.
-
-
Constructor Summary
Constructors Constructor Description FileSystemBLOBStore(FileSystem fs)
Creates a newFileSystemBLOBStore
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createId(PropertyId id, int index)
Creates a unique identifier for the BLOB data associated with the given property id and value subscript.InputStream
get(String blobId)
Retrieves the BLOB data with the specified id as a binary stream.FileSystemResource
getResource(String blobId)
Retrieves the BLOB data with the specified id as a permanent resource.void
put(String blobId, InputStream in, long size)
Stores the BLOB data and returns a unique identifier.boolean
remove(String blobId)
Removes the BLOB data with the specified id.
-
-
-
Constructor Detail
-
FileSystemBLOBStore
public FileSystemBLOBStore(FileSystem fs)
Creates a newFileSystemBLOBStore
instance.- Parameters:
fs
- file system for storing the BLOB data
-
-
Method Detail
-
createId
public String createId(PropertyId id, int index)
Creates a unique identifier for the BLOB data associated with the given property id and value subscript.
-
get
public InputStream get(String blobId) throws Exception
Retrieves the BLOB data with the specified id as a binary stream.- Specified by:
get
in interfaceBLOBStore
- Parameters:
blobId
- identifier of the BLOB data as returned byBLOBStore.createId(PropertyId, int)
- Returns:
- an input stream that delivers the BLOB data
- Throws:
Exception
- if an error occured
-
put
public void put(String blobId, InputStream in, long size) throws Exception
Stores the BLOB data and returns a unique identifier.- Specified by:
put
in interfaceBLOBStore
- Parameters:
blobId
- identifier of the BLOB data as returned byBLOBStore.createId(PropertyId, int)
in
- stream containing the BLOB datasize
- size of the BLOB data- Throws:
Exception
- if an error occured
-
remove
public boolean remove(String blobId) throws Exception
Removes the BLOB data with the specified id.- Specified by:
remove
in interfaceBLOBStore
- Parameters:
blobId
- identifier of the BLOB data as returned byBLOBStore.createId(PropertyId, int)
- Returns:
true
if BLOB data with the given id exists and has been successfully removed,false
if there's no BLOB data with the given id.- Throws:
Exception
- if an error occured
-
getResource
public FileSystemResource getResource(String blobId) throws Exception
Retrieves the BLOB data with the specified id as a permanent resource.- Specified by:
getResource
in interfaceResourceBasedBLOBStore
- Parameters:
blobId
- identifier of the BLOB data as returned byBLOBStore.createId(org.apache.jackrabbit.core.id.PropertyId , int)
- Returns:
- a resource representing the BLOB data
- Throws:
Exception
- if an error occurred
-
-