public class BinaryStorageServiceImpl extends java.lang.Object implements BinaryStorageService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIGURATION_DIR
Path to binary storage configuration file.
|
static java.lang.String |
CONFIGURATION_FILE
Binary storage configuration file name.
|
Constructor and Description |
---|
BinaryStorageServiceImpl()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activate(ComponentContext context)
Perform binary storage activation.
|
protected void |
deactivate(ComponentContext context)
Release binary storage resources.
|
byte[] |
fetchAsByte(java.lang.String id)
Fetch an already persisted attachment through (
BinaryStorageService.storeRecordAttachment ) from binary
storage as byte array. |
java.io.InputStream |
fetchAsStream(java.lang.String id)
Fetch an already persisted attachment through (
BinaryStorageService.storeRecordAttachment ) from binary
storage as InputStream. |
long |
fetchSize(java.lang.String id)
Fetch size of persisted attachment.
|
void |
remove(java.lang.String id)
Removes folder&file structure from the binary storage, based on the passed key.
|
void |
store(java.lang.String id,
byte[] blob)
Save the attachment byte array content in the binary storage location.
|
void |
store(java.lang.String id,
java.io.InputStream stream)
Save the attachment stream in the binary storage location.
|
public static final java.lang.String CONFIGURATION_DIR
public static final java.lang.String CONFIGURATION_FILE
public void store(java.lang.String id, java.io.InputStream stream) throws BinaryStorageException
store
in interface BinaryStorageService
id
- String - calculated key (attachment id) from blackboard service based on record Id and file name. The key
will serve to identify (persistence scope) current folder & file inside of binary storage.stream
- InputStream - attachment streamBinaryStorageException
- in case of any exceptionBinaryStorageService.store(java.lang.String, java.io.InputStream)
public void store(java.lang.String id, byte[] blob) throws BinaryStorageException
store
in interface BinaryStorageService
id
- String - calculated key (attachment id) from blackboard service based on record Id and file name. The key
will serve to identify (persistence scope) current folder & file inside of binary storage.blob
- byte[] - file content to be stored in binary storageBinaryStorageException
- in case of any exceptionorg.eclipse.smila.binarystorage.BinaryStorageService#createStorageFile(java.lang.String, java.lang.String,
byte[])
public byte[] fetchAsByte(java.lang.String id) throws BinaryStorageException
BinaryStorageService.storeRecordAttachment
) from binary
storage as byte array.fetchAsByte
in interface BinaryStorageService
id
- String - calculated key (attachment id) from blackboard service based on record Id and file name. The key
value passed by the Blackboard service shall be identically with the same one, passed one step previously
(through the createStorageFile service) in order to get exactly the same file content.BinaryStorageException
- in case of any exceptionBinaryStorageService.fetchAsByte(java.lang.String)
public java.io.InputStream fetchAsStream(java.lang.String id) throws BinaryStorageException
BinaryStorageService.storeRecordAttachment
) from binary
storage as InputStream.fetchAsStream
in interface BinaryStorageService
id
- String - calculated key (attachment id) from blackboard service based on record Id and file name. The key
value passed by the Blackboard service shall be identically with the same one, passed one step previously
(through the createStorageFile service) in order to get exactly the same file content.BinaryStorageException
- in case of any exceptionBinaryStorageService.fetchAsStream(java.lang.String)
public void remove(java.lang.String id) throws BinaryStorageException
remove
in interface BinaryStorageService
id
- String - calculated key (attachment id) from blackboard service based on record Id and file name.BinaryStorageException
- in case of any exceptionorg.eclipse.smila.binarystorage.BinaryStorageService#removeRecordAttachment(java.lang.String)
public long fetchSize(java.lang.String id) throws BinaryStorageException
fetchSize
in interface BinaryStorageService
BinaryStorageException
- in case of any exceptionBinaryStorageService.fetchSize(java.lang.String)
protected void activate(ComponentContext context)
context
- ComponentContextprotected void deactivate(ComponentContext context) throws BinaryStorageException
context
- ComponentContext.BinaryStorageException