org.jboss.minerva.xa
Class XADataSourceImpl

java.lang.Object
  |
  +--org.jboss.minerva.xa.XADataSourceImpl
All Implemented Interfaces:
javax.sql.XADataSource

public class XADataSourceImpl
extends java.lang.Object
implements javax.sql.XADataSource

Transactional DataSource wrapper for JDBC 1.0 drivers. This is very lightweight - it just passes requests through to an underlying driver, and wraps the results with an XAConnection. The XAConnection and corresponding XAResource are responsible for closing the connection when appropriate. Note that the underlying driver may perform pooling, but need not. This class does not add any pooling capabilities.

Version:
$Revision: 1.3 $
Author:
Aaron Mulder (ammulder@alumni.princeton.edu)

Constructor Summary
XADataSourceImpl()
          Empty constructure for beans, reflection, etc.
XADataSourceImpl(java.lang.String url, java.util.Properties properties)
          Specifies the URL and properties to connect to the underlying driver.
 
Method Summary
 int getLoginTimeout()
          This is not used by the current implementation, since the effect would differ depending on the underlying driver.
 java.io.PrintWriter getLogWriter()
          Gets the log writer used to record when XAConnections are opened.
 java.lang.String getPassword()
          Gets the JDBC password used to open an underlying connection.
 java.util.Properties getProperties()
          Gets the JDBC properties used to open an underlying connection.
 java.lang.String getURL()
          Gets the JDBC URL used to open an underlying connection.
 java.lang.String getUser()
          Gets the JDBC user name used to open an underlying connection.
 javax.sql.XAConnection getXAConnection()
          Gets an XAConnection.
 javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String password)
          Gets an XAConnection.
 void setLoginTimeout(int timeout)
          This is not used by the current implementation, since the effect would differ depending on the underlying driver.
 void setLogWriter(java.io.PrintWriter writer)
          Sets a log writer used to record when XAConnections are opened.
 void setPassword(java.lang.String password)
          Sets the JDBC password used to open an underlying connection.
 void setProperties(java.util.Properties properties)
          Sets the JDBC properties used to open an underlying connection.
 void setURL(java.lang.String url)
          Sets the JDBC URL used to open an underlying connection.
 void setUser(java.lang.String user)
          Sets the JDBC user name used to open an underlying connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XADataSourceImpl

public XADataSourceImpl()
Empty constructure for beans, reflection, etc.

XADataSourceImpl

public XADataSourceImpl(java.lang.String url,
                        java.util.Properties properties)
Specifies the URL and properties to connect to the underlying driver. If the properties are null, they will not be used.
Method Detail

getURL

public java.lang.String getURL()
Gets the JDBC URL used to open an underlying connection.

setURL

public void setURL(java.lang.String url)
Sets the JDBC URL used to open an underlying connection.

getUser

public java.lang.String getUser()
Gets the JDBC user name used to open an underlying connection.

setUser

public void setUser(java.lang.String user)
Sets the JDBC user name used to open an underlying connection. This is optional - use it only if your underlying driver requires it.

getPassword

public java.lang.String getPassword()
Gets the JDBC password used to open an underlying connection.

setPassword

public void setPassword(java.lang.String password)
Sets the JDBC password used to open an underlying connection. This is optional - use it only if your underlying driver requires it.

getProperties

public java.util.Properties getProperties()
Gets the JDBC properties used to open an underlying connection.

setProperties

public void setProperties(java.util.Properties properties)
Sets the JDBC properties used to open an underlying connection. This is optional - use it only if your underlying driver requires it.

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Gets the log writer used to record when XAConnections are opened.
Specified by:
getLogWriter in interface javax.sql.XADataSource

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
                  throws java.sql.SQLException
Sets a log writer used to record when XAConnections are opened.
Specified by:
setLogWriter in interface javax.sql.XADataSource

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
This is not used by the current implementation, since the effect would differ depending on the underlying driver.
Specified by:
getLoginTimeout in interface javax.sql.XADataSource

setLoginTimeout

public void setLoginTimeout(int timeout)
                     throws java.sql.SQLException
This is not used by the current implementation, since the effect would differ depending on the underlying driver.
Specified by:
setLoginTimeout in interface javax.sql.XADataSource

getXAConnection

public javax.sql.XAConnection getXAConnection()
                                       throws java.sql.SQLException
Gets an XAConnection. This first gets a java.sql.Connection from the underlying driver, and then wraps it in an XAConnection and XAResource. This uses the URL, user, password, and properties (or as many as you have specified) to make the connection.
Specified by:
getXAConnection in interface javax.sql.XADataSource

getXAConnection

public javax.sql.XAConnection getXAConnection(java.lang.String user,
                                              java.lang.String password)
                                       throws java.sql.SQLException
Gets an XAConnection. This first gets a java.sql.Connection from the underlying driver, and then wraps it in an XAConnection and XAResource. This first sets the default user name and password to the values you specify. Then it uses those, the URL, and properties (or as many as you have specified) to make the connection.
Specified by:
getXAConnection in interface javax.sql.XADataSource


Copyright © 2000 The jBoss Organization. All Rights Reserved.