|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.jdbc.FakeXADataSource
public class FakeXADataSource
A "fake" XADataSource implemented on top of the old JDBC 1.0 architecture or a non-XA DataSource. The peculiar behaviour of this class should be taken into consideration before using it. This class is designed only for use with the MonitoredDataSource and the XAOnlyDataSource.
As indicated by it's namesake, this XADataSource is not a real XADataSource, nor do it's connections behave like connections from a real XADataSource. Most notably, two-phase commits are NOT supported. In a two-phase commit, connections from this XADataSource commit on the commit phase ignoring the prepare phase completely. Setting the property "commitOnPrepare" to true will cause commits to be performed on the prepare phase. Either way is problematic since commiting on the prepare phase will prevent rollbacks should one of the other enlisted resources request a rollback and commiting on the commit phase will produce an error should the fake XAConnection's commit fail.
In a distributed transaction two connections from the same DB in the same transaction should be able to see each other's changes. This fake XADataSource will attempt to insure that the same underlying connection is returned each time getConnection() is called within the same transaction. As such, any given transaction should have only one connection out of the pool at a time. This condition is not enforced however. If this condition is not adhered to and a transaction nests calls to getConnection(), there is potential for the nested call to step on result sets still in use by the first connection.
This fake XADataSource can be configured to use either a non-XA DataSource or a JDBC 1.0 style driver. To configure for a non-XA DataSource look at the properties:
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
FakeXADataSource()
Constructs an uninitialized JDBCConnectionPool. |
Method Summary | |
---|---|
java.util.Properties |
getAdditionalConnectionProperties()
Returns property additionalConnectionProperties. |
boolean |
getCloseOrphanedConnections()
Whether to close orphaned connections at the end of a transaction. |
java.lang.String |
getDatabase()
Returns property database. |
javax.sql.DataSource |
getDataSource()
Returns property dataSource. |
java.util.Properties |
getDataSourceJNDIEnvironment()
Returns property dataSourceJNDIEnvironment. |
java.lang.String |
getDataSourceJNDIName()
Returns property dataSourceJNDIName. |
java.lang.String |
getDriver()
Returns property driver. |
atg.nucleus.PropertyValueDecoder |
getLoginDecoder()
Returns the LoginDecoder used to decode the user and password values before connecting to the database |
int |
getLoginTimeout()
This property from the DataSource interface is not used. |
java.io.PrintWriter |
getLogWriter()
This property from the DataSource interface is ignored. |
boolean |
getNeedsSeparateUserInfo()
Returns property needsSeparateUserInfo. |
java.lang.String |
getPassword()
Returns property password. |
boolean |
getReadOnly()
Returns property readOnly. |
java.lang.String |
getServer()
Returns property server. |
java.lang.String |
getURL()
Returns property URL. |
java.lang.String |
getUser()
Returns property user. |
javax.sql.XAConnection |
getXAConnection()
Returns a fake XAConnection wrapping a Connection from the underlying JDBC driver. |
javax.sql.XAConnection |
getXAConnection(java.lang.String pUsername,
java.lang.String pPassword)
Returns a fake XAConnection wrapping a Connection from the underlying JDBC driver using the supplied username and password. |
boolean |
isCommitOnPrepare()
Returns property commitOnPrepare. |
void |
setAdditionalConnectionProperties(java.util.Properties pAdditionalConnectionProperties)
Sets property additionalConnectionProperties. |
void |
setCloseOrphanedConnections(boolean pCloseOrphanedConnections)
Whether to close orphaned connections at the end of a transaction. |
void |
setCommitOnPrepare(boolean pCommitOnPrepare)
Sets property commitOnPrepare. |
void |
setDatabase(java.lang.String pDatabase)
Sets property database. |
void |
setDataSource(javax.sql.DataSource pDataSource)
Sets the property dataSource. |
void |
setDataSourceJNDIEnvironment(java.util.Properties pDataSourceJNDIEnvironment)
Sets property dataSourceJNDIEnvironment. |
void |
setDataSourceJNDIName(java.lang.String pDataSourceJNDIName)
Sets property dataSourceJNDIName. |
void |
setDriver(java.lang.String pDriver)
Sets property driver. |
void |
setLoginDecoder(atg.nucleus.PropertyValueDecoder pLoginDecoder)
Sets the Decoder to be used to decode the user and password values before connecting to the database |
void |
setLoginTimeout(int pLoginTimeout)
This property from the DataSource interface is not used. |
void |
setLogWriter(java.io.PrintWriter pLogWriter)
This property from the DataSource interface is ignored. |
void |
setNeedsSeparateUserInfo(boolean pNeedsSeparateUserInfo)
Sets property needsSeparateUserInfo. |
void |
setPassword(java.lang.String pPassword)
Sets property password. |
void |
setReadOnly(boolean pReadOnly)
Sets property readOnly. |
void |
setServer(java.lang.String pServer)
Sets property server. |
void |
setURL(java.lang.String pURL)
Sets property URL. |
void |
setUser(java.lang.String pUser)
Sets property user. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public FakeXADataSource()
Method Detail |
---|
public void setCommitOnPrepare(boolean pCommitOnPrepare)
pCommitOnPrepare
- new value to setpublic boolean isCommitOnPrepare()
public void setDriver(java.lang.String pDriver)
pDriver
- new value to setpublic java.lang.String getDriver()
public void setURL(java.lang.String pURL)
pURL
- new value to setpublic java.lang.String getURL()
public void setServer(java.lang.String pServer)
pServer
- new value to setpublic java.lang.String getServer()
public void setDatabase(java.lang.String pDatabase)
pDatabase
- new value to setpublic java.lang.String getDatabase()
public void setLoginDecoder(atg.nucleus.PropertyValueDecoder pLoginDecoder)
public atg.nucleus.PropertyValueDecoder getLoginDecoder()
public void setUser(java.lang.String pUser)
pUser
- new value to setpublic java.lang.String getUser()
public void setPassword(java.lang.String pPassword)
pPassword
- new value to setpublic java.lang.String getPassword()
public void setAdditionalConnectionProperties(java.util.Properties pAdditionalConnectionProperties)
pAdditionalConnectionProperties
- new value to setpublic java.util.Properties getAdditionalConnectionProperties()
public void setNeedsSeparateUserInfo(boolean pNeedsSeparateUserInfo)
pNeedsSeparateUserInfo
- new value to setpublic boolean getNeedsSeparateUserInfo()
public void setReadOnly(boolean pReadOnly)
pReadOnly
- new value to setpublic boolean getReadOnly()
public void setDataSourceJNDIName(java.lang.String pDataSourceJNDIName)
pDataSourceJNDIName
- new value to setpublic java.lang.String getDataSourceJNDIName()
public void setDataSourceJNDIEnvironment(java.util.Properties pDataSourceJNDIEnvironment)
pDataSourceJNDIEnvironment
- new value to setpublic java.util.Properties getDataSourceJNDIEnvironment()
public void setDataSource(javax.sql.DataSource pDataSource)
pDataSource
- new value to setpublic javax.sql.DataSource getDataSource()
public void setLoginTimeout(int pLoginTimeout)
setLoginTimeout
in interface javax.sql.CommonDataSource
pLoginTimeout
- new value to setpublic int getLoginTimeout()
getLoginTimeout
in interface javax.sql.CommonDataSource
public void setLogWriter(java.io.PrintWriter pLogWriter)
setLogWriter
in interface javax.sql.CommonDataSource
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.CommonDataSource
public void setCloseOrphanedConnections(boolean pCloseOrphanedConnections)
public boolean getCloseOrphanedConnections()
public javax.sql.XAConnection getXAConnection() throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
java.sql.SQLException
public javax.sql.XAConnection getXAConnection(java.lang.String pUsername, java.lang.String pPassword) throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |