com.metamatrix.platform.security.api
Class SessionToken

java.lang.Object
  extended by com.metamatrix.platform.security.api.SessionToken
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<SessionToken>

public class SessionToken
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<SessionToken>, java.lang.Cloneable

This class is an immutable identifier for a unique session that also maintains the name of the principal for that session. It is used internally to MetaMatrix to allow association of a principal name to various activities. Server-side object should not be returned to the client

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
SessionToken()
          Fake SessionToken representing a trusted user
SessionToken(MetaMatrixSessionID id, java.lang.String userName)
          The primary constructor that specifies the id, userName, and product info for the session represented by this token.
 
Method Summary
 java.lang.Object clone()
          Return a cloned instance of this object.
 int compareTo(SessionToken that)
          Compares this SessionToken to another Object.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 MetaMatrixSessionID getSessionID()
          Returns unique session identifier
 java.lang.String getSessionIDValue()
          Returns unique session identifier
 java.lang.String getUsername()
          Get the principal name for this session's user.
 int hashCode()
          Overrides Object hashCode method.
 java.lang.String toString()
          Returns a string representing the current state of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

SessionToken

public SessionToken()
Fake SessionToken representing a trusted user


SessionToken

public SessionToken(MetaMatrixSessionID id,
                    java.lang.String userName)
The primary constructor that specifies the id, userName, and product info for the session represented by this token.

Parameters:
id - (long) the unique identifier for the session
userName - (String) the userName for this session
Throws:
java.lang.IllegalArgumentException
Method Detail

getSessionID

public MetaMatrixSessionID getSessionID()
Returns unique session identifier

Returns:
the session ID

getSessionIDValue

public java.lang.String getSessionIDValue()
Returns unique session identifier

Returns:
the session ID value

getUsername

public java.lang.String getUsername()
Get the principal name for this session's user.

Returns:
the user name

compareTo

public int compareTo(SessionToken that)
Compares this SessionToken to another Object. If the Object is a SessionToken, this function compares the ID and the user account ID. Otherwise, it throws a ClassCastException (as SessionToken instances are comparable only to other SessionToken instances). Note: this method is consistent with equals().

Specified by:
compareTo in interface java.lang.Comparable<SessionToken>
Parameters:
o - the object that this instance is to be compared to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this UserID.

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

hashCode

public int hashCode()
Overrides Object hashCode method.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.
See Also:
Object.hashCode(), Object.equals(Object)

toString

public java.lang.String toString()
Returns a string representing the current state of the object.

Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Return a cloned instance of this object.

Overrides:
clone in class java.lang.Object
Returns:
the object that is the clone of this instance.


Copyright © 2009. All Rights Reserved.