| 
 | Apache Tomcat 6.0.53 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.session.StoreBase
org.apache.catalina.session.JDBCStore
public class JDBCStore
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  java.lang.String | connectionNameThe connection username to use when trying to connect to the database. | 
| protected  java.lang.String | connectionPasswordThe connection URL to use when trying to connect to the database. | 
| protected  java.lang.String | connectionURLConnection string to use when connecting to the DB. | 
| protected  java.sql.Driver | driverInstance of the JDBC Driver class we use as a connection factory. | 
| protected  java.lang.String | driverNameDriver to use. | 
| protected static java.lang.String | infoThe descriptive information about this implementation. | 
| protected  java.sql.PreparedStatement | preparedClearSqlVariable to hold the clear()prepared statement. | 
| protected  java.sql.PreparedStatement | preparedKeysSqlVariable to hold the keys()prepared statement. | 
| protected  java.sql.PreparedStatement | preparedLoadSqlVariable to hold the load()prepared statement. | 
| protected  java.sql.PreparedStatement | preparedRemoveSqlVariable to hold the remove()prepared statement. | 
| protected  java.sql.PreparedStatement | preparedSaveSqlVariable to hold the save()prepared statement. | 
| protected  java.sql.PreparedStatement | preparedSizeSqlVariable to hold the getSize()prepared statement. | 
| protected  java.lang.String | sessionAppColColumn to use for /Engine/Host/Context name | 
| protected  java.lang.String | sessionDataColData column to use. | 
| protected  java.lang.String | sessionIdColId column to use. | 
| protected  java.lang.String | sessionLastAccessedColLast Accessed column to use. | 
| protected  java.lang.String | sessionMaxInactiveColMax Inactive column to use. | 
| protected  java.lang.String | sessionTableTable to use. | 
| protected  java.lang.String | sessionValidColIs Valid column to use. | 
| protected static java.lang.String | storeNameName to register for this Store, used for logging. | 
| protected  java.lang.String | threadNameName to register for the background thread. | 
| Fields inherited from class org.apache.catalina.session.StoreBase | 
|---|
| lifecycle, manager, sm, started, support | 
| Fields inherited from interface org.apache.catalina.Lifecycle | 
|---|
| AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT | 
| Constructor Summary | |
|---|---|
| JDBCStore() | |
| Method Summary | |
|---|---|
|  void | clear()Remove all of the Sessions in this Store. | 
| protected  void | close(java.sql.Connection dbConnection)Close the specified database connection. | 
| protected  java.sql.Connection | getConnection()Check the connection associated with this store, if it's nullor closed try to reopen it. | 
|  java.lang.String | getConnectionName()Return the username to use to connect to the database. | 
|  java.lang.String | getConnectionPassword()Return the password to use to connect to the database. | 
|  java.lang.String | getConnectionURL()Return the Connection URL for this Store. | 
|  java.lang.String | getDriverName()Return the driver for this Store. | 
|  java.lang.String | getInfo()Return the info for this Store. | 
|  java.lang.String | getName()Return the name for this instance (built from container name) | 
|  java.lang.String | getSessionAppCol()Return the web application name column for the table. | 
|  java.lang.String | getSessionDataCol()Return the data column for the table | 
|  java.lang.String | getSessionIdCol()Return the Id column for the table. | 
|  java.lang.String | getSessionLastAccessedCol()Return the Last Accessed column | 
|  java.lang.String | getSessionMaxInactiveCol()Return the Max Inactive column | 
|  java.lang.String | getSessionTable()Return the table for this Store. | 
|  java.lang.String | getSessionValidCol()Return the Is Valid column | 
|  int | getSize()Return an integer containing a count of all Sessions currently saved in this Store. | 
|  java.lang.String | getStoreName()Return the name for this Store, used for logging. | 
|  java.lang.String | getThreadName()Return the thread name for this Store. | 
|  java.lang.String[] | keys()Return an array containing the session identifiers of all Sessions currently saved in this Store. | 
|  Session | load(java.lang.String id)Load the Session associated with the id id. | 
| protected  java.sql.Connection | open()Open (if necessary) and return a database connection for use by this Realm. | 
| protected  void | release(java.sql.Connection conn)Release the connection, not needed here since the connection is not associated with a connection pool. | 
|  void | remove(java.lang.String id)Remove the Session with the specified session identifier from this Store, if present. | 
|  void | save(Session session)Save a session to the Store. | 
|  void | setConnectionName(java.lang.String connectionName)Set the username to use to connect to the database. | 
|  void | setConnectionPassword(java.lang.String connectionPassword)Set the password to use to connect to the database. | 
|  void | setConnectionURL(java.lang.String connectionURL)Set the Connection URL for this Store. | 
|  void | setDriverName(java.lang.String driverName)Set the driver for this Store. | 
|  void | setSessionAppCol(java.lang.String sessionAppCol)Set the App column for the table. | 
|  void | setSessionDataCol(java.lang.String sessionDataCol)Set the Data column for the table | 
|  void | setSessionIdCol(java.lang.String sessionIdCol)Set the Id column for the table. | 
|  void | setSessionLastAccessedCol(java.lang.String sessionLastAccessedCol)Set the Last Accessed column for the table | 
|  void | setSessionMaxInactiveCol(java.lang.String sessionMaxInactiveCol)Set the Max Inactive column for the table | 
|  void | setSessionTable(java.lang.String sessionTable)Set the table for this Store. | 
|  void | setSessionValidCol(java.lang.String sessionValidCol)Set the Is Valid column for the table | 
|  void | start()Called once when this Store is first started. | 
|  void | stop()Gracefully terminate everything associated with our db. | 
| Methods inherited from class org.apache.catalina.session.StoreBase | 
|---|
| addLifecycleListener, addPropertyChangeListener, findLifecycleListeners, getManager, getObjectInputStream, processExpires, removeLifecycleListener, removePropertyChangeListener, setManager | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected static java.lang.String info
protected static java.lang.String storeName
protected java.lang.String threadName
protected java.lang.String connectionName
protected java.lang.String connectionPassword
protected java.lang.String connectionURL
protected java.sql.Driver driver
protected java.lang.String driverName
protected java.lang.String sessionTable
protected java.lang.String sessionAppCol
protected java.lang.String sessionIdCol
protected java.lang.String sessionDataCol
protected java.lang.String sessionValidCol
protected java.lang.String sessionMaxInactiveCol
protected java.lang.String sessionLastAccessedCol
protected java.sql.PreparedStatement preparedSizeSql
getSize() prepared statement.
protected java.sql.PreparedStatement preparedKeysSql
keys() prepared statement.
protected java.sql.PreparedStatement preparedSaveSql
save() prepared statement.
protected java.sql.PreparedStatement preparedClearSql
clear() prepared statement.
protected java.sql.PreparedStatement preparedRemoveSql
remove() prepared statement.
protected java.sql.PreparedStatement preparedLoadSql
load() prepared statement.
| Constructor Detail | 
|---|
public JDBCStore()
| Method Detail | 
|---|
public java.lang.String getInfo()
getInfo in interface StoregetInfo in class StoreBasepublic java.lang.String getName()
public java.lang.String getThreadName()
public java.lang.String getStoreName()
getStoreName in class StoreBasepublic void setDriverName(java.lang.String driverName)
driverName - The new driverpublic java.lang.String getDriverName()
public java.lang.String getConnectionName()
public void setConnectionName(java.lang.String connectionName)
connectionName - Usernamepublic java.lang.String getConnectionPassword()
public void setConnectionPassword(java.lang.String connectionPassword)
connectionPassword - User passwordpublic void setConnectionURL(java.lang.String connectionURL)
connectionURL - The new Connection URLpublic java.lang.String getConnectionURL()
public void setSessionTable(java.lang.String sessionTable)
sessionTable - The new tablepublic java.lang.String getSessionTable()
public void setSessionAppCol(java.lang.String sessionAppCol)
sessionAppCol - the column namepublic java.lang.String getSessionAppCol()
public void setSessionIdCol(java.lang.String sessionIdCol)
sessionIdCol - the column namepublic java.lang.String getSessionIdCol()
public void setSessionDataCol(java.lang.String sessionDataCol)
sessionDataCol - the column namepublic java.lang.String getSessionDataCol()
public void setSessionValidCol(java.lang.String sessionValidCol)
sessionValidCol - The column namepublic java.lang.String getSessionValidCol()
public void setSessionMaxInactiveCol(java.lang.String sessionMaxInactiveCol)
sessionMaxInactiveCol - The column namepublic java.lang.String getSessionMaxInactiveCol()
public void setSessionLastAccessedCol(java.lang.String sessionLastAccessedCol)
sessionLastAccessedCol - The column namepublic java.lang.String getSessionLastAccessedCol()
public java.lang.String[] keys()
                        throws java.io.IOException
java.io.IOException - if an input/output error occurred
public int getSize()
            throws java.io.IOException
0 is returned.
java.io.IOException - if an input/output error occurred
public Session load(java.lang.String id)
             throws java.lang.ClassNotFoundException,
                    java.io.IOException
id.
 If no such session is found null is returned.
id - a value of type String
Session
java.lang.ClassNotFoundException - if an error occurs
java.io.IOException - if an input/output error occurred
public void remove(java.lang.String id)
            throws java.io.IOException
id - Session identifier of the Session to be removed
java.io.IOException - if an input/output error occurs
public void clear()
           throws java.io.IOException
java.io.IOException - if an input/output error occurs
public void save(Session session)
          throws java.io.IOException
session - the session to be stored
java.io.IOException - if an input/output error occursprotected java.sql.Connection getConnection()
null or closed try to reopen it.
 Returns null if the connection could not be established.
Connection if the connection suceeded
protected java.sql.Connection open()
                            throws java.sql.SQLException
java.sql.SQLException - if a database error occursprotected void close(java.sql.Connection dbConnection)
dbConnection - The connection to be closedprotected void release(java.sql.Connection conn)
conn - The connection to be released
public void start()
           throws LifecycleException
start in interface Lifecyclestart in class StoreBaseLifecycleException - if this component detects a fatal error
  that prevents this component from being used
public void stop()
          throws LifecycleException
stop in interface Lifecyclestop in class StoreBaseLifecycleException - if this component detects a fatal error
  that needs to be reported| 
 | Apache Tomcat 6.0.53 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||