fr.gouv.culture.sdx.repository
Class HSQLRepository

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.utils.rdbms.JDBC
          extended by fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
              extended by fr.gouv.culture.sdx.repository.AbstractDataSourceComponentBackedRepository
                  extended by fr.gouv.culture.sdx.repository.JDBCRepository
                      extended by fr.gouv.culture.sdx.repository.HSQLRepository
All Implemented Interfaces:
Repository, Describable, Encodable, Identifiable, Localizable, Saveable, SdxObject, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable

public class HSQLRepository
extends JDBCRepository

The same as JDBCRespository, but the method for the table creation query is overridden.


Nested Class Summary
 
Nested classes/interfaces inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC
JDBC.QueryExecutor, JDBC.Template
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.repository.Repository
Repository.ConfigurationNode
 
Field Summary
protected  java.lang.String DATABASE_DIR_NAME
           
protected  java.lang.String dbDirPath
           
protected  HSQLDB hsqldb
           
 
Fields inherited from class fr.gouv.culture.sdx.repository.JDBCRepository
FIELD_DATA, NO_SPECIFIC_TYPE, PARAM_INDEX_FIELD_DATA_ORIGINAL
 
Fields inherited from class fr.gouv.culture.sdx.repository.AbstractDataSourceComponentBackedRepository
FIELD_ID, isDefault, PARAM_INDEX_FIELD_ID
 
Fields inherited from class fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
ATTRIBUTE_DSI, dbSelector, dsi
 
Fields inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC
tableName
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.repository.Repository
CLASS_NAME_SUFFIX, PACKAGE_QUALNAME
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Fields inherited from interface fr.gouv.culture.sdx.utils.save.Saveable
ALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAM
 
Constructor Summary
HSQLRepository()
           
 
Method Summary
 void backup(SaveParameters save_config)
          Save the repository
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures this repository.
 RepositoryConnection getConnection()
          Gets a connection for manipulating repository's content.
 java.lang.String getDatabaseDirectoryName()
           
protected  java.lang.String getEntriesWithLimitQuery(long offset, long number)
          Implementation of statement with a limit parameter HSQL implementation SELECT LIMIT >offset< >number< DISTINCT * FROM >table_name<);
protected  java.lang.String getOptimizeQuery()
           
protected  java.lang.String getTableCreationQuery()
          Returns an SQL query that could create the table.
protected  java.lang.String getTableName()
          Returns a table name used to store the repository's data.
 void init()
          Initializes the repository.
protected  boolean initToSax()
          Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
 void optimize()
          Utility method for repository maintenance, normally used to optimize indices of Lucene based repositories It is the responsibility of the Repository to ensure that unnecessary optimizations are not performed when this method is called.
 void releaseConnection(RepositoryConnection conn)
          Releases a previously opened connection.
 void restore(SaveParameters save_config)
          Restore the repository
 
Methods inherited from class fr.gouv.culture.sdx.repository.JDBCRepository
add, delete, empty, get, getDeleteAllQuery, getDocumentAddQuery, getDocumentDeleteQuery, initVolatileObjectsToSax, lists, openStream, size, toSAX
 
Methods inherited from class fr.gouv.culture.sdx.repository.AbstractDataSourceComponentBackedRepository
checkConnection, checkEncoding, exists, getClassNameSuffix, getDocumentGetQuery, isDefault, loadBaseConfiguration, setIsDefault
 
Methods inherited from class fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
finalize, getDataSourceComponent, releaseDataSourceComponent, service
 
Methods inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC
createTable, handleUnsupportedTokens
 
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject
getLog
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable
contextualize
 
Methods inherited from interface org.apache.avalon.framework.service.Serviceable
service
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Identifiable
getId, setId
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Describable
getDescription, setDescription
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Encodable
getEncoding, setEncoding
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Localizable
getLocale, getXmlLang, setLocale, setXmlLang
 
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable
toSAX
 

Field Detail

dbDirPath

protected java.lang.String dbDirPath

hsqldb

protected HSQLDB hsqldb

DATABASE_DIR_NAME

protected java.lang.String DATABASE_DIR_NAME
Constructor Detail

HSQLRepository

public HSQLRepository()
Method Detail

getDatabaseDirectoryName

public java.lang.String getDatabaseDirectoryName()

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Description copied from class: JDBCRepository
Configures this repository.

In addition to the parameters needed in the base configuration handled by the parent class, the following parameter is required: data source _identifier (dsi), the value of the "name" attribute of the "jdbc" subElement for the "datasources" element in cocoon.xconf (user must create this information in cocoon.xconf)

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class JDBCRepository
Parameters:
configuration - The configuration for this repository (based on a xml file).

Sample configuration entry:

<sdx:repository sdx:type = "JDBC" sdx:id = "myRepoId" dsi = "datasource _identifier from cocoon.xconf"/>

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getTableCreationQuery

protected java.lang.String getTableCreationQuery()
Returns an SQL query that could create the table.

This query should not have any parameter.

Overrides:
getTableCreationQuery in class JDBCRepository
Returns:
The query.

getEntriesWithLimitQuery

protected java.lang.String getEntriesWithLimitQuery(long offset,
                                                    long number)
Implementation of statement with a limit parameter HSQL implementation SELECT LIMIT >offset< >number< DISTINCT * FROM >table_name<);

Overrides:
getEntriesWithLimitQuery in class JDBCRepository
Returns:
the query

init

public void init()
          throws SDXException
Initializes the repository. If there are no tables in the database, we create the necessary table

Specified by:
init in interface Repository
Overrides:
init in class JDBCRepository
Throws:
SDXException

getTableName

protected java.lang.String getTableName()
Description copied from class: JDBC
Returns a table name used to store the repository's data.

Overrides:
getTableName in class JDBC
Returns:
The table name should be appropriately escaped for table building.

getConnection

public RepositoryConnection getConnection()
                                   throws SDXException
Gets a connection for manipulating repository's content.

Specified by:
getConnection in interface Repository
Overrides:
getConnection in class JDBCRepository
Returns:
The connection.
Throws:
SDXException

releaseConnection

public void releaseConnection(RepositoryConnection conn)
                       throws SDXException
Description copied from class: JDBCRepository
Releases a previously opened connection. The releases both the SQL connection to the database and the datasource service connection from cocoon's database selector service.

Specified by:
releaseConnection in interface Repository
Overrides:
releaseConnection in class JDBCRepository
Parameters:
conn - A connection.
Throws:
SDXException

optimize

public void optimize()
              throws SDXException
Description copied from interface: Repository
Utility method for repository maintenance, normally used to optimize indices of Lucene based repositories It is the responsibility of the Repository to ensure that unnecessary optimizations are not performed when this method is called.

Specified by:
optimize in interface Repository
Overrides:
optimize in class AbstractDataSourceComponentBackedRepository
Throws:
SDXException

getOptimizeQuery

protected java.lang.String getOptimizeQuery()

initToSax

protected boolean initToSax()
Description copied from class: AbstractSdxObject
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML

Overrides:
initToSax in class JDBCRepository

backup

public void backup(SaveParameters save_config)
            throws SDXException
Save the repository

Specified by:
backup in interface Saveable
Overrides:
backup in class JDBCRepository
Throws:
SDXException
See Also:
Saveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)

restore

public void restore(SaveParameters save_config)
             throws SDXException
Restore the repository

Specified by:
restore in interface Saveable
Overrides:
restore in class JDBCRepository
Throws:
SDXException
See Also:
Saveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.