Class ConnectionPoolProvider<T extends ConnectionPool>
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.configuration.provider.HierarchicalConfigProvider<T>
-
- edu.uiuc.ncsa.security.storage.sql.ConnectionPoolProvider<T>
-
- All Implemented Interfaces:
CfgEventListener
,EventListener
,javax.inject.Provider<T>
- Direct Known Subclasses:
DerbyConnectionPoolProvider
,H2ConnectionPoolProvider
,MariaDBConnectionPoolProvider
,MySQLConnectionPoolProvider
,PGConnectionPoolProvider
public abstract class ConnectionPoolProvider<T extends ConnectionPool> extends HierarchicalConfigProvider<T>
Creates aConnectionPool
from a configuration.Created by Jeff Gaynor
on 1/17/12 at 12:07 PM
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description ConnectionPoolProvider()
ConnectionPoolProvider(SQLConnectionImpl sqlConnection)
this only sets the database name and the schema.protected
ConnectionPoolProvider(String database, String schema)
protected
ConnectionPoolProvider(String database, String schema, String host, int port, String driver, boolean useSSL)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
checkTime(String key, long defaultValue)
Checks long value assuming it is time.protected String
checkValue(String key)
Check the value associated with this key.protected boolean
checkValue(String key, boolean defaultValue)
protected int
checkValue(String key, int defaultValue)
protected long
checkValue(String key, long defaultValue)
protected String
checkValue(String key, String defaultValue)
Check that the value associated with the key is not null.String
getDatabase()
String
getDriver()
String
getHost()
int
getPort()
String
getSchema()
boolean
isUseSSL()
ConnectionPoolProvider
setDatabase(String database)
ConnectionPoolProvider
setDriver(String driver)
ConnectionPoolProvider
setHost(String host)
protected void
setPoolParameters(ConnectionPool pool)
Called exactly once duringProvider.get()
per (new) pool to set the parameters (max size etc.).ConnectionPoolProvider
setPort(int port)
ConnectionPoolProvider
setSchema(String schema)
ConnectionPoolProvider
setUseSSL(boolean useSSL)
-
Methods inherited from class edu.uiuc.ncsa.security.core.configuration.provider.HierarchicalConfigProvider
addListener, checkEvent, fireComponentFound, getAttribute, getAttribute, getBooleanAttribute, getConfig, getConfigurationAt, getIntAttribute, getIntAttribute, getListeners, hasA, isA, removeListener, setConfig
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.uiuc.ncsa.security.core.configuration.provider.CfgEventListener
componentFound
-
-
-
-
Field Detail
-
host
protected String host
-
driver
protected String driver
-
port
protected int port
-
schema
protected String schema
-
database
protected String database
-
useSSL
protected boolean useSSL
-
USERNAME
public static final String USERNAME
- See Also:
- Constant Field Values
-
PASSWORD
public static final String PASSWORD
- See Also:
- Constant Field Values
-
HOST
public static final String HOST
- See Also:
- Constant Field Values
-
PORT
public static final String PORT
- See Also:
- Constant Field Values
-
DRIVER
public static final String DRIVER
- See Also:
- Constant Field Values
-
USE_SSL
public static final String USE_SSL
- See Also:
- Constant Field Values
-
DATABASE
public static final String DATABASE
- See Also:
- Constant Field Values
-
PARAMETERS
public static final String PARAMETERS
- See Also:
- Constant Field Values
-
SCHEMA
public static final String SCHEMA
- See Also:
- Constant Field Values
-
BOOT_PASSWORD
public static final String BOOT_PASSWORD
- See Also:
- Constant Field Values
-
DERBY_CREATE_SCRIPT
public static final String DERBY_CREATE_SCRIPT
- See Also:
- Constant Field Values
-
DERBY_STORE_TYPE
public static final String DERBY_STORE_TYPE
- See Also:
- Constant Field Values
-
DERBY_FS_DEFAULT_USER
public static final String DERBY_FS_DEFAULT_USER
- See Also:
- Constant Field Values
-
DERBY_FS_DEFAULT_PASSWORD
public static final String DERBY_FS_DEFAULT_PASSWORD
- See Also:
- Constant Field Values
-
DERBY_FS_DEFAULT_BOOT_PASSWORD
public static final String DERBY_FS_DEFAULT_BOOT_PASSWORD
- See Also:
- Constant Field Values
-
DERBY_FS_DEFAULT_SCHEMA
public static final String DERBY_FS_DEFAULT_SCHEMA
- See Also:
- Constant Field Values
-
CONNECTION_MAX
public static final String CONNECTION_MAX
- See Also:
- Constant Field Values
-
CONNECTION_IDLE_TIMEOUT
public static final String CONNECTION_IDLE_TIMEOUT
- See Also:
- Constant Field Values
-
CONNECTION_CLEANUP_INTERVAL
public static final String CONNECTION_CLEANUP_INTERVAL
- See Also:
- Constant Field Values
-
CONNECTION_CLEANUP_ENABLE
public static final String CONNECTION_CLEANUP_ENABLE
- See Also:
- Constant Field Values
-
CONNECTION_ENABLE_QUEUE
public static final String CONNECTION_ENABLE_QUEUE
- See Also:
- Constant Field Values
-
CONNECTION_QUEUE_INTERVAL
public static final String CONNECTION_QUEUE_INTERVAL
- See Also:
- Constant Field Values
-
DEFAULT_MAX_CONNECTIONS
public static int DEFAULT_MAX_CONNECTIONS
-
DEFAULT_IDLE_TIMEOUT
public static long DEFAULT_IDLE_TIMEOUT
-
DEFAULT_CLEANUP_INTERVAL
public static long DEFAULT_CLEANUP_INTERVAL
-
DEFAULT_CLEANUP_ENABLE
public static boolean DEFAULT_CLEANUP_ENABLE
-
DEFAULT_QUEUE_INTERVAL
public static long DEFAULT_QUEUE_INTERVAL
-
-
Constructor Detail
-
ConnectionPoolProvider
public ConnectionPoolProvider()
-
ConnectionPoolProvider
protected ConnectionPoolProvider(String database, String schema, String host, int port, String driver, boolean useSSL)
-
ConnectionPoolProvider
public ConnectionPoolProvider(SQLConnectionImpl sqlConnection)
this only sets the database name and the schema. Subclasses should set what they specifically need.- Parameters:
sqlConnection
-
-
-
Method Detail
-
setPoolParameters
protected void setPoolParameters(ConnectionPool pool)
Called exactly once duringProvider.get()
per (new) pool to set the parameters (max size etc.).- Parameters:
pool
-
-
checkValue
protected String checkValue(String key, String defaultValue)
Check that the value associated with the key is not null. If it is, use the default value. If there is no default value, then throw an exception.- Parameters:
key
-defaultValue
-- Returns:
-
checkValue
protected int checkValue(String key, int defaultValue)
-
checkTime
protected long checkTime(String key, long defaultValue)
Checks long value assuming it is time. No units means it is passed back, but look at the documentation inXMLConfigUtil.getValueSecsOrMillis(String)
. IOf you just need a long value, usecheckValue(String, long)
.- Parameters:
key
-defaultValue
-- Returns:
-
checkValue
protected long checkValue(String key, long defaultValue)
-
checkValue
protected boolean checkValue(String key, boolean defaultValue)
-
checkValue
protected String checkValue(String key)
Check the value associated with this key. If the value is missing, throw an exception.- Parameters:
key
-- Returns:
-
getHost
public String getHost()
-
setHost
public ConnectionPoolProvider setHost(String host)
-
getDriver
public String getDriver()
-
setDriver
public ConnectionPoolProvider setDriver(String driver)
-
getPort
public int getPort()
-
setPort
public ConnectionPoolProvider setPort(int port)
-
getSchema
public String getSchema()
-
setSchema
public ConnectionPoolProvider setSchema(String schema)
-
getDatabase
public String getDatabase()
-
setDatabase
public ConnectionPoolProvider setDatabase(String database)
-
isUseSSL
public boolean isUseSSL()
-
setUseSSL
public ConnectionPoolProvider setUseSSL(boolean useSSL)
-
-