fr.gouv.culture.sdx.user
Class User

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.document.AbstractDocument
          extended by fr.gouv.culture.sdx.document.AbstractIndexableDocument
              extended by fr.gouv.culture.sdx.document.XMLDocument
                  extended by fr.gouv.culture.sdx.user.AbstractIdentity
                      extended by fr.gouv.culture.sdx.user.User
All Implemented Interfaces:
Document, IndexableDocument, ParsableDocument, Identity, 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.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, org.apache.excalibur.xml.sax.XMLizable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

public class User
extends AbstractIdentity

Definition of an SDX user.

A user is defined by the contents of an XML document. Once this document is transformed during indexing, it must return a name. This is the only restriction for a user definition document and its accompanying transformation : the application developer is free to put any other information within the XML document, and index it as he or she wishes.

Users are authentificated against a password, but this password is not kept within the XML definition document. It is given to the application when the user is added or updated. It is the responsibility of the application to manage users and passwords.

A user may be a member of one or more groups. Once again, the relationships between users and groups are not kept within the user definition file, but managed by the application.

For compatibility reasons, this class can manage the following user properties:

But in SDX 2, the most important property is the preferred locale, which may be used in setting the current locale of a given acceptRequest. The preferred locale is defined with the language, country and variant fields derived from the value of xml:lang when the user is indexed.


Nested Class Summary
 
Nested classes/interfaces inherited from class fr.gouv.culture.sdx.document.AbstractIndexableDocument
AbstractIndexableDocument.StoreHandler
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
static java.lang.String XCONF_EMAIL
          The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='email']
static java.lang.String XCONF_FIRSTNAME
          The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='firstname']
static java.lang.String XCONF_LANG
          The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='lang']
static java.lang.String XCONF_LASTNAME
          The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='lastname']
static java.lang.String XCONF_VARIANT
          The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='variant']
 
Fields inherited from class fr.gouv.culture.sdx.document.AbstractIndexableDocument
_boost, _currentFieldBoost, _msgHandler, _xmlFieldList, _xmlFieldOutput, _xmlFieldTransformer, attachedDocuments, contentHandler, DOC_ATTACHEDOC_ELEMENT_NAME, DOC_FIELD_ELEMENT_NAME, DOC_MSG_ELEMENT_NAME, DOC_NAMESPACE, DOC_ROOT_ELEMENT_NAME, lexicalHandler, nsTable, openSdxDocElems, properties, storeHandler, subDoc, subDocBytes, subDocuments, transformedDoc, withinSdxElement, withinXmlField, xmlConsumer
 
Fields inherited from class fr.gouv.culture.sdx.document.AbstractDocument
idGenerator, idPrefix, idSuffix, mimeType, storeRepo
 
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.document.Document
CLASS_NAME_SUFFIX, DOCTYPE_BINARY, DOCTYPE_GROUP, DOCTYPE_HTML, DOCTYPE_USER, DOCTYPE_XML
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Constructor Summary
User()
          Creates an empty user.
User(java.lang.String username)
          Creates a user given a username.
 
Method Summary
 java.lang.String getDocType()
          Gets the docType for the document
 java.lang.String getEmail()
          Returns the user's email.
 java.lang.String getFirstname()
          Returns the user's firstname.
 java.lang.String getLastname()
          Returns the user's lastname.
 java.util.Locale getPreferredLocale()
          Returns the user's preferred locale.
 java.lang.String getXmlLang()
          Returns the user's language.
 void setEmail(java.lang.String email)
          Sets the user's email
 void startIndexing(org.apache.excalibur.xml.sax.SAXParser parser, org.apache.cocoon.xml.XMLConsumer consumer)
          Starts the indexing process.
 
Methods inherited from class fr.gouv.culture.sdx.user.AbstractIdentity
getType, setType
 
Methods inherited from class fr.gouv.culture.sdx.document.XMLDocument
addAdditionalSystemFields, getLength, getMimeType, openStream, parse, parse, setContent, setTransformedDocument, setTransformedDocument
 
Methods inherited from class fr.gouv.culture.sdx.document.AbstractIndexableDocument
addAttachedDocument, characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, generateId, getAttachedDocuments, getAttachedDocumentsSize, getBoost, getFieldValues, getStoreHandler, getSubDocuments, getSubDocumentsSize, getTransformedDocument, handleDocumentId, ignorableWhitespace, processingInstruction, resetAttachedDocuments, resetFields, setAttachedDocuments, setBoost, setConsumer, setContentHandler, setDocumentLocator, setLexicalHandler, setMessageHandler, setUpdateAttachedDocuments, setUpTransformedDocument, setXMLFieldList, setXMLTransformerHandler, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, updateAttachedDocuments
 
Methods inherited from class fr.gouv.culture.sdx.document.AbstractDocument
getClassNameSuffix, getInputSource, getPreferredFilename, getRepositoryForStorage, getURL, initToSax, initVolatileObjectsToSax, save, setContent, setContent, setContent, setContent, setIdGenerator, setIdGenerator, setMimeType, setPreferredFilename, setPreferredFilename, setRepositoryForStorage, setURL
 
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, 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.document.IndexableDocument
addAdditionalSystemFields, getAttachedDocuments, getBoost, getFieldValues, getStoreHandler, getSubDocuments, getTransformedDocument, resetAttachedDocuments, setBoost, setMessageHandler, setTransformedDocument, setTransformedDocument, setXMLFieldList, setXMLTransformerHandler
 
Methods inherited from interface fr.gouv.culture.sdx.document.Document
getLength, getMimeType, getPreferredFilename, getRepositoryForStorage, getURL, openStream, save, setContent, setContent, setContent, setContent, setId, setIdGenerator, setIdGenerator, setMimeType, setPreferredFilename, setRepositoryForStorage, setURL
 
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
 
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, setLocale, setXmlLang
 
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable
toSAX
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

XCONF_FIRSTNAME

public static final java.lang.String XCONF_FIRSTNAME
The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='firstname']

See Also:
Constant Field Values

XCONF_LASTNAME

public static final java.lang.String XCONF_LASTNAME
The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='lastname']

See Also:
Constant Field Values

XCONF_EMAIL

public static final java.lang.String XCONF_EMAIL
The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='email']

See Also:
Constant Field Values

XCONF_LANG

public static final java.lang.String XCONF_LANG
The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='lang']

See Also:
Constant Field Values

XCONF_VARIANT

public static final java.lang.String XCONF_VARIANT
The code from the field in document(application.xconf)/sdx:application/sdx:userDocumentBase/sdx:fieldList/sdx:field[@code='variant']

See Also:
Constant Field Values
Constructor Detail

User

public User()
     throws SDXException
Creates an empty user. The username and other relevant informations will be supplied at indexation time. If logging is desired the super.getLog() should be set after user creation.

Throws:
SDXException
See Also:
AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger)

User

public User(java.lang.String username)
     throws SDXException
Creates a user given a username. Another username may be supplied at indexing time.

Parameters:
username - The username to use. If logging is desired the super.getLog() should be set after user creation.
Throws:
SDXException
See Also:
AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger)
Method Detail

getDocType

public java.lang.String getDocType()
Gets the docType for the document

Specified by:
getDocType in interface Document
Overrides:
getDocType in class XMLDocument

startIndexing

public void startIndexing(org.apache.excalibur.xml.sax.SAXParser parser,
                          org.apache.cocoon.xml.XMLConsumer consumer)
                   throws SDXException
Starts the indexing process. For users, it must return at least a "id" field.

Indexing is done in the usual way but at the end we keep specific user information and make them available for the getters.

Specified by:
startIndexing in interface IndexableDocument
Overrides:
startIndexing in class XMLDocument
Parameters:
parser - A parser that can be used for the indexing.
consumer - The consumer that will receive the indexing process (may be null. The previously provided consumer will then be used)
Throws:
SDXException

getXmlLang

public java.lang.String getXmlLang()
Returns the user's language.

Specified by:
getXmlLang in interface Localizable
Overrides:
getXmlLang in class AbstractSdxObject

getFirstname

public java.lang.String getFirstname()
Returns the user's firstname.


getLastname

public java.lang.String getLastname()
Returns the user's lastname.


getPreferredLocale

public java.util.Locale getPreferredLocale()
Returns the user's preferred locale.


getEmail

public java.lang.String getEmail()
Returns the user's email.


setEmail

public void setEmail(java.lang.String email)
Sets the user's email



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