Lifecycle.SingleUse
Modifier and Type | Field and Description |
---|---|
protected String |
connectionName
The connection username to use when trying to connect to the database.
|
protected String |
connectionPassword
The connection URL to use when trying to connect to the database.
|
protected String |
connectionURL
Connection string to use when connecting to the DB.
|
protected DataSource |
dataSource
DataSource to use
|
protected String |
dataSourceName
name of the JNDI resource
|
protected Driver |
driver
Instance of the JDBC Driver class we use as a connection factory.
|
protected String |
driverName
Driver to use.
|
protected PreparedStatement |
preparedClearSql
Variable to hold the
clear() prepared statement. |
protected PreparedStatement |
preparedLoadSql
Variable to hold the
load() prepared statement. |
protected PreparedStatement |
preparedRemoveSql
Variable to hold the
remove() prepared statement. |
protected PreparedStatement |
preparedSaveSql
Variable to hold the
save() prepared statement. |
protected PreparedStatement |
preparedSizeSql
Variable to hold the
getSize() prepared statement. |
protected String |
sessionAppCol
Column to use for /Engine/Host/Context name
|
protected String |
sessionDataCol
Data column to use.
|
protected String |
sessionIdCol
Id column to use.
|
protected String |
sessionLastAccessedCol
Last Accessed column to use.
|
protected String |
sessionMaxInactiveCol
Max Inactive column to use.
|
protected String |
sessionTable
Table to use.
|
protected String |
sessionValidCol
Is Valid column to use. |
protected static String |
storeName
Name to register for this Store, used for logging.
|
protected static 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(Connection dbConnection)
Close the specified database connection.
|
String[] |
expiredKeys()
Get only those keys of sessions, that are saved in the Store and are to
be expired.
|
protected Connection |
getConnection()
Check the connection associated with this store, if it's
null or closed try to reopen it. |
String |
getConnectionName() |
String |
getConnectionPassword() |
String |
getConnectionURL() |
String |
getDataSourceName() |
String |
getDriverName() |
String |
getName() |
String |
getSessionAppCol() |
String |
getSessionDataCol() |
String |
getSessionIdCol() |
String |
getSessionLastAccessedCol() |
String |
getSessionMaxInactiveCol() |
String |
getSessionTable() |
String |
getSessionValidCol() |
int |
getSize()
Return an integer containing a count of all Sessions
currently saved in this Store.
|
String |
getStoreName() |
String |
getThreadName() |
String[] |
keys() |
Session |
load(String id)
Load the Session associated with the id
id . |
protected Connection |
open()
Open (if necessary) and return a database connection for use by
this Store.
|
protected void |
release(Connection conn)
Release the connection, if it
is associated with a connection pool.
|
void |
remove(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(String connectionName)
Set the username to use to connect to the database.
|
void |
setConnectionPassword(String connectionPassword)
Set the password to use to connect to the database.
|
void |
setConnectionURL(String connectionURL)
Set the Connection URL for this Store.
|
void |
setDataSourceName(String dataSourceName)
Set the JNDI name of a DataSource-factory to use for db access
|
void |
setDriverName(String driverName)
Set the driver for this Store.
|
void |
setSessionAppCol(String sessionAppCol)
Set the App column for the table.
|
void |
setSessionDataCol(String sessionDataCol)
Set the Data column for the table
|
void |
setSessionIdCol(String sessionIdCol)
Set the Id column for the table.
|
void |
setSessionLastAccessedCol(String sessionLastAccessedCol)
Set the
Last Accessed column for the table |
void |
setSessionMaxInactiveCol(String sessionMaxInactiveCol)
Set the
Max Inactive column for the table |
void |
setSessionTable(String sessionTable)
Set the table for this Store.
|
void |
setSessionValidCol(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, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, toString
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
protected static final String storeName
protected static final String threadName
protected String connectionName
protected String connectionPassword
protected String connectionURL
protected Driver driver
protected String driverName
protected String dataSourceName
protected DataSource dataSource
protected String sessionTable
protected String sessionAppCol
protected String sessionIdCol
protected String sessionDataCol
protected String sessionValidCol
Is Valid
column to use.protected String sessionMaxInactiveCol
protected String sessionLastAccessedCol
protected PreparedStatement preparedSizeSql
getSize()
prepared statement.protected PreparedStatement preparedSaveSql
save()
prepared statement.protected PreparedStatement preparedClearSql
clear()
prepared statement.protected PreparedStatement preparedRemoveSql
remove()
prepared statement.protected PreparedStatement preparedLoadSql
load()
prepared statement.public String getName()
public String getThreadName()
public String getStoreName()
getStoreName
in class StoreBase
public void setDriverName(String driverName)
driverName
- The new driverpublic String getDriverName()
public String getConnectionName()
public void setConnectionName(String connectionName)
connectionName
- Usernamepublic String getConnectionPassword()
public void setConnectionPassword(String connectionPassword)
connectionPassword
- User passwordpublic void setConnectionURL(String connectionURL)
connectionURL
- The new Connection URLpublic String getConnectionURL()
public void setSessionTable(String sessionTable)
sessionTable
- The new tablepublic String getSessionTable()
public void setSessionAppCol(String sessionAppCol)
sessionAppCol
- the column namepublic String getSessionAppCol()
public void setSessionIdCol(String sessionIdCol)
sessionIdCol
- the column namepublic String getSessionIdCol()
public void setSessionDataCol(String sessionDataCol)
sessionDataCol
- the column namepublic String getSessionDataCol()
public void setSessionValidCol(String sessionValidCol)
Is Valid
column for the tablesessionValidCol
- The column namepublic String getSessionValidCol()
Is Valid
columnpublic void setSessionMaxInactiveCol(String sessionMaxInactiveCol)
Max Inactive
column for the tablesessionMaxInactiveCol
- The column namepublic String getSessionMaxInactiveCol()
Max Inactive
columnpublic void setSessionLastAccessedCol(String sessionLastAccessedCol)
Last Accessed
column for the tablesessionLastAccessedCol
- The column namepublic String getSessionLastAccessedCol()
Last Accessed
columnpublic void setDataSourceName(String dataSourceName)
dataSourceName
- The JNDI name of the DataSource-factorypublic String getDataSourceName()
public String[] expiredKeys() throws IOException
StoreBase
expiredKeys
in class StoreBase
IOException
- if an input-/output error occurredpublic String[] keys() throws IOException
IOException
- if an input/output error occurredpublic int getSize() throws IOException
0
is returned.IOException
- if an input/output error occurredpublic Session load(String id) throws ClassNotFoundException, IOException
id
.
If no such session is found null
is returned.id
- a value of type String
Session
ClassNotFoundException
- if an error occursIOException
- if an input/output error occurredpublic void remove(String id) throws IOException
id
- Session identifier of the Session to be removedIOException
- if an input/output error occurspublic void clear() throws IOException
IOException
- if an input/output error occurspublic void save(Session session) throws IOException
session
- the session to be storedIOException
- if an input/output error occursprotected Connection getConnection()
null
or closed try to reopen it.
Returns null
if the connection could not be established.Connection
if the connection succeededprotected Connection open() throws SQLException
SQLException
- if a database error occursprotected void close(Connection dbConnection)
dbConnection
- The connection to be closedprotected void release(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-2016 Apache Software Foundation. All Rights Reserved.