asgaard.skid
Class UserSession

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--asgaard.skid.UserSession

public final class UserSession
extends java.lang.Thread

This class holds all information nessecary to identify an valid user-session


Field Summary
 byte MIN_PWD_SIZE
          Minimum length of an valid Password
static long offlinetime
          Survival time of the Session without user-interaction
static char STATUS_ADMIN
          Administrator
static char STATUS_DEFAULT
          The normal user with default access-rights
static char STATUS_DELETED
          The user is not in use any more
static char STATUS_EXPERT_FORM
          Kind of Expert for Form-Maintenance
static char STATUS_REPLY_HTML
          Format of the autom. reply PUSHED
static char STATUS_REPLY_WEEKLY
          Interval in which a reply is calculated
static long waitFor
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UserSession(asgaard.skid.HttpServletRequest request)
          Creates a new User, for each class which may create a UserSession has to be registrated explicitely (hardcoded).
UserSession(java.lang.String userName, java.lang.String pwd, java.lang.String ipAdr)
          Checks if the given user has a valid password and throws an exception if not.
UserSession(UserSession su, java.lang.String searchName)
          Checks the access-rights from the asking session and replys an instance in maintenance mode
 
Method Summary
 java.lang.String addPage(java.lang.String pageName)
          Adds the ID for a valid page in this session to the page-list
 void addStatus(char c)
          Adds a specific Atribute to this this session
 boolean checkPage(java.lang.String pageName, java.lang.String pid)
          Checks the page-ID if it is a valid page in this session
static boolean checkSession(java.lang.String id, java.lang.String ipAdr)
          Checks whether a Session whith a given ID exists or not and sets the modify-Timestamp.
 boolean checkStatus(char c)
          Checks if a given Atribute exists for this session
 long getCreated()
          Returns when the session has been created
 java.lang.String getEMail()
          Returns the e-Mail adress
 java.lang.String getEncrypt()
          Returns the encrypted password of the reply
 long getEnded()
          Returns when the session has been modified at last
 long getExpiring()
          Returns when the account will expire
 java.lang.String getID()
          Returns the ID of this user
 java.lang.String getIpAdr()
          Returns the IP-Adress of the current Connection
 long getKey()
          Returns the key of the associated Person-Bean
 java.lang.String getLanguage()
          Returns the Language of the current Connection
 long getModified()
          Returns when the session has been modified at last
static UserSession getSession(java.lang.String id)
          Returns a Session whith a given ID exists or not and sets the modify-Timestamp.
static UserSession getSession(java.lang.String id, java.lang.String ipAdr)
          Returns a Session whith a given ID exists or not and sets the modify-Timestamp.
 long getStarted()
          Returns when the session has been modified at last
 java.lang.String getStatus()
          Returns the status of this session
 java.lang.String getURL()
          Returns the url of the homepage of the user
 java.lang.String getUserName()
          Returns the Name of this user
 void modify()
          Resets the Session
 void remove()
          Removes the session from the list of valid sessions.
 void removeStatus(char c)
          Removes a specific Atribute from this this session
 void run()
          Cecks whether the Session shall be removed from the list of valid sessions or not.
 boolean save()
          Adds the ID for a valid page in this session to the page-list
 boolean setEMail(java.lang.String value)
          Sets the e-Mail adress
 boolean setEncrypt(java.lang.String value)
          Sets the encrypted Password
 void setExpiring(long when)
          Sets when the account will expire
 boolean setKey(int key)
          Sets the Person.Key of the current Connection
 boolean setLanguage(java.lang.String value, java.lang.String[] languages)
          Sets the Language of the current Connection
 boolean setPwd(java.lang.String value, java.lang.String verify)
          Sets a new Password if long enough
 boolean setURL(java.lang.String value)
          Sets the url of the homepage of the user
 boolean setUserName(java.lang.String value)
          Sets the Name of this user only new names are accepted
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_PWD_SIZE

public final byte MIN_PWD_SIZE
Minimum length of an valid Password

STATUS_DELETED

public static final char STATUS_DELETED
The user is not in use any more

STATUS_DEFAULT

public static final char STATUS_DEFAULT
The normal user with default access-rights

STATUS_ADMIN

public static final char STATUS_ADMIN
Administrator

STATUS_EXPERT_FORM

public static final char STATUS_EXPERT_FORM
Kind of Expert for Form-Maintenance

STATUS_REPLY_HTML

public static final char STATUS_REPLY_HTML
Format of the autom. reply PUSHED

STATUS_REPLY_WEEKLY

public static final char STATUS_REPLY_WEEKLY
Interval in which a reply is calculated

offlinetime

public static long offlinetime
Survival time of the Session without user-interaction

waitFor

public static long waitFor
Constructor Detail

UserSession

public UserSession(asgaard.skid.HttpServletRequest request)
Creates a new User, for each class which may create a UserSession has to be registrated explicitely (hardcoded).
Parameters:
creator - the requesting Object (has to be a BeanBroker)
ipAdr - IP-Adress of the user

UserSession

public UserSession(java.lang.String userName,
                   java.lang.String pwd,
                   java.lang.String ipAdr)
            throws SkidException,
                   java.rmi.RemoteException,
                   java.sql.SQLException
Checks if the given user has a valid password and throws an exception if not.
Parameters:
userName - name of the user
pwd - the encrypted password
ipAdr - the Adress of the user
Throws:
SkidException - if password doesen't match
java.rmi.RemoteException - if RMI doesen't work
java.sql.SQLException - the db doesen't work

UserSession

public UserSession(UserSession su,
                   java.lang.String searchName)
            throws SkidException,
                   java.rmi.RemoteException,
                   java.sql.SQLException
Checks the access-rights from the asking session and replys an instance in maintenance mode
Parameters:
su - the Administrator's session
Throws:
java.rmi.RemoteException - if RMI doesen't work
java.sql.SQLException - the db doesen't work
Method Detail

checkSession

public static boolean checkSession(java.lang.String id,
                                   java.lang.String ipAdr)
                            throws java.lang.IllegalAccessException
Checks whether a Session whith a given ID exists or not and sets the modify-Timestamp.

getSession

public static UserSession getSession(java.lang.String id,
                                     java.lang.String ipAdr)
                              throws java.lang.IllegalAccessException
Returns a Session whith a given ID exists or not and sets the modify-Timestamp.

getSession

public static UserSession getSession(java.lang.String id)
Returns a Session whith a given ID exists or not and sets the modify-Timestamp.

getID

public java.lang.String getID()
                       throws java.lang.IllegalAccessException
Returns the ID of this user

getIpAdr

public java.lang.String getIpAdr()
                          throws java.lang.IllegalAccessException
Returns the IP-Adress of the current Connection

getLanguage

public java.lang.String getLanguage()
Returns the Language of the current Connection

getUserName

public java.lang.String getUserName()
Returns the Name of this user

getEMail

public java.lang.String getEMail()
Returns the e-Mail adress

getURL

public java.lang.String getURL()
Returns the url of the homepage of the user

getEncrypt

public java.lang.String getEncrypt()
Returns the encrypted password of the reply

getCreated

public long getCreated()
Returns when the session has been created

getModified

public long getModified()
Returns when the session has been modified at last

setExpiring

public void setExpiring(long when)
Sets when the account will expire

getExpiring

public long getExpiring()
Returns when the account will expire

getStarted

public long getStarted()
Returns when the session has been modified at last

getEnded

public long getEnded()
Returns when the session has been modified at last

getKey

public long getKey()
Returns the key of the associated Person-Bean

setKey

public boolean setKey(int key)
Sets the Person.Key of the current Connection
Parameters:
languages - set with valid languages

setLanguage

public boolean setLanguage(java.lang.String value,
                           java.lang.String[] languages)
Sets the Language of the current Connection
Parameters:
languages - set with valid languages

setUserName

public boolean setUserName(java.lang.String value)
Sets the Name of this user only new names are accepted

setEMail

public boolean setEMail(java.lang.String value)
Sets the e-Mail adress

setURL

public boolean setURL(java.lang.String value)
Sets the url of the homepage of the user

setPwd

public boolean setPwd(java.lang.String value,
                      java.lang.String verify)
Sets a new Password if long enough
See Also:
MIN_PWD_SIZE

setEncrypt

public boolean setEncrypt(java.lang.String value)
Sets the encrypted Password
See Also:
MIN_PWD_SIZE

getStatus

public java.lang.String getStatus()
Returns the status of this session

checkStatus

public boolean checkStatus(char c)
Checks if a given Atribute exists for this session
See Also:

addStatus

public void addStatus(char c)
Adds a specific Atribute to this this session
See Also:

removeStatus

public void removeStatus(char c)
Removes a specific Atribute from this this session
See Also:

modify

public void modify()
Resets the Session

remove

public void remove()
Removes the session from the list of valid sessions.

run

public void run()
Cecks whether the Session shall be removed from the list of valid sessions or not.
Overrides:
run in class java.lang.Thread

addPage

public java.lang.String addPage(java.lang.String pageName)
                         throws java.lang.IllegalAccessException
Adds the ID for a valid page in this session to the page-list

save

public boolean save()
             throws SkidException,
                    java.sql.SQLException,
                    java.rmi.RemoteException
Adds the ID for a valid page in this session to the page-list

checkPage

public boolean checkPage(java.lang.String pageName,
                         java.lang.String pid)
                  throws java.lang.IllegalAccessException
Checks the page-ID if it is a valid page in this session