jrun.servlet.session
Class JDBCSessionStorage

java.lang.Object
  |
  +--jrun.servlet.session.JDBCSessionStorage
All Implemented Interfaces:
SessionStorage

public class JDBCSessionStorage
extends java.lang.Object
implements SessionStorage

Provide session storage to a JDBC driver

Author:
Karl Moss, Brian Deitte

Constructor Summary
JDBCSessionStorage()
           
 
Method Summary
protected  void connect()
          Connect to the JDBC driver
 void destroy()
          Destroy the service.
protected  java.lang.String getKey(java.lang.String id)
          Create the session key
 void init(java.util.Properties initConfig)
          Initialize the JDBCSessionStorage provider.
 void purge()
          Gives the storage provider an opportunity to perform housekeeping.
 void remove(java.lang.String id)
          Removes the session data for the given session ID
 java.io.InputStream retrieve(java.lang.String id)
          Retrieves the session data for the given session ID.
 void store(java.lang.String id, java.io.InputStream in, int len)
          Stores the given session data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCSessionStorage

public JDBCSessionStorage()
Method Detail

init

public void init(java.util.Properties initConfig)
          throws java.io.IOException,
                 java.sql.SQLException

Initialize the JDBCSessionStorage provider. Valid properties are:

JDBCConnection - The jndi name of the resource JDBCSessionTable - The table name to use for session data JDBCSessionIDPrefix - A key prefix to ensure that session ID's are unique across servers JDBCSessionIDColumn - The column name of the session ID JDBCSessionDataColumn - The column name of the session data
Specified by:
init in interface SessionStorage
Parameters:
props - The properties

destroy

public void destroy()
Description copied from interface: SessionStorage
Destroy the service. This is called whenever the webapp is destroyed
Specified by:
destroy in interface SessionStorage

store

public void store(java.lang.String id,
                  java.io.InputStream in,
                  int len)
           throws java.lang.Exception
Description copied from interface: SessionStorage
Stores the given session data. Note that the input stream will be closed by the caller.
Specified by:
store in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
id - The session ID
in - InputStream containing the session data
len - The length of the session data

retrieve

public java.io.InputStream retrieve(java.lang.String id)
                             throws java.lang.Exception
Description copied from interface: SessionStorage
Retrieves the session data for the given session ID. Note that the input stream will be closed by the caller
Specified by:
retrieve in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
id - The session ID
Returns:
The InputStream used to read the session data

remove

public void remove(java.lang.String id)
            throws java.lang.Exception
Description copied from interface: SessionStorage
Removes the session data for the given session ID
Specified by:
remove in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
id - The session ID

purge

public void purge()
           throws java.lang.Exception
Description copied from interface: SessionStorage
Gives the storage provider an opportunity to perform housekeeping. This is called during server startup after sessions have been restored.
Specified by:
purge in interface SessionStorage

connect

protected void connect()
                throws java.io.IOException
Connect to the JDBC driver

getKey

protected java.lang.String getKey(java.lang.String id)
Create the session key


Copyright � 2002 Macromedia Corporation. All Rights Reserved.