Package org.apache.catalina.session
Class DataSourceStore
java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.session.StoreBase
org.apache.catalina.session.JDBCStore
org.apache.catalina.session.DataSourceStore
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.- Author:
- Bip Thelin
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
- 
Field SummaryFields inherited from class org.apache.catalina.session.JDBCStoreconnectionName, connectionPassword, connectionURL, dataSource, dataSourceName, driver, driverName, preparedClearSql, preparedLoadSql, preparedRemoveSql, preparedSaveSql, preparedSizeSql, sessionAppCol, sessionDataCol, sessionIdCol, sessionLastAccessedCol, sessionMaxInactiveCol, sessionTable, sessionValidCol, storeName, threadNameFields inherited from interface org.apache.catalina.LifecycleAFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Remove all of the Sessions in this Store.protected voidclose(Connection dbConnection) Close the specified database connection.String[]Get only those keys of sessions, that are saved in the Store and are to be expired.intgetSize()Return an integer containing a count of all Sessions currently saved in this Store.String[]keys()Load the Session associated with the idid.protected Connectionopen()Open (if necessary) and return a database connection for use by this Store.voidRemove the Session with the specified session identifier from this Store, if present.voidSave a session to the Store.Methods inherited from class org.apache.catalina.session.JDBCStoregetConnection, getConnectionName, getConnectionPassword, getConnectionURL, getDataSourceName, getDriverName, getLocalDataSource, getName, getSessionAppCol, getSessionDataCol, getSessionIdCol, getSessionLastAccessedCol, getSessionMaxInactiveCol, getSessionTable, getSessionValidCol, getStoreName, getThreadName, release, setConnectionName, setConnectionPassword, setConnectionURL, setDataSourceName, setDriverName, setLocalDataSource, setSessionAppCol, setSessionDataCol, setSessionIdCol, setSessionLastAccessedCol, setSessionMaxInactiveCol, setSessionTable, setSessionValidCol, startInternal, stopInternalMethods inherited from class org.apache.catalina.session.StoreBaseaddPropertyChangeListener, destroyInternal, getManager, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, toStringMethods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
- 
Constructor Details- 
DataSourceStorepublic DataSourceStore()
 
- 
- 
Method Details- 
expiredKeysDescription copied from class:StoreBaseGet only those keys of sessions, that are saved in the Store and are to be expired.- Overrides:
- expiredKeysin class- JDBCStore
- Returns:
- list of session keys, that are to be expired
- Throws:
- IOException- if an input-/output error occurred
 
- 
keys- Specified by:
- keysin interface- Store
- Overrides:
- keysin class- JDBCStore
- Returns:
- 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.
- Throws:
- IOException- if an input/output error occurred
 
- 
getSizeDescription copied from class:JDBCStoreReturn an integer containing a count of all Sessions currently saved in this Store. If there are no Sessions,0is returned.- Specified by:
- getSizein interface- Store
- Overrides:
- getSizein class- JDBCStore
- Returns:
- the count of all sessions currently saved in this Store
- Throws:
- IOException- if an input/output error occurred
 
- 
loadDescription copied from class:JDBCStoreLoad the Session associated with the idid. If no such session is foundnullis returned.- Specified by:
- loadin interface- Store
- Overrides:
- loadin class- JDBCStore
- Parameters:
- id- a value of type- String
- Returns:
- the stored Session
- Throws:
- ClassNotFoundException- if an error occurs
- IOException- if an input/output error occurred
 
- 
removeDescription copied from class:JDBCStoreRemove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.- Specified by:
- removein interface- Store
- Overrides:
- removein class- JDBCStore
- Parameters:
- id- Session identifier of the Session to be removed
- Throws:
- IOException- if an input/output error occurs
 
- 
clearDescription copied from class:JDBCStoreRemove all of the Sessions in this Store.- Specified by:
- clearin interface- Store
- Overrides:
- clearin class- JDBCStore
- Throws:
- IOException- if an input/output error occurs
 
- 
saveDescription copied from class:JDBCStoreSave a session to the Store.- Specified by:
- savein interface- Store
- Overrides:
- savein class- JDBCStore
- Parameters:
- session- the session to be stored
- Throws:
- IOException- if an input/output error occurs
 
- 
openOpen (if necessary) and return a database connection for use by this Store.- Overrides:
- openin class- JDBCStore
- Returns:
- database connection ready to use
- Throws:
- SQLException- if a database error occurs
 
- 
closeClose the specified database connection.
 
-