|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.gouv.culture.sdx.utils.AbstractSdxObject
fr.gouv.culture.sdx.utils.rdbms.JDBC
fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
fr.gouv.culture.sdx.utils.database.AbstractJDBCDatabase
Created by IntelliJ IDEA. User: rpandey Date: Mar 3, 2003 Time: 3:58:12 PM
| Nested Class Summary |
| Nested classes inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC |
JDBC.QueryExecutor, JDBC.Template |
| Nested classes inherited from class fr.gouv.culture.sdx.utils.SdxObject |
SdxObject.ConfigurationNode |
| Field Summary | |
static java.lang.String[] |
_searchModes
|
protected int |
COLUMN_PARAM_INDEX_FIELD_ID
|
protected int |
COLUMN_PARAM_INDEX_FIELD_PROPERTY_NAME
|
protected int |
COLUMN_PARAM_INDEX_FIELD_PROPERTY_VALUE
|
protected java.lang.String |
FIELD_ID
|
protected java.lang.String |
FIELD_PROPERTY_NAME
|
protected java.lang.String |
FIELD_PROPERTY_VALUE
|
| 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.utils.database.Database |
CLASS_NAME_SUFFIX, DATABASE_DIR_PATH, PACKAGE_QUALNAME, SEARCH_MODE_AND, SEARCH_MODE_NOT, SEARCH_MODE_OR |
| 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 | |
AbstractJDBCDatabase()
|
|
| Method Summary | |
void |
addProperty(java.lang.String entityId,
java.lang.String propertyName,
java.lang.String propertyValue)
If the entity does not exist the method fails silently |
void |
backup(SaveParameters save_config)
The backup method gives a way to an object to save its data |
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
createIndicies(java.sql.Connection conn)
Creates and index on the "id" field. |
void |
delete(DatabaseEntity ent)
Deletes an entity. |
void |
delete(DatabaseEntity[] entities)
|
void |
empty()
Empties the database. |
boolean |
entityExists(java.lang.String id)
Checks whether an entity with the provided id exists within this database |
protected java.lang.String |
getAllEntitiesQuery()
|
protected java.lang.String |
getClassNameSuffix()
Sub classes should element this method to return their class name suffix for SAX output |
DatabaseConnection |
getConnection()
|
protected java.lang.String |
getCreateIndiciesQuery(java.lang.String fieldName)
|
protected java.lang.String |
getDeleteAllQuery()
|
DatabaseEntity[] |
getEntities()
Returns the list of entities from the database. |
protected DatabaseEntity[] |
getEntities(java.sql.ResultSet rs)
Calling methods should close ResultSet after calling this method |
DatabaseEntity |
getEntity(java.lang.String id)
Gets an entity from the database. |
protected DatabaseEntity |
getEntity(java.lang.String id,
java.sql.ResultSet rs)
Calling methods should close ResultSet after calling this method |
protected java.lang.String |
getEntityDeleteQuery()
|
protected java.lang.String |
getEntityGetQuery()
Returns an SQL query that could select a entity using its id. |
protected java.lang.String[] |
getEntityIds(java.sql.ResultSet rs)
Calling methods should close ResultSet after calling this method |
protected abstract java.lang.String |
getEntriesWithLimitQuery(long offset,
long number)
Implementation of statement with a limit parameter |
Property[] |
getProperties(java.lang.String entityId)
Returns all properties from an entity in the database. |
protected java.lang.String |
getPropertyAddQuery()
|
protected java.lang.String |
getPropertyRemoveQueryWithId()
|
protected java.lang.String |
getPropertyRemoveQueryWithoutId()
|
java.lang.String |
getPropertyValue(java.lang.String entityId,
java.lang.String name)
Returns a property value from an entity in the database. |
java.lang.String[] |
getPropertyValues(java.lang.String entityId,
java.lang.String propertyName)
Returns a repeatable property from an entity in the database. |
protected java.lang.String |
getTableCreationQuery()
Returns an SQL query that could create the table. |
java.lang.String |
getWildcardSearchToken()
Returns a String representing the appropriate wildcard search token for the implementation |
void |
init()
Initializes the repository. |
void |
releaseConnection(DatabaseConnection conn)
|
void |
removeProperty(java.lang.String propertyName,
java.lang.String propertyValue)
Removes a property with the provided name and value from the and EXISTING entity having the name/value pair It is up to the implementation to determine proper behavior if the entity with the provided id does not exist. |
void |
removeProperty(java.lang.String entityId,
java.lang.String propertyName,
java.lang.String propertyValue)
If the entity does not exist the method fails silently |
void |
restore(SaveParameters save_config)
The restore method gives a way to an object to restore its data from a backup. |
void |
save(DatabaseEntity ent)
Saves an entity. |
java.lang.String[] |
search(org.apache.avalon.framework.parameters.Parameters params)
Returns an array of database entity ids based upon the provided search parameters One can used Database.getEntity(id) after retrieving a list of ids with this method. |
java.lang.String[] |
search(org.apache.avalon.framework.parameters.Parameters params,
int mode)
|
java.lang.String[] |
searchWithParams(org.apache.avalon.framework.parameters.Parameters params)
Search entities in SDX system databases with two parameters and a single table. |
long |
size()
Returns the number of entities within this database. |
void |
update(DatabaseEntity ent)
Updates an entity. |
| 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, getTableName, handleUnsupportedTokens, initVolatileObjectsToSax |
| Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, initToSax, 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.database.Database |
getDatabaseDirectoryName, optimize |
| 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 |
protected final java.lang.String FIELD_ID
protected final java.lang.String FIELD_PROPERTY_NAME
protected final java.lang.String FIELD_PROPERTY_VALUE
protected final int COLUMN_PARAM_INDEX_FIELD_ID
protected final int COLUMN_PARAM_INDEX_FIELD_PROPERTY_NAME
protected final int COLUMN_PARAM_INDEX_FIELD_PROPERTY_VALUE
public static final java.lang.String[] _searchModes
| Constructor Detail |
public AbstractJDBCDatabase()
| Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
throws org.apache.avalon.framework.configuration.ConfigurationException
configure in interface org.apache.avalon.framework.configuration.Configurableconfigure in class DataSourceComponentBackedorg.apache.avalon.framework.configuration.ConfigurationException
public DatabaseEntity getEntity(java.lang.String id)
throws SDXException
Database
getEntity in interface Databaseid - The needed entity's id.
SDXException
public DatabaseEntity[] getEntities()
throws SDXException
Database
getEntities in interface DatabaseSDXException
public java.lang.String getPropertyValue(java.lang.String entityId,
java.lang.String name)
throws SDXException
Database
getPropertyValue in interface DatabaseentityId - The needed entity's id.name - The needed property's name.
null. If the property is
defined more than once, the first value is returned.
SDXException
public java.lang.String[] getPropertyValues(java.lang.String entityId,
java.lang.String propertyName)
throws SDXException
Database
getPropertyValues in interface DatabaseentityId - The needed entity's name.propertyName - The needed property's name.
null is this
property is not defined for this entity.
SDXException
public Property[] getProperties(java.lang.String entityId)
throws SDXException
Database
getProperties in interface DatabaseSDXException
public void save(DatabaseEntity ent)
throws SDXException
Database
save in interface DatabaseSDXException
public void delete(DatabaseEntity ent)
throws SDXException
Database
delete in interface DatabaseSDXException
public void delete(DatabaseEntity[] entities)
throws SDXException
SDXException
public void update(DatabaseEntity ent)
throws SDXException
Database
update in interface DatabaseSDXExceptionpublic long size()
Database
size in interface Database
public void empty()
throws SDXException
Database
empty in interface DatabaseSDXExceptionpublic boolean entityExists(java.lang.String id)
Database
entityExists in interface Databaseid - _identifier of the entity
public java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params)
throws SDXException
Database
search in interface Databaseparams - search params
SDXExceptionDatabase.search(org.apache.avalon.framework.parameters.Parameters)
public java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params,
int mode)
throws SDXException
search in interface DatabaseSDXException
public java.lang.String[] searchWithParams(org.apache.avalon.framework.parameters.Parameters params)
throws SDXException
SDXException
public void init()
throws SDXException
init in interface DatabaseSDXExceptionprotected java.lang.String getTableCreationQuery()
JDBCThis query should not have any parameter.
getTableCreationQuery in class JDBCprotected java.lang.String getEntityGetQuery()
This query should have one parameter for the id.
protected java.lang.String getAllEntitiesQuery()
protected abstract java.lang.String getEntriesWithLimitQuery(long offset,
long number)
offset - number -
protected java.lang.String getEntityDeleteQuery()
protected java.lang.String getPropertyAddQuery()
protected java.lang.String getPropertyRemoveQueryWithId()
protected java.lang.String getPropertyRemoveQueryWithoutId()
protected java.lang.String getDeleteAllQuery()
protected java.lang.String getCreateIndiciesQuery(java.lang.String fieldName)
protected DatabaseEntity getEntity(java.lang.String id,
java.sql.ResultSet rs)
throws SDXException
id - rs -
SDXException
protected DatabaseEntity[] getEntities(java.sql.ResultSet rs)
throws SDXException
rs -
SDXException
protected java.lang.String[] getEntityIds(java.sql.ResultSet rs)
throws SDXException
rs -
SDXException
protected void createIndicies(java.sql.Connection conn)
throws SDXException
SDXException
public void addProperty(java.lang.String entityId,
java.lang.String propertyName,
java.lang.String propertyValue)
throws SDXException
addProperty in interface DatabaseentityId - propertyName - propertyValue -
SDXException
public void removeProperty(java.lang.String entityId,
java.lang.String propertyName,
java.lang.String propertyValue)
throws SDXException
removeProperty in interface DatabaseentityId - propertyName - propertyValue -
SDXException
public void removeProperty(java.lang.String propertyName,
java.lang.String propertyValue)
throws SDXException
Database
removeProperty in interface DatabasepropertyName - The property to removepropertyValue - The property value
SDXException
public DatabaseConnection getConnection()
throws SDXException
getConnection in interface DatabaseSDXException
public void releaseConnection(DatabaseConnection conn)
throws SDXException
releaseConnection in interface DatabaseSDXExceptionprotected java.lang.String getClassNameSuffix()
AbstractSdxObject
getClassNameSuffix in class AbstractSdxObjectpublic java.lang.String getWildcardSearchToken()
Database
getWildcardSearchToken in interface Database
public void backup(SaveParameters save_config)
throws SDXException
Saveable
backup in interface SaveableSDXException
public void restore(SaveParameters save_config)
throws SDXException
Saveable
restore in interface Saveablesave_config -
SDXException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||