|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.gouv.culture.sdx.utils.SdxObjectImpl
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 |
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.util.Hashtable |
entityCache
|
protected java.lang.String |
FIELD_ID
|
protected java.lang.String |
FIELD_PROPERTY_NAME
|
protected java.lang.String |
FIELD_PROPERTY_VALUE
|
protected java.util.Hashtable |
props
Hashtable of property values |
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 | |
AbstractJDBCDatabase()
|
Method Summary | |
protected void |
addEntityToCache(DatabaseEntity dbe)
|
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 |
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)
|
protected void |
deleteEntityFromCache(java.lang.String id)
|
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 |
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 DatabaseEntity |
getEntityFromCache(java.lang.String id)
|
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 |
java.lang.String |
getId()
|
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. |
protected boolean |
isEntityInCache(java.lang.String id)
|
protected void |
refreshEntityCache()
|
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 |
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. |
void |
setId(java.lang.String id)
|
void |
setProperties(java.util.Hashtable props)
Provides a list of properties of this class which can be used at configuration and/or initialization time |
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 |
compose, getDataSourceComponent, releaseDataSourceComponent |
Methods inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC |
createTable, getTableName, handleUnsupportedTokens |
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl |
enableLogging, getChildLogger, setEncoding |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface fr.gouv.culture.sdx.utils.database.Database |
getConnection, getDatabaseDirectoryName, optimize, releaseConnection |
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 |
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
protected java.util.Hashtable props
protected java.util.Hashtable entityCache
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.Configurable
configure
in class DataSourceComponentBacked
org.apache.avalon.framework.configuration.ConfigurationException
public DatabaseEntity getEntity(java.lang.String id) throws SDXException
Database
getEntity
in interface Database
id
- The needed entity's id.
SDXException
public DatabaseEntity[] getEntities() throws SDXException
Database
getEntities
in interface Database
SDXException
public java.lang.String getPropertyValue(java.lang.String entityId, java.lang.String name) throws SDXException
Database
getPropertyValue
in interface Database
entityId
- 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 Database
entityId
- 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 Database
SDXException
public void save(DatabaseEntity ent) throws SDXException
Database
save
in interface Database
SDXException
public void delete(DatabaseEntity ent) throws SDXException
Database
delete
in interface Database
SDXException
public void delete(DatabaseEntity[] entities) throws SDXException
SDXException
public void update(DatabaseEntity ent) throws SDXException
Database
update
in interface Database
SDXException
public long size()
Database
size
in interface Database
public void empty() throws SDXException
Database
empty
in interface Database
SDXException
public void setProperties(java.util.Hashtable props)
Database
setProperties
in interface Database
props
- public boolean entityExists(java.lang.String id)
Database
entityExists
in interface Database
id
- identifier of the entitypublic java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params) throws SDXException
Database
search
in interface Database
params
- search params
SDXException
Database.search(org.apache.avalon.framework.parameters.Parameters)
public java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params, int mode) throws SDXException
SDXException
public java.lang.String[] searchWithParams(org.apache.avalon.framework.parameters.Parameters params) throws SDXException
SDXException
public void setId(java.lang.String id)
setId
in interface Database
public java.lang.String getId()
getId
in interface Database
public void init() throws SDXException
init
in interface Database
SDXException
protected java.lang.String getTableCreationQuery()
JDBC
This query should not have any parameter.
getTableCreationQuery
in class JDBC
protected java.lang.String getEntityGetQuery()
This query should have one parameter for the id.
protected java.lang.String getAllEntitiesQuery()
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 Database
entityId
- propertyName
- propertyValue
-
SDXException
public void removeProperty(java.lang.String entityId, java.lang.String propertyName, java.lang.String propertyValue) throws SDXException
removeProperty
in interface Database
entityId
- propertyName
- propertyValue
-
SDXException
public void removeProperty(java.lang.String propertyName, java.lang.String propertyValue) throws SDXException
Database
removeProperty
in interface Database
propertyName
- The property to removepropertyValue
- The property value
SDXException
protected DatabaseEntity getEntityFromCache(java.lang.String id)
protected void addEntityToCache(DatabaseEntity dbe)
protected void deleteEntityFromCache(java.lang.String id)
public java.lang.String getWildcardSearchToken()
Database
getWildcardSearchToken
in interface Database
protected boolean isEntityInCache(java.lang.String id)
protected void refreshEntityCache() throws SDXException
SDXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |