de.kosi.session
Class Session

java.lang.Object
  |
  +--de.kosi.session.Session
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Session
extends java.lang.Object
implements java.io.Externalizable

This class represents a Session. It is created on the server, when a client logs on and is passed as an implicit parameter to every method call afterwards.

ChangeLog:

 $Log: Session.java,v $
 Revision 1.3  2001/06/04 14:21:10  jiriki
 Made source more comliant to coding guidelines.

 

Version:
$Revision: 1.3 $ ($Date: 2001/06/04 14:21:10 $)
Author:
Jan-Ole Janssen, Niklas Mehner, Time Sticher
See Also:
Serialized Form

Constructor Summary
Session()
          Creates a new Session.
 
Method Summary
static Session createInvalidSession()
          Creates a new invalid session.
static Session createSession()
          Creates a new (valid) session, with a new session id.
 boolean equals(java.lang.Object obj)
          Compares this session to an object.
 int hashCode()
          Returns the hash code for this session.
 void readExternal(java.io.ObjectInput in)
          Reads a session from an ObjectInput Stream.
 java.lang.String toString()
          Returns a string representation of the session.
 void writeExternal(java.io.ObjectOutput out)
          Writes this object to an ObjectOutput Stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Session

public Session()
Creates a new Session. This Constructor should never be called directly from Application code, but has to be public because it has do be Serializable.
Method Detail

toString

public java.lang.String toString()
Returns a string representation of the session.
Overrides:
toString in class java.lang.Object
Returns:
string representation fo this session.

hashCode

public int hashCode()
Returns the hash code for this session. This has to be the same, for different instances of session, that have the same sessionID.
Overrides:
hashCode in class java.lang.Object
Returns:
hash code of this session.

equals

public boolean equals(java.lang.Object obj)
Compares this session to an object. Two sessions are equal, if theis session ids are equal, session does not equal any other object.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object this session is compared to.
Returns:
wether this session is equal to obj.

createSession

public static Session createSession()
Creates a new (valid) session, with a new session id. This is a factory method for the session class. Sessions are not created with the default constructor, because creating a random value for the session id can take some time and should not be done while deserializating a session object.
Returns:
a new session.

createInvalidSession

public static Session createInvalidSession()
Creates a new invalid session.
Returns:
a invalid session.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes this object to an ObjectOutput Stream. This method makes serialization faster.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - the ObjectOutput Stream this session should be written to.
Throws:
java.io.IOException - if ObjectOutput throws an IOException.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException
Reads a session from an ObjectInput Stream.
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - the ObjectOutput Stream this session should be read from
Throws:
java.io.IOException - if ObjectInputs throws an IOException.