KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.mim.api;
19
20 import org.objectweb.jorm.api.PClassMapping;
21 import org.objectweb.jorm.util.api.Loggable;
22 import org.objectweb.perseus.persistence.api.TransactionalPersistenceManager;
23 import org.objectweb.speedo.pm.api.ProxyManager;
24 import org.objectweb.speedo.pm.api.ProxyManagerFactory;
25 import org.objectweb.speedo.query.api.QueryDefinition;
26 import org.objectweb.speedo.usercache.api.UserCacheManager;
27
28 import java.util.Collection JavaDoc;
29 import java.util.Map JavaDoc;
30 import java.util.Properties JavaDoc;
31
32 import javax.jdo.listener.InstanceLifecycleListener;
33
34
35 /**
36  * It defines a home for a persitent class. The home groups common fields and
37  * methods.
38  *
39  * @author S.Chassande-Barrioz
40  */

41 public interface SpeedoHome extends PClassMapping, UserCacheManager, Loggable {
42
43     String JavaDoc getProjectName();
44
45     /**
46      * Indicates if the class has been marked as detacheable
47      */

48     boolean isDetachable();
49     
50     /**
51      * Indicates if the state of persistent instance managed by this home, are
52      * kept between two transaction.
53      * @return true means the state is kept between transaction.
54      */

55     boolean isCacheable();
56     
57     boolean hasToFix();
58     
59     boolean allLoaded();
60     
61     /**
62      * Permit to Indicate if the state of persistent instance managed by this
63      * home, are kept between two transaction.
64      */

65     void setCachePolicy(byte v);
66     byte NO_CACHE = 0;
67     byte CACHED = 1;
68     byte FIXED = 3;
69     byte ALL = 11;
70     
71     /**
72      * Indicates if the locking level must be the field. A false value (default)
73      * means the locking level has to be done at instance level.
74      */

75     boolean isFieldLockingLevel();
76     
77     /**
78      * Permits to Indicate if the locking level must be the field. A false
79      * value (default) means the locking level has to be done at instance level.
80      */

81     void setFieldLockingLevel(boolean val);
82
83     /**
84      * The versioning strategy.
85      * @see org.objectweb.speedo.metadata.SpeeedoVersion.DATE_TIME
86      * @see org.objectweb.speedo.metadata.SpeeedoVersion.STATE_COMPARISON
87      * @see org.objectweb.speedo.metadata.SpeeedoVersion.VERSION_NUMBER NO_VERSION
88      */

89     byte getVersioningStrategy();
90
91     /**
92      * @return the PersistenceManagerFactory representing the data support
93      * where the proxy is persistent.
94      */

95     ProxyManagerFactory getProxyManagerFactory();
96
97     /**
98      * It assignes a PersistenceManagerFactory
99      * @param _pmf is the PersistenceManagerFactory representing the data
100      * support where the proxy is persistent.
101      */

102     void setProxyManagerFactory(ProxyManagerFactory _pmf);
103
104
105     /**
106      * @return the TransactionalPersistenceManager which manages the
107      * concurrency, loading, caching ... of the proxies.
108      */

109     TransactionalPersistenceManager getTransactionalPersistenceManager();
110
111     /**
112      * It assignes a TransactionalPersistenceManager
113      * @param _tpm is the TransactionalPersistenceManager which manage the
114      * concurrency, loading, ... of the proxy.
115      */

116     void setTransactionalPersistenceManager(TransactionalPersistenceManager _tpm);
117
118     /**
119      * Notifies the transactional persistency manager of a read intention for
120      * the given persistent instance.
121      * @param sp is the SpeedoProxy which the read access is requested.
122      * @param fields the ids of the fields that may be accessed by the caller
123      * of this method. If the i-th bit of 'fields' is set to 1, then the i-th
124      * field of the given speedo accessor may be accessed by the caller of this
125      * method.
126      */

127     SpeedoAccessor readIntention(SpeedoProxy sp, long[] fields);
128
129     /**
130      * Notifies the transactional persistency manager of a write intention for
131      * the given persistent instance.
132      *
133      * @param sp is the SpeedoProxy which the write access is requested.
134      * @param fields the ids of the fields that may be accessed by the caller
135      * of this method. If the i-th bit of 'fields' is set to 1, then the i-th
136      * field of the given speedo accessor may be accessed by the caller of this
137      * method.
138      * @param thinLock permits to allocate a lock on only a part of the
139      * resource. The locking size is thinner than a lock on the persistent
140      * object entirely. This parameter can be typically used to lock at the
141      * field or the genclass element levels.
142      */

143     SpeedoAccessor writeIntention(SpeedoProxy sp, long[] fields, Object JavaDoc thinLock);
144
145     SpeedoAccessor writeIntention(SpeedoProxy sp, long[] fields);
146
147     SpeedoAccessor getSpeedoAccessor(SpeedoProxy sp);
148
149     SpeedoProxy detachCopy(SpeedoProxy sp,
150             ProxyManager pm,
151             Map JavaDoc map,
152             Object JavaDoc clone,
153             Collection JavaDoc fgHints) ;
154
155     void attachCopy(SpeedoProxy sp,
156         ProxyManager pm,
157         Map JavaDoc map,
158         Object JavaDoc clone,
159         SpeedoAccessor sa,
160         boolean makeTransactional) ;
161
162     Properties JavaDoc getClassProperties();
163     
164     /**
165      * Defines a named query
166      * @param name is the name identifying the query
167      * @param query is the definition of the query
168      * @return the old query definition corresponding to the name, if it
169      * existed one.
170      */

171     QueryDefinition addNamedQuery(String JavaDoc name, QueryDefinition query);
172
173     /**
174      * Remove a named query
175      * @param name is the name of the query definition to remove
176      * @return the removed query definition (null if not found)
177      */

178     QueryDefinition removeNamedQuery(String JavaDoc name);
179
180     /**
181      * Retrieves a query defintion from its name. If the name is not known, the
182      * null value is returned.
183      * @param name is the name the wanted query definition
184      */

185     QueryDefinition getNamedQuery(String JavaDoc name);
186     
187         
188     void initSH();
189     
190     String JavaDoc getPath();
191     
192     /**
193      * Indicates if the prefetching must be activated on queries when they
194      * return instance corresponding to this home.
195      */

196     void setPrefetchOnQuery(boolean prefetch);
197     
198     boolean getPrefetchOnQuery();
199     
200     /**
201      * Indicates if the prefetching must be activated on extents when they
202      * return instance corresponding to this home.
203      */

204     void setPrefetchOnExtent(boolean prefetch);
205     
206     boolean getPrefetchOnExtent();
207     
208     /**
209      * Indicates if the prefetching must be activated genclass loading. This
210      * method is only applicable for gen class home.
211      */

212     void setPrefetchOnGenClass(boolean prefetch);
213
214     boolean getPrefetchOnGenClass();
215     
216     void addInstanceLifeCycleListener(InstanceLifecycleListener listener);
217
218     void removeInstanceLifeCycleListener(InstanceLifecycleListener listener);
219     
220     void sendEvent(int eventType, Object JavaDoc source, Object JavaDoc target, boolean pre);
221 }
222
Popular Tags