KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > descriptors > DescriptorEventListener


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.descriptors;
23
24 import java.util.*;
25
26 /**
27  * <p><b>Purpose</b>: Used to support Java event listener event model on descriptors.
28  * Events can be registered for, through two methods, the first is by providing a method
29  * to be called on the object that a paticualr operation is being performed on.
30  * The second is by registering an event listener object to be notified when any event occurs
31  * for that descriptor. The second method is more similar to the java beans event model
32  * and requires the registered listener to implement the DescriptorEventListener interface.
33  *
34  * @see DescriptorEventAdapter
35  * @see DescriptorEventManager
36  * @see DescriptorEvent
37  */

38 public interface DescriptorEventListener extends EventListener {
39
40     /**
41      * This event is raised before an object is deleted from the database.
42      * The object's row has already been built and is accessible from the event.
43      * This event can be used to amend an object's delete row.
44      */

45     // CR#2660080 was missing aboutToDelete
46
public void aboutToDelete(DescriptorEvent event);
47     
48     /**
49      * This event is raised before a new object is inserted to the database.
50      * The object's row has already been built and is accessible from the event.
51      * This event can be used to amend an object's insert row.
52      */

53     public void aboutToInsert(DescriptorEvent event);
54
55     /**
56      * This event is raised before an object is updated in the database.
57      * This event is only raised for object's that have changes and will be updated.
58      * The object's row has already been built and is accessible from the event.
59      * This event can be used to amend an object's update row.
60      */

61     public void aboutToUpdate(DescriptorEvent event);
62
63     /**
64      * Implementers should define this method if they need or want to restrict
65      * the calling of inherited events.
66      */

67      public boolean isOverriddenEvent(DescriptorEvent event, Vector eventManagers);
68      
69     /**
70      * This event is raised after an object is built from its row on a read operation.
71      * This event can be used to initialize non-persistent or non-mapped state in the object.
72      */

73     public void postBuild(DescriptorEvent event);
74
75     /**
76      * This event is raised after an object is cloned into a unit of work.
77      * This event can be used to initialize non-mapped state in the object.
78      * The event source/object is the unit of work clone,
79      * the event originalObject is the original object from the session cache.
80      */

81     public void postClone(DescriptorEvent event);
82
83     /**
84      * This event is raised after an object is deleted from the database.
85      */

86     public void postDelete(DescriptorEvent event);
87
88     /**
89      * This event is raised after an object is inserted to the database.
90      */

91     public void postInsert(DescriptorEvent event);
92
93     /**
94      * This event is raised after an object is merged from a unit of work into its parent.
95      * This event can be used to initialize non-mapped state in the parent object.
96      * The event source/object is the parent session object that was merged into,
97      * the event originalObject is the unit of work clone that was merged from.
98      */

99     public void postMerge(DescriptorEvent event);
100
101     /**
102      * This event is raised after an object is refreshed from its row on a refresh operation.
103      * This event can be used to initialize non-persistent or non-mapped state in the object.
104      */

105     public void postRefresh(DescriptorEvent event);
106
107     /**
108      * This event is raised after an object updated in the database.
109      * This event is only raised for objects that had changes and were updated.
110      */

111     public void postUpdate(DescriptorEvent event);
112
113     /**
114      * This event is raised after an object is inserted or updated in the database.
115      * This event is only raised for new objects or objects that had changes and were updated.
116      */

117     public void postWrite(DescriptorEvent event);
118     
119     /**
120      * This event is raised before an object is deleted from the database.
121      */

122     public void preDelete(DescriptorEvent event);
123
124     /**
125      * This event is raised before an object is inserted to the database.
126      */

127     public void preInsert(DescriptorEvent event);
128
129     /**
130      * This event is only raised by the EntityManager. It is raised when the
131      * create operation is initiated on an object.
132      */

133     public void prePersist(DescriptorEvent event);
134     
135     /**
136      * This event is raised when the remove operation is initiated on an object.
137      */

138     public void preRemove(DescriptorEvent event);
139     
140     /**
141      * This event is raised for all existing objects written or committed in a unit of work.
142      * This event is raised before the object's changes are computed,
143      * so the object may still be modified by the event.
144      * If the object has no changes, it will not be updated in a unit of work.
145      */

146     public void preUpdate(DescriptorEvent event);
147
148     /**
149      * This event is raised before an object is updated regardless if the object
150      * has any database changes. This event was created to support EJB 3.0
151      * events. The object in this case will not have a row accessible from the
152      * event. For objects that have database changes, an aboutToUpdate will also
153      * be triggered.
154      */

155     public void preUpdateWithChanges(DescriptorEvent event);
156     
157     /**
158      * This event is raised for all new or existing objects written or committed in a unit of work.
159      * This event is raised before the object's changes are computed,
160      * so the object may still be modified by the event.
161      * If the object is existing and has no changes, it will not be updated in a unit of work.
162      */

163     public void preWrite(DescriptorEvent event);
164 }
165
Popular Tags