org.tranql.connector.jdbc
Class JDBCDriverMCF

java.lang.Object
  extended by org.tranql.connector.jdbc.JDBCDriverMCF
All Implemented Interfaces:
java.io.Serializable, javax.resource.spi.ManagedConnectionFactory, UserPasswordManagedConnectionFactory

public class JDBCDriverMCF
extends java.lang.Object
implements UserPasswordManagedConnectionFactory

Implementation of a ManagedConnectionFactory that connects to a JDBC database using a generic JDBC Driver.

Version:
$Revision: 226 $ $Date: 2005-08-08 00:23:33 +0200 (Mon, 08 Aug 2005) $
See Also:
Serialized Form

Constructor Summary
JDBCDriverMCF()
           
 
Method Summary
 java.lang.Object createConnectionFactory()
           
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager)
           
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
           
 boolean equals(java.lang.Object obj)
          Equality is define in terms of the url property.
 java.lang.String getConnectionURL()
          Return the JDBC connection URL
 java.lang.String getDriver()
          Return the name of the Driver class
 java.lang.String getExceptionSorterClass()
          Return the name of the ExceptionSorter implementation used to classify Exceptions raised by the Driver.
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getPassword()
          Return the password credential used to establish the connection.
protected  java.sql.Connection getPhysicalConnection(javax.security.auth.Subject subject, CredentialExtractor credentialExtractor)
           
 java.lang.String getUserName()
          Return the user name used to establish the connection.
 int hashCode()
           
 java.lang.Boolean isCommitBeforeAutocommit()
          Return whether the Driver requires a commit before enabling auto-commit.
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set set, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
           
 void setCommitBeforeAutocommit(java.lang.Boolean commitBeforeAutocommit)
          Set whether the Driver requires a commit before enabling auto-commit.
 void setConnectionURL(java.lang.String url)
          Set the JDBC connection URL.
 void setDriver(java.lang.String driver)
          Set the name of the Driver class
 void setExceptionSorterClass(java.lang.String className)
          Set the name of the ExceptionSorter implementation so use.
 void setLogWriter(java.io.PrintWriter log)
           
 void setPassword(java.lang.String password)
          Set the user password credential establish the connection.
 void setUserName(java.lang.String user)
          Set the user name used establish the connection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDBCDriverMCF

public JDBCDriverMCF()
Method Detail

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager)
                                         throws javax.resource.ResourceException
Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
                                                             throws javax.resource.ResourceException
Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

getPhysicalConnection

protected java.sql.Connection getPhysicalConnection(javax.security.auth.Subject subject,
                                                    CredentialExtractor credentialExtractor)
                                             throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set set,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
                                                             throws javax.resource.ResourceException
Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

getLogWriter

public java.io.PrintWriter getLogWriter()
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory

setLogWriter

public void setLogWriter(java.io.PrintWriter log)
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory

getDriver

public java.lang.String getDriver()
Return the name of the Driver class

Returns:
the name of the Driver class

setDriver

public void setDriver(java.lang.String driver)
               throws javax.resource.spi.InvalidPropertyException
Set the name of the Driver class

Parameters:
driver - the name of the Driver class
Throws:
javax.resource.spi.InvalidPropertyException - if the class name is null or empty

getConnectionURL

public java.lang.String getConnectionURL()
Return the JDBC connection URL

Returns:
the JDBC connection URL

setConnectionURL

public void setConnectionURL(java.lang.String url)
                      throws javax.resource.spi.InvalidPropertyException
Set the JDBC connection URL. This URL is passed directly to the Driver and should contain any properties required to configure the connection.

Parameters:
url - the JDBC connection URL
Throws:
javax.resource.spi.InvalidPropertyException

getUserName

public java.lang.String getUserName()
Return the user name used to establish the connection.

Specified by:
getUserName in interface UserPasswordManagedConnectionFactory
Returns:
the user name used to establish the connection

setUserName

public void setUserName(java.lang.String user)
Set the user name used establish the connection. This value is used if no connection information is supplied by the application when attempting to create a connection.

Parameters:
user - the user name used to establish the connection; may be null

getPassword

public java.lang.String getPassword()
Return the password credential used to establish the connection.

Specified by:
getPassword in interface UserPasswordManagedConnectionFactory
Returns:
the password credential used to establish the connection

setPassword

public void setPassword(java.lang.String password)
Set the user password credential establish the connection. This value is used if no connection information is supplied by the application when attempting to create a connection.

Parameters:
password - the password credential used to establish the connection; may be null

isCommitBeforeAutocommit

public java.lang.Boolean isCommitBeforeAutocommit()
Return whether the Driver requires a commit before enabling auto-commit.

Returns:
TRUE if the Driver requires a commit before enabling auto-commit.

setCommitBeforeAutocommit

public void setCommitBeforeAutocommit(java.lang.Boolean commitBeforeAutocommit)
Set whether the Driver requires a commit before enabling auto-commit. Although the JDBC specification requires any pending work to be committed when auto-commit is enabled, not all drivers respect this. Setting this property to true will cause the connector to explicitly commit the transaction before re-enabling auto-commit; for compliant drivers this may result in two commits.

Parameters:
commitBeforeAutocommit - set TRUE if a commit should be performed before enabling auto-commit

getExceptionSorterClass

public java.lang.String getExceptionSorterClass()
Return the name of the ExceptionSorter implementation used to classify Exceptions raised by the Driver.

Returns:
the class name of the ExceptionSorter being used

setExceptionSorterClass

public void setExceptionSorterClass(java.lang.String className)
                             throws javax.resource.spi.InvalidPropertyException
Set the name of the ExceptionSorter implementation so use.

Parameters:
className - the class name of an ExceptionSorter to use
Throws:
javax.resource.spi.InvalidPropertyException - if the class name is null or empty

equals

public boolean equals(java.lang.Object obj)
Equality is define in terms of the url property.

Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © -2010 The Codehaus. All Rights Reserved.