com.atomikos.datasource.xa.jdbc
Class JdbcTransactionalResource

java.lang.Object
  extended by com.atomikos.datasource.xa.XATransactionalResource
      extended by com.atomikos.datasource.xa.jdbc.JdbcTransactionalResource
All Implemented Interfaces:
RecoverableResource, TransactionalResource

public class JdbcTransactionalResource
extends XATransactionalResource

A default XATransactionalResource implementation for JDBC.


Field Summary
 
Fields inherited from class com.atomikos.datasource.xa.XATransactionalResource
recoveryMap_, servername_, siblingmappers_, xares_, xidFact_
 
Constructor Summary
JdbcTransactionalResource(String serverName, XADataSource xads)
          Constructs a new instance with a given name and XADataSource.
JdbcTransactionalResource(String serverName, XADataSource xads, XidFactory factory)
          Constructs a new instance with a given name and XADataSource, and an Xid factory to use.
 
Method Summary
 void close()
          Overrides default close to include closing any open connections to the XADataSource.
protected  XAResource refreshXAConnection()
          Implements the functionality to get an XAResource handle.
 void setPassword(String password)
          Optionally set the password with which to get connections for recovery.
 void setUser(String user)
          Optionally set the user name with which to get connections for recovery.
 
Methods inherited from class com.atomikos.datasource.xa.XATransactionalResource
acceptsAllXAResources, createXid, endRecovery, getName, getResourceTransaction, getXAResource, getXidFactory, isClosed, isSameRM, needsRefresh, printMsg, recover, recover, setAcceptAllXAResources, setRecoveryService, setXidFactory, usesWeakCompare, usesXAResource, useWeakCompare
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcTransactionalResource

public JdbcTransactionalResource(String serverName,
                                 XADataSource xads)
Constructs a new instance with a given name and XADataSource.

Parameters:
serverName - The unique name.
xads - The data source.

JdbcTransactionalResource

public JdbcTransactionalResource(String serverName,
                                 XADataSource xads,
                                 XidFactory factory)
Constructs a new instance with a given name and XADataSource, and an Xid factory to use. The custom Xid factory is needed for data servers that do not accept arbitrary Xid formats.

Parameters:
serverName - The unique name.
xads - The data source.
factory - The custom Xid factory.
Method Detail

refreshXAConnection

protected XAResource refreshXAConnection()
                                  throws ResourceException
Implements the functionality to get an XAResource handle.

Specified by:
refreshXAConnection in class XATransactionalResource
Returns:
XAResource The XAResource instance.
Throws:
ResourceException - On failure.

setUser

public void setUser(String user)
Optionally set the user name with which to get connections for recovery. If not set, then the right user name should be configured on the XADataSource directly.

Parameters:
user - The user name.

setPassword

public void setPassword(String password)
Optionally set the password with which to get connections for recovery. If not set, then the right password should be configured on the XADataSource directly.

Parameters:
password - The password.

close

public void close()
           throws ResourceException
Overrides default close to include closing any open connections to the XADataSource.

Specified by:
close in interface RecoverableResource
Overrides:
close in class XATransactionalResource
Throws:
ResourceException


Copyright © 2011. All Rights Reserved.