SMILA 1.0 API documentation

org.eclipse.smila.binarystorage.persistence.jpa
Class JPABinaryPersistence

java.lang.Object
  extended by org.eclipse.smila.binarystorage.persistence.BinaryPersistence
      extended by org.eclipse.smila.binarystorage.persistence.jpa.JPABinaryPersistence

public class JPABinaryPersistence
extends BinaryPersistence

JPA Binary Storage persistence layer.


Field Summary
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 Summary
JPABinaryPersistence(BinaryStorageConfiguration binaryStorageConfig)
          Basic constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_NAME

public static final java.lang.String BUNDLE_NAME
name of bundle. Used in configuration reading.

See Also:
Constant Field Values

PERSISTENCE_UNIT_NAME

public static final java.lang.String PERSISTENCE_UNIT_NAME
Constant for the eclipseLink persistence unit name.

See Also:
Constant Field Values

CONFIGURATION_FILE

public static final java.lang.String CONFIGURATION_FILE
name of configuration file. Hardcoded for now (or fallback), configuration properties should be received from configuration service later.

See Also:
Constant Field Values
Constructor Detail

JPABinaryPersistence

public JPABinaryPersistence(BinaryStorageConfiguration binaryStorageConfig)
                     throws BinaryStorageException
Basic constructor.

Parameters:
binaryStorageConfig - the BinaryStorageConfiguration
Throws:
BinaryStorageException - if any error occurs during initialization
Method Detail

storeBinary

public void storeBinary(java.lang.String key,
                        byte[] content)
                 throws BinaryStorageException
Store binary data in binary storage.

Specified by:
storeBinary in class BinaryPersistence
Parameters:
key - String - unique identifier inside of binary storage
content - byte[] - binary content
Throws:
BinaryStorageException - - in case of any exception occurs
See Also:
org.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#storeBinary(java.lang.String, byte[])

storeBinary

public void storeBinary(java.lang.String key,
                        java.io.InputStream stream)
                 throws BinaryStorageException
Store binary data in binary storage.

Specified by:
storeBinary in class BinaryPersistence
Parameters:
key - String - unique identifier inside of binary storage
stream - InputStream - binary data input stream
Throws:
BinaryStorageException - - in case of any exception occurs
See Also:
org.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#storeBinary(java.lang.String, java.io.InputStream)

deleteBinary

public void deleteBinary(java.lang.String key)
                  throws BinaryStorageException
Delete binary data by key from binary storage.

Specified by:
deleteBinary in class BinaryPersistence
Parameters:
key - String - unique identifier inside of binary storage
Throws:
BinaryStorageException - - in case of any exception occurs
See Also:
org.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#deleteBinary(java.lang.String)

fetchSize

public long fetchSize(java.lang.String key)
               throws BinaryStorageException
Fetch record size.

Specified by:
fetchSize in class BinaryPersistence
Parameters:
key - String - unique identifier inside of binary storage
Returns:
long - size of record
Throws:
BinaryStorageException - - in case of any exception occurs
See Also:
org.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#fetchSize(java.lang.String)

loadBinaryAsByteArray

public byte[] loadBinaryAsByteArray(java.lang.String key)
                             throws BinaryStorageException
Fetch binary data by key from binary storage.

Specified by:
loadBinaryAsByteArray in class BinaryPersistence
Parameters:
key - String - unique identifier inside of binary storage
Returns:
byte[] - binary data
Throws:
BinaryStorageException - - in case of any exception occurs
See Also:
loadBinaryAsByteArray(java.lang.String)

loadBinaryAsInputStream

public java.io.InputStream loadBinaryAsInputStream(java.lang.String key)
                                            throws BinaryStorageException
Fetch binary data by key from binary storage.

Specified by:
loadBinaryAsInputStream in class BinaryPersistence
Parameters:
key - String - unique identifier inside of binary storage
Returns:
InputStream - binary input stream
Throws:
BinaryStorageException - - in case of any exception occurs
See Also:
loadBinaryAsInputStream(java.lang.String)

cleanup

public void cleanup()
             throws BinaryStorageException
Release resources and performs cleanup actions.

Specified by:
cleanup in class BinaryPersistence
Throws:
BinaryStorageException - in case of any exception
See Also:
org.eclipse.smila.binarystorage.internal.impl.persistence.BinaryPersistence#cleanup()

SMILA 1.0 API documentation