|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.session.StoreBase org.apache.catalina.session.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 |
connString
Connection string to use when connecting to the DB. |
protected java.lang.String |
driverName
Driver to use. |
protected static java.lang.String |
info
The descriptive information about this implementation. |
protected java.sql.PreparedStatement |
preparedClearSql
Variable to hold the clear() prepared statement. |
protected java.sql.PreparedStatement |
preparedExpiresSql
Variable to hold the processExpires() prepared statement. |
protected java.sql.PreparedStatement |
preparedKeysSql
Variable to hold the keys() prepared statement. |
protected java.sql.PreparedStatement |
preparedLoadSql
Variable to hold the load() prepared statement. |
protected java.sql.PreparedStatement |
preparedRemoveSql
Variable to hold the remove() prepared statement. |
protected java.sql.PreparedStatement |
preparedSaveSql
Variable to hold the save() prepared statement. |
protected java.sql.PreparedStatement |
preparedSizeSql
Variable to hold the getSize() prepared statement. |
protected java.lang.String |
sessionAppCol
Column to use for /Engine/Host/Context name |
protected java.lang.String |
sessionDataCol
Data column to use. |
protected java.lang.String |
sessionIdCol
Id column to use. |
protected java.lang.String |
sessionLastAccessedCol
Last Accessed column to use. |
protected java.lang.String |
sessionMaxInactiveCol
Max Inactive column to use. |
protected java.lang.String |
sessionTable
Table to use. |
protected java.lang.String |
sessionValidCol
Is Valid column to use. |
protected static java.lang.String |
storeName
Name to register for this Store, used for logging. |
protected java.lang.String |
threadName
Name to register for the background thread. |
Fields inherited from class org.apache.catalina.session.StoreBase |
checkInterval, debug, lifecycle, manager, sm, started, support, thread, threadDone |
Fields inherited from interface org.apache.catalina.Lifecycle |
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
JDBCStore()
|
Method Summary | |
void |
clear()
Remove all of the Sessions in this Store. |
protected java.sql.Connection |
getConnection()
Check the connection associated with this store, if it's null or closed try to reopen it. |
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 Id 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 void |
processExpires()
Called by our background reaper thread to check if Sessions saved in our store are subject of being expired. |
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 |
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, getCheckInterval, getDebug, getManager, log, removeLifecycleListener, removePropertyChangeListener, run, setCheckInterval, setDebug, setManager, threadSleep, threadStart, threadStop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.catalina.Store |
addPropertyChangeListener, getManager, removePropertyChangeListener, setManager |
Field Detail |
protected static java.lang.String info
protected static java.lang.String storeName
protected java.lang.String threadName
protected java.lang.String connString
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.
protected java.sql.PreparedStatement preparedExpiresSql
processExpires()
prepared statement.
Constructor Detail |
public JDBCStore()
Method Detail |
public java.lang.String getInfo()
getInfo
in interface Store
getInfo
in class StoreBase
public java.lang.String getName()
public java.lang.String getThreadName()
getThreadName
in class StoreBase
public java.lang.String getStoreName()
getStoreName
in class StoreBase
public void setDriverName(java.lang.String driverName)
driverName
- The new driverpublic java.lang.String getDriverName()
public 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
keys
in interface Store
java.io.IOException
- if an input/output error occurredpublic int getSize() throws java.io.IOException
0
is returned.
getSize
in interface Store
java.io.IOException
- if an input/output error occurredpublic Session load(java.lang.String id) throws java.lang.ClassNotFoundException, java.io.IOException
id
.
If no such session is found null
is returned.
load
in interface Store
id
- a value of type String
Session
java.lang.ClassNotFoundException
- if an error occurs
java.io.IOException
- if an input/output error occurredpublic void remove(java.lang.String id) throws java.io.IOException
remove
in interface Store
id
- Session identifier of the Session to be removed
java.io.IOException
- if an input/output error occurspublic void clear() throws java.io.IOException
clear
in interface Store
java.io.IOException
- if an input/output error occurspublic void save(Session session) throws java.io.IOException
save
in interface Store
session
- the session to be stored
java.io.IOException
- if an input/output error occursprotected void processExpires()
processExpires
in class StoreBase
protected java.sql.Connection getConnection()
null
or closed try to reopen it.
Returns null
if the connection could not be established.
Connection
if the connection suceededprotected void release(java.sql.Connection conn)
conn
- The connection to be releasedpublic void start() throws LifecycleException
start
in interface Lifecycle
start
in class StoreBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void stop() throws LifecycleException
stop
in interface Lifecycle
stop
in class StoreBase
LifecycleException
- if this component detects a fatal error
that needs to be reported
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |