Xindice API

org.apache.xindice.server
Class User

java.lang.Object
  |
  +--org.apache.xindice.server.User
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class User
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

User is the atomic representation of a Xindice user. Users can be stored in an application-independent fashion using custom implementations of UserManager. StdUserManager uses Java's serialization mechanism to stream User instances to and from a file in a directory on disk. TODO: At some point, this system will be replaced by a repository- based user management system using XML as the storage and representation format.

See Also:
StdUserManager, Serialized Form

Constructor Summary
User(java.lang.String username)
           
User(java.lang.String username, java.lang.String password)
           
User(java.lang.String username, java.lang.String password, java.util.Map props)
           
 
Method Summary
 boolean appendProperty(java.lang.String key, java.io.Serializable value, java.lang.String delimiter)
          appendProperty appends a value to an existing property in the User's property set.
 java.lang.Object clone()
          Serializable clone() implementation - The easy way to do it!
 boolean getActive()
          getActive returns the User's actively available status.
 java.lang.String getPassword()
          getPassword returns the User's password.
 void getPersistentState(Gateway gateway)
          getPersistentState allows a Script to retrieve the Gateway's current session state from the current User, having been serialized as part of the User's image in the UserManager's data store.
 java.lang.Object getProperty(java.lang.String key)
          getProperty returns the value for a property in the User's property set.
 int getRealm(java.lang.String realm)
          getRealm returns the authentication realm value that is associated with the User's access control.
 UserManager getUserManager()
          getUserManager returns the originating UserManager for this User.
 java.lang.String getUsername()
          getUsername returns the User's name.
 boolean isDirty()
          isDirty returns whether or not the User's record has been modified since its last save.
 java.lang.String[] listProperties()
          listProperties returns an array of Strings containing the names of all of the properties that the User has available in their property set.
 void removePersistentState()
          removePersistentState allows a Script to completely remove all serialized Session state from the User's record.
 boolean removeProperty(java.lang.String key)
          removeProperty removes a property from the User's property set.
 boolean save()
          save instructs the UserManager to save this User to its data store.
 void setActive(boolean active)
          setActive sets whether the User is actively available in the User data store.
 void setPassword(java.lang.String password)
          setPassword allows the User to replace their password.
 void setPersistentState(Gateway gateway)
          setPersistentState allows a Script to store the Gateway's current session state to the current User and serialize that state as part of the User's image in the UserManager's data store.
 boolean setProperty(java.lang.String key, java.io.Serializable value)
          setProperty sets a value in the User's property set.
 void setRealm(java.lang.String realm, int value)
          setRealm adds or replaces an authentication realm value in the User's access control.
 void setUserManager(UserManager manager)
          setUserManager attaches the originating UserManager to this User in order to allow the User to save any changes that it has performed back to the data store via the UserManager.
 void setUsername(java.lang.String username)
          setUsername sets the User's name, basically replacing the User in the data store with a new User object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

User

public User(java.lang.String username,
            java.lang.String password,
            java.util.Map props)

User

public User(java.lang.String username,
            java.lang.String password)

User

public User(java.lang.String username)
Method Detail

setUserManager

public void setUserManager(UserManager manager)
setUserManager attaches the originating UserManager to this User in order to allow the User to save any changes that it has performed back to the data store via the UserManager.
Parameters:
manager - The originating UserManager for this User

getUserManager

public UserManager getUserManager()
getUserManager returns the originating UserManager for this User.
Returns:
The originating UserManager for this User

setUsername

public void setUsername(java.lang.String username)
                 throws ParameterException
setUsername sets the User's name, basically replacing the User in the data store with a new User object.
Parameters:
username - The new username
Throws:
ParameterException - if the username is taken or invalid

setPassword

public void setPassword(java.lang.String password)
                 throws ParameterException
setPassword allows the User to replace their password.
Parameters:
password - The new password
Throws:
ParameterException - if the password is invalid

setActive

public void setActive(boolean active)
setActive sets whether the User is actively available in the User data store. If the User is inactive, the authentication system should not allow that User to log in or access any resources that might be associated with them.
Parameters:
active - The new User active status

setRealm

public void setRealm(java.lang.String realm,
                     int value)
setRealm adds or replaces an authentication realm value in the User's access control.
Parameters:
realm - The realm to add
value - The Access Methods the user will be afforded
See Also:
Script

getRealm

public int getRealm(java.lang.String realm)
getRealm returns the authentication realm value that is associated with the User's access control.
Parameters:
realm - The realm to retrieve
Returns:
The Access Methods the user can be afforded
See Also:
Script

setProperty

public boolean setProperty(java.lang.String key,
                           java.io.Serializable value)
setProperty sets a value in the User's property set. User properties are serialized and stored with the User in the data store.
Parameters:
key - The property name
value - The property value
Returns:
Whether or not the property was stored

getUsername

public java.lang.String getUsername()
getUsername returns the User's name.
Returns:
The User's name

getPassword

public java.lang.String getPassword()
getPassword returns the User's password.
Returns:
The User's password

getActive

public boolean getActive()
getActive returns the User's actively available status. If the User is inactive, the authentication system should not allow that User to log in or access any resources that might be associated with them.
Returns:
The User active status

getProperty

public java.lang.Object getProperty(java.lang.String key)
getProperty returns the value for a property in the User's property set.
Parameters:
key - The property name
Returns:
The property value (or null)

removeProperty

public boolean removeProperty(java.lang.String key)
removeProperty removes a property from the User's property set.
Parameters:
key - The property name
Returns:
Whether or not the property could be removed

appendProperty

public boolean appendProperty(java.lang.String key,
                              java.io.Serializable value,
                              java.lang.String delimiter)
appendProperty appends a value to an existing property in the User's property set. The specified delimiter will be used to delimit existing values if there are any.
Parameters:
key - The property name
value - The value to append
delimiter - The delimiter to use
Returns:
Whether or not the property value could be appended

listProperties

public java.lang.String[] listProperties()
listProperties returns an array of Strings containing the names of all of the properties that the User has available in their property set.
Returns:
The property names

isDirty

public boolean isDirty()
isDirty returns whether or not the User's record has been modified since its last save.
Returns:
Whether or not the User's record has been modified

save

public boolean save()
save instructs the UserManager to save this User to its data store.
Returns:
Whether or not the User could be saved

setPersistentState

public void setPersistentState(Gateway gateway)
setPersistentState allows a Script to store the Gateway's current session state to the current User and serialize that state as part of the User's image in the UserManager's data store. Because Session State can exist without a User, and vice versa, this method is a convenient tool for storing a User's personalized information.
Parameters:
gateway - The Gateway to query for session state

getPersistentState

public void getPersistentState(Gateway gateway)
getPersistentState allows a Script to retrieve the Gateway's current session state from the current User, having been serialized as part of the User's image in the UserManager's data store. Because Session State can exist without a User, and vice versa, this method is a convenient tool for storing a User's personalized information.
Parameters:
gateway - The Gateway to store the session state in

removePersistentState

public void removePersistentState()
removePersistentState allows a Script to completely remove all serialized Session state from the User's record.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Serializable clone() implementation - The easy way to do it!
Returns:
The cloned Object
Throws:
java.lang.CloneNotSupportedException - If an error occurs.

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation