SMILA (incubation) API documentation

org.eclipse.smila.recordstorage.impl
Class RecordStorageImpl

java.lang.Object
  extended by org.eclipse.smila.recordstorage.impl.RecordStorageImpl
All Implemented Interfaces:
RecordStorage

public class RecordStorageImpl
extends java.lang.Object
implements RecordStorage

Implementation of a RecordStorage using eclipseLink and JPA. providing limited search access.


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
RecordStorageImpl()
          Default Constructor.
 
Method Summary
protected  void activate(ComponentContext context)
          DS activate method.
protected  void deactivate(ComponentContext context)
          DS deactivate method.
 boolean existsRecord(Id id)
          Checks if a Record with the given Id exists in the storeage.
 Record loadRecord(Id id)
          Load the record with the given Id.
 java.util.Iterator<Record> loadRecords(java.lang.String source)
          Loads all records of the given source.
 void removeRecord(Id id)
          Removes the record with the given Id.
 void storeRecord(Record record)
          Stores the given Record object.
 
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

RecordStorageImpl

public RecordStorageImpl()
Default Constructor.

Method Detail

activate

protected void activate(ComponentContext context)
                 throws java.lang.Exception
DS activate method.

Parameters:
context - ComponentContext
Throws:
java.lang.Exception - if any error occurs

deactivate

protected void deactivate(ComponentContext context)
                   throws java.lang.Exception
DS deactivate method.

Parameters:
context - the ComponentContext
Throws:
java.lang.Exception - if any error occurs

loadRecord

public Record loadRecord(Id id)
                  throws RecordStorageException
Load the record with the given Id.

Specified by:
loadRecord in interface RecordStorage
Parameters:
id - Id of the record
Returns:
a Record object or null, if no record with the given Id exists
Throws:
RecordStorageException - if any error occurs
See Also:
RecordStorage.loadRecord(org.eclipse.smila.datamodel.id.Id)

storeRecord

public void storeRecord(Record record)
                 throws RecordStorageException
Stores the given Record object. An existing Record with the same ID is overwritten by the given record.

Specified by:
storeRecord in interface RecordStorage
Parameters:
record - the Record object
Throws:
RecordStorageException - if any error occurs
See Also:
RecordStorage.storeRecord(org.eclipse.smila.datamodel.record.Record)

removeRecord

public void removeRecord(Id id)
                  throws RecordStorageException
Removes the record with the given Id.

Specified by:
removeRecord in interface RecordStorage
Parameters:
id - Id of the record
Throws:
RecordStorageException - if any error occurs
See Also:
RecordStorage.removeRecord(org.eclipse.smila.datamodel.id.Id)

existsRecord

public boolean existsRecord(Id id)
                     throws RecordStorageException
Checks if a Record with the given Id exists in the storeage.

Specified by:
existsRecord in interface RecordStorage
Parameters:
id - Id of the record
Returns:
true if a record with the given Id exists, false otherwise
Throws:
RecordStorageException - if any error occurs
See Also:
RecordStorage.existsRecord(org.eclipse.smila.datamodel.id.Id)

loadRecords

public java.util.Iterator<Record> loadRecords(java.lang.String source)
                                       throws RecordStorageException
Loads all records of the given source.

Specified by:
loadRecords in interface RecordStorage
Parameters:
source - the name of the data source
Returns:
an Iterator over the Record objects
Throws:
RecordStorageException - if any error occurs
See Also:
org.eclipse.smila.recordstorage.RecordStorage#findRecordsBySource(java.lang.String)

SMILA (incubation) API documentation