Class ManagedConnectionFactoryImpl

    • Field Detail

      • ra

        protected transient jakarta.resource.spi.ResourceAdapter ra
      • statementWrapping

        protected boolean statementWrapping
      • cm_

        protected jakarta.resource.spi.LazyEnlistableConnectionManager cm_
      • isLazyCm_

        protected boolean isLazyCm_
      • localStrings

        protected static final StringManager localStrings
      • JVM_OPTION_STATEMENT_WRAPPING_ON

        protected static final int JVM_OPTION_STATEMENT_WRAPPING_ON
        See Also:
        Constant Field Values
      • JVM_OPTION_STATEMENT_WRAPPING_OFF

        protected static final int JVM_OPTION_STATEMENT_WRAPPING_OFF
        See Also:
        Constant Field Values
      • JVM_OPTION_STATEMENT_WRAPPING_NOT_SET

        protected static final int JVM_OPTION_STATEMENT_WRAPPING_NOT_SET
        See Also:
        Constant Field Values
    • Constructor Detail

      • ManagedConnectionFactoryImpl

        public ManagedConnectionFactoryImpl()
    • Method Detail

      • createConnectionFactory

        public Object createConnectionFactory()
        Creates a Connection Factory instance. The ConnectionManager implementation of the resource adapter is used here.
        Specified by:
        createConnectionFactory in interface jakarta.resource.spi.ManagedConnectionFactory
        Returns:
        Generic JDBC Connector implementation of javax.sql.DataSource
      • createConnectionFactory

        public Object createConnectionFactory​(jakarta.resource.spi.ConnectionManager cxManager)
        Creates a Connection Factory instance. The ConnectionManager implementation of the application server is used here.
        Specified by:
        createConnectionFactory in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        cxManager - ConnectionManager passed by the application server
        Returns:
        Generic JDBC Connector implementation of javax.sql.DataSource
      • createManagedConnection

        public abstract jakarta.resource.spi.ManagedConnection createManagedConnection​(Subject subject,
                                                                                       jakarta.resource.spi.ConnectionRequestInfo cxRequestInfo)
                                                                                throws jakarta.resource.ResourceException
        Creates a new physical connection to the underlying EIS resource manager.
        Specified by:
        createManagedConnection in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        subject - Subject instance passed by the application server
        cxRequestInfo - ConnectionRequestInfo which may be created as a result of the invocation getConnection(user, password) on the DataSource object
        Returns:
        ManagedConnection object created
        Throws:
        jakarta.resource.ResourceException - if there is an error in instantiating the DataSource object used for the creation of the ManagedConnection object; or if there is an error in allocating the physical connection
        SecurityException - if there no PasswordCredential object satisfying this request
      • equals

        public abstract boolean equals​(Object other)
        Check if this ManagedConnectionFactoryImpl is equal to another ManagedConnectionFactoryImpl.
        Specified by:
        equals in interface jakarta.resource.spi.ManagedConnectionFactory
        Overrides:
        equals in class Object
        Parameters:
        other - ManagedConnectionFactoryImpl object for checking equality with
        Returns:
        true if the property sets of both the ManagedConnectionFactoryImpl objects are the same false otherwise
      • getLogWriter

        public PrintWriter getLogWriter()
        Get the log writer for this ManagedConnectionFactoryImpl instance.
        Specified by:
        getLogWriter in interface jakarta.resource.spi.ManagedConnectionFactory
        Returns:
        PrintWriter associated with this ManagedConnectionFactoryImpl instance
        See Also:
        setLogWriter
      • getResourceAdapter

        public jakarta.resource.spi.ResourceAdapter getResourceAdapter()
        Get the ResourceAdapterImpl for this ManagedConnectionFactoryImpl instance.
        Specified by:
        getResourceAdapter in interface jakarta.resource.spi.ResourceAdapterAssociation
        Returns:
        ResourceAdapterImpl associated with this ManagedConnectionFactoryImpl instance
        See Also:
        setResourceAdapter
      • hashCode

        public int hashCode()
        Returns the hash code for this ManagedConnectionFactoryImpl.
        Specified by:
        hashCode in interface jakarta.resource.spi.ManagedConnectionFactory
        Overrides:
        hashCode in class Object
        Returns:
        hash code for this ManagedConnectionFactoryImpl
      • matchManagedConnections

        public jakarta.resource.spi.ManagedConnection matchManagedConnections​(Set connectionSet,
                                                                              Subject subject,
                                                                              jakarta.resource.spi.ConnectionRequestInfo cxRequestInfo)
                                                                       throws jakarta.resource.ResourceException
        Returns a matched ManagedConnection from the candidate set of ManagedConnection objects.
        Specified by:
        matchManagedConnections in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        connectionSet - Set of ManagedConnection objects passed by the application server
        subject - passed by the application server for retrieving information required for matching
        cxRequestInfo - ConnectionRequestInfo passed by the application server for retrieving information required for matching
        Returns:
        ManagedConnection that is the best match satisfying this request
        Throws:
        jakarta.resource.ResourceException - if there is an error accessing the Subject parameter or the Set of ManagedConnection objects passed by the application server
      • getInvalidConnections

        public Set getInvalidConnections​(Set connectionSet)
                                  throws jakarta.resource.ResourceException
        This method returns a set of invalid ManagedConnection objects chosen from a specified set of ManagedConnection objects.
        Specified by:
        getInvalidConnections in interface jakarta.resource.spi.ValidatingManagedConnectionFactory
        Parameters:
        connectionSet - a set of ManagedConnection objects that need to be validated.
        Returns:
        a set of invalid ManagedConnection objects.
        Throws:
        jakarta.resource.ResourceException - generic exception.
      • isValidByCustomValidation

        protected void isValidByCustomValidation​(Connection con,
                                                 String validationClassName)
                                          throws jakarta.resource.ResourceException
        Checks if a java.sql.Connection is valid or not by doing a custom validation using the validation class name specified.
        Parameters:
        con - java.sql.Connection to be validated
        Throws:
        jakarta.resource.ResourceException - if the connection is not valid
      • isValidByAutoCommit

        protected void isValidByAutoCommit​(Connection con)
                                    throws jakarta.resource.ResourceException
        Checks if a java.sql.Connection is valid or not by checking its auto commit property.
        Parameters:
        con - java.sql.Connection to be validated
        Throws:
        jakarta.resource.ResourceException - if the connection is not valid
      • isValidByMetaData

        protected void isValidByMetaData​(Connection con)
                                  throws jakarta.resource.ResourceException
        Checks if a java.sql.Connection is valid or not by checking its meta data.
        Parameters:
        con - java.sql.Connection to be validated
        Throws:
        jakarta.resource.ResourceException - if the connection is not valid
      • isValidByTableQuery

        protected void isValidByTableQuery​(Connection con,
                                           String tableName)
                                    throws jakarta.resource.ResourceException
        Checks if a java.sql.Connection is valid or not by querying a table.
        Parameters:
        con - java.sql.Connection to be validated
        tableName - table which should be queried
        Throws:
        jakarta.resource.ResourceException - if the connection is not valid
      • setIsolation

        protected void setIsolation​(ManagedConnectionImpl mc)
                             throws jakarta.resource.ResourceException
        Sets the isolation level specified in the ConnectionRequestInfo for the ManagedConnection passed.
        Parameters:
        mc - ManagedConnection
        Throws:
        jakarta.resource.ResourceException - if the isolation property is invalid or if the isolation cannot be set over the connection
      • validateAndSetIsolation

        protected void validateAndSetIsolation​(ManagedConnectionImpl mc)
                                        throws jakarta.resource.ResourceException
        Common operation performed by all the child MCFs before returning a created mc
        Throws:
        jakarta.resource.ResourceException
      • setLogWriter

        public void setLogWriter​(PrintWriter out)
        Set the log writer for this ManagedConnectionFactoryImpl instance.
        Specified by:
        setLogWriter in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        out - PrintWriter passed by the application server
        See Also:
        getLogWriter
      • setResourceAdapter

        public void setResourceAdapter​(jakarta.resource.spi.ResourceAdapter ra)
        Set the associated ResourceAdapterImpl JavaBean.
        Specified by:
        setResourceAdapter in interface jakarta.resource.spi.ResourceAdapterAssociation
        Parameters:
        ra - ResourceAdapterImpl associated with this ManagedConnectionFactoryImpl instance
        See Also:
        getResourceAdapter
      • setUser

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="APP")
        public void setUser​(String user)
        Sets the user name
        Parameters:
        user - String
      • getUser

        public String getUser()
        Gets the user name
        Returns:
        user
      • setPassword

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="APP")
        public void setPassword​(String passwd)
        Sets the password
        Parameters:
        passwd - String
      • getPassword

        public String getPassword()
        Gets the password
        Returns:
        passwd
      • setClassName

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="org.h2.jdbcx.JdbcDataSource")
        public void setClassName​(String className)
        Sets the class name of the data source
        Parameters:
        className - String
      • getClassName

        public String getClassName()
        Gets the class name of the data source
        Returns:
        className
      • setConnectionValidationRequired

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="false")
        public void setConnectionValidationRequired​(String conVldReq)
        Sets if connection validation is required or not
        Parameters:
        conVldReq - String
      • getConnectionValidationRequired

        public String getConnectionValidationRequired()
        Returns if connection validation is required or not
        Returns:
        connection validation requirement
      • setValidationMethod

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setValidationMethod​(String validationMethod)
        Sets the validation method required
        Parameters:
        validationMethod - String
      • getValidationMethod

        public String getValidationMethod()
        Returns the connection validation method type
        Returns:
        validation method
      • setValidationTableName

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setValidationTableName​(String table)
        Sets the table checked for during validation
        Parameters:
        table - String
      • getValidationTableName

        public String getValidationTableName()
        Returns the table checked for during validation
        Returns:
        table
      • setValidationClassName

        public void setValidationClassName​(String className)
        Sets the validation class name checked for during validation
        Parameters:
        className - String
      • getValidationClassName

        public String getValidationClassName()
        Returns the validation class name checked for during validation
        Returns:
        table
      • setTransactionIsolation

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setTransactionIsolation​(String trnIsolation)
        Sets the transaction isolation level
        Parameters:
        trnIsolation - String
      • getTransactionIsolation

        public String getTransactionIsolation()
        Returns the transaction isolation level
        Returns:
        transaction isolation level
      • setGuaranteeIsolationLevel

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setGuaranteeIsolationLevel​(String guaranteeIsolation)
        Sets if the transaction isolation level is to be guaranteed
        Parameters:
        guaranteeIsolation - String
      • getGuaranteeIsolationLevel

        public String getGuaranteeIsolationLevel()
        Returns the transaction isolation level
        Returns:
        isolation level guarantee
      • isEqual

        protected boolean isEqual​(jakarta.resource.spi.security.PasswordCredential pc,
                                  String user,
                                  String password)
      • setServerName

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="localhost")
        public void setServerName​(String serverName)
        Sets the server name.
        Parameters:
        serverName - String
        See Also:
        getServerName
      • getServerName

        public String getServerName()
        Gets the server name.
        Returns:
        serverName
        See Also:
        setServerName
      • setPortNumber

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="1527")
        public void setPortNumber​(String portNumber)
        Sets the port number.
        Parameters:
        portNumber - String
        See Also:
        getPortNumber
      • getPortNumber

        public String getPortNumber()
        Gets the port number.
        Returns:
        portNumber
        See Also:
        setPortNumber
      • setDatabaseName

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="testdb")
        public void setDatabaseName​(String databaseName)
        Sets the database name.
        Parameters:
        databaseName - String
        See Also:
        getDatabaseName
      • getDatabaseName

        public String getDatabaseName()
        Gets the database name.
        Returns:
        databaseName
        See Also:
        setDatabaseName
      • setDataSourceName

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setDataSourceName​(String dsn)
        Sets the data source name.
        Parameters:
        dsn - String
        See Also:
        getDataSourceName
      • getDataSourceName

        public String getDataSourceName()
        Gets the data source name.
        Returns:
        dsn
        See Also:
        setDataSourceName
      • setStatementWrapping

        public void setStatementWrapping​(String wrapping)
        Set Statement Wrapping value
        Parameters:
        wrapping - String
        See Also:
        getStatementWrapping
      • getStatementWrapping

        public String getStatementWrapping()
        Gets the statement wrapping value
        Returns:
        String representing "true" or "false"
        See Also:
        setStatementWrapping
      • setStatementCacheSize

        public void setStatementCacheSize​(String value)
      • getStatementCacheSize

        public String getStatementCacheSize()
      • setStatementLeakTimeoutInSeconds

        public void setStatementLeakTimeoutInSeconds​(String value)
      • getStatementLeakTimeoutInSeconds

        public String getStatementLeakTimeoutInSeconds()
      • setStatementLeakReclaim

        public void setStatementLeakReclaim​(String value)
      • getStatementLeakReclaim

        public String getStatementLeakReclaim()
      • setPoolMonitoringSubTreeRoot

        public void setPoolMonitoringSubTreeRoot​(String value)
      • getPoolMonitoringSubTreeRoot

        public String getPoolMonitoringSubTreeRoot()
      • getApplicationName

        public String getApplicationName()
      • setApplicationName

        public void setApplicationName​(String value)
      • getModuleName

        public String getModuleName()
      • setModuleName

        public void setModuleName​(String value)
      • getPoolName

        public String getPoolName()
      • setPoolName

        public void setPoolName​(String value)
      • getStatementCacheType

        public String getStatementCacheType()
      • setStatementCacheType

        public void setStatementCacheType​(String statementCacheType)
      • getMaxCacheSize

        public String getMaxCacheSize()
      • setMaxCacheSize

        public void setMaxCacheSize​(String maxCacheSize)
      • getNumberOfTopQueriesToReport

        public String getNumberOfTopQueriesToReport()
      • setNumberOfTopQueriesToReport

        public void setNumberOfTopQueriesToReport​(String numTopQueriesToReport)
      • getTimeToKeepQueriesInMinutes

        public String getTimeToKeepQueriesInMinutes()
      • setTimeToKeepQueriesInMinutes

        public void setTimeToKeepQueriesInMinutes​(String timeToKeepQueries)
      • getInitSql

        public String getInitSql()
      • setInitSql

        public void setInitSql​(String initSql)
      • setStatementTimeout

        public void setStatementTimeout​(String timeout)
        Set StatementTimeout value
        Parameters:
        timeout - String
        See Also:
        getStatementTimeout
      • getStatementTimeout

        public String getStatementTimeout()
        Gets the StatementTimeout value
        Returns:
        String representing "true" or "false"
        See Also:
        setStatementTimeout
      • getSqlTraceListeners

        public String getSqlTraceListeners()
      • setSqlTraceListeners

        public void setSqlTraceListeners​(String sqlTraceListeners)
      • setSlowQueryThresholdInSeconds

        public void setSlowQueryThresholdInSeconds​(String seconds)
      • getSlowQueryThresholdInSeconds

        public String getSlowQueryThresholdInSeconds()
      • setLogJdbcCalls

        public void setLogJdbcCalls​(String enabled)
      • getLogJdbcCalls

        public String getLogJdbcCalls()
      • setDescription

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="H2 driver for datasource")
        public void setDescription​(String desc)
        Sets the description.
        Parameters:
        desc - String
        See Also:
        getDescription
      • getDescription

        public String getDescription()
        Gets the description.
        Returns:
        desc
        See Also:
        setDescription
      • setNetworkProtocol

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setNetworkProtocol​(String nwProtocol)
        Sets the network protocol.
        Parameters:
        nwProtocol - String
        See Also:
        getNetworkProtocol
      • getNetworkProtocol

        public String getNetworkProtocol()
        Gets the network protocol.
        Returns:
        nwProtocol
        See Also:
        setNetworkProtocol
      • setRoleName

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setRoleName​(String roleName)
        Sets the role name.
        Parameters:
        roleName - String
        See Also:
        getRoleName
      • getRoleName

        public String getRoleName()
        Gets the role name.
        Returns:
        roleName
        See Also:
        setRoleName
      • setLoginTimeOut

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="0")
        public void setLoginTimeOut​(String loginTimeOut)
        Sets the login timeout.
        Parameters:
        loginTimeOut - String
        See Also:
        getLoginTimeOut
      • getLoginTimeOut

        public String getLoginTimeOut()
        Gets the login timeout.
        Returns:
        loginTimeout
        See Also:
        setLoginTimeOut
      • setDelimiter

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="#")
        public void setDelimiter​(String delim)
        Sets the delimiter.
        Parameters:
        delim - String
        See Also:
        getDelimiter
      • getDelimiter

        public String getDelimiter()
        Gets the delimiter.
        Returns:
        delim
        See Also:
        setDelimiter
      • setEscapeCharacter

        public void setEscapeCharacter​(String escapeCharacter)
      • getEscapeCharacter

        public String getEscapeCharacter()
      • setDriverProperties

        @ConfigProperty(type=java.lang.String.class,
                        defaultValue="")
        public void setDriverProperties​(String driverProps)
        Sets the driver specific properties.
        Parameters:
        driverProps - String
        See Also:
        getDriverProperties
      • getDriverProperties

        public String getDriverProperties()
        Gets the driver specific properties.
        Returns:
        driverProps
        See Also:
        setDriverProperties
      • getPoolInfo

        protected PoolInfo getPoolInfo()
      • getDataSource

        public Object getDataSource()
                             throws jakarta.resource.ResourceException
        Returns the underlying datasource
        Returns:
        DataSource of jdbc vendor
        Throws:
        jakarta.resource.ResourceException
      • computeStatementWrappingStatus

        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.
      • isStatementWrappingEnabled

        public boolean isStatementWrappingEnabled()
        Returns whether statement wrapping is enabled or not.
        Returns:
        boolean representing statementwrapping status
      • logFine

        protected void logFine​(String logMessage)