org.apache.catalina.session
Class ManagerBase

java.lang.Object
  |
  +--org.apache.catalina.session.ManagerBase
All Implemented Interfaces:
Manager
Direct Known Subclasses:
PersistentManagerBase, StandardManager

public abstract class ManagerBase
extends java.lang.Object
implements Manager

Minimal implementation of the Manager interface that supports no session persistence or distributable capabilities. This class may be subclassed to create more sophisticated Manager implementations.

Version:
$Revision: 1.9.2.2 $ $Date: 2002/01/17 12:11:59 $
Author:
Craig R. McClanahan

Field Summary
protected  java.lang.String algorithm
          The message digest algorithm to be used when generating session identifiers.
protected  Container container
          The Container with which this Manager is associated.
protected  int debug
          The debugging detail level for this component.
protected static java.lang.String DEFAULT_ALGORITHM
          The default message digest algorithm to use if we cannot use the requested one.
protected  java.security.MessageDigest digest
          Return the MessageDigest implementation to be used when creating session identifiers.
protected  boolean distributable
          The distributable flag for Sessions created by this Manager.
protected  java.lang.String entropy
          A String initialization parameter used to increase the entropy of the initialization of our random number generator.
protected  int maxInactiveInterval
          The default maximum inactive interval for Sessions created by this Manager.
protected static java.lang.String name
          The descriptive name of this Manager implementation (for logging).
protected  java.util.Random random
          A random number generator to use when generating session identifiers.
protected  java.lang.String randomClass
          The Java class name of the random number generator class to be used when generating session identifiers.
protected  java.util.ArrayList recycled
          The set of previously recycled Sessions for this Manager.
protected static int SESSION_ID_BYTES
          The number of random bytes to include when generating a session identifier.
protected  java.util.HashMap sessions
          The set of currently active Sessions for this Manager, keyed by session identifier.
protected static StringManager sm
          The string manager for this package.
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
 
Constructor Summary
ManagerBase()
           
 
Method Summary
 void add(Session session)
          Add this Session to the set of active Sessions for this Manager.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 Session createSession()
          Construct and return a new session object, based on the default settings specified by this Manager's properties.
 Session findSession(java.lang.String id)
          Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
 Session[] findSessions()
          Return the set of active Sessions associated with this Manager.
protected  java.lang.String generateSessionId()
          Generate and return a new session identifier.
 java.lang.String getAlgorithm()
          Return the message digest algorithm for this Manager.
 Container getContainer()
          Return the Container with which this Manager is associated.
 int getDebug()
          Return the debugging detail level for this component.
 java.security.MessageDigest getDigest()
          Return the MessageDigest object to be used for calculating session identifiers.
 boolean getDistributable()
          Return the distributable flag for the sessions supported by this Manager.
protected  Engine getEngine()
          Retrieve the enclosing Engine for this Manager.
 java.lang.String getEntropy()
          Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.
 java.lang.String getInfo()
          Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
protected  java.lang.String getJvmRoute()
          Retrieve the JvmRoute for the enclosing Engine.
 int getMaxInactiveInterval()
          Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.
 java.lang.String getName()
          Return the descriptive short name of this Manager implementation.
 java.util.Random getRandom()
          Return the random number generator instance we should use for generating session identifiers.
 java.lang.String getRandomClass()
          Return the random number generator class name.
 void remove(Session session)
          Remove this Session from the active Sessions for this Manager.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener from this component.
 void setAlgorithm(java.lang.String algorithm)
          Set the message digest algorithm for this Manager.
 void setContainer(Container container)
          Set the Container with which this Manager is associated.
 void setDebug(int debug)
          Set the debugging detail level for this component.
 void setDistributable(boolean distributable)
          Set the distributable flag for the sessions supported by this Manager.
 void setEntropy(java.lang.String entropy)
          Set the entropy increaser value.
 void setMaxInactiveInterval(int interval)
          Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.
 void setRandomClass(java.lang.String randomClass)
          Set the random number generator class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Manager
load, unload
 

Field Detail

DEFAULT_ALGORITHM

protected static final java.lang.String DEFAULT_ALGORITHM
The default message digest algorithm to use if we cannot use the requested one.

See Also:
Constant Field Values

SESSION_ID_BYTES

protected static final int SESSION_ID_BYTES
The number of random bytes to include when generating a session identifier.

See Also:
Constant Field Values

algorithm

protected java.lang.String algorithm
The message digest algorithm to be used when generating session identifiers. This must be an algorithm supported by the java.security.MessageDigest class on your platform.


container

protected Container container
The Container with which this Manager is associated.


debug

protected int debug
The debugging detail level for this component.


digest

protected java.security.MessageDigest digest
Return the MessageDigest implementation to be used when creating session identifiers.


distributable

protected boolean distributable
The distributable flag for Sessions created by this Manager. If this flag is set to true, any user attributes added to a session controlled by this Manager must be Serializable.


entropy

protected java.lang.String entropy
A String initialization parameter used to increase the entropy of the initialization of our random number generator.


maxInactiveInterval

protected int maxInactiveInterval
The default maximum inactive interval for Sessions created by this Manager.


name

protected static java.lang.String name
The descriptive name of this Manager implementation (for logging).


random

protected java.util.Random random
A random number generator to use when generating session identifiers.


randomClass

protected java.lang.String randomClass
The Java class name of the random number generator class to be used when generating session identifiers.


recycled

protected java.util.ArrayList recycled
The set of previously recycled Sessions for this Manager.


sessions

protected java.util.HashMap sessions
The set of currently active Sessions for this Manager, keyed by session identifier.


sm

protected static StringManager sm
The string manager for this package.


support

protected java.beans.PropertyChangeSupport support
The property change support for this component.

Constructor Detail

ManagerBase

public ManagerBase()
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Return the message digest algorithm for this Manager.


setAlgorithm

public void setAlgorithm(java.lang.String algorithm)
Set the message digest algorithm for this Manager.

Parameters:
algorithm - The new message digest algorithm

getContainer

public Container getContainer()
Return the Container with which this Manager is associated.

Specified by:
getContainer in interface Manager

setContainer

public void setContainer(Container container)
Set the Container with which this Manager is associated.

Specified by:
setContainer in interface Manager
Parameters:
container - The newly associated Container

getDebug

public int getDebug()
Return the debugging detail level for this component.


setDebug

public void setDebug(int debug)
Set the debugging detail level for this component.

Parameters:
debug - The new debugging detail level

getDigest

public java.security.MessageDigest getDigest()
Return the MessageDigest object to be used for calculating session identifiers. If none has been created yet, initialize one the first time this method is called.


getDistributable

public boolean getDistributable()
Return the distributable flag for the sessions supported by this Manager.

Specified by:
getDistributable in interface Manager

setDistributable

public void setDistributable(boolean distributable)
Set the distributable flag for the sessions supported by this Manager. If this flag is set, all user data objects added to sessions associated with this manager must implement Serializable.

Specified by:
setDistributable in interface Manager
Parameters:
distributable - The new distributable flag

getEntropy

public java.lang.String getEntropy()
Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.


setEntropy

public void setEntropy(java.lang.String entropy)
Set the entropy increaser value.

Parameters:
entropy - The new entropy increaser value

getInfo

public java.lang.String getInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface Manager

getMaxInactiveInterval

public int getMaxInactiveInterval()
Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.

Specified by:
getMaxInactiveInterval in interface Manager

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.

Specified by:
setMaxInactiveInterval in interface Manager
Parameters:
interval - The new default value

getName

public java.lang.String getName()
Return the descriptive short name of this Manager implementation.


getRandom

public java.util.Random getRandom()
Return the random number generator instance we should use for generating session identifiers. If there is no such generator currently defined, construct and seed a new one.


getRandomClass

public java.lang.String getRandomClass()
Return the random number generator class name.


setRandomClass

public void setRandomClass(java.lang.String randomClass)
Set the random number generator class name.

Parameters:
randomClass - The new random number generator class name

add

public void add(Session session)
Add this Session to the set of active Sessions for this Manager.

Specified by:
add in interface Manager
Parameters:
session - Session to be added

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.

Specified by:
addPropertyChangeListener in interface Manager
Parameters:
listener - The listener to add

createSession

public Session createSession()
Construct and return a new session object, based on the default settings specified by this Manager's properties. The session id will be assigned by this method, and available via the getId() method of the returned session. If a new session cannot be created for any reason, return null.

Specified by:
createSession in interface Manager
Throws:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

findSession

public Session findSession(java.lang.String id)
                    throws java.io.IOException
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.

Specified by:
findSession in interface Manager
Parameters:
id - The session id for the session to be returned
Throws:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason
java.io.IOException - if an input/output error occurs while processing this request

findSessions

public Session[] findSessions()
Return the set of active Sessions associated with this Manager. If this Manager has no active Sessions, a zero-length array is returned.

Specified by:
findSessions in interface Manager

remove

public void remove(Session session)
Remove this Session from the active Sessions for this Manager.

Specified by:
remove in interface Manager
Parameters:
session - Session to be removed

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.

Specified by:
removePropertyChangeListener in interface Manager
Parameters:
listener - The listener to remove

generateSessionId

protected java.lang.String generateSessionId()
Generate and return a new session identifier.


getEngine

protected Engine getEngine()
Retrieve the enclosing Engine for this Manager.

Returns:
an Engine object (or null).

getJvmRoute

protected java.lang.String getJvmRoute()
Retrieve the JvmRoute for the enclosing Engine.

Returns:
the JvmRoute or null.


Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.