KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > mim > api > SpeedoProxy


1 /**
2  * Speedo: an implementation of JDO compliant personality on top of JORM generic
3  * I/O sub-system.
4  * Copyright (C) 2001-2004 France Telecom R&D
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  *
21  *
22  * Contact: speedo@objectweb.org
23  *
24  * Authors: S.Chassande-Barrioz.
25  *
26  */

27
28 package org.objectweb.speedo.mim.api;
29
30 import org.objectweb.jorm.api.PBinding;
31 import org.objectweb.perseus.cache.replacement.api.ReplaceableCacheEntry;
32 import org.objectweb.speedo.mim.api.SpeedoAccessor;
33
34 import javax.jdo.spi.PersistenceCapable;
35
36 /**
37  * This interface what is a Proxy in Speedo. A proxy a PersistentCapable
38  * instance because it is the user object. It is the jorm PBinding because it is
39  * unique. There are several fields: <UL>
40  * <LI>The field 'isActive' indicates if the proxy is active (linked to a ProxyManager)</LI>
41  * <LI>The fields 'pmf' represents the data source where
42  * the current object is persistent.</LI>
43  * <LI>The fields 'tpm' is the perseus TransactionalPersistenceManager managing
44  * this instance.</LI>
45  * </UL>
46  *
47  * @author S.Chassande-Barrioz
48  */

49 public interface SpeedoProxy
50         extends PersistenceCapable, PBinding, ReplaceableCacheEntry {
51
52     /**
53      * Tests whether the Proxy infrastructure has already been set.
54      * A proxy has a correct PClassMapping linked to a PBinder,
55      * a PName obtained thanks to this PClassMapping.
56      *
57      * @return true if this object is a Proxy.
58      */

59     boolean jdoIsActive();
60
61     /**
62      * Sets the new value of the proxy flags
63      *
64      * @see #jdoIsActive()
65      * @param newvalue the new value of the proxy flag
66      */

67     void jdoIsActive(boolean newvalue);
68     
69     SpeedoHome getSpeedoHome();
70
71     /**
72      * It retrieves the SpeedoAccessor instance used in the current context.
73      * If the proxy is not active then the reference state is returned.
74      * otherwise a $classNameFields is returned
75      */

76     SpeedoAccessor getSpeedoAccessor();
77
78     /**
79      * @return the reference accessor of the SpeedoProxy instance. It can be *
80      * null.
81      * The Reference accessor is used for non persistent instance, as cache
82      * value and for pessimistic policy.
83      */

84     SpeedoAccessor getReferenceAccessor();
85
86     /**
87      * Assignes the reference accessor to the SpeedoProxy
88      * The Reference accessor is used for non persistent instance, as cache
89      * value and for pessimistic policy.
90      *
91      * @param refAcc the new reference accessor
92      */

93     void setReferenceAccessor(SpeedoAccessor refAcc);
94
95     /**
96      * @return a new SpeedoAccessor instance.
97      */

98     SpeedoAccessor createAccessor();
99
100     /**
101      * Copies persistent fields from an accessor to another.
102      * @param src is the accessor containing peristent fields to copy
103      * @param dest is the accessor where persistent fields have to be copied
104      */

105     void copyAccessor(SpeedoAccessor src, SpeedoAccessor dest);
106
107     /**
108      * Set the encoded PName of the detach copy to allow serialization.
109      * @param encodedPName : the encoded PName of the persistent object
110      */

111     void setEncodedPName(Object JavaDoc encodedPName);
112     
113     /**
114      * @return the encoded PName of the detached copy
115      */

116     Object JavaDoc getEncodedPName();
117     
118     /**
119      * @return The file name of the jdo descriptor. This file must be availlable
120      * in the class at runtime.
121      */

122     String JavaDoc jdoGetJdoFileName();
123
124     /**
125      * Retrieves the hints needed to build the PName of the persistent object
126      * during the export action.
127      */

128     Object JavaDoc jdoGetPNameHints();
129
130     /**
131      * Adds an element in the gen class field whose number is given. This method
132      * must call the speedoAdd method of the SpeedoGenClassCoherence interface,
133      * or the Collection.add method (if the field contains a collection that
134      * does implement the previous interface). If the field is null, a new
135      * (speedo) collection must be created first.
136      */

137     void speedoAdd (Object JavaDoc elem, int gcFieldNumber);
138 }
139
Popular Tags