|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database
A simple database abstraction for managing document-like simple data.
Various SDX objects must manage simple data structures : the framework keeps track of applications, an application keeps track of document bases, user and groups, a document base keeps track of repositories, etc. These management tasks share some common properties : (1) they can involve quite complex and variable data structures ; (2) the management tasks need only a few properties from these complex structures ; (3) the underlying entities are all managed by their ids.
The Database interface models a Database managing simple entities by their ids and some properties, some may be repeatable. The complex structures behind the entities are stored in XML outside of the database.
SDX implements for now only one Database class : a LuceneDatabase, which uses Lucene, SDX's underlying search engine, to manage and retrieve these entities.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject |
---|
SdxObject.ConfigurationNode |
Field Summary | |
---|---|
static java.lang.String |
CLASS_NAME_SUFFIX
|
static java.lang.String |
DATABASE_DIR_PATH
Key name for the directory path in which to store database contents |
static java.lang.String |
PACKAGE_QUALNAME
|
static int |
SEARCH_MODE_AND
|
static int |
SEARCH_MODE_NOT
|
static int |
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 |
Method Summary | |
---|---|
void |
addProperty(java.lang.String entityId,
java.lang.String propertyName,
java.lang.String propertyValue)
Adds a property with the provided name and value to the EXISTING entity with the provided id It is up to the implementation to determine proper behavior if the entity with the provided id does not exist. |
void |
delete(DatabaseEntity ent)
Deletes an entity. |
void |
empty()
Empties the database. |
boolean |
entityExists(java.lang.String id)
Checks whether an entity with the provided id exists within this database |
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 |
DatabaseEntity[] |
getEntities()
Returns the list of entities from the database. |
DatabaseEntity |
getEntity(java.lang.String id)
Gets an entity from the database. |
Property[] |
getProperties(java.lang.String entityId)
Returns all properties from an entity in the database. |
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. |
java.lang.String |
getWildcardSearchToken()
Returns a String representing the appropriate wildcard search token for the implementation |
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)
|
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)
Removes a property with the provided name and value to the EXISTING entity with the provided id It is up to the implementation to determine proper behavior if the entity with the provided id does not exist. |
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)
|
long |
size()
Returns the number of entities within this database. |
void |
update(DatabaseEntity ent)
Updates an entity. |
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 org.apache.avalon.framework.configuration.Configurable |
---|
configure |
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 |
Methods inherited from interface fr.gouv.culture.sdx.utils.save.Saveable |
---|
backup, restore |
Field Detail |
---|
static final int SEARCH_MODE_OR
static final int SEARCH_MODE_AND
static final int SEARCH_MODE_NOT
static final java.lang.String DATABASE_DIR_PATH
static final java.lang.String PACKAGE_QUALNAME
static final java.lang.String CLASS_NAME_SUFFIX
Method Detail |
---|
DatabaseEntity getEntity(java.lang.String id) throws SDXException
id
- The needed entity's id.
SDXException
DatabaseEntity[] getEntities() throws SDXException
SDXException
java.lang.String getPropertyValue(java.lang.String entityId, java.lang.String name) throws SDXException
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
java.lang.String[] getPropertyValues(java.lang.String entityId, java.lang.String propertyName) throws SDXException
entityId
- The needed entity's name.propertyName
- The needed property's name.
null
is this
property is not defined for this entity.
SDXException
Property[] getProperties(java.lang.String entityId) throws SDXException
SDXException
void save(DatabaseEntity ent) throws SDXException
SDXException
void delete(DatabaseEntity ent) throws SDXException
SDXException
void update(DatabaseEntity ent) throws SDXException
SDXException
long size()
void empty() throws SDXException
SDXException
void init() throws SDXException
SDXException
boolean entityExists(java.lang.String id)
id
- _identifier of the entityjava.lang.String getWildcardSearchToken()
java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params) throws SDXException
params
- search params
SDXException
void optimize() throws SDXException
SDXException
java.lang.String getDatabaseDirectoryName()
DatabaseConnection getConnection() throws SDXException
SDXException
void releaseConnection(DatabaseConnection conn) throws SDXException
SDXException
void addProperty(java.lang.String entityId, java.lang.String propertyName, java.lang.String propertyValue) throws SDXException
entityId
- The entity to updatepropertyName
- The property to addpropertyValue
- The property value
SDXException
void removeProperty(java.lang.String entityId, java.lang.String propertyName, java.lang.String propertyValue) throws SDXException
entityId
- The entity to updatepropertyName
- The property to removepropertyValue
- The property value
SDXException
void removeProperty(java.lang.String propertyName, java.lang.String propertyValue) throws SDXException
propertyName
- The property to removepropertyValue
- The property value
SDXException
java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params, int mode) throws SDXException
SDXException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |