org.objectweb.jonas.jdbc_xa
Class XADataSourceImpl

java.lang.Object
  |
  +--org.objectweb.jonas.jdbc_xa.XADataSourceImpl
All Implemented Interfaces:
javax.sql.XADataSource

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

The XADataSource implementation in our pseudo JDBC-XA driver. Acts as a factory for XAConnection objects. Created by our DataSource implementation, in the JOnAS Server. There is one XADataSource for each DataSource JDBC which do not have this kind of driver in standard (all databases today!)

Author:
Philippe Durieux Contributor(s):

Constructor Summary
XADataSourceImpl()
          Constructor for Factory
 
Method Summary
 java.lang.String getClassName()
           
 java.lang.String getDataSourceName()
           
 int getLoginTimeout()
          Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
 java.io.PrintWriter getLogWriter()
          Get the log writer for this data source.
 java.lang.String getPassword()
           
 java.lang.String getUrl()
           
 java.lang.String getUserName()
           
 javax.sql.XAConnection getXAConnection()
          Attempt to establish a database connection.
 javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String passwd)
          Attempt to establish a database connection.
 void setClassName(java.lang.String s)
           
 void setDataSourceName(java.lang.String s)
           
 void setLoginTimeout(int seconds)
          Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
 void setLogWriter(java.io.PrintWriter out)
          Set the log writer for this data source.
 void setPassword(java.lang.String s)
           
 void setTransactionIsolation(int level)
           
 void setUrl(java.lang.String s)
           
 void setUserName(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XADataSourceImpl

public XADataSourceImpl()
Constructor for Factory
Method Detail

getDataSourceName

public java.lang.String getDataSourceName()

setDataSourceName

public void setDataSourceName(java.lang.String s)

getUrl

public java.lang.String getUrl()

setUrl

public void setUrl(java.lang.String s)

getClassName

public java.lang.String getClassName()

setClassName

public void setClassName(java.lang.String s)

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String s)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String s)

setTransactionIsolation

public void setTransactionIsolation(int level)

getXAConnection

public javax.sql.XAConnection getXAConnection()
                                       throws java.sql.SQLException
Attempt to establish a database connection.
Specified by:
getXAConnection in interface javax.sql.XADataSource
Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs.

getXAConnection

public javax.sql.XAConnection getXAConnection(java.lang.String user,
                                              java.lang.String passwd)
                                       throws java.sql.SQLException
Attempt to establish a database connection.
Specified by:
getXAConnection in interface javax.sql.XADataSource
Parameters:
user - The database user on whose behalf the Connection is being made
passwd - the user's password
Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs.

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Get the log writer for this data source.
Specified by:
getLogWriter in interface javax.sql.XADataSource
Returns:
PrintWritert he log writer for this data source, null if disabled
Throws:
java.sql.SQLException - if a database-access error occurs.

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws java.sql.SQLException
Set the log writer for this data source.
Specified by:
setLogWriter in interface javax.sql.XADataSource
Parameters:
out - the new log writer; to disable, set to null
Throws:
java.sql.SQLException - if a database-access error occurs.

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws java.sql.SQLException
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
Specified by:
setLoginTimeout in interface javax.sql.XADataSource
Parameters:
seconds - the data source login time limit
Throws:
java.sql.SQLException - if a database-access error occurs.

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
Specified by:
getLoginTimeout in interface javax.sql.XADataSource
Returns:
the data source login time limit
Throws:
java.sql.SQLException - if a database-access error occurs.