org.jboss.jca.adapters.jdbc
Class BaseWrapperManagedConnectionFactory

java.lang.Object
  extended by org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory
All Implemented Interfaces:
Serializable, javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ValidatingManagedConnectionFactory
Direct Known Subclasses:
LocalManagedConnectionFactory, XAManagedConnectionFactory

public abstract class BaseWrapperManagedConnectionFactory
extends Object
implements javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ValidatingManagedConnectionFactory, Serializable

BaseWrapperManagedConnectionFactory

Version:
$Revision: 105426 $
Author:
David Jencks, Adrian Brock, Weston Price
See Also:
Serialized Form

Field Summary
protected  String checkValidConnectionSQL
          The variable checkValidConnectionSQL holds an sql statement that may be executed whenever a managed connection is removed from the pool, to check that it is still valid.
protected  ValidConnectionChecker connectionChecker
          The instance of the valid connection checker
protected  Properties connectionProps
          This is used by Local wrapper for all properties, and is left in this class for ease of writing getConnectionProperties, which always holds the user/pw.
protected  boolean doQueryTimeout
          Query timeout enabled
protected  Boolean isTransactionQueryTimeout
          Transaction query timeout
protected  org.jboss.logging.Logger log
          The logger
protected  String newConnectionSQL
          The variable newConnectionSQL holds an SQL statement which if not null is executed when a new Connection is obtained for a new ManagedConnection.
protected  String password
          The password
protected  Integer preparedStatementCacheSize
          The prepared statement cache size
protected  Integer queryTimeout
          Query timeout
protected  Boolean sharePS
          Whether to share cached prepared statements
protected  StaleConnectionChecker staleConnectionChecker
          The instance of the stale connection checker
static String TRACK_STATEMENTS_FALSE
          Track statements - false
static int TRACK_STATEMENTS_FALSE_INT
          Track statements - false
static String TRACK_STATEMENTS_NOWARN
          Track statements - no warning
static int TRACK_STATEMENTS_NOWARN_INT
          Track statements - no warning
static String TRACK_STATEMENTS_TRUE
          Track statements - true
static int TRACK_STATEMENTS_TRUE_INT
          Track statements - true
protected  int trackStatements
          Track statement
protected  int transactionIsolation
          The transaction isolation level
protected  String urlDelimiter
          The variable urlDelimiter holds the url delimiter information to be used for HA DS configuration .
protected  String urlSelectorStrategyClassName
          URL selector strategy class name
protected  String userName
          The user name
protected  String validConnectionCheckerClassName
          The classname used to check whether a connection is valid
 
Constructor Summary
BaseWrapperManagedConnectionFactory()
          Constructor
 
Method Summary
 Object createConnectionFactory()
          
 Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
          
 String getCheckValidConnectionSQL()
          Get the check valid connection SQL statement
protected  Properties getConnectionProperties(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Gets full set of connection properties, i.e.
 String getExceptionSorterClassName()
          Get the exception sorter class name
 Set<BaseWrapperManagedConnection> getInvalidConnections(Set connectionSet)
          Get the invalid connections
 PrintWriter getLogWriter()
          
 String getNewConnectionSQL()
          Get the new connection SQL statement
 String getPassword()
          Get the password
 Integer getPreparedStatementCacheSize()
          Get the prepared statement cache size
 Integer getQueryTimeout()
          Get the query timeout
 Boolean getSharePreparedStatements()
          Get the prepared statement share status
 String getStaleConnectionCheckerClassName()
          Get the stale connection checker class name
 String getTrackStatements()
          Get the track statement value
 String getTransactionIsolation()
          Get the transaction isolation level
 String getURLDelimiter()
          Get the url delimiter
 URLSelectorStrategy getUrlSelectorStrategy()
          Get the url selector strategy
 String getUrlSelectorStrategyClassName()
          Get the url selector strategy class name
 String getUserName()
          Get the user name
 Integer getUseTryLock()
          Get the use try lock value
 Boolean getValidateOnMatch()
          Get the validate on match value
 String getValidConnectionCheckerClassName()
          Get the valid connection checker class name
 Boolean isTransactionQueryTimeout()
          Is transaction query timeout set
 Object loadClass(String className, Object constructorParameter)
          Load the URLSelectStrategy
 void setCheckValidConnectionSQL(String checkValidConnectionSQL)
          Set the check valid connection SQL statement
 void setExceptionSorterClassName(String exceptionSorterClassName)
          Set the exception sorter class name
 void setLogWriter(PrintWriter param1)
          
 void setNewConnectionSQL(String newConnectionSQL)
          Set the new connection SQL statement
 void setPassword(String password)
          Set the password
 void setPreparedStatementCacheSize(Integer size)
          Set the prepared statement cache size
 void setQueryTimeout(Integer timeout)
          Set the query timeout
 void setSharePreparedStatements(Boolean sharePS)
          Set the prepared statement share status
 void setStaleConnectionCheckerClassName(String value)
          Set the stale connection checker class name
 void setTrackStatements(String value)
          Set the track statement value
 void setTransactionIsolation(String transactionIsolation)
          Set the transaction isolation level
 void setTransactionQueryTimeout(Boolean value)
          Set transaction query timeout
 void setURLDelimiter(String urlDelimiter)
          Set the url delimiter.
 void setUrlSelectorStrategyClassName(String urlSelectorStrategyClassName)
          Set the url selector strategy class name
 void setUserName(String userName)
          Set the user name
 void setUseTryLock(Integer useTryLock)
          Set the use try lock value
 void setValidateOnMatch(Boolean validateOnMatch)
          Set the validate on match value
 void setValidConnectionCheckerClassName(String value)
          Set the valid connection checker class name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory
createManagedConnection, equals, hashCode, matchManagedConnections
 

Field Detail

TRACK_STATEMENTS_FALSE_INT

public static final int TRACK_STATEMENTS_FALSE_INT
Track statements - false

See Also:
Constant Field Values

TRACK_STATEMENTS_TRUE_INT

public static final int TRACK_STATEMENTS_TRUE_INT
Track statements - true

See Also:
Constant Field Values

TRACK_STATEMENTS_NOWARN_INT

public static final int TRACK_STATEMENTS_NOWARN_INT
Track statements - no warning

See Also:
Constant Field Values

TRACK_STATEMENTS_FALSE

public static final String TRACK_STATEMENTS_FALSE
Track statements - false

See Also:
Constant Field Values

TRACK_STATEMENTS_TRUE

public static final String TRACK_STATEMENTS_TRUE
Track statements - true

See Also:
Constant Field Values

TRACK_STATEMENTS_NOWARN

public static final String TRACK_STATEMENTS_NOWARN
Track statements - no warning

See Also:
Constant Field Values

log

protected final org.jboss.logging.Logger log
The logger


userName

protected String userName
The user name


password

protected String password
The password


connectionProps

protected final Properties connectionProps
This is used by Local wrapper for all properties, and is left in this class for ease of writing getConnectionProperties, which always holds the user/pw.


transactionIsolation

protected int transactionIsolation
The transaction isolation level


preparedStatementCacheSize

protected Integer preparedStatementCacheSize
The prepared statement cache size


doQueryTimeout

protected boolean doQueryTimeout
Query timeout enabled


newConnectionSQL

protected String newConnectionSQL
The variable newConnectionSQL holds an SQL statement which if not null is executed when a new Connection is obtained for a new ManagedConnection.


checkValidConnectionSQL

protected String checkValidConnectionSQL
The variable checkValidConnectionSQL holds an sql statement that may be executed whenever a managed connection is removed from the pool, to check that it is still valid. This requires setting up an mbean to execute it when notified by the ConnectionManager.


validConnectionCheckerClassName

protected String validConnectionCheckerClassName
The classname used to check whether a connection is valid


connectionChecker

protected ValidConnectionChecker connectionChecker
The instance of the valid connection checker


staleConnectionChecker

protected StaleConnectionChecker staleConnectionChecker
The instance of the stale connection checker


trackStatements

protected int trackStatements
Track statement


sharePS

protected Boolean sharePS
Whether to share cached prepared statements


isTransactionQueryTimeout

protected Boolean isTransactionQueryTimeout
Transaction query timeout


queryTimeout

protected Integer queryTimeout
Query timeout


urlDelimiter

protected String urlDelimiter
The variable urlDelimiter holds the url delimiter information to be used for HA DS configuration .


urlSelectorStrategyClassName

protected String urlSelectorStrategyClassName
URL selector strategy class name

Constructor Detail

BaseWrapperManagedConnectionFactory

public BaseWrapperManagedConnectionFactory()
Constructor

Method Detail

getLogWriter

public PrintWriter getLogWriter()
                         throws javax.resource.ResourceException

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

setLogWriter

public void setLogWriter(PrintWriter param1)
                  throws javax.resource.ResourceException

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createConnectionFactory

public Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
                               throws javax.resource.ResourceException

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createConnectionFactory

public Object createConnectionFactory()
                               throws javax.resource.ResourceException

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

getUserName

public String getUserName()
Get the user name

Returns:
The value

setUserName

public void setUserName(String userName)
Set the user name

Parameters:
userName - The value

getPassword

public String getPassword()
Get the password

Returns:
The value

setPassword

public void setPassword(String password)
Set the password

Parameters:
password - The value

getPreparedStatementCacheSize

public Integer getPreparedStatementCacheSize()
Get the prepared statement cache size

Returns:
The value

setPreparedStatementCacheSize

public void setPreparedStatementCacheSize(Integer size)
Set the prepared statement cache size

Parameters:
size - The value

getSharePreparedStatements

public Boolean getSharePreparedStatements()
Get the prepared statement share status

Returns:
The value

setSharePreparedStatements

public void setSharePreparedStatements(Boolean sharePS)
Set the prepared statement share status

Parameters:
sharePS - The value

getTransactionIsolation

public String getTransactionIsolation()
Get the transaction isolation level

Returns:
The value

setTransactionIsolation

public void setTransactionIsolation(String transactionIsolation)
Set the transaction isolation level

Parameters:
transactionIsolation - The value

getNewConnectionSQL

public String getNewConnectionSQL()
Get the new connection SQL statement

Returns:
The value

setNewConnectionSQL

public void setNewConnectionSQL(String newConnectionSQL)
Set the new connection SQL statement

Parameters:
newConnectionSQL - The value

getCheckValidConnectionSQL

public String getCheckValidConnectionSQL()
Get the check valid connection SQL statement

Returns:
The value

setCheckValidConnectionSQL

public void setCheckValidConnectionSQL(String checkValidConnectionSQL)
Set the check valid connection SQL statement

Parameters:
checkValidConnectionSQL - The value

getStaleConnectionCheckerClassName

public String getStaleConnectionCheckerClassName()
Get the stale connection checker class name

Returns:
The value

setStaleConnectionCheckerClassName

public void setStaleConnectionCheckerClassName(String value)
Set the stale connection checker class name

Parameters:
value - The value

getTrackStatements

public String getTrackStatements()
Get the track statement value

Returns:
The value

setTrackStatements

public void setTrackStatements(String value)
Set the track statement value

Parameters:
value - The value

getValidateOnMatch

public Boolean getValidateOnMatch()
Get the validate on match value

Returns:
The value

setValidateOnMatch

public void setValidateOnMatch(Boolean validateOnMatch)
Set the validate on match value

Parameters:
validateOnMatch - The value

getExceptionSorterClassName

public String getExceptionSorterClassName()
Get the exception sorter class name

Returns:
The value

setExceptionSorterClassName

public void setExceptionSorterClassName(String exceptionSorterClassName)
Set the exception sorter class name

Parameters:
exceptionSorterClassName - The value

getValidConnectionCheckerClassName

public String getValidConnectionCheckerClassName()
Get the valid connection checker class name

Returns:
The value

setValidConnectionCheckerClassName

public void setValidConnectionCheckerClassName(String value)
Set the valid connection checker class name

Parameters:
value - The value

isTransactionQueryTimeout

public Boolean isTransactionQueryTimeout()
Is transaction query timeout set

Returns:
The value

setTransactionQueryTimeout

public void setTransactionQueryTimeout(Boolean value)
Set transaction query timeout

Parameters:
value - The value

getQueryTimeout

public Integer getQueryTimeout()
Get the query timeout

Returns:
The value

setQueryTimeout

public void setQueryTimeout(Integer timeout)
Set the query timeout

Parameters:
timeout - The value

getUseTryLock

public Integer getUseTryLock()
Get the use try lock value

Returns:
The value

setUseTryLock

public void setUseTryLock(Integer useTryLock)
Set the use try lock value

Parameters:
useTryLock - The value

getURLDelimiter

public String getURLDelimiter()
Get the url delimiter

Returns:
The vlaue

setURLDelimiter

public void setURLDelimiter(String urlDelimiter)
                     throws javax.resource.ResourceException
Set the url delimiter.

Parameters:
urlDelimiter - The value
Throws:
javax.resource.ResourceException - Thrown in case of an error

getUrlSelectorStrategyClassName

public String getUrlSelectorStrategyClassName()
Get the url selector strategy class name

Returns:
The value

setUrlSelectorStrategyClassName

public void setUrlSelectorStrategyClassName(String urlSelectorStrategyClassName)
Set the url selector strategy class name

Parameters:
urlSelectorStrategyClassName - The value

getUrlSelectorStrategy

public URLSelectorStrategy getUrlSelectorStrategy()
Get the url selector strategy

Returns:
The value

loadClass

public Object loadClass(String className,
                        Object constructorParameter)
Load the URLSelectStrategy

Parameters:
className - The class name
constructorParameter - The parameter
Returns:
The URL selector strategy

getInvalidConnections

public Set<BaseWrapperManagedConnection> getInvalidConnections(Set connectionSet)
                                                        throws javax.resource.ResourceException
Get the invalid connections

Specified by:
getInvalidConnections in interface javax.resource.spi.ValidatingManagedConnectionFactory
Parameters:
connectionSet - The connection set
Returns:
The invalid connections
Throws:
javax.resource.ResourceException - Thrown if an error occurs

getConnectionProperties

protected Properties getConnectionProperties(Subject subject,
                                             javax.resource.spi.ConnectionRequestInfo cri)
                                      throws javax.resource.ResourceException
Gets full set of connection properties, i.e. whatever is provided in config plus "user" and "password" from subject/cri.

Note that the set is used to match connections to datasources as well as to create new managed connections.

In fact, we have a problem here. Theoretically, there is a possible name collision between config properties and "user"/"password".

Parameters:
subject - The subject
cri - The connection request info
Returns:
The properties
Throws:
javax.resource.ResourceException - Thrown if an error occurs


Copyright © 2008 Red Hat Middleware LLC (http://www.jboss.com/)