Package org.apache.cayenne.access.util
Class DefaultOperationObserver
java.lang.Object
org.apache.cayenne.access.util.DefaultOperationObserver
- All Implemented Interfaces:
- OperationHints,- OperationObserver
- Direct Known Subclasses:
- IteratedSelectObserver
public class DefaultOperationObserver extends Object implements OperationObserver
Simple implementation of OperationObserver interface. Useful as a superclass
 of other implementations of OperationObserver. This implementation only
 tracks transaction events and exceptions.
 
This operation observer is unsafe to use in application, since it doesn't rethrow the exceptions immediately, and may cause the database to hang.
- 
Field SummaryFields Modifier and Type Field Description protected List<Throwable>globalExceptionsprotected Map<Query,Throwable>queryExceptions
- 
Constructor SummaryConstructors Constructor Description DefaultOperationObserver()
- 
Method SummaryModifier and Type Method Description List<Throwable>getGlobalExceptions()Returns a list of global exceptions that occured during data operation run.Map<Query,Throwable>getQueryExceptions()Returns a list of exceptions that occured during data operation run by query.booleanhasExceptions()Returnstrueif at least one exception was registered during query execution.booleanisIteratedResult()Returnsfalse.voidnextBatchCount(Query query, int[] resultCount)Callback method invoked after a batch update is executed.voidnextCount(Query query, int resultCount)Callback method invoked after an updating query is executed.voidnextGeneratedRows(Query query, ResultIterator keys, ObjectId idToUpdate)Closes ResultIterator without reading its data.voidnextGlobalException(Exception ex)Callback method invoked on exceptions that are not tied to a specific query execution, such as JDBC connection exceptions, etc.voidnextQueryException(Query query, Exception ex)Callback method invoked on exceptions that happen during an execution of a specific query.voidnextRows(Query query, List<?> dataRows)Callback method invoked for each processed ResultSet.voidnextRows(Query query, ResultIterator it)Closes ResultIterator without reading its data.voidprintExceptions(PrintWriter out)Prints the information about query and global exceptions.
- 
Field Details- 
globalExceptions
- 
queryExceptions
 
- 
- 
Constructor Details- 
DefaultOperationObserverpublic DefaultOperationObserver()
 
- 
- 
Method Details- 
printExceptionsPrints the information about query and global exceptions.
- 
getGlobalExceptionsReturns a list of global exceptions that occured during data operation run.
- 
getQueryExceptionsReturns a list of exceptions that occured during data operation run by query.
- 
hasExceptionspublic boolean hasExceptions()Returnstrueif at least one exception was registered during query execution.
- 
nextCountDescription copied from interface:OperationObserverCallback method invoked after an updating query is executed.- Specified by:
- nextCountin interface- OperationObserver
 
- 
nextBatchCountDescription copied from interface:OperationObserverCallback method invoked after a batch update is executed.- Specified by:
- nextBatchCountin interface- OperationObserver
 
- 
nextRowsDescription copied from interface:OperationObserverCallback method invoked for each processed ResultSet.- Specified by:
- nextRowsin interface- OperationObserver
 
- 
nextRowsCloses ResultIterator without reading its data. If you implement a custom subclass, only call super if closing the iterator is what you need.- Specified by:
- nextRowsin interface- OperationObserver
 
- 
nextGeneratedRowsCloses ResultIterator without reading its data. If you implement a custom subclass, only call super if closing the iterator is what you need.- Specified by:
- nextGeneratedRowsin interface- OperationObserver
- Since:
- 4.0
 
- 
nextQueryExceptionDescription copied from interface:OperationObserverCallback method invoked on exceptions that happen during an execution of a specific query.- Specified by:
- nextQueryExceptionin interface- OperationObserver
 
- 
nextGlobalExceptionDescription copied from interface:OperationObserverCallback method invoked on exceptions that are not tied to a specific query execution, such as JDBC connection exceptions, etc.- Specified by:
- nextGlobalExceptionin interface- OperationObserver
 
- 
isIteratedResultpublic boolean isIteratedResult()Returnsfalse.- Specified by:
- isIteratedResultin interface- OperationHints
 
 
-