KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > perseus > persistence > api > WorkingSet


1 /**
2  * Copyright (C) 2001-2002
3  * - France Telecom R&D
4  * - Laboratoire Logiciels, Systemes, Reseaux - UMR 5526, CNRS-INPG-UJF
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  * Release: 1.0
21  *
22  * Authors:
23  *
24  */

25 package org.objectweb.perseus.persistence.api;
26
27 import java.util.Set JavaDoc;
28
29 /**
30  * It defines a context used in by the PersistenceManager. A context contains
31  * a collection of CacheEntry instances and has a status.
32  *
33  * @author S.Chassande-Barrioz, Y.Bersihand
34  */

35 public interface WorkingSet {
36
37     /**
38      * The status of a non transactional context which is not already
39      * closed.
40      */

41     byte CTX_ACTIVE = 1;
42
43
44     /**
45      * The status of a cloased context (transactional or not)
46      */

47     byte CTX_CLOSED = 32;
48
49     /**
50      * The origin of the binding action.
51      */

52     byte READ_INTENTION = 1;
53     byte WRITE_INTENTION = 2;
54     byte UNKNOWN_INTENTION = 3;
55     
56     /**
57      * Returns the working set's status.
58      * @return one of the constants of the {@link
59      * org.objectweb.perseus.persistence.api.TransactionalPersistenceManager}
60      * interface.
61      */

62     byte getStatus();
63
64     /**
65      * Sets the working set's status.
66      * This setter permits also to intercept the working set life cycle.
67      * @param status one of the constants of the {@link
68      * org.objectweb.perseus.persistence.api.TransactionalPersistenceManager}
69      * interface.
70      * @throws PersistenceException if this is a probleme in the interception of
71      * the working set life cycle.
72      */

73     void setStatus(byte status) throws PersistenceException;
74
75     /**
76      * @return the entry attached to the working set weither its identifier
77      */

78     State lookup(Object JavaDoc oid);
79
80     /**
81      * Attaches an entry to the working set.
82      * @param state is the state which must be attached to the working set
83      * @param oid is the id of the corresponding object
84      * @param mode is the origin of the binding action: read/write intention
85      * @see READ_INTENTION.WRITE_INTENTION.UNKNOWN_INTENTION
86      * @return the value of the old state in the cache, can be null if the state was not already in the cache
87      */

88     
89     State bind(State state, Object JavaDoc oid, byte mode);
90
91     /**
92      * Dettaches an entry from the working set.
93      * @param oid is the identifier of entry which must be detattached from
94      * the working set
95      * @return true if the entry was present in the working set
96      */

97     boolean unbind(Object JavaDoc oid);
98
99     /**
100      * Removes all entries of the working set.
101      */

102     void clear();
103
104     /**
105      * @return the list of entries attached to the working set.
106      */

107     Set JavaDoc entries();
108
109     /**
110      * @return the list of entries attached to the working set
111      */

112     Set JavaDoc oids();
113
114     /**
115      * @return the user object linked to the working set
116      */

117     Object JavaDoc getUserObject();
118
119     /**
120      * Compare the current working set to the parameter.
121      */

122     //boolean equals(Object ws);
123

124     /**
125      * @return a ConnectionHolder instance permiting to acces the data support
126      */

127     ConnectionHolder getConnectionHolder();
128
129     /**
130      * Indicates if the state of persistent objects reached in the working set
131      * must be kept in the cache at the working set end.
132      */

133     boolean getWSRetainValues();
134
135     /**
136      * assing a boolean a value Indicating if the state of persistent objects
137      * reached in the working set must be kept in the cache at the working
138      * set end.
139      */

140     void setWSRetainValues(boolean val);
141
142     /**
143      * Indicates if the dirty object must be reload at rollback time.
144      */

145     boolean getWSRestoreValues();
146
147     /**
148      * assignes a boolean value indicating if the dirty object must be reload
149      * at rollback time.
150      */

151     void setWSRestoreValues(boolean val);
152 }
153
Popular Tags