Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## fr.gouv.culture.sdx.user
Class UserDatabase

    java.lang.Object
      fr.gouv.culture.sdx.utils.AbstractSdxObject
          fr.gouv.culture.sdx.utils.database.DatabaseBacked
              fr.gouv.culture.sdx.user.UserDatabase

All Implemented Interfaces:
  org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, Database, Describable, Encodable, Identifiable, Localizable, org.apache.avalon.framework.logger.LogEnabled, Saveable, SdxObject, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable

public class UserDatabase
extends DatabaseBacked
implements Database

A database for keeping track of users and groups, and mainly of their membership relationships.

This class is backed by a LuceneDatabase where groups and users information are kept.

A user may be a member of some groups, and groups can be member of other groups.

Nested Class Summary

Nested classes inherited from class fr.gouv.culture.sdx.utils.SdxObject
`SdxObject.ConfigurationNode`

Field Summary
`static java.lang.String` | `FIELD_EMAIL` The field for the email
`static java.lang.String` | `FIELD_FIRSTNAME` The field for the firstname
`static java.lang.String` | `FIELD_LASTNAME` The field for the lastname
`static java.lang.String` | `FIELD_LOCALE` The field for the preferred locale
`static java.lang.String` | `FIELD_PASSWORD` The field for the encoded password

Fields inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
`_database, CLASS_NAME_SUFFIX, DATABASE_DIR_NAME, databaseConf, dbLocation, dbPath, DEFAULT_DATABASE_TYPE`

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
`UserDatabase(java.lang.String id)`

Method Summary
`void` | `add(Identity identity, java.lang.String password)` Adds an identity to this database.
`void` | `addMember(Group group, java.lang.String id)` Adds a member to a group.
`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` | `backup(SaveParameters save_config)` Save the DocumentBase data objects
`boolean` | `changePassword(java.lang.String id, java.lang.String oldPass, java.lang.String newPass)` Checks if user login as "id" have the encoded password "password".
`boolean` | `checkPassword(java.lang.String id, java.lang.String password)` Checks if user login as "id" have the encoded password "password".
`void` | `delete(DatabaseEntity ent)` Deletes an entity.
`void` | `delete(Identity identity)` Removes an identity from the database.
`void` | `deleteMembers(Group group)` Deletes all references to this group in members
`void` | `empty()` Empties the database.
`boolean` | `entityExists(java.lang.String id)` Checks whether an entity with the provided id exists within this database
`boolean` | `exists(java.lang.String id)`
`protected java.lang.String` | `getClassNameSuffix()` Sub classes should element this method to return their class name suffix for SAX output
`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.
`java.lang.String[]` | `getMembers(java.lang.String groupName)` Gets an array of member ids for a group
`java.util.Hashtable` | `getParents(java.lang.String id)` Returns all the groups an identity belongs to.
`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.
`UserInformation` | `getUserInformation(java.lang.String application, java.lang.String username, java.util.Locale locale, java.lang.String adminGroup)` Returns basic information about a user.
`java.lang.String` | `getWildcardSearchToken()` Returns a String representing the appropriate wildcard search token for the implementation
`protected boolean` | `initToSax()` Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
`protected void` | `initVolatileObjectsToSax()` Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called
`boolean` | `isMember(Identity identity, java.lang.String groupName)` Tests whether a database entity indicates membership of a group.
`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` | `restore(SaveParameters save_config)` restore the DocumentBase data objects
`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 class fr.gouv.culture.sdx.utils.database.DatabaseBacked
`configure, configure, getDatabase, init`

Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
`configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources`

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
`init`

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`

Field Detail

### FIELD_PASSWORD

    public static final java.lang.String FIELD_PASSWORD

  The field for the encoded password

  See Also:
    Constant Field Values

### FIELD_FIRSTNAME

    public static final java.lang.String FIELD_FIRSTNAME

  The field for the firstname

  See Also:
    Constant Field Values

### FIELD_LASTNAME

    public static final java.lang.String FIELD_LASTNAME

  The field for the lastname

  See Also:
    Constant Field Values

### FIELD_EMAIL

    public static final java.lang.String FIELD_EMAIL

  The field for the email

  See Also:
    Constant Field Values

### FIELD_LOCALE

    public static final java.lang.String FIELD_LOCALE

  The field for the preferred locale

  See Also:
    Constant Field Values

Constructor Detail

### UserDatabase

    public UserDatabase(java.lang.String id)
                 throws SDXException

Method Detail

### addMember

    public void addMember(Group group,
                          java.lang.String id)
                   throws SDXException

  Adds a member to a group. The member should be in the database.

  Parameters:
    `group` - The group.
    `id` - Id of an identity to add as a member.
  Throws:
    `SDXException`

### deleteMembers

    public void deleteMembers(Group group)
                       throws SDXException

  Deletes all references to this group in members

  Parameters:
    `group` - The group
  Throws:
    `SDXException`

### delete

    public void delete(Identity identity)
                throws SDXException

  Removes an identity from the database.

  For groups, all identities member of the group will have this membership removed also.

  Parameters:
    `identity` - The identity to delete.
  Throws:
    `SDXException`

### add

    public void add(Identity identity,
                    java.lang.String password)
             throws SDXException

  Adds an identity to this database.

  Parameters:
    `identity` - The identity to add.
    `password` - The encoded password associated to this identity (may be null).
  Throws:
    `SDXException`

### getMembers

    public java.lang.String[] getMembers(java.lang.String groupName)
                                  throws SDXException

  Gets an array of member ids for a group

  Parameters:
    `groupName` - The name of the group for which the list is desired
  Throws:
    `SDXException`

### getParents

    public java.util.Hashtable getParents(java.lang.String id)
                                   throws SDXException

  Returns all the groups an identity belongs to.

  Parameters:
    `id` - Name of the identity (group or user).
  Throws:
    `SDXException`

### isMember

    public boolean isMember(Identity identity,
                            java.lang.String groupName)
                     throws SDXException

  Tests whether a database entity indicates membership of a group.

  Parameters:
    `identity` - a group or a user to check
    `groupName` - the groupName to test membership in
  Throws:
    `SDXException`

### checkPassword

    public boolean checkPassword(java.lang.String id,
                                 java.lang.String password)
                          throws SDXException

  Checks if user login as "id" have the encoded password "password".

  Parameters:
    `id` - id of user (if null returns false).
    `password` - The password (may be null).
  Throws:
    `SDXException`

### changePassword

    public boolean changePassword(java.lang.String id,
                                  java.lang.String oldPass,
                                  java.lang.String newPass)
                           throws SDXException

  Checks if user login as "id" have the encoded password "password".

  Parameters:
    `id` - id of user (if null returns false).
    `oldPass` - The password (may be null).
    `newPass` - The password (may NOT be null).
  Throws:
    `SDXException`

### getUserInformation

    public UserInformation getUserInformation(java.lang.String application,
                                              java.lang.String username,
                                              java.util.Locale locale,
                                              java.lang.String adminGroup)
                                       throws SDXException

  Returns basic information about a user.

  Parameters:
    `application` - id of the application where the user should be registered
    `username` - id of a user (if `null`, anonymous user is returned).
    `locale` - The default locale if the user's locale is not set.
  Throws:
    `SDXException`

### exists

    public boolean exists(java.lang.String id)
                   throws SDXException

  Throws:
    `SDXException`

### getEntity

    public DatabaseEntity getEntity(java.lang.String id)
                             throws SDXException

  Description copied from interface: `Database`
  Gets an entity from the database.

  Specified by:
    `getEntity` in interface `Database`
  Parameters:
    `id` - The needed entity's id.
  Throws:
    `SDXException`

### getEntities

    public DatabaseEntity[] getEntities()
                                 throws SDXException

  Description copied from interface: `Database`
  Returns the list of entities from the database.

  Specified by:
    `getEntities` in interface `Database`
  Throws:
    `SDXException`

### getPropertyValue

    public java.lang.String getPropertyValue(java.lang.String entityId,
                                             java.lang.String name)
                                      throws SDXException

  Description copied from interface: `Database`
  Returns a property value from an entity in the database.

  Specified by:
    `getPropertyValue` in interface `Database`
  Parameters:
    `entityId` - The needed entity's id.
    `name` - The needed property's name.
  Returns:
    The property is defined, otherwise `null`. If the property is defined more than once, the first value is returned.
  Throws:
    `SDXException`

### getPropertyValues

    public java.lang.String[] getPropertyValues(java.lang.String entityId,
                                                java.lang.String propertyName)
                                         throws SDXException

  Description copied from interface: `Database`
  Returns a repeatable property from an entity in the database.

  Specified by:
    `getPropertyValues` in interface `Database`
  Parameters:
    `entityId` - The needed entity's name.
    `propertyName` - The needed property's name.
  Returns:
    An enumeration of all values for this property, `null` is this property is not defined for this entity.
  Throws:
    `SDXException`

### getProperties

    public Property[] getProperties(java.lang.String entityId)
                             throws SDXException

  Description copied from interface: `Database`
  Returns all properties from an entity in the database.

  Specified by:
    `getProperties` in interface `Database`
  Throws:
    `SDXException`

### save

    public void save(DatabaseEntity ent)
              throws SDXException

  Description copied from interface: `Database`
  Saves an entity.

  Specified by:
    `save` in interface `Database`
  Throws:
    `SDXException`

### delete

    public void delete(DatabaseEntity ent)
                throws SDXException

  Description copied from interface: `Database`
  Deletes an entity.

  Specified by:
    `delete` in interface `Database`
  Throws:
    `SDXException`

### update

    public void update(DatabaseEntity ent)
                throws SDXException

  Description copied from interface: `Database`
  Updates an entity.

  Specified by:
    `update` in interface `Database`
  Throws:
    `SDXException`

### size

    public long size()

  Description copied from interface: `Database`
  Returns the number of entities within this database.

  Specified by:
    `size` in interface `Database`

### empty

    public void empty()
               throws SDXException

  Description copied from interface: `Database`
  Empties the database.

  Specified by:
    `empty` in interface `Database`
  Throws:
    `SDXException`

### entityExists

    public boolean entityExists(java.lang.String id)

  Description copied from interface: `Database`
  Checks whether an entity with the provided id exists within this database

  Specified by:
    `entityExists` in interface `Database`
  Parameters:
    `id` - _identifier of the entity

### search

    public java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params)
                              throws SDXException

  Description copied from interface: `Database`
  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.

  Specified by:
    `search` in interface `Database`
  Parameters:
    `params` - search params
  Throws:
    `SDXException`

### search

    public java.lang.String[] search(org.apache.avalon.framework.parameters.Parameters params,
                                     int mode)
                              throws SDXException

  Specified by:
    `search` in interface `Database`
  Throws:
    `SDXException`

### 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.

  Specified by:
    `optimize` in interface `Database`
  Throws:
    `SDXException`

### 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

  Specified by:
    `getDatabaseDirectoryName` in interface `Database`
  Returns:
    A directory name (not a full path)

### getConnection

    public DatabaseConnection getConnection()
                                     throws SDXException

  Specified by:
    `getConnection` in interface `Database`
  Throws:
    `SDXException`

### releaseConnection

    public void releaseConnection(DatabaseConnection conn)
                           throws SDXException

  Specified by:
    `releaseConnection` in interface `Database`
  Throws:
    `SDXException`

### addProperty

    public void addProperty(java.lang.String entityId,
                            java.lang.String propertyName,
                            java.lang.String propertyValue)
                     throws SDXException

  Description copied from interface: `Database`
  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.

  Specified by:
    `addProperty` in interface `Database`
  Parameters:
    `entityId` - The entity to update
    `propertyName` - The property to add
    `propertyValue` - The property value
  Throws:
    `SDXException`

### removeProperty

    public void removeProperty(java.lang.String entityId,
                               java.lang.String propertyName,
                               java.lang.String propertyValue)
                        throws SDXException

  Description copied from interface: `Database`
  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.

  Specified by:
    `removeProperty` in interface `Database`
  Parameters:
    `entityId` - The entity to update
    `propertyName` - The property to remove
    `propertyValue` - The property value
  Throws:
    `SDXException`

### removeProperty

    public void removeProperty(java.lang.String propertyName,
                               java.lang.String propertyValue)
                        throws SDXException

  Description copied from interface: `Database`
  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.

  Specified by:
    `removeProperty` in interface `Database`
  Parameters:
    `propertyName` - The property to remove
    `propertyValue` - The property value
  Throws:
    `SDXException`

### getClassNameSuffix

    protected java.lang.String getClassNameSuffix()

  Description copied from class: `AbstractSdxObject`
  Sub classes should element this method to return their class name suffix for SAX output

  Overrides:
    `getClassNameSuffix` in class `DatabaseBacked`

### getWildcardSearchToken

    public java.lang.String getWildcardSearchToken()

  Description copied from interface: `Database`
  Returns a String representing the appropriate wildcard search token for the implementation

  Specified by:
    `getWildcardSearchToken` in interface `Database`

### 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 `DatabaseBacked`

### initVolatileObjectsToSax

    protected void initVolatileObjectsToSax()

  Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called

  Overrides:
    `initVolatileObjectsToSax` in class `DatabaseBacked`

### backup

    public void backup(SaveParameters save_config)
                throws SDXException

  Save the DocumentBase data objects

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

### restore

    public void restore(SaveParameters save_config)
                 throws SDXException

  restore the DocumentBase data objects

  Specified by:
    `restore` in interface `Saveable`
  Parameters:
    `save_config` -
  Throws:
    `SDXException`
  See Also:
    `Saveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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