fr.gouv.culture.sdx.documentbase
Class AbstractIDGenerator

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.documentbase.AbstractIDGenerator
All Implemented Interfaces:
IDGenerator, Describable, Encodable, Identifiable, Localizable, SdxObject, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable
Direct Known Subclasses:
DefaultIDGenerator, SimpleIDGenerator

public abstract class AbstractIDGenerator
extends AbstractSdxObject
implements IDGenerator


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.documentbase.IDGenerator
IDGenerator.ConfigurationNode
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
protected  Database _database
           
protected  java.lang.String ATTRIBUTE_ID_PREFIX
          The attribute used to generate a prefix for an id generator.
protected  java.lang.String ATTRIBUTE_ID_SUFFIX
          The attribute used to generate a suffix for an id generator.
protected  java.lang.String idPrefix
          Prefix for generated ids.
protected  java.lang.String idSuffix
          Suffix for generated ids.
 
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.documentbase.IDGenerator
CLASS_NAME_SUFFIX, PACKAGE_QUALNAME
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Constructor Summary
AbstractIDGenerator()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 java.lang.String generate()
          Generates an id using configured prefix and suffix
protected  java.lang.String getClassNameSuffix()
          Sub classes should element this method to return their class name suffix for SAX output
 java.lang.String getPrefix()
           
 java.lang.String getSuffix()
           
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 isIdUnique(java.lang.String id)
          If no lucene index has been provided (i.e. it is null) this method will return true as it has no concrete context by which it can determine uniqueness
 void setDatabase(Database database)
          Sets the database for verification of a generated id's uniqueness
 void setIdFieldName(java.lang.String fieldName)
          Set's the field name for the id field in the index for id verification needs
 void setIndex(Index docBaseIndex)
          Deprecated. No longer useful
 void setPrefix(java.lang.String idPrefix)
           
 void setSuffix(java.lang.String idSuffix)
           
 
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.documentbase.IDGenerator
generate
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 

Field Detail

ATTRIBUTE_ID_PREFIX

protected final java.lang.String ATTRIBUTE_ID_PREFIX
The attribute used to generate a prefix for an id generator.

See Also:
Constant Field Values

ATTRIBUTE_ID_SUFFIX

protected final java.lang.String ATTRIBUTE_ID_SUFFIX
The attribute used to generate a suffix for an id generator.

See Also:
Constant Field Values

_database

protected Database _database

idPrefix

protected java.lang.String idPrefix
Prefix for generated ids.


idSuffix

protected java.lang.String idSuffix
Suffix for generated ids.

Constructor Detail

AbstractIDGenerator

public AbstractIDGenerator()
Method Detail

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 AbstractSdxObject
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getSuffix

public java.lang.String getSuffix()
Specified by:
getSuffix in interface IDGenerator

setSuffix

public void setSuffix(java.lang.String idSuffix)
Specified by:
setSuffix in interface IDGenerator

getPrefix

public java.lang.String getPrefix()
Specified by:
getPrefix in interface IDGenerator

setPrefix

public void setPrefix(java.lang.String idPrefix)
Specified by:
setPrefix in interface IDGenerator

setIndex

public void setIndex(Index docBaseIndex)
Deprecated. No longer useful

Was used to provide and index for id uniqueness verification

Specified by:
setIndex in interface IDGenerator

setDatabase

public void setDatabase(Database database)
Description copied from interface: IDGenerator
Sets the database for verification of a generated id's uniqueness

Specified by:
setDatabase in interface IDGenerator

isIdUnique

public boolean isIdUnique(java.lang.String id)
If no lucene index has been provided (i.e. it is null) this method will return true as it has no concrete context by which it can determine uniqueness

Specified by:
isIdUnique in interface IDGenerator
Parameters:
id - The id to verify
Returns:

setIdFieldName

public void setIdFieldName(java.lang.String fieldName)
Description copied from interface: IDGenerator
Set's the field name for the id field in the index for id verification needs

Specified by:
setIdFieldName in interface IDGenerator

generate

public java.lang.String generate()
Description copied from interface: IDGenerator
Generates an id using configured prefix and suffix

Specified by:
generate in interface IDGenerator

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

Specified by:
getClassNameSuffix in class AbstractSdxObject

initToSax

protected boolean initToSax()
Description copied from class: AbstractSdxObject
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML

Specified by:
initToSax in class AbstractSdxObject

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

Specified by:
initVolatileObjectsToSax in class AbstractSdxObject


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