KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > access > OperationObserver


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20
21 package org.apache.cayenne.access;
22
23 import java.util.List JavaDoc;
24
25 import org.apache.cayenne.query.Query;
26
27 /**
28  * Defines a set of callback methods that allow QueryEngine to pass back query results and
29  * notify caller about exceptions.
30  *
31  * @see org.apache.cayenne.access.QueryEngine
32  * @author Andrus Adamchik
33  */

34 // TODO: need a name that better reflects the functionality,
35
// e.g. OperationContext or QueryContext
36
public interface OperationObserver extends OperationHints {
37
38     /**
39      * Callback method invoked after an updating query is executed.
40      */

41     public void nextCount(Query query, int resultCount);
42
43     /**
44      * Callback method invoked after a batch update is executed.
45      */

46     public void nextBatchCount(Query query, int[] resultCount);
47
48     /**
49      * Callback method invoked for each processed ResultSet.
50      */

51     public void nextDataRows(Query query, List JavaDoc dataRows);
52
53     /**
54      * Callback method invoked for each opened ResultIterator. If this observer requested
55      * results to be returned as a ResultIterator, this method is invoked instead of
56      * "nextDataRows(Query,List)". OperationObserver is responsible for closing the
57      * ResultIterators passed via this method.
58      */

59     public void nextDataRows(Query q, ResultIterator it);
60
61     /**
62      * Callback method invoked after each batch of generated values is read durring an
63      * update.
64      *
65      * @since 1.2
66      */

67     public void nextGeneratedDataRows(Query query, ResultIterator keysIterator);
68
69     /**
70      * Callback method invoked on exceptions that happen during an execution of a specific
71      * query.
72      */

73     public void nextQueryException(Query query, Exception JavaDoc ex);
74
75     /**
76      * Callback method invoked on exceptions that are not tied to a specific query
77      * execution, such as JDBC connection exceptions, etc.
78      */

79     public void nextGlobalException(Exception JavaDoc ex);
80 }
81
Popular Tags