KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > pm > api > ProxyManager


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 package org.objectweb.speedo.pm.api;
28
29 import org.objectweb.speedo.mim.api.SpeedoProxy;
30 import org.objectweb.perseus.persistence.api.TransactionalPersistenceManager;
31 import org.objectweb.perseus.concurrency.lib.Semaphore;
32
33 import javax.jdo.datastore.JDOConnection;
34 import javax.jdo.PersistenceManager;
35 import javax.transaction.Synchronization JavaDoc;
36
37 import java.util.Collection JavaDoc;
38 import java.util.Map JavaDoc;
39
40 /**
41  * This interfaces defined a manager of persistent instance. This concept
42  * is based on the javax.jdo.PersistenceManager interface.
43  * A ProxyManager is also a javax.transaction.Synchronization for the JTA
44  * integration. This permits to support the container transaction demarcation.
45  * On the beforeCompletion method the JDO transaction is prepared.
46  * A proxy manager used a TransactionalPersistenceManager for managing the
47  * concurrency, the loading and the caching aspects.
48  *
49  * @see org.objectweb.speedo.pm.api.ProxyManagerFactory
50  * @see org.objectweb.speedo.pm.api.ProxyManagerSwitch
51  * @see org.objectweb.perseus.persistence.api.TransactionalPersistenceManager
52  *
53  * @author S.Chassande-Barrioz
54  */

55 public interface ProxyManager
56         extends PersistenceManager, Synchronization JavaDoc, JDOConnection {
57
58     /**
59      * Retrieves the TransactionalPersistenceManager used by this ProxyManager.
60      */

61     TransactionalPersistenceManager getTransactionalPersistenceManager();
62
63     /**
64      * Opens the persistent manager. This operation is the opposite of the
65      * javax.jdo.PersistenceManager.close() method. It prepares a ProxyManager
66      * to be used. During the preparation, the optimistic and multithread modes
67      * are initialized.
68      * @param connectionSpec is the information to access to the data store
69      * (user, password, ...)
70      */

71     void open(Object JavaDoc connectionSpec);
72
73     /**
74      * @return the connection information to access the data store
75      */

76     Object JavaDoc getConnectionSpec();
77
78     /**
79      * Signal to the persistence maneger that it is used. A persistence managed
80      * can be used by several thread. In this case each thread have done a
81      * PersistenceManagerFactory.getPersistentceManager() to obtain a proxy
82      * manager instance. The threads will do a close() operation, but only the
83      * last has to be taken in account. This method permits to knwon how many
84      * users uses the current proxy manager.
85      */

86     void addUse();
87
88     /**
89      * is the same method than PersistenceManager.getObjectById(Object, boolean)
90      * but no checking is done, because this is an internal call of Speedo.
91      * @param oid is an object representing an persistent object.
92      */

93     Object JavaDoc speedoGetObjectById(Object JavaDoc oid, boolean validate);
94
95     /**
96      * Make persistent a SpeedoProxy. This method does the same thing than the
97      * PersistenceManager.makePersistent(Object) method except the call to the
98      * bind to the ProxyManager to the current thread.
99      *
100      * @param sp is the instance to make persistent.
101      * @param byAttach is a boolean value indicating if the instance to make
102      * persistent becomes persistent because the instance is linked/attached to
103      * a persistent object (true), or because the user calls explicitly
104      * pm.makePersistent(Obj) (false).
105      */

106     void speedoMakePersistent(SpeedoProxy sp, boolean byAttach);
107
108     /**
109      * Delete persistent a SpeedoProxy. This method does the same thing than the
110      * PersistenceManager.deletePersistent(Object) method except the call to the
111      * bind to the ProxyManager to the current thread.
112      *
113      * @param o is the instance to make persistent.
114      */

115     void speedoDeletePersistent(Object JavaDoc o);
116
117     /**
118      * Retrieves the semaphore object permiting the multithreading mode.
119      */

120     Semaphore getSemaphore();
121         
122     /**
123      * Same as detachCopy(Object detached), but uses a map to avoid cycles when detaching objects referencing each other
124      * @param map the map contains element of type: [SpeedoProxy, clone of SpeedoProxy]
125      */

126     Object JavaDoc speedoDetachCopy(SpeedoProxy sp, Map JavaDoc map, Collection JavaDoc fgHints);
127     
128     Object JavaDoc speedoAttachCopy(Object JavaDoc detached, boolean makeTransactional, Map JavaDoc map);
129     
130     void speedoRefresh(SpeedoProxy sp, Map JavaDoc map, Collection JavaDoc fgHints);
131     
132     void speedoRetrieve(SpeedoProxy sp, Map JavaDoc map, Collection JavaDoc fgHints);
133 }
134
Popular Tags