KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > support > InstanceCallbacks


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 in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
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 Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * InstanceCallbacks.java
26  *
27  * Created on February 25, 2000
28  */

29  
30 package com.sun.jdo.api.persistence.support;
31
32 /**
33  *
34  * @author Craig Russell
35  * @version 0.1
36  */

37
38 /**
39  * A PersistenceCapable class that provides callback methods for life
40  * cycle events implements this interface.
41  *
42  * <P>Classes which include derived fields (transient fields whose values depend
43  * on the values of persistent fields) require callbacks on specific
44  * JDO Instance life cycle events in order to correctly populate the
45  * values in these fields.
46  *
47  * <P>This interface defines the methods executed
48  * by the PersistenceManager for these life cycle events. If the class
49  * implements InstanceCallbacks, it must explicitly declare it in the
50  * class definition. The Reference Enhancer does not modify the declaration or
51  * any of the methods in the interface.
52  */

53 public interface InstanceCallbacks
54 {
55     /**
56      * Called after the values are loaded from the data store into
57      * this instance.
58      *
59      * <P>Derived fields should be initialized in this method.
60      *
61      * <P>This method is never modified by the Reference Enhancer.
62      */

63     void jdoPostLoad();
64
65     /**
66      * Called before the values are stored from this instance to the
67      * data store.
68      *
69      * <P>Database fields that might have been affected by modified derived
70      * fields should be updated in this method.
71      *
72      * <P>This method is never modified by the Reference Enhancer.
73      */

74     void jdoPreStore();
75
76     /**
77      * Called before the values in the instance are cleared.
78      *
79      * <P>Transient fields should be cleared in this method, as they will
80      * not be affected by the jdoClear method. Associations between this
81      * instance and others in the runtime environment should be cleared.
82      *
83      * <P>This method is never modified by the Reference Enhancer.
84      */

85     void jdoPreClear();
86 }
87
Popular Tags