fr.gouv.culture.sdx.user
Class User

java.lang.Object
  extended byfr.gouv.culture.sdx.utils.SdxObjectImpl
      extended byfr.gouv.culture.sdx.document.AbstractDocument
          extended byfr.gouv.culture.sdx.document.AbstractIndexableDocument
              extended byfr.gouv.culture.sdx.document.XMLDocument
                  extended byfr.gouv.culture.sdx.user.AbstractIdentity
                      extended byfr.gouv.culture.sdx.user.User
All Implemented Interfaces:
org.xml.sax.ContentHandler, Document, Identity, IndexableDocument, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.LogEnabled, ParsableDocument, SdxObject, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLProducer

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 inherited from class fr.gouv.culture.sdx.document.AbstractIndexableDocument
AbstractIndexableDocument.StoreHandler
 
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.user.AbstractIdentity
logger
 
Fields inherited from class fr.gouv.culture.sdx.document.AbstractIndexableDocument
_boost, _currentFieldBoost, _msgHandler, 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, 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.SdxObjectImpl
encoding
 
Fields inherited from interface fr.gouv.culture.sdx.document.Document
DOCTYPE_BINARY, DOCTYPE_GROUP, DOCTYPE_HTML, DOCTYPE_USER, DOCTYPE_XML
 
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.avalon.excalibur.xml.Parser parser, org.apache.cocoon.xml.XMLConsumer consumer)
          Starts the indexing process.
 
Methods inherited from class fr.gouv.culture.sdx.user.AbstractIdentity
enableLogging, 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, getBoost, getFieldValues, getStoreHandler, getSubDocuments, getTransformedDocument, handleDocumentId, ignorableWhitespace, processingInstruction, resetAttachedDocuments, resetFields, setAttachedDocuments, setBoost, setConsumer, setContentHandler, setDocumentLocator, setLexicalHandler, setMessageHandler, setUpdateAttachedDocuments, setUpTransformedDocument, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, updateAttachedDocuments
 
Methods inherited from class fr.gouv.culture.sdx.document.AbstractDocument
getId, getInputSource, getPreferredFilename, getRepositoryForStorage, getURL, save, setContent, setContent, setContent, setContent, setId, setIdGenerator, setIdGenerator, setMimeType, setPreferredFilename, setPreferredFilename, setRepositoryForStorage, setURL
 
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
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.document.IndexableDocument
addAdditionalSystemFields, getAttachedDocuments, getBoost, getFieldValues, getStoreHandler, getSubDocuments, getTransformedDocument, resetAttachedDocuments, setBoost, setMessageHandler, setTransformedDocument, setTransformedDocument
 
Methods inherited from interface fr.gouv.culture.sdx.document.Document
getId, getLength, getMimeType, getPreferredFilename, getRepositoryForStorage, getURL, openStream, save, setContent, setContent, setContent, setContent, setId, setIdGenerator, setIdGenerator, setMimeType, setPreferredFilename, setRepositoryForStorage, setURL
 
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 logger should be set after user creation.

See Also:
AbstractIdentity.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 logger should be set after user creation.
See Also:
AbstractIdentity.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.avalon.excalibur.xml.Parser 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.


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-2004 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.