public class JPABinaryPersistence extends BinaryPersistence
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_NAME
name of bundle.
|
static java.lang.String |
CONFIGURATION_FILE
name of configuration file.
|
static java.lang.String |
PERSISTENCE_UNIT_NAME
Constant for the eclipseLink persistence unit name.
|
Constructor and Description |
---|
JPABinaryPersistence(BinaryStorageConfiguration binaryStorageConfig)
Basic constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Release resources and performs cleanup actions.
|
void |
deleteBinary(java.lang.String key)
Delete binary data by key from binary storage.
|
long |
fetchSize(java.lang.String key)
Fetch record size.
|
byte[] |
loadBinaryAsByteArray(java.lang.String key)
Fetch binary data by key from binary storage.
|
java.io.InputStream |
loadBinaryAsInputStream(java.lang.String key)
Fetch binary data by key from binary storage.
|
void |
storeBinary(java.lang.String key,
byte[] content)
Store binary data in binary storage.
|
void |
storeBinary(java.lang.String key,
java.io.InputStream stream)
Store binary data in binary storage.
|
public static final java.lang.String BUNDLE_NAME
public static final java.lang.String PERSISTENCE_UNIT_NAME
public static final java.lang.String CONFIGURATION_FILE
public JPABinaryPersistence(BinaryStorageConfiguration binaryStorageConfig) throws BinaryStorageException
binaryStorageConfig
- the BinaryStorageConfigurationBinaryStorageException
- if any error occurs during initializationpublic void storeBinary(java.lang.String key, byte[] content) throws BinaryStorageException
storeBinary
in class BinaryPersistence
key
- String - unique identifier inside of binary storagecontent
- byte[] - binary contentBinaryStorageException
- -
in case of any exception occursorg.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#storeBinary(java.lang.String,
byte[])
public void storeBinary(java.lang.String key, java.io.InputStream stream) throws BinaryStorageException
storeBinary
in class BinaryPersistence
key
- String - unique identifier inside of binary storagestream
- InputStream - binary data input streamBinaryStorageException
- -
in case of any exception occursorg.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#storeBinary(java.lang.String,
java.io.InputStream)
public void deleteBinary(java.lang.String key) throws BinaryStorageException
deleteBinary
in class BinaryPersistence
key
- String - unique identifier inside of binary storageBinaryStorageException
- -
in case of any exception occursorg.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#deleteBinary(java.lang.String)
public long fetchSize(java.lang.String key) throws BinaryStorageException
fetchSize
in class BinaryPersistence
key
- String - unique identifier inside of binary storageBinaryStorageException
- - in case of any exception occursorg.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#fetchSize(java.lang.String)
public byte[] loadBinaryAsByteArray(java.lang.String key) throws BinaryStorageException
loadBinaryAsByteArray
in class BinaryPersistence
key
- String - unique identifier inside of binary storageBinaryStorageException
- -
in case of any exception occursloadBinaryAsByteArray(java.lang.String)
public java.io.InputStream loadBinaryAsInputStream(java.lang.String key) throws BinaryStorageException
loadBinaryAsInputStream
in class BinaryPersistence
key
- String - unique identifier inside of binary storageBinaryStorageException
- -
in case of any exception occursloadBinaryAsInputStream(java.lang.String)
public void cleanup() throws BinaryStorageException
cleanup
in class BinaryPersistence
BinaryStorageException
- in case of any exceptionorg.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#cleanup()