|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.service.jdbc.XAOnlyDataSource
public class XAOnlyDataSource
An application server tier DataSource that sits on top of an XADataSource and registers/unregisters XAConnections with the TransactionManager. This DataSource provides no pooling features of its own.
This DataSource is designed to only work on top of an XADataSource. Therefore, when used within the scope of a distributed transaction commit(), rollback(), and setAutoCommit() should never be called on Connections obtained from it. Those functions are executed by the TransactionManager. When used in local transaction mode, i.e. outside the scope of a distributed transaction, all of the Connections transactional methods are available for use.
Typical usage of this DataSource might look as follows:
DataSource ds =Note this example assumes a distributed transaction is in place meaning transactioning is handled by JTA and no transactioning methods are called on the Connection itself.; Connection c = null; try { try { c = ds.getConnection(); // Various work without calling c.commit() or c.rollback(). } finally { // Closing of the Connection must always occur or else // Connections will not be returned to the pool properly! if (c != null) c.close(); } } catch (SQLException sqle) { // If something went wrong, we might want to rollback // the transaction. }
All Connections produced by this DataSource are MonitoredConnections, i.e. they are normal Connections wrapped for the purpose of gathering statistics. Because of this, message logging is achievable at a finer granularity. The standard ApplicationLogging interface exists for messages generated by the DataSource proper and a variant of the interface is implemented for the logging of messages generated by Connections. Use the methods loggingSQLInfo(), loggingSQLDebug(), loggingSQLWarning(), and loggingSQLError() to turn off message logging for Connections created by this DataSource.
| Nested Class Summary | |
|---|---|
class |
XAOnlyDataSource.SQLLogging
A utility class which builds a separate logging interface for SQL logging to have access to. |
| 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 | |
|---|---|
XAOnlyDataSource()
Constructs an uninitialized XAOnlyDataSource. |
|
| Method Summary | |
|---|---|
void |
connectionClosed(javax.sql.ConnectionEvent pEvent)
Invoked when the application calls close() on its representation of the connection. |
void |
connectionErrorOccurred(javax.sql.ConnectionEvent pEvent)
Invoked when a fatal connection error occurs, just before an SQLException is thrown to the application. |
void |
doStartService()
Things to do when the service starts up. |
int |
getCommitCount()
Returns the number of times commit() has been called |
java.sql.Connection |
getConnection()
Returns a Connection that is participating in the current Transaction using the default username and password. |
java.sql.Connection |
getConnection(java.lang.String pUsername,
java.lang.String pPassword)
Returns a Connection that is participating in the current Transaction using the given username and password. |
int |
getCreateStatementCount()
Returns the number of times createStatement() has been called |
javax.sql.XADataSource |
getDataSource()
Returns property dataSource. |
java.util.Properties |
getDataSourceJNDIEnvironment()
Returns property dataSourceJNDIEnvironment. |
java.lang.String |
getDataSourceJNDIName()
Returns property dataSourceJNDIName. |
int |
getErrorCount()
Returns the number of times a SQLException resulted from calls. |
int |
getExecuteCount()
Returns the number of times Statement.execute() has been called |
int |
getExecuteQueryCount()
Returns the number of times Statement.executeQuery() has been called |
int |
getExecuteUpdateCount()
Returns the number of times Statement.executeUpdate() has been called |
int |
getGetMoreResultsCount()
Returns the number of times Statement.getMoreResults() has been called |
java.lang.String[] |
getInitializingSQL()
Returns property initializingSQL. |
int |
getLoginTimeout()
Returns property loginTimeout. |
java.io.PrintWriter |
getLogWriter()
This property from the DataSource interface is ignored. |
java.lang.Integer |
getMaxFieldSize()
Returns the size of the data that can be returned for any column. |
java.lang.Integer |
getMaxRows()
Returns the maximum number of rows that can be returned for any query. |
int |
getPrepareCallCount()
Returns the number of times prepareCall() has been called |
int |
getPrepareStatementCount()
Returns the number of times prepareStatement() has been called |
java.lang.Integer |
getQueryTimeout()
Returns the maximum number of seconds that the driver will wait for a Statement to execute. |
int |
getResultSetRowCount()
Returns the number of times ResultSet.next() has been called |
int |
getRollbackCount()
Returns the number of times rollback() has been called |
javax.transaction.TransactionManager |
getTransactionManager()
Returns property transactionManager. |
void |
incrementCommitCount()
Increments the number of times commit() has been called |
void |
incrementCreateStatementCount()
Increments the number of times createStatement() has been called |
void |
incrementErrorCount()
Increments the number of times a SQLException resulted from calls. |
void |
incrementExecuteCount()
Increments the number of times Statement.execute() has been called |
void |
incrementExecuteQueryCount()
Increments the number of times Statement.executeQuery() has been called |
void |
incrementExecuteUpdateCount()
Increments the number of times Statement.executeUpdate() has been called |
void |
incrementGetMoreResultsCount()
Increments the number of times Statement.getMoreResults() has been called |
void |
incrementPrepareCallCount()
Increments the number of times prepareCall() has been called |
void |
incrementPrepareStatementCount()
Increments the number of times prepareStatement() has been called |
void |
incrementResultSetRowCount()
Increments the number of times ResultSet.next() has been called |
void |
incrementRollbackCount()
Increments the number of times rollback() has been called |
boolean |
isAssociativeFakeXA()
Returns property associativeFakeXA. |
boolean |
isEnlistBeforeGet()
Returns property enlistBeforeGet. |
boolean |
isLoggingSQLDebug()
This method returns whether or not an debug log event should be broadcast for MonitoredConnections. |
boolean |
isLoggingSQLError()
This method returns whether or not an error log event should be broadcast for MonitoredConnections. |
boolean |
isLoggingSQLInfo()
This method returns whether or not an info log event should be broadcast for MonitoredConnections. |
boolean |
isLoggingSQLWarning()
This method returns whether or not an warning log event should be broadcast for MonitoredConnections. |
void |
setAssociativeFakeXA(boolean pAssociativeFakeXA)
Sets property associativeFakeXA. |
void |
setDataSource(javax.sql.XADataSource pXADataSource)
Sets the property dataSource. |
void |
setDataSourceJNDIEnvironment(java.util.Properties pDataSourceJNDIEnvironment)
Sets property dataSourceJNDIEnvironment. |
void |
setDataSourceJNDIName(java.lang.String pDataSourceJNDIName)
Sets property dataSourceJNDIName. |
void |
setEnlistBeforeGet(boolean pEnlistBeforeGet)
Sets property enlistBeforeGet. |
void |
setInitializingSQL(java.lang.String[] pInitializingSQL)
Sets property initializingSQL. |
void |
setLoggingSQLDebug(boolean pLogging)
Sets whether or not error log events should be logged for MonitoredConnections. |
void |
setLoggingSQLError(boolean pLogging)
Sets whether or not error log events should be logged for MonitoredConnections. |
void |
setLoggingSQLInfo(boolean pLogging)
Sets whether or not info log events should be logged for MonitoredConnections. |
void |
setLoggingSQLWarning(boolean pLogging)
Sets whether or not warning log events should be logged for MonitoredConnections. |
void |
setLoginTimeout(int pLoginTimeout)
Sets property loginTimeout. |
void |
setLogWriter(java.io.PrintWriter pLogWriter)
This property from the DataSource interface is ignored. |
void |
setMaxFieldSize(java.lang.Integer pMaxFieldSize)
Sets the size of the data that can be returned for any column. |
void |
setMaxRows(java.lang.Integer pMaxRows)
Sets the maximum number of rows that can be returned for any query. |
void |
setQueryTimeout(java.lang.Integer pQueryTimeout)
Sets the maximum number of seconds that the driver will wait for a Statement to execute. |
void |
setTransactionManager(javax.transaction.TransactionManager pValue)
|
| 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 XAOnlyDataSource()
| Method Detail |
|---|
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.XADataSource pXADataSource)
pXADataSource - new value to setpublic javax.sql.XADataSource getDataSource()
public void setTransactionManager(javax.transaction.TransactionManager pValue)
public javax.transaction.TransactionManager getTransactionManager()
public boolean isLoggingSQLInfo()
public void setLoggingSQLInfo(boolean pLogging)
public boolean isLoggingSQLWarning()
public void setLoggingSQLWarning(boolean pLogging)
public boolean isLoggingSQLError()
public void setLoggingSQLError(boolean pLogging)
public boolean isLoggingSQLDebug()
public void setLoggingSQLDebug(boolean pLogging)
public java.lang.Integer getMaxFieldSize()
public void setMaxFieldSize(java.lang.Integer pMaxFieldSize)
public java.lang.Integer getMaxRows()
public void setMaxRows(java.lang.Integer pMaxRows)
public java.lang.Integer getQueryTimeout()
public void setQueryTimeout(java.lang.Integer pQueryTimeout)
public void setInitializingSQL(java.lang.String[] pInitializingSQL)
pInitializingSQL - new value to setpublic java.lang.String[] getInitializingSQL()
public void setEnlistBeforeGet(boolean pEnlistBeforeGet)
pEnlistBeforeGet - new value to setpublic boolean isEnlistBeforeGet()
public void setAssociativeFakeXA(boolean pAssociativeFakeXA)
pAssociativeFakeXA - new value to setpublic boolean isAssociativeFakeXA()
public void setLoginTimeout(int pLoginTimeout)
setLoginTimeout in interface javax.sql.DataSourcepLoginTimeout - new value to setpublic int getLoginTimeout()
getLoginTimeout in interface javax.sql.DataSourcepublic void setLogWriter(java.io.PrintWriter pLogWriter)
setLogWriter in interface javax.sql.DataSourcepublic java.io.PrintWriter getLogWriter()
getLogWriter in interface javax.sql.DataSource
public void doStartService()
throws ServiceException
doStartService in class GenericServiceServiceException - if the Service had a problem starting up
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLException
public java.sql.Connection getConnection(java.lang.String pUsername,
java.lang.String pPassword)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic void connectionClosed(javax.sql.ConnectionEvent pEvent)
connectionClosed in interface javax.sql.ConnectionEventListenerpEvent - an event object describing the source of the eventpublic void connectionErrorOccurred(javax.sql.ConnectionEvent pEvent)
connectionErrorOccurred in interface javax.sql.ConnectionEventListenerpEvent - an event object describing the source of the eventpublic void incrementErrorCount()
incrementErrorCount in interface ConnectionStatspublic int getErrorCount()
public void incrementCommitCount()
incrementCommitCount in interface ConnectionStatspublic int getCommitCount()
public void incrementRollbackCount()
incrementRollbackCount in interface ConnectionStatspublic int getRollbackCount()
public void incrementCreateStatementCount()
incrementCreateStatementCount in interface ConnectionStatspublic int getCreateStatementCount()
public void incrementPrepareStatementCount()
incrementPrepareStatementCount in interface ConnectionStatspublic int getPrepareStatementCount()
public void incrementPrepareCallCount()
incrementPrepareCallCount in interface ConnectionStatspublic int getPrepareCallCount()
public void incrementExecuteQueryCount()
incrementExecuteQueryCount in interface ConnectionStatspublic int getExecuteQueryCount()
public void incrementExecuteUpdateCount()
incrementExecuteUpdateCount in interface ConnectionStatspublic int getExecuteUpdateCount()
public void incrementExecuteCount()
incrementExecuteCount in interface ConnectionStatspublic int getExecuteCount()
public void incrementGetMoreResultsCount()
incrementGetMoreResultsCount in interface ConnectionStatspublic int getGetMoreResultsCount()
public void incrementResultSetRowCount()
incrementResultSetRowCount in interface ConnectionStatspublic int getResultSetRowCount()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||