Lifecycle.SingleUse
Modifier and Type | Field and Description |
---|---|
protected DataSource |
dataSource
DataSource to use
|
protected String |
dataSourceName
name of the JNDI resource
|
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.
|
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 |
---|
DataSourceStore() |
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 |
getDataSourceName() |
boolean |
getLocalDataSource() |
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[] |
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 |
setDataSourceName(String dataSourceName)
Set the JNDI name of a DataSource-factory to use for db access
|
void |
setLocalDataSource(boolean localDataSource)
Set to
true to cause the datasource to be looked up in the webapp
JNDI Context. |
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 |
addPropertyChangeListener, destroyInternal, getManager, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, startInternal, stopInternal, toString
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
protected static final String storeName
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
public String getName()
public String getStoreName()
getStoreName
in class StoreBase
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 boolean getLocalDataSource()
public void setLocalDataSource(boolean localDataSource)
true
to cause the datasource to be looked up in the webapp
JNDI Context.localDataSource
- the new flag valuepublic 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 releasedCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.