Skip to main content
Jump to: navigation, search

Difference between revisions of "SMILA/Documentation/Record Storage"

m (Configuration: todo note)
Line 77: Line 77:
  
 
==== Configuration ====
 
==== Configuration ====
 +
 +
{{note|todo| this section needs to take this new page into account: [[SMILA/Documentation/General_JPA_Configuration_in_SMILA]] }}
  
 
The only configuration needed is a typicall eclipseLink configuration property file. Therin you can specify settings for logging, database connection settings. For more information please refer to the eclipseLink documentation [[http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Extensions_for_JDBC]].
 
The only configuration needed is a typicall eclipseLink configuration property file. Therin you can specify settings for logging, database connection settings. For more information please refer to the eclipseLink documentation [[http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Extensions_for_JDBC]].
Line 94: Line 96:
  
 
After starting Smila for the first time, the DDL generation setting will print out some nasty warnings, complaining that it can't create some tables. These warnings are not critical. You can get rid of them by setting <tt>eclipselink.ddl-generation=none</tt>, but only after Smila was started at least once (and the tables were created).
 
After starting Smila for the first time, the DDL generation setting will print out some nasty warnings, complaining that it can't create some tables. These warnings are not critical. You can get rid of them by setting <tt>eclipselink.ddl-generation=none</tt>, but only after Smila was started at least once (and the tables were created).
 
  
 
==== Limitations ====
 
==== Limitations ====
 
At the moment it is necessary to import all packages containing JDBCDriver classes in <tt>bundle org.eclipse.smila.recordstorage.impl</tt>. So for changing from derby to another database it is not sufficient to change the configuration in <tt>persistence.properties</tt>, you also have to add import package statementsv for the JDBC driver to use to your bundles manifest. This will hopefully be changed with the next release of eclipseLink.
 
At the moment it is necessary to import all packages containing JDBCDriver classes in <tt>bundle org.eclipse.smila.recordstorage.impl</tt>. So for changing from derby to another database it is not sufficient to change the configuration in <tt>persistence.properties</tt>, you also have to add import package statementsv for the JDBC driver to use to your bundles manifest. This will hopefully be changed with the next release of eclipseLink.

Revision as of 13:01, 2 November 2009

Overview

Record Storage Service provides an easy way to store / access record objects. It does not persist any attachments included in the records, only the Id and the MObject. To persist attachments one has to use the Binary Storage.


API

  /**
   * Load the record with the given Id.
   * @param id Id of the record
   * @return a Record object or null, if no record with the given Id exists
   * @throws RecordStorageException if any error occurs
   */
  Record loadRecord(Id id) throws RecordStorageException;
 
  /**
   * Stores the given Record object. An existing Record with the same ID is overwritten by the given record.
   * @param record the Record object
   * @throws RecordStorageException if any error occurs
   */
  void storeRecord(Record record) throws RecordStorageException;
 
  /**
   * Removes the record with the given Id.
   * @param id Id of the record
   * @throws RecordStorageException if any error occurs
   */
  void removeRecord(Id id) throws RecordStorageException;
 
  /**
   * Checks if a Record with the given Id exists in the storeage.
   * @param id Id of the record
   * @return true if a record with the given Id exists, false otherwise
   * @throws RecordStorageException if any error occurs
   */
  boolean existsRecord(Id id) throws RecordStorageException;
 
  /**
   * Loads all records of the given source.
   * @param source the name of the data source
   * @return an Iterator over the Record objects
   * @throws RecordStorageException if any error occurs
   */
  Iterator<Record> loadRecords(String source) throws RecordStorageException;

Implementations

It is possible to provide different implementations for the RecordStorage interface. Below is a list of the currently available implementations.

org.eclipse.smila.recordstorage.impl

The default implementation uses eclipseLink JPA to store the records in an apache derby database. The data is stored in the table RECORDS:

RECORDS
Column Type Description
ID VARCHAR a hashed value of the Id object of the record
SOURCE VARCHAR the source attribute of the Id object
RECORD BLOB the serialized record object without attachments


Configuration

Note.png
todo
this section needs to take this new page into account: SMILA/Documentation/General_JPA_Configuration_in_SMILA


The only configuration needed is a typicall eclipseLink configuration property file. Therin you can specify settings for logging, database connection settings. For more information please refer to the eclipseLink documentation [[1]]. The configuration is located at configuration/org.eclipse.smila.recordstorage.impl/org.eclipse.smila.recordstorage.impl/persistence.properties.

# EclipseLink properties
eclipselink.logging.level=INFO
eclipselink.target-server=None
eclipselink.target-database=org.eclipse.persistence.platform.database.DerbyPlatform
eclipselink.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
eclipselink.jdbc.url=jdbc:derby:workspace/.metadata/.plugins/org.eclipse.smila.recordstorage.impl/recordstorage;create=true
eclipselink.jdbc.password=smila
eclipselink.jdbc.user=smila
eclipselink.ddl-generation=create-tables

After starting Smila for the first time, the DDL generation setting will print out some nasty warnings, complaining that it can't create some tables. These warnings are not critical. You can get rid of them by setting eclipselink.ddl-generation=none, but only after Smila was started at least once (and the tables were created).

Limitations

At the moment it is necessary to import all packages containing JDBCDriver classes in bundle org.eclipse.smila.recordstorage.impl. So for changing from derby to another database it is not sufficient to change the configuration in persistence.properties, you also have to add import package statementsv for the JDBC driver to use to your bundles manifest. This will hopefully be changed with the next release of eclipseLink.

Back to the top