Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » session » [javadoc | source]
org.apache.catalina.session
public class: JDBCStore [javadoc | source]
java.lang.Object
   org.apache.catalina.session.StoreBase
      org.apache.catalina.session.JDBCStore

All Implemented Interfaces:
    Store, Lifecycle

Implementation of the Store interface that stores serialized session objects in a database. Sessions that are saved are still subject to being expired based on inactivity.
Field Summary
protected static  String info    The descriptive information about this implementation. 
protected static  String storeName    Name to register for this Store, used for logging. 
protected  String threadName    Name to register for the background thread. 
protected  String connectionName    The connection username to use when trying to connect to the database. 
protected  String connectionPassword    The connection URL to use when trying to connect to the database. 
protected  String connectionURL    Connection string to use when connecting to the DB. 
protected  Driver driver    Instance of the JDBC Driver class we use as a connection factory. 
protected  String driverName    Driver to use. 
protected  String sessionTable    Table to use. 
protected  String sessionAppCol    Column to use for /Engine/Host/Context name 
protected  String sessionIdCol    Id column to use. 
protected  String sessionDataCol    Data column to use. 
protected  String sessionValidCol    Is Valid column to use. 
protected  String sessionMaxInactiveCol    Max Inactive column to use. 
protected  String sessionLastAccessedCol    Last Accessed column to use. 
protected  PreparedStatement preparedSizeSql    Variable to hold the getSize() prepared statement. 
protected  PreparedStatement preparedKeysSql    Variable to hold the keys() prepared statement. 
protected  PreparedStatement preparedSaveSql    Variable to hold the save() prepared statement. 
protected  PreparedStatement preparedClearSql    Variable to hold the clear() prepared statement. 
protected  PreparedStatement preparedRemoveSql    Variable to hold the remove() prepared statement. 
protected  PreparedStatement preparedLoadSql    Variable to hold the load() prepared statement. 
Fields inherited from org.apache.catalina.session.StoreBase:
info,  storeName,  started,  lifecycle,  support,  sm,  manager
Method from org.apache.catalina.session.JDBCStore Summary:
clear,   close,   getConnection,   getConnectionName,   getConnectionPassword,   getConnectionURL,   getDriverName,   getInfo,   getName,   getSessionAppCol,   getSessionDataCol,   getSessionIdCol,   getSessionLastAccessedCol,   getSessionMaxInactiveCol,   getSessionTable,   getSessionValidCol,   getSize,   getStoreName,   getThreadName,   keys,   load,   open,   release,   remove,   save,   setConnectionName,   setConnectionPassword,   setConnectionURL,   setDriverName,   setSessionAppCol,   setSessionDataCol,   setSessionIdCol,   setSessionLastAccessedCol,   setSessionMaxInactiveCol,   setSessionTable,   setSessionValidCol,   start,   stop
Methods from org.apache.catalina.session.StoreBase:
addLifecycleListener,   addPropertyChangeListener,   findLifecycleListeners,   getInfo,   getManager,   getStoreName,   processExpires,   removeLifecycleListener,   removePropertyChangeListener,   setManager,   start,   stop
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.session.JDBCStore Detail:
 public  void clear() throws IOException 
    Remove all of the Sessions in this Store.
 protected  void close(Connection dbConnection) 
    Close the specified database connection.
 protected Connection getConnection() 
    Check the connection associated with this store, if it's null or closed try to reopen it. Returns null if the connection could not be established.
 public String getConnectionName() 
    Return the username to use to connect to the database.
 public String getConnectionPassword() 
    Return the password to use to connect to the database.
 public String getConnectionURL() 
    Return the Connection URL for this Store.
 public String getDriverName() 
    Return the driver for this Store.
 public String getInfo() 
    Return the info for this Store.
 public String getName() 
    Return the name for this instance (built from container name)
 public String getSessionAppCol() 
    Return the web application name column for the table.
 public String getSessionDataCol() 
    Return the data column for the table
 public String getSessionIdCol() 
    Return the Id column for the table.
 public String getSessionLastAccessedCol() 
    Return the Last Accessed column
 public String getSessionMaxInactiveCol() 
    Return the Max Inactive column
 public String getSessionTable() 
    Return the table for this Store.
 public String getSessionValidCol() 
    Return the Is Valid column
 public int getSize() throws IOException 
    Return an integer containing a count of all Sessions currently saved in this Store. If there are no Sessions, 0 is returned.
 public String getStoreName() 
    Return the name for this Store, used for logging.
 public String getThreadName() 
    Return the thread name for this Store.
 public String[] keys() throws IOException 
    Return an array containing the session identifiers of all Sessions currently saved in this Store. If there are no such Sessions, a zero-length array is returned.
 public Session load(String id) throws IOException, ClassNotFoundException 
    Load the Session associated with the id id. If no such session is found null is returned.
 protected Connection open() throws SQLException 
    Open (if necessary) and return a database connection for use by this Realm.
 protected  void release(Connection conn) 
    Release the connection, not needed here since the connection is not associated with a connection pool.
 public  void remove(String id) throws IOException 
    Remove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.
 public  void save(Session session) throws IOException 
    Save a session to the Store.
 public  void setConnectionName(String connectionName) 
    Set the username to use to connect to the database.
 public  void setConnectionPassword(String connectionPassword) 
    Set the password to use to connect to the database.
 public  void setConnectionURL(String connectionURL) 
    Set the Connection URL for this Store.
 public  void setDriverName(String driverName) 
    Set the driver for this Store.
 public  void setSessionAppCol(String sessionAppCol) 
    Set the App column for the table.
 public  void setSessionDataCol(String sessionDataCol) 
    Set the Data column for the table
 public  void setSessionIdCol(String sessionIdCol) 
    Set the Id column for the table.
 public  void setSessionLastAccessedCol(String sessionLastAccessedCol) 
    Set the Last Accessed column for the table
 public  void setSessionMaxInactiveCol(String sessionMaxInactiveCol) 
    Set the Max Inactive column for the table
 public  void setSessionTable(String sessionTable) 
    Set the table for this Store.
 public  void setSessionValidCol(String sessionValidCol) 
    Set the Is Valid column for the table
 public  void start() throws LifecycleException 
    Called once when this Store is first started.
 public  void stop() throws LifecycleException 
    Gracefully terminate everything associated with our db. Called once when this Store is stopping.