Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
connectionName
The connection username to use when trying to connect to the database.
|
protected java.lang.String |
connectionPassword
The connection URL to use when trying to connect to the database.
|
protected java.lang.String |
connectionURL
Connection string to use when connecting to the DB.
|
protected javax.sql.DataSource |
dataSource
DataSource to use
|
protected java.lang.String |
dataSourceName
name of the JNDI resource
|
protected java.sql.Driver |
driver
Instance of the JDBC Driver class we use as a connection factory.
|
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 |
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.
|
AFTER_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 and Description |
---|
JDBCStore() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all of the Sessions in this Store.
|
protected void |
close(java.sql.Connection dbConnection)
Close the specified database connection.
|
java.lang.String[] |
expiredKeys()
Get only those keys of sessions, that are saved in the Store and are to
be expired.
|
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 |
getConnectionName() |
java.lang.String |
getConnectionPassword() |
java.lang.String |
getConnectionURL() |
java.lang.String |
getDataSourceName() |
java.lang.String |
getDriverName() |
java.lang.String |
getInfo()
Return descriptive information about this Store implementation and
the corresponding version number, in the format
<description>/<version> . |
java.lang.String |
getName() |
java.lang.String |
getSessionAppCol() |
java.lang.String |
getSessionDataCol() |
java.lang.String |
getSessionIdCol() |
java.lang.String |
getSessionLastAccessedCol() |
java.lang.String |
getSessionMaxInactiveCol() |
java.lang.String |
getSessionTable() |
java.lang.String |
getSessionValidCol() |
int |
getSize()
Return an integer containing a count of all Sessions
currently saved in this Store.
|
java.lang.String |
getStoreName() |
java.lang.String |
getThreadName() |
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 Store.
|
protected void |
release(java.sql.Connection conn)
Release the connection, if it
is 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 |
setDataSourceName(java.lang.String dataSourceName)
Set the JNDI name of a DataSource-factory to use for db access
|
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 |
protected void |
startInternal()
Start this component and implement the requirements
of
LifecycleBase.startInternal() . |
protected void |
stopInternal()
Stop this component and implement the requirements
of
LifecycleBase.stopInternal() . |
addPropertyChangeListener, destroyInternal, getManager, initInternal, processExpires, removePropertyChangeListener, setManager, toString
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
protected static final 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 dataSourceName
protected javax.sql.DataSource dataSource
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
Is Valid
column to use.protected java.lang.String sessionMaxInactiveCol
protected java.lang.String sessionLastAccessedCol
protected java.sql.PreparedStatement preparedSizeSql
getSize()
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.public java.lang.String getInfo()
Store
<description>/<version>
.public java.lang.String getName()
public java.lang.String getThreadName()
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 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)
Is Valid
column for the tablesessionValidCol
- The column namepublic java.lang.String getSessionValidCol()
Is Valid
columnpublic void setSessionMaxInactiveCol(java.lang.String sessionMaxInactiveCol)
Max Inactive
column for the tablesessionMaxInactiveCol
- The column namepublic java.lang.String getSessionMaxInactiveCol()
Max Inactive
columnpublic void setSessionLastAccessedCol(java.lang.String sessionLastAccessedCol)
Last Accessed
column for the tablesessionLastAccessedCol
- The column namepublic java.lang.String getSessionLastAccessedCol()
Last Accessed
columnpublic void setDataSourceName(java.lang.String dataSourceName)
dataSourceName
- The JNDI name of the DataSource-factorypublic java.lang.String getDataSourceName()
public java.lang.String[] expiredKeys() throws java.io.IOException
StoreBase
expiredKeys
in class StoreBase
java.io.IOException
- if an input-/output error occurredpublic java.lang.String[] keys() throws java.io.IOException
Store
java.io.IOException
- if an input/output error occurredpublic int getSize() throws java.io.IOException
0
is returned.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.id
- a value of type String
Session
java.lang.ClassNotFoundException
- if an error occursjava.io.IOException
- if an input/output error occurredpublic void remove(java.lang.String id) throws java.io.IOException
id
- Session identifier of the Session to be removedjava.io.IOException
- if an input/output error occurspublic void clear() throws java.io.IOException
java.io.IOException
- if an input/output error occurspublic void save(Session session) throws java.io.IOException
session
- the session to be storedjava.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 succeededprotected 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 releasedprotected void startInternal() throws LifecycleException
LifecycleBase.startInternal()
.startInternal
in class StoreBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedprotected void stopInternal() throws LifecycleException
LifecycleBase.stopInternal()
.stopInternal
in class StoreBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.