fr.gouv.culture.sdx.utils.database
Class HSQLDatabase

java.lang.Object
  extended byfr.gouv.culture.sdx.utils.SdxObjectImpl
      extended byfr.gouv.culture.sdx.utils.rdbms.JDBC
          extended byfr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
              extended byfr.gouv.culture.sdx.utils.database.AbstractJDBCDatabase
                  extended byfr.gouv.culture.sdx.utils.database.HSQLDatabase
All Implemented Interfaces:
org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, Database, org.apache.avalon.framework.logger.LogEnabled, SdxObject

public class HSQLDatabase
extends AbstractJDBCDatabase

Created by IntelliJ IDEA. User: rpandey Date: Feb 25, 2003 Time: 1:54:42 PM To change this template use Options | File Templates.


Nested Class Summary
 
Nested classes inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC
JDBC.QueryExecutor, JDBC.Template
 
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.utils.database.AbstractJDBCDatabase
_searchModes, COLUMN_PARAM_INDEX_FIELD_ID, COLUMN_PARAM_INDEX_FIELD_PROPERTY_NAME, COLUMN_PARAM_INDEX_FIELD_PROPERTY_VALUE, entityCache, FIELD_ID, FIELD_PROPERTY_NAME, FIELD_PROPERTY_VALUE, props
 
Fields inherited from class fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
ATTRIBUTE_DSI, dbSelector, dsi, manager
 
Fields inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC
id, tableName
 
Fields inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
encoding, logger
 
Fields inherited from interface fr.gouv.culture.sdx.utils.database.Database
DATABASE_DIR_PATH, SEARCH_MODE_AND, SEARCH_MODE_NOT, SEARCH_MODE_OR
 
Constructor Summary
HSQLDatabase()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected  void finalize()
           
protected  java.lang.String getAlterTableNameQuery(java.lang.String oldName)
           
 DatabaseConnection getConnection()
           
 java.lang.String getDatabaseDirectoryName()
          If the database is a directory based file system implemenation like lucene this method should return a valid name for a directory which may be created to house the database, or in the case of hsql it will return a valid table name
protected  java.lang.String getOptimizeQuery()
           
protected  java.sql.Connection getSQLConnection()
           
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 database.
 void optimize()
          Utility method for database 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(DatabaseConnection conn)
           
 java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params, int mode)
           
 
Methods inherited from class fr.gouv.culture.sdx.utils.database.AbstractJDBCDatabase
addEntityToCache, addProperty, createIndicies, delete, delete, deleteEntityFromCache, empty, entityExists, getAllEntitiesQuery, getCreateIndiciesQuery, getDeleteAllQuery, getEntities, getEntities, getEntity, getEntity, getEntityDeleteQuery, getEntityFromCache, getEntityGetQuery, getEntityIds, getId, getProperties, getPropertyAddQuery, getPropertyRemoveQueryWithId, getPropertyRemoveQueryWithoutId, getPropertyValue, getPropertyValues, getWildcardSearchToken, isEntityInCache, refreshEntityCache, removeProperty, removeProperty, save, search, searchWithParams, setId, setProperties, size, update
 
Methods inherited from class fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
compose, getDataSourceComponent, releaseDataSourceComponent
 
Methods inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC
createTable, handleUnsupportedTokens
 
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
enableLogging, getChildLogger, setEncoding
 
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
setEncoding
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.component.Composable
compose
 

Field Detail

dbDirPath

protected java.lang.String dbDirPath

hsqldb

protected HSQLDB hsqldb

DATABASE_DIR_NAME

protected java.lang.String DATABASE_DIR_NAME
Constructor Detail

HSQLDatabase

public HSQLDatabase()
Method Detail

getDatabaseDirectoryName

public java.lang.String getDatabaseDirectoryName()
Description copied from interface: Database
If the database is a directory based file system implemenation like lucene this method should return a valid name for a directory which may be created to house the database, or in the case of hsql it will return a valid table name

Returns:
A directory name (not a full path)

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class AbstractJDBCDatabase
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getSQLConnection

protected java.sql.Connection getSQLConnection()
                                        throws SDXException
Throws:
SDXException

getConnection

public DatabaseConnection getConnection()
                                 throws SDXException
Throws:
SDXException

getOptimizeQuery

protected java.lang.String getOptimizeQuery()

optimize

public void optimize()
              throws SDXException
Description copied from interface: Database
Utility method for database 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.

Throws:
SDXException

releaseConnection

public void releaseConnection(DatabaseConnection conn)
                       throws SDXException
Throws:
SDXException

init

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

Specified by:
init in interface Database
Overrides:
init in class AbstractJDBCDatabase
Throws:
SDXException

getTableCreationQuery

protected java.lang.String getTableCreationQuery()
Description copied from class: JDBC
Returns an SQL query that could create the table.

This query should not have any parameter.

Overrides:
getTableCreationQuery in class AbstractJDBCDatabase

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.

getAlterTableNameQuery

protected java.lang.String getAlterTableNameQuery(java.lang.String oldName)

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

search

public java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params,
                                 int mode)
                          throws SDXException
Overrides:
search in class AbstractJDBCDatabase
Throws:
SDXException


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