Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.turbine.services.security.ldap
Class LDAPUser  view LDAPUser download LDAPUser.java

java.lang.Object
  extended byorg.apache.torque.om.BaseObject
      extended byorg.apache.turbine.services.security.ldap.LDAPUser
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, org.apache.torque.om.Persistent, org.apache.turbine.om.security.SecurityEntity, java.io.Serializable, org.apache.turbine.om.security.User

public class LDAPUser
extends org.apache.torque.om.BaseObject
implements org.apache.turbine.om.security.User

LDAPUser implements User and provides access to a user who accesses the system via LDAP.

Version:
$Id: LDAPUser.java 278822 2005-09-05 19:53:05Z henning $

Field Summary
private  java.util.Date createDate
          Date when the user was created
private  java.util.Date lastAccessDate
          Date when the user was last accessed
private static org.apache.commons.logging.Log log
          Logging
private  java.util.Hashtable permStorage
          This is data that will survive a servlet engine restart.
private static long serialVersionUID
          Serial Version UID
private  java.util.Hashtable tempStorage
          This is data that will not survive a servlet engine restart.
private  int timeout
          timeout
 
Fields inherited from class org.apache.torque.om.BaseObject
NEW_ID
 
Fields inherited from interface org.apache.turbine.om.security.User
ACCESS_COUNTER, CONFIRM_DATA, CONFIRM_VALUE, EMAIL, FIRST_NAME, HAS_LOGGED_IN, LAST_LOGIN, LAST_NAME, PASSWORD, SESSION_ACCESS_COUNTER, SESSION_KEY, USERNAME
 
Constructor Summary
LDAPUser()
          Constructor.
 
Method Summary
 int getAccessCounter()
          Gets the access counter for a user from perm storage.
 int getAccessCounterForSession()
          Gets the access counter for a user during a session.
 java.lang.String getConfirmed()
          Returns the value of Confirmed variable
 java.util.Date getCreateDate()
          Gets the create date for this User.
 java.lang.String getDN()
          Gets the distinguished name (DN) of the User.
 java.lang.String getEmail()
          Returns the Email for this user.
 java.lang.String getFirstName()
          Returns the first name for this user.
private  java.lang.Boolean getHasLoggedIn()
          This gets whether or not someone has logged in.
 int getId()
          Not implemented.
 java.lang.Integer getIdAsObj()
          Not implemented.
 java.util.Date getLastAccessDate()
          Gets the last access date for this User.
 java.util.Date getLastLogin()
          Get last login date/time for this user.
 java.lang.String getLastName()
          Returns the last name for this user.
 javax.naming.directory.Attributes getLDAPAttributes()
          Get the JNDI Attributes used to store the user in LDAP.
 java.lang.String getName()
          Returns the username for this user.
 java.lang.String getPassword()
          Get password for this user.
 java.lang.Object getPerm(java.lang.String name)
          Get an object from permanent storage.
 java.lang.Object getPerm(java.lang.String name, java.lang.Object def)
          Get an object from permanent storage; return default if value is null.
 java.util.Hashtable getPermStorage()
          This should only be used in the case where we want to save the data to the database.
 java.lang.Object getTemp(java.lang.String name)
          Get an object from temporary storage.
 java.lang.Object getTemp(java.lang.String name, java.lang.Object def)
          Get an object from temporary storage; return default if value is null.
 java.util.Hashtable getTempStorage()
          This should only be used in the case where we want to save the data to the database.
 int getTimeout()
          A User object can have a variable Timeout, which is defined in minutes.
 java.lang.String getUserName()
          Deprecated. Use getName() instead
 boolean hasLoggedIn()
          The user is considered logged in if they have not timed out.
 void incrementAccessCounter()
          Increments the permanent hit counter for the user.
 void incrementAccessCounterForSession()
          Increments the session hit counter for the user.
 boolean isConfirmed()
          This method reports whether or not the user has been confirmed in the system by checking the CONFIRM_VALUE column to see if it is equal to CONFIRM_DATA.
 java.lang.Object removeTemp(java.lang.String name)
          Remove an object from temporary storage and return the object.
 void save()
          Saves this object to the data store.
 void save(java.sql.Connection conn)
          not implemented
 void save(java.lang.String dbname)
          not implemented
 void setAccessCounter(int cnt)
          Sets the access counter for a user, saved in perm storage.
 void setAccessCounterForSession(int cnt)
          Sets the session access counter for a user, saved in temp storage.
 void setConfirmed(java.lang.String confirm)
          Set the users confirmed variable
 void setCreateDate(java.util.Date date)
          Sets the create date for this User.
 void setEmail(java.lang.String email)
          Set the users Email
 void setFirstName(java.lang.String fname)
          Set the users First Name
 void setHasLoggedIn(java.lang.Boolean value)
          This sets whether or not someone has logged in.
 void setId(int id)
          Not implemented.
 void setLastAccessDate()
          Sets the last access date for this User.
 void setLastLogin(java.util.Date date)
          Set last login date/time.
 void setLastName(java.lang.String lname)
          Set the users Last Name Sets the last name for this user.
 void setLDAPAttributes(javax.naming.directory.Attributes attribs)
          Populates the user with values obtained from the LDAP Service.
 void setName(java.lang.String name)
          Not implemented.
 void setPassword(java.lang.String password)
          Set password.
 void setPerm(java.lang.String name, java.lang.Object value)
          Put an object into permanent storage.
 void setPermStorage(java.util.Hashtable stuff)
          This should only be used in the case where we want to save the data to the database.
 void setTemp(java.lang.String name, java.lang.Object value)
          Put an object into temporary storage.
 void setTempStorage(java.util.Hashtable storage)
          This should only be used in the case where we want to save the data to the database.
 void setTimeout(int time)
          A User object can have a variable Timeout which is defined in minutes.
 void setUserName(java.lang.String username)
          Sets the username for this user.
 void updateLastLogin()
          Updates the last login date in the database.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent hsbe)
          Implement this method if you wish to be notified when the User has been Bound to the session.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent hsbe)
          Implement this method if you wish to be notified when the User has been Unbound from the session.
 
Methods inherited from class org.apache.torque.om.BaseObject
equals, equals, getByName, getByPeerName, getByPosition, getLog, getPrimaryKey, hashCode, isModified, isNew, log, resetModified, setModified, setNew, setPrimaryKey, setPrimaryKey, setPrimaryKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial Version UID

See Also:
Constant Field Values

log

private static org.apache.commons.logging.Log log
Logging


createDate

private java.util.Date createDate
Date when the user was created


lastAccessDate

private java.util.Date lastAccessDate
Date when the user was last accessed


timeout

private int timeout
timeout


permStorage

private java.util.Hashtable permStorage
This is data that will survive a servlet engine restart.


tempStorage

private java.util.Hashtable tempStorage
This is data that will not survive a servlet engine restart.

Constructor Detail

LDAPUser

public LDAPUser()
Constructor. Create a new User and set the createDate.

Method Detail

setLDAPAttributes

public void setLDAPAttributes(javax.naming.directory.Attributes attribs)
                       throws javax.naming.NamingException
Populates the user with values obtained from the LDAP Service. This method could be redefined in subclasses.


getLDAPAttributes

public javax.naming.directory.Attributes getLDAPAttributes()
                                                    throws javax.naming.NamingException
Get the JNDI Attributes used to store the user in LDAP. This method could be redefined in a subclass.


getDN

public java.lang.String getDN()
Gets the distinguished name (DN) of the User. This method could be redefined in a subclass.


getAccessCounterForSession

public int getAccessCounterForSession()
Gets the access counter for a user during a session.

Specified by:
getAccessCounterForSession in interface org.apache.turbine.om.security.User

getAccessCounter

public int getAccessCounter()
Gets the access counter for a user from perm storage.

Specified by:
getAccessCounter in interface org.apache.turbine.om.security.User

getCreateDate

public java.util.Date getCreateDate()
Gets the create date for this User. This is the time at which the user object was created.

Specified by:
getCreateDate in interface org.apache.turbine.om.security.User

getConfirmed

public java.lang.String getConfirmed()
Returns the value of Confirmed variable

Specified by:
getConfirmed in interface org.apache.turbine.om.security.User

getEmail

public java.lang.String getEmail()
Returns the Email for this user. If this is defined, then the user is considered logged in.

Specified by:
getEmail in interface org.apache.turbine.om.security.User

getLastAccessDate

public java.util.Date getLastAccessDate()
Gets the last access date for this User. This is the last time that the user object was referenced.

Specified by:
getLastAccessDate in interface org.apache.turbine.om.security.User

getLastLogin

public java.util.Date getLastLogin()
Get last login date/time for this user.

Specified by:
getLastLogin in interface org.apache.turbine.om.security.User

getPassword

public java.lang.String getPassword()
Get password for this user.

Specified by:
getPassword in interface org.apache.turbine.om.security.User

getPerm

public java.lang.Object getPerm(java.lang.String name)
Get an object from permanent storage.

Specified by:
getPerm in interface org.apache.turbine.om.security.User

getPerm

public java.lang.Object getPerm(java.lang.String name,
                                java.lang.Object def)
Get an object from permanent storage; return default if value is null.

Specified by:
getPerm in interface org.apache.turbine.om.security.User

getPermStorage

public java.util.Hashtable getPermStorage()
This should only be used in the case where we want to save the data to the database.

Specified by:
getPermStorage in interface org.apache.turbine.om.security.User

getTemp

public java.lang.Object getTemp(java.lang.String name)
Get an object from temporary storage.

Specified by:
getTemp in interface org.apache.turbine.om.security.User

getTemp

public java.lang.Object getTemp(java.lang.String name,
                                java.lang.Object def)
Get an object from temporary storage; return default if value is null.

Specified by:
getTemp in interface org.apache.turbine.om.security.User

getTimeout

public int getTimeout()
A User object can have a variable Timeout, which is defined in minutes. If the user has been timed out, then the hasLoggedIn() value will return false.


getUserName

public java.lang.String getUserName()
Deprecated. Use getName() instead

Returns the username for this user. If this is defined, then the user is considered logged in.

Specified by:
getUserName in interface org.apache.turbine.om.security.User

getFirstName

public java.lang.String getFirstName()
Returns the first name for this user. If this is defined, then the user is considered logged in.

Specified by:
getFirstName in interface org.apache.turbine.om.security.User

getLastName

public java.lang.String getLastName()
Returns the last name for this user. If this is defined, then the user is considered logged in.

Specified by:
getLastName in interface org.apache.turbine.om.security.User

hasLoggedIn

public boolean hasLoggedIn()
The user is considered logged in if they have not timed out.

Specified by:
hasLoggedIn in interface org.apache.turbine.om.security.User

isConfirmed

public boolean isConfirmed()
This method reports whether or not the user has been confirmed in the system by checking the CONFIRM_VALUE column to see if it is equal to CONFIRM_DATA.

Specified by:
isConfirmed in interface org.apache.turbine.om.security.User

incrementAccessCounter

public void incrementAccessCounter()
Increments the permanent hit counter for the user.

Specified by:
incrementAccessCounter in interface org.apache.turbine.om.security.User

incrementAccessCounterForSession

public void incrementAccessCounterForSession()
Increments the session hit counter for the user.

Specified by:
incrementAccessCounterForSession in interface org.apache.turbine.om.security.User

removeTemp

public java.lang.Object removeTemp(java.lang.String name)
Remove an object from temporary storage and return the object.

Specified by:
removeTemp in interface org.apache.turbine.om.security.User

setAccessCounter

public void setAccessCounter(int cnt)
Sets the access counter for a user, saved in perm storage.

Specified by:
setAccessCounter in interface org.apache.turbine.om.security.User

setAccessCounterForSession

public void setAccessCounterForSession(int cnt)
Sets the session access counter for a user, saved in temp storage.

Specified by:
setAccessCounterForSession in interface org.apache.turbine.om.security.User

setConfirmed

public void setConfirmed(java.lang.String confirm)
Set the users confirmed variable

Specified by:
setConfirmed in interface org.apache.turbine.om.security.User

setLastAccessDate

public void setLastAccessDate()
Sets the last access date for this User. This is the last time that the user object was referenced.

Specified by:
setLastAccessDate in interface org.apache.turbine.om.security.User

setCreateDate

public void setCreateDate(java.util.Date date)
Sets the create date for this User. This is the time at which the user object was created.

Specified by:
setCreateDate in interface org.apache.turbine.om.security.User

setEmail

public void setEmail(java.lang.String email)
Set the users Email

Specified by:
setEmail in interface org.apache.turbine.om.security.User

setFirstName

public void setFirstName(java.lang.String fname)
Set the users First Name

Specified by:
setFirstName in interface org.apache.turbine.om.security.User

setLastLogin

public void setLastLogin(java.util.Date date)
Set last login date/time.

Specified by:
setLastLogin in interface org.apache.turbine.om.security.User

setLastName

public void setLastName(java.lang.String lname)
Set the users Last Name Sets the last name for this user.

Specified by:
setLastName in interface org.apache.turbine.om.security.User

setPassword

public void setPassword(java.lang.String password)
Set password.

Specified by:
setPassword in interface org.apache.turbine.om.security.User

setPerm

public void setPerm(java.lang.String name,
                    java.lang.Object value)
Put an object into permanent storage.

Specified by:
setPerm in interface org.apache.turbine.om.security.User

setPermStorage

public void setPermStorage(java.util.Hashtable stuff)
This should only be used in the case where we want to save the data to the database.

Specified by:
setPermStorage in interface org.apache.turbine.om.security.User

getTempStorage

public java.util.Hashtable getTempStorage()
This should only be used in the case where we want to save the data to the database.

Specified by:
getTempStorage in interface org.apache.turbine.om.security.User

setTempStorage

public void setTempStorage(java.util.Hashtable storage)
This should only be used in the case where we want to save the data to the database.

Specified by:
setTempStorage in interface org.apache.turbine.om.security.User

getHasLoggedIn

private java.lang.Boolean getHasLoggedIn()
This gets whether or not someone has logged in. hasLoggedIn() returns this value as a boolean. This is private because you should use hasLoggedIn() instead.


setHasLoggedIn

public void setHasLoggedIn(java.lang.Boolean value)
This sets whether or not someone has logged in. hasLoggedIn() returns this value.

Specified by:
setHasLoggedIn in interface org.apache.turbine.om.security.User

setTemp

public void setTemp(java.lang.String name,
                    java.lang.Object value)
Put an object into temporary storage.

Specified by:
setTemp in interface org.apache.turbine.om.security.User

setTimeout

public void setTimeout(int time)
A User object can have a variable Timeout which is defined in minutes. If the user has been timed out, then the hasLoggedIn() value will return false.


setUserName

public void setUserName(java.lang.String username)
Sets the username for this user.

Specified by:
setUserName in interface org.apache.turbine.om.security.User

updateLastLogin

public void updateLastLogin()
                     throws java.lang.Exception
Updates the last login date in the database.

Specified by:
updateLastLogin in interface org.apache.turbine.om.security.User

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent hsbe)
Implement this method if you wish to be notified when the User has been Bound to the session.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent hsbe)
Implement this method if you wish to be notified when the User has been Unbound from the session.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

getName

public java.lang.String getName()
Returns the username for this user. If this is defined, then the user is considered logged in.

Specified by:
getName in interface org.apache.turbine.om.security.SecurityEntity

setName

public void setName(java.lang.String name)
Not implemented.

Specified by:
setName in interface org.apache.turbine.om.security.SecurityEntity

getId

public int getId()
Not implemented.

Specified by:
getId in interface org.apache.turbine.om.security.SecurityEntity

getIdAsObj

public java.lang.Integer getIdAsObj()
Not implemented.

Specified by:
getIdAsObj in interface org.apache.turbine.om.security.SecurityEntity

setId

public void setId(int id)
Not implemented.

Specified by:
setId in interface org.apache.turbine.om.security.SecurityEntity

save

public void save()
          throws java.lang.Exception
Saves this object to the data store.

Specified by:
save in interface org.apache.torque.om.Persistent

save

public void save(java.sql.Connection conn)
          throws java.lang.Exception
not implemented

Specified by:
save in interface org.apache.torque.om.Persistent

save

public void save(java.lang.String dbname)
          throws java.lang.Exception
not implemented

Specified by:
save in interface org.apache.torque.om.Persistent