Class DataSourceStore
java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.session.StoreBase
org.apache.catalina.session.DataSourceStore
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected DataSourceDataSource to useprotected Stringname of the JNDI resourceprotected StringColumn to use for /Engine/Host/Context nameprotected StringData column to use.protected StringId column to use.protected StringLast Accessed column to use.protected StringMax Inactive column to use.protected StringTable to use.protected StringIs Validcolumn to use.protected static final StringName to register for this Store, used for logging.Fields 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 Sessions from 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.protected ConnectionCheck the connection associated with this store, if it'snullor closed try to reopen it.booleangetName()intgetSize()String[]keys()Load and return the Session associated with the specified session identifier from this Store, without removing it.protected Connectionopen()Open (if necessary) and return a database connection for use by this Store.protected voidrelease(Connection conn) Release the connection, if it is associated with a connection pool.voidRemove the Session with the specified session identifier from this Store, if present.voidSave the specified Session into this Store.voidsetDataSourceName(String dataSourceName) Set the JNDI name of a DataSource-factory to use for db accessvoidsetLocalDataSource(boolean localDataSource) Set totrueto cause the datasource to be looked up in the webapp JNDI Context.voidsetSessionAppCol(String sessionAppCol) Set the App column for the table.voidsetSessionDataCol(String sessionDataCol) Set the Data column for the tablevoidsetSessionIdCol(String sessionIdCol) Set the Id column for the table.voidsetSessionLastAccessedCol(String sessionLastAccessedCol) Set theLast Accessedcolumn for the tablevoidsetSessionMaxInactiveCol(String sessionMaxInactiveCol) Set theMax Inactivecolumn for the tablevoidsetSessionTable(String sessionTable) Set the table for this Store.voidsetSessionValidCol(String sessionValidCol) Set theIs Validcolumn for the tableMethods inherited from class org.apache.catalina.session.StoreBaseaddPropertyChangeListener, destroyInternal, getManager, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, startInternal, stopInternal, toStringMethods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
- 
Field Details- 
storeNameName to register for this Store, used for logging.- See Also:
 
- 
dataSourceNamename of the JNDI resource
- 
dataSourceDataSource to use
- 
sessionTableTable to use.
- 
sessionAppColColumn to use for /Engine/Host/Context name
- 
sessionIdColId column to use.
- 
sessionDataColData column to use.
- 
sessionValidColIs Validcolumn to use.
- 
sessionMaxInactiveColMax Inactive column to use.
- 
sessionLastAccessedColLast Accessed column to use.
 
- 
- 
Constructor Details- 
DataSourceStorepublic DataSourceStore()
 
- 
- 
Method Details- 
getName- Returns:
- the name for this instance (built from container name)
 
- 
getStoreName- Overrides:
- getStoreNamein class- StoreBase
- Returns:
- the name for this Store, used for logging.
 
- 
setSessionTableSet the table for this Store.- Parameters:
- sessionTable- The new table
 
- 
getSessionTable- Returns:
- the table for this Store.
 
- 
setSessionAppColSet the App column for the table.- Parameters:
- sessionAppCol- the column name
 
- 
getSessionAppCol- Returns:
- the web application name column for the table.
 
- 
setSessionIdColSet the Id column for the table.- Parameters:
- sessionIdCol- the column name
 
- 
getSessionIdCol- Returns:
- the Id column for the table.
 
- 
setSessionDataColSet the Data column for the table- Parameters:
- sessionDataCol- the column name
 
- 
getSessionDataCol- Returns:
- the data column for the table
 
- 
setSessionValidColSet theIs Validcolumn for the table- Parameters:
- sessionValidCol- The column name
 
- 
getSessionValidCol- Returns:
- the Is Validcolumn
 
- 
setSessionMaxInactiveColSet theMax Inactivecolumn for the table- Parameters:
- sessionMaxInactiveCol- The column name
 
- 
getSessionMaxInactiveCol- Returns:
- the Max Inactivecolumn
 
- 
setSessionLastAccessedColSet theLast Accessedcolumn for the table- Parameters:
- sessionLastAccessedCol- The column name
 
- 
getSessionLastAccessedCol- Returns:
- the Last Accessedcolumn
 
- 
setDataSourceNameSet the JNDI name of a DataSource-factory to use for db access- Parameters:
- dataSourceName- The JNDI name of the DataSource-factory
 
- 
getDataSourceName- Returns:
- the name of the JNDI DataSource-factory
 
- 
getLocalDataSourcepublic boolean getLocalDataSource()- Returns:
- if the datasource will be looked up in the webapp JNDI Context.
 
- 
setLocalDataSourcepublic void setLocalDataSource(boolean localDataSource) Set totrueto cause the datasource to be looked up in the webapp JNDI Context.- Parameters:
- localDataSource- the new flag value
 
- 
expiredKeysDescription copied from class:StoreBaseGet only those keys of sessions, that are saved in the Store and are to be expired.- Overrides:
- expiredKeysin class- StoreBase
- Returns:
- list of session keys, that are to be expired
- Throws:
- IOException- if an input-/output error occurred
 
- 
keys- 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
 
- 
getSize- Returns:
- the number of Sessions present in this Store.
- Throws:
- IOException- if an input/output error occurs
 
- 
loadDescription copied from interface:StoreLoad and return the Session associated with the specified session identifier from this Store, without removing it. If there is no such stored Session, returnnull.- Parameters:
- id- Session identifier of the session to load
- Returns:
- the loaded Session instance
- Throws:
- ClassNotFoundException- if a deserialization error occurs
- IOException- if an input/output error occurs
 
- 
removeDescription copied from interface:StoreRemove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.- Parameters:
- id- Session identifier of the Session to be removed
- Throws:
- IOException- if an input/output error occurs
 
- 
clearDescription copied from interface:StoreRemove all Sessions from this Store.- Throws:
- IOException- if an input/output error occurs
 
- 
saveDescription copied from interface:StoreSave the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.- Parameters:
- session- Session to be saved
- Throws:
- IOException- if an input/output error occurs
 
- 
getConnectionCheck the connection associated with this store, if it'snullor closed try to reopen it. Returnsnullif the connection could not be established.- Returns:
- Connectionif the connection succeeded
 
- 
openOpen (if necessary) and return a database connection for use by this Store.- Returns:
- database connection ready to use
- Throws:
- SQLException- if a database error occurs
 
- 
closeClose the specified database connection.- Parameters:
- dbConnection- The connection to be closed
 
- 
releaseRelease the connection, if it is associated with a connection pool.- Parameters:
- conn- The connection to be released
 
 
-