KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > DataChannelListener


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 package org.apache.cayenne;
21
22 import org.apache.cayenne.graph.GraphEvent;
23
24 /**
25  * A listener of {@link org.apache.cayenne.DataChannel} lifecycle events. Changes
26  * related to an event are attached as a GraphDiff. If a listener needs to process these
27  * changes, the easiest way to do that is via GraphChangeHandler "visitor":
28  *
29  * <pre>
30  * public void graphChanged(GraphEvent event) {
31  * GraphChangeHandler handler = ..;
32  * event.getDiff().apply(handler);
33  * }
34  * </pre>
35  *
36  * @since 1.2
37  * @author Andrus Adamchik
38  */

39 public interface DataChannelListener {
40
41     /**
42      * Notifies implementing object of the changes that were performed to the object graph
43      * externally, not by one of the channel ObjectContexts.
44      */

45     void graphChanged(GraphEvent event);
46
47     /**
48      * Notifies implementing object that one of the channel ObjectContexts flushed its
49      * changes to the channel.
50      */

51     void graphFlushed(GraphEvent event);
52
53     /**
54      * Notifies implementing object that one of the channel ObjectContexts initiated a
55      * rollback.
56      */

57     void graphRolledback(GraphEvent event);
58 }
59
Popular Tags