Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.access
Class DefaultOperationObserver  view DefaultOperationObserver download DefaultOperationObserver.java

java.lang.Object
  extended byorg.objectstyle.cayenne.access.DefaultOperationObserver
All Implemented Interfaces:
OperationHints, OperationObserver

public class DefaultOperationObserver
extends java.lang.Object
implements OperationObserver

Simple implementation of OperationObserver interface. Useful as a superclass of other implementations of OperationObserver.

For more information see Cayenne User Guide.


Field Summary
static org.apache.log4j.Level DEFAULT_LOG_LEVEL
           
protected  java.util.List globalExceptions
           
protected  org.apache.log4j.Level loggingLevel
           
private static org.apache.log4j.Logger logObj
           
protected  java.util.Map queryExceptions
           
protected  boolean transactionCommitted
           
protected  boolean transactionRolledback
           
 
Constructor Summary
DefaultOperationObserver()
           
 
Method Summary
 java.util.List getGlobalExceptions()
          Returns a list of global exceptions that occured during data operation run.
 org.apache.log4j.Level getLoggingLevel()
          Returns a log level level that should be used when logging query execution.
 java.util.Map getQueryExceptions()
          Returns a list of exceptions that occured during data operation run by query.
 boolean hasExceptions()
          Returns true if at least one exception was registered during query execution.
 boolean isIteratedResult()
          Returns false.
 boolean isTransactionCommitted()
           
 boolean isTransactionRolledback()
           
 void nextCount(org.objectstyle.cayenne.query.Query query, int resultCount)
          Invoked after the update (can be insert, delete or update query) is executed.
 void nextDataRows(org.objectstyle.cayenne.query.Query query, java.util.List dataRows)
          Invoked after the next query results are read.
 void nextDataRows(org.objectstyle.cayenne.query.Query q, ResultIterator it)
          Invoked after the next query is invoked, if a query required results to be returned as a ResultIterator.
 void nextGlobalException(java.lang.Exception ex)
          Invoked when a "global" exception occurred, such as JDBC connection exception, etc.
 void nextQueryException(org.objectstyle.cayenne.query.Query query, java.lang.Exception ex)
          Invoked when an exception occurs during query execution.
 java.util.List orderQueries(DataNode aNode, java.util.List queryList)
          Returns query list without altering its ordering.
 void printExceptions(java.io.PrintWriter out)
          Prints the information about query and global exceptions.
 void setLoggingLevel(org.apache.log4j.Level level)
          Sets log level that should be used for queries.
 void transactionCommitted()
          Invoked when a batch of queries was processed as a single transaction, and this transaction was successfully committed.
 void transactionRolledback()
          Invoked when a batch of queries was processed as a single transaction, and this transaction was failed and was rolled back.
 boolean useAutoCommit()
          Returns true so that individual queries are executed in separate transactions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectstyle.cayenne.access.OperationObserver
nextBatchCount
 

Field Detail

logObj

private static org.apache.log4j.Logger logObj

DEFAULT_LOG_LEVEL

public static final org.apache.log4j.Level DEFAULT_LOG_LEVEL

globalExceptions

protected java.util.List globalExceptions

queryExceptions

protected java.util.Map queryExceptions

transactionCommitted

protected boolean transactionCommitted

transactionRolledback

protected boolean transactionRolledback

loggingLevel

protected org.apache.log4j.Level loggingLevel
Constructor Detail

DefaultOperationObserver

public DefaultOperationObserver()
Method Detail

printExceptions

public void printExceptions(java.io.PrintWriter out)
Prints the information about query and global exceptions.


getGlobalExceptions

public java.util.List getGlobalExceptions()
Returns a list of global exceptions that occured during data operation run.


getQueryExceptions

public java.util.Map getQueryExceptions()
Returns a list of exceptions that occured during data operation run by query.


hasExceptions

public boolean hasExceptions()
Returns true if at least one exception was registered during query execution.


isTransactionCommitted

public boolean isTransactionCommitted()

isTransactionRolledback

public boolean isTransactionRolledback()

getLoggingLevel

public org.apache.log4j.Level getLoggingLevel()
Returns a log level level that should be used when logging query execution.

Specified by:
getLoggingLevel in interface OperationHints

setLoggingLevel

public void setLoggingLevel(org.apache.log4j.Level level)
Sets log level that should be used for queries. If level argument is null, level is set to DEFAULT_LOG_LEVEL. If level is equal or higher than log level configured for QueryLogger, query SQL statements will be logged.


nextCount

public void nextCount(org.objectstyle.cayenne.query.Query query,
                      int resultCount)
Description copied from interface: OperationObserver
Invoked after the update (can be insert, delete or update query) is executed.

Specified by:
nextCount in interface OperationObserver

nextDataRows

public void nextDataRows(org.objectstyle.cayenne.query.Query query,
                         java.util.List dataRows)
Description copied from interface: OperationObserver
Invoked after the next query results are read.

Specified by:
nextDataRows in interface OperationObserver

nextDataRows

public void nextDataRows(org.objectstyle.cayenne.query.Query q,
                         ResultIterator it)
Description copied from interface: OperationObserver
Invoked after the next query is invoked, if a query required results to be returned as a ResultIterator. OperationObserver is responsible for closing the ResultIterator.

Specified by:
nextDataRows in interface OperationObserver

nextQueryException

public void nextQueryException(org.objectstyle.cayenne.query.Query query,
                               java.lang.Exception ex)
Description copied from interface: OperationObserver
Invoked when an exception occurs during query execution.

Specified by:
nextQueryException in interface OperationObserver

nextGlobalException

public void nextGlobalException(java.lang.Exception ex)
Description copied from interface: OperationObserver
Invoked when a "global" exception occurred, such as JDBC connection exception, etc.

Specified by:
nextGlobalException in interface OperationObserver

transactionCommitted

public void transactionCommitted()
Description copied from interface: OperationObserver
Invoked when a batch of queries was processed as a single transaction, and this transaction was successfully committed.

Specified by:
transactionCommitted in interface OperationObserver

transactionRolledback

public void transactionRolledback()
Description copied from interface: OperationObserver
Invoked when a batch of queries was processed as a single transaction, and this transaction was failed and was rolled back.

Specified by:
transactionRolledback in interface OperationObserver

useAutoCommit

public boolean useAutoCommit()
Returns true so that individual queries are executed in separate transactions.

Specified by:
useAutoCommit in interface OperationHints

orderQueries

public java.util.List orderQueries(DataNode aNode,
                                   java.util.List queryList)
Returns query list without altering its ordering.


isIteratedResult

public boolean isIteratedResult()
Returns false.

Specified by:
isIteratedResult in interface OperationHints