public abstract class ManagedConnectionFactoryImpl extends Object implements javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ValidatingManagedConnectionFactory, MCFLifecycleListener, javax.resource.spi.ResourceAdapterAssociation, Serializable, Externalizable
ManagedConnectionFactory implementation for Generic JDBC Connector.
This class is extended by the DataSource specific ManagedConnection factories
and the ManagedConnectionFactory for the DriverManager.| Modifier and Type | Field and Description |
|---|---|
protected javax.resource.spi.LazyEnlistableConnectionManager |
cm_ |
protected DataSourceObjectBuilder |
dsObjBuilder |
protected boolean |
isLazyCm_ |
protected static int |
JVM_OPTION_STATEMENT_WRAPPING_NOT_SET |
protected static int |
JVM_OPTION_STATEMENT_WRAPPING_OFF |
protected static int |
JVM_OPTION_STATEMENT_WRAPPING_ON |
protected static StringManager |
localStrings |
protected PrintWriter |
logWriter |
protected javax.resource.spi.ResourceAdapter |
ra |
protected DataSourceSpec |
spec |
protected SQLTraceDelegator |
sqlTraceDelegator |
protected boolean |
statementWrapping |
| Constructor and Description |
|---|
ManagedConnectionFactoryImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
computeStatementWrappingStatus()
9.1 has attribute "wrap-statements" which will be overriden
when JVM option is specified as "true" or "false"
JVM Option will be deprecated in future versions.
|
protected ManagedConnectionImpl |
constructManagedConnection(PooledConnection pc,
Connection sqlCon,
javax.resource.spi.security.PasswordCredential passCred,
ManagedConnectionFactoryImpl mcf) |
Object |
createConnectionFactory()
Creates a Connection Factory instance.
|
Object |
createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
Creates a Connection Factory instance.
|
abstract javax.resource.spi.ManagedConnection |
createManagedConnection(Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Creates a new physical connection to the underlying EIS resource
manager.
|
abstract boolean |
equals(Object other)
Check if this
ManagedConnectionFactoryImpl is equal to
another ManagedConnectionFactoryImpl. |
String |
getApplicationName() |
String |
getClassName()
Gets the class name of the data source
|
String |
getConnectionValidationRequired()
Returns if connection validation is required or not
|
String |
getDatabaseName()
Gets the database name.
|
Object |
getDataSource()
Returns the underlying datasource
|
String |
getDataSourceName()
Gets the data source name.
|
String |
getDelimiter()
Gets the delimiter.
|
String |
getDescription()
Gets the description.
|
String |
getDriverProperties()
Gets the driver specific properties.
|
String |
getEscapeCharacter() |
String |
getGuaranteeIsolationLevel()
Returns the transaction isolation level
|
String |
getInitSql() |
Set |
getInvalidConnections(Set connectionSet)
This method returns a set of invalid
ManagedConnection
objects chosen from a specified set of ManagedConnection
objects. |
String |
getJdbc30DataSource() |
JdbcObjectsFactory |
getJdbcObjectsFactory() |
String |
getLoginTimeOut()
Gets the login timeout.
|
String |
getLogJdbcCalls() |
PrintWriter |
getLogWriter()
Get the log writer for this
ManagedConnectionFactoryImpl instance. |
String |
getMaxCacheSize() |
String |
getModuleName() |
String |
getNetworkProtocol()
Gets the network protocol.
|
String |
getNumberOfTopQueriesToReport() |
String |
getPassword()
Gets the password
|
protected PoolInfo |
getPoolInfo() |
String |
getPoolMonitoringSubTreeRoot() |
String |
getPoolName() |
String |
getPortNumber()
Gets the port number.
|
javax.resource.spi.ResourceAdapter |
getResourceAdapter()
Get the
ResourceAdapterImpl for this ManagedConnectionFactoryImpl instance. |
String |
getRoleName()
Gets the role name.
|
String |
getServerName()
Gets the server name.
|
String |
getSlowQueryThresholdInSeconds() |
String |
getSqlTraceListeners() |
String |
getStatementCacheSize() |
String |
getStatementCacheType() |
String |
getStatementLeakReclaim() |
String |
getStatementLeakTimeoutInSeconds() |
String |
getStatementTimeout()
Gets the StatementTimeout value
|
String |
getStatementWrapping()
Gets the statement wrapping value
|
String |
getTimeToKeepQueriesInMinutes() |
String |
getTransactionIsolation()
Returns the transaction isolation level
|
String |
getUser()
Gets the user name
|
String |
getValidationClassName()
Returns the validation class name checked for during validation
|
String |
getValidationMethod()
Returns the connection validation method type
|
String |
getValidationTableName()
Returns the table checked for during validation
|
int |
hashCode()
Returns the hash code for this
ManagedConnectionFactoryImpl. |
protected boolean |
isEqual(javax.resource.spi.security.PasswordCredential pc,
String user,
String password) |
boolean |
isStatementWrappingEnabled()
Returns whether statement wrapping is enabled or not.
|
protected void |
isValidByAutoCommit(Connection con)
Checks if a
java.sql.Connection is valid or not
by checking its auto commit property. |
protected void |
isValidByCustomValidation(Connection con,
String validationClassName)
Checks if a
java.sql.Connection is valid or not
by doing a custom validation using the validation class name specified. |
protected void |
isValidByMetaData(Connection con)
Checks if a
java.sql.Connection is valid or not
by checking its meta data. |
protected void |
isValidByTableQuery(Connection con,
String tableName)
Checks if a
java.sql.Connection is valid or not
by querying a table. |
protected void |
logFine(String logMessage) |
javax.resource.spi.ManagedConnection |
matchManagedConnections(Set connectionSet,
Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Returns a matched
ManagedConnection from the candidate
set of ManagedConnection objects. |
void |
mcfCreated()
mcf-created event
|
void |
mcfDestroyed()
mcf-destroyed event
|
void |
readExternal(ObjectInput in) |
void |
setApplicationName(String value) |
void |
setClassName(String className)
Sets the class name of the data source
|
void |
setConnectionValidationRequired(String conVldReq)
Sets if connection validation is required or not
|
void |
setDatabaseName(String databaseName)
Sets the database name.
|
void |
setDataSourceName(String dsn)
Sets the data source name.
|
void |
setDelimiter(String delim)
Sets the delimiter.
|
void |
setDescription(String desc)
Sets the description.
|
void |
setDriverProperties(String driverProps)
Sets the driver specific properties.
|
void |
setEscapeCharacter(String escapeCharacter) |
void |
setGuaranteeIsolationLevel(String guaranteeIsolation)
Sets if the transaction isolation level is to be guaranteed
|
void |
setInitSql(String initSql) |
protected void |
setIsolation(ManagedConnectionImpl mc)
Sets the isolation level specified in the
ConnectionRequestInfo
for the ManagedConnection passed. |
void |
setJdbc30DataSource(String booleanValue) |
void |
setLoginTimeOut(String loginTimeOut)
Sets the login timeout.
|
void |
setLogJdbcCalls(String enabled) |
void |
setLogWriter(PrintWriter out)
Set the log writer for this
ManagedConnectionFactoryImpl instance. |
void |
setMaxCacheSize(String maxCacheSize) |
void |
setModuleName(String value) |
void |
setNetworkProtocol(String nwProtocol)
Sets the network protocol.
|
void |
setNumberOfTopQueriesToReport(String numTopQueriesToReport) |
void |
setPassword(String passwd)
Sets the password
|
void |
setPoolMonitoringSubTreeRoot(String value) |
void |
setPoolName(String value) |
void |
setPortNumber(String portNumber)
Sets the port number.
|
void |
setResourceAdapter(javax.resource.spi.ResourceAdapter ra)
Set the associated
ResourceAdapterImpl JavaBean. |
void |
setRoleName(String roleName)
Sets the role name.
|
void |
setServerName(String serverName)
Sets the server name.
|
void |
setSlowQueryThresholdInSeconds(String seconds) |
void |
setSqlTraceListeners(String sqlTraceListeners) |
void |
setStatementCacheSize(String value) |
void |
setStatementCacheType(String statementCacheType) |
void |
setStatementLeakReclaim(String value) |
void |
setStatementLeakTimeoutInSeconds(String value) |
void |
setStatementTimeout(String timeout)
Set StatementTimeout value
|
void |
setStatementWrapping(String wrapping)
Set Statement Wrapping value
|
void |
setTimeToKeepQueriesInMinutes(String timeToKeepQueries) |
void |
setTransactionIsolation(String trnIsolation)
Sets the transaction isolation level
|
void |
setUser(String user)
Sets the user name
|
void |
setValidationClassName(String className)
Sets the validation class name checked for during validation
|
void |
setValidationMethod(String validationMethod)
Sets the validation method required
|
void |
setValidationTableName(String table)
Sets the table checked for during validation
|
protected void |
validateAndSetIsolation(ManagedConnectionImpl mc)
Common operation performed by all the child MCFs before returning a created mc
|
void |
writeExternal(ObjectOutput out) |
protected DataSourceSpec spec
protected transient DataSourceObjectBuilder dsObjBuilder
protected PrintWriter logWriter
protected transient javax.resource.spi.ResourceAdapter ra
protected boolean statementWrapping
protected SQLTraceDelegator sqlTraceDelegator
protected javax.resource.spi.LazyEnlistableConnectionManager cm_
protected boolean isLazyCm_
protected static final StringManager localStrings
protected static final int JVM_OPTION_STATEMENT_WRAPPING_ON
protected static final int JVM_OPTION_STATEMENT_WRAPPING_OFF
protected static final int JVM_OPTION_STATEMENT_WRAPPING_NOT_SET
public Object createConnectionFactory()
ConnectionManager implementation
of the resource adapter is used here.createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactoryjavax.sql.DataSourcepublic Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
ConnectionManager implementation
of the application server is used here.createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactorycxManager - ConnectionManager passed by the application serverjavax.sql.DataSourcepublic abstract javax.resource.spi.ManagedConnection createManagedConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactorysubject - Subject instance passed by the application servercxRequestInfo - ConnectionRequestInfo which may be created
as a result of the invocation getConnection(user, password)
on the DataSource objectManagedConnection object createdjavax.resource.ResourceException - if there is an error in instantiating the
DataSource object used for the
creation of the ManagedConnection objectSecurityException - if there ino PasswordCredential object
satisfying this requestjavax.resource.ResourceException - if there is an error in allocating the
physical connectionpublic abstract boolean equals(Object other)
ManagedConnectionFactoryImpl is equal to
another ManagedConnectionFactoryImpl.equals in interface javax.resource.spi.ManagedConnectionFactoryequals in class Objectother - ManagedConnectionFactoryImpl object for checking equality withManagedConnectionFactoryImpl objects are the same
false otherwisepublic PrintWriter getLogWriter()
ManagedConnectionFactoryImpl instance.getLogWriter in interface javax.resource.spi.ManagedConnectionFactoryPrintWriter associated with this ManagedConnectionFactoryImpl instancesetLogWriterpublic javax.resource.spi.ResourceAdapter getResourceAdapter()
ResourceAdapterImpl for this ManagedConnectionFactoryImpl instance.getResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociationResourceAdapterImpl associated with this ManagedConnectionFactoryImpl instancesetResourceAdapterpublic int hashCode()
ManagedConnectionFactoryImpl.public javax.resource.spi.ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException
ManagedConnection from the candidate
set of ManagedConnection objects.matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactoryconnectionSet - Set of ManagedConnection
objects passed by the application serversubject - passed by the application server
for retrieving information required for matchingcxRequestInfo - ConnectionRequestInfo passed by the application server
for retrieving information required for matchingManagedConnection that is the best match satisfying this requestjavax.resource.ResourceException - if there is an error accessing the Subject
parameter or the Set of ManagedConnection
objects passed by the application serverpublic Set getInvalidConnections(Set connectionSet) throws javax.resource.ResourceException
ManagedConnection
objects chosen from a specified set of ManagedConnection
objects.getInvalidConnections in interface javax.resource.spi.ValidatingManagedConnectionFactoryconnectionSet - a set of ManagedConnection objects
that need to be validated.ManagedConnection objects.javax.resource.ResourceException - generic exception.protected void isValidByCustomValidation(Connection con, String validationClassName) throws javax.resource.ResourceException
java.sql.Connection is valid or not
by doing a custom validation using the validation class name specified.con - java.sql.Connection to be validatedjavax.resource.ResourceException - if the connection is not validprotected void isValidByAutoCommit(Connection con) throws javax.resource.ResourceException
java.sql.Connection is valid or not
by checking its auto commit property.con - java.sql.Connection to be validatedjavax.resource.ResourceException - if the connection is not validprotected void isValidByMetaData(Connection con) throws javax.resource.ResourceException
java.sql.Connection is valid or not
by checking its meta data.con - java.sql.Connection to be validatedjavax.resource.ResourceException - if the connection is not validprotected void isValidByTableQuery(Connection con, String tableName) throws javax.resource.ResourceException
java.sql.Connection is valid or not
by querying a table.con - java.sql.Connection to be validatedtableName - table which should be queriedjavax.resource.ResourceException - if the connection is not validprotected void setIsolation(ManagedConnectionImpl mc) throws javax.resource.ResourceException
ConnectionRequestInfo
for the ManagedConnection passed.mc - ManagedConnectionjavax.resource.ResourceException - if the isolation property is invalid
or if the isolation cannot be set over the connectionprotected void validateAndSetIsolation(ManagedConnectionImpl mc) throws javax.resource.ResourceException
javax.resource.ResourceExceptionpublic void setLogWriter(PrintWriter out)
ManagedConnectionFactoryImpl instance.setLogWriter in interface javax.resource.spi.ManagedConnectionFactoryout - PrintWriter passed by the application servergetLogWriterpublic void setResourceAdapter(javax.resource.spi.ResourceAdapter ra)
ResourceAdapterImpl JavaBean.setResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociationra - ResourceAdapterImpl associated with this
ManagedConnectionFactoryImpl instancegetResourceAdapter@ConfigProperty(type=java.lang.String.class, defaultValue="APP") public void setUser(String user)
user - Stringpublic String getUser()
@ConfigProperty(type=java.lang.String.class, defaultValue="APP") public void setPassword(String passwd)
passwd - Stringpublic String getPassword()
@ConfigProperty(type=java.lang.String.class, defaultValue="org.apache.derby.jdbc.ClientConnectionPoolDataSource") public void setClassName(String className)
className - Stringpublic String getClassName()
@ConfigProperty(type=java.lang.String.class, defaultValue="false") public void setConnectionValidationRequired(String conVldReq)
conVldReq - Stringpublic String getConnectionValidationRequired()
@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setValidationMethod(String validationMethod)
validationMethod - Stringpublic String getValidationMethod()
@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setValidationTableName(String table)
table - Stringpublic String getValidationTableName()
public void setValidationClassName(String className)
className - Stringpublic String getValidationClassName()
@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setTransactionIsolation(String trnIsolation)
trnIsolation - Stringpublic String getTransactionIsolation()
@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setGuaranteeIsolationLevel(String guaranteeIsolation)
guaranteeIsolation - Stringpublic String getGuaranteeIsolationLevel()
protected boolean isEqual(javax.resource.spi.security.PasswordCredential pc,
String user,
String password)
@ConfigProperty(type=java.lang.String.class, defaultValue="localhost") public void setServerName(String serverName)
serverName - StringgetServerNamepublic String getServerName()
setServerName@ConfigProperty(type=java.lang.String.class, defaultValue="1527") public void setPortNumber(String portNumber)
portNumber - StringgetPortNumberpublic String getPortNumber()
setPortNumberpublic void setJdbc30DataSource(String booleanValue)
public String getJdbc30DataSource()
@ConfigProperty(type=java.lang.String.class, defaultValue="testdb") public void setDatabaseName(String databaseName)
databaseName - StringgetDatabaseNamepublic String getDatabaseName()
setDatabaseName@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setDataSourceName(String dsn)
dsn - StringgetDataSourceNamepublic String getDataSourceName()
setDataSourceNamepublic void setStatementWrapping(String wrapping)
wrapping - String getStatementWrapping public String getStatementWrapping()
setStatementWrappingpublic void setStatementCacheSize(String value)
public String getStatementCacheSize()
public void setStatementLeakTimeoutInSeconds(String value)
public String getStatementLeakTimeoutInSeconds()
public void setStatementLeakReclaim(String value)
public String getStatementLeakReclaim()
public void setPoolMonitoringSubTreeRoot(String value)
public String getPoolMonitoringSubTreeRoot()
public String getApplicationName()
public void setApplicationName(String value)
public String getModuleName()
public void setModuleName(String value)
public String getPoolName()
public void setPoolName(String value)
public String getStatementCacheType()
public void setStatementCacheType(String statementCacheType)
public String getMaxCacheSize()
public void setMaxCacheSize(String maxCacheSize)
public String getNumberOfTopQueriesToReport()
public void setNumberOfTopQueriesToReport(String numTopQueriesToReport)
public String getTimeToKeepQueriesInMinutes()
public void setTimeToKeepQueriesInMinutes(String timeToKeepQueries)
public String getInitSql()
public void setInitSql(String initSql)
public void setStatementTimeout(String timeout)
timeout - String getStatementTimeout public String getStatementTimeout()
setStatementTimeoutpublic String getSqlTraceListeners()
public void setSqlTraceListeners(String sqlTraceListeners)
public void setSlowQueryThresholdInSeconds(String seconds)
public String getSlowQueryThresholdInSeconds()
public void setLogJdbcCalls(String enabled)
public String getLogJdbcCalls()
@ConfigProperty(type=java.lang.String.class, defaultValue="Derby driver for datasource") public void setDescription(String desc)
desc - StringgetDescriptionpublic String getDescription()
setDescription@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setNetworkProtocol(String nwProtocol)
nwProtocol - StringgetNetworkProtocolpublic String getNetworkProtocol()
setNetworkProtocol@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setRoleName(String roleName)
roleName - StringgetRoleNamepublic String getRoleName()
setRoleName@ConfigProperty(type=java.lang.String.class, defaultValue="0") public void setLoginTimeOut(String loginTimeOut)
loginTimeOut - StringgetLoginTimeOutpublic String getLoginTimeOut()
setLoginTimeOut@ConfigProperty(type=java.lang.String.class, defaultValue="#") public void setDelimiter(String delim)
delim - StringgetDelimiterpublic String getDelimiter()
setDelimiterpublic void setEscapeCharacter(String escapeCharacter)
public String getEscapeCharacter()
@ConfigProperty(type=java.lang.String.class, defaultValue="") public void setDriverProperties(String driverProps)
driverProps - StringgetDriverPropertiespublic String getDriverProperties()
setDriverPropertiesprotected PoolInfo getPoolInfo()
protected ManagedConnectionImpl constructManagedConnection(PooledConnection pc, Connection sqlCon, javax.resource.spi.security.PasswordCredential passCred, ManagedConnectionFactoryImpl mcf) throws javax.resource.ResourceException
javax.resource.ResourceExceptionpublic Object getDataSource() throws javax.resource.ResourceException
javax.resource.ResourceExceptionprotected void computeStatementWrappingStatus()
public boolean isStatementWrappingEnabled()
public JdbcObjectsFactory getJdbcObjectsFactory()
protected void logFine(String logMessage)
public void mcfCreated()
MCFLifecycleListenermcfCreated in interface MCFLifecycleListenerpublic void mcfDestroyed()
MCFLifecycleListenermcfDestroyed in interface MCFLifecycleListenerpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2017. All rights reserved.