KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > api > Session


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.api;
25
26 import org.objectweb.jalisto.se.api.internal.SessionInternal;
27 import org.objectweb.jalisto.se.api.query.QueryManager;
28
29 import java.util.Collection JavaDoc;
30
31 /**
32  * Session is the principale Jalisto interface for users.
33  * It allows to define class, store, read, modify or remove obects.
34  */

35 public interface Session {
36
37     /**
38      * Allows users to define structure of a persistent class.
39      *
40      * @param classDescription The meta-description of the persistent class to define.
41      */

42     void defineClass(ClassDescription classDescription);
43
44     /**
45      * Allows users to remove the structure of a persistent class.
46      *
47      * @param fullClassName The full class name of the persistent class to remove.
48      */

49     void removeClass(String JavaDoc fullClassName);
50
51     /**
52      * Check if a persistent class is define in Jalisto.
53      *
54      * @param fullQualifiedClassName The full class name of the class to check.
55      * @return true if there already is a class with this name define in the base.
56      */

57     boolean isClassDefined(String JavaDoc fullQualifiedClassName);
58
59     /**
60      * Get class name of a persistent instance. The user has to specify the identity of the persistent instance.
61      *
62      * @param oid The identity of the persistent instance.
63      * @return String : The full class name of the corresponding persistent class; null otherwise.
64      */

65     String JavaDoc getClassNameFor(Object JavaDoc oid);
66
67
68     /**
69      * Create a new identity for an instance of the given class.
70      *
71      * @param objectClass The class of the expecting new persistent instance.
72      * @return Object : The new identity of the expecting new persistent instance.
73      */

74     Object JavaDoc makeNewFileOid(Class JavaDoc objectClass);
75
76     /**
77      * Create a new identity for an instance of the given class.
78      *
79      * @param objectClassName The full qualified class name of the expecting new persistent instance.
80      * @return Object : The new identity of the expecting new persistent instance.
81      */

82     Object JavaDoc makeNewFileOid(String JavaDoc objectClassName);
83
84     /**
85      * Make a new instance of a given class persistent.
86      * Also create a new identity for this instance and return it.
87      *
88      * @param objectToCreate The array representation of the persistent object, according to the class meta-description.
89      * @param objectClass The class of the new persistent instance.
90      * @return Object : The new identity of the expecting new persistent instance.
91      */

92     Object JavaDoc createObject(Object JavaDoc[] objectToCreate, Class JavaDoc objectClass);
93
94     /**
95      * Make a new instance of a given class persistent.
96      * Also create a new identity for this instance and return it.
97      *
98      * @param objectToCreate The array representation of the persistent object, according to the class meta-description.
99      * @param objectClassName The full qualified class name of the new persistent instance.
100      * @return Object : The new identity of the expecting new persistent instance.
101      */

102     Object JavaDoc createObject(Object JavaDoc[] objectToCreate, String JavaDoc objectClassName);
103
104     /**
105      * Make a new instance of a given persistent class, with a given identity.
106      * The identity must has been created before with method Object createObject(Object[] objectToCreate, Class objectClass). The class specified at this time must be the same than the instance class.
107      *
108      * @param oid The identity of the new instance.
109      * @param objectToCreate The array representation of the persistent object, according to the class meta-description.
110      * @return Object : The identity of the expecting new persistent instance.
111      */

112     Object JavaDoc createObject(Object JavaDoc oid, Object JavaDoc[] objectToCreate);
113
114     /**
115      * Read the object of the given identity in Jalisto.
116      *
117      * @param oid The identity of the persistent instance.
118      * @return Object[] : The array representation of the persistent object, according to the class meta-description.
119      */

120     Object JavaDoc[] readObjectByOid(Object JavaDoc oid);
121
122     Collection JavaDoc readObjectsByOids(Collection JavaDoc oids);
123
124      Object JavaDoc[] refreshObjectByOid(Object JavaDoc oid);
125
126     /**
127      * Tell if the datastore contains a persistent object of the given identity in Jalisto.
128      *
129      * @param oid The identity of the persistent instance.
130      * @return boolean : true if the datastore contains a persistent object with the given identity
131      */

132     boolean contains(Object JavaDoc oid);
133
134     /**
135      * Update a persistent instance with a given identity.
136      *
137      * @param oid The identity of the persistent instance.
138      * @param objectToUpdate The array representation of the persistent object, according to the class meta-description.
139      * @return Object : The identity of the persistent instance.
140      */

141     Object JavaDoc updateObjectByOid(Object JavaDoc oid, Object JavaDoc[] objectToUpdate);
142
143     /**
144      * Remove a persistent object of the given identity from Jalisto.
145      *
146      * @param oid The identity of the persistent instance.
147      */

148     void deleteObjectByOid(Object JavaDoc oid);
149
150
151     /**
152      * Get identities of all persistent instance of a given class.
153      *
154      * @param fullClassName The full name of the class.
155      * @return Collection : A collection of all the oid of the persistent instances of the class.
156      */

157     Extent getExtent(String JavaDoc fullClassName);
158
159     /**
160      * Get identities of all persistent instance of a given class.
161      *
162      * @param theClass The class.
163      * @return Collection : A collection of all the oid of the persistent instances of the class.
164      */

165     Extent getExtent(Class JavaDoc theClass);
166
167
168     /**
169      * Tell if the Jalisto base has been created during the initialisation of the Session instance.
170      *
171      * @return boolean : true if the base has been created during the initialisation of Session instance; false otherwise.
172      */

173     boolean isNewBase();
174
175     /**
176      * Try to optimize space in base files.
177      */

178     void reorganize();
179
180     /**
181      * The getQueryManager method returns the QueryManager instance associated with the Session instance.
182      *
183      * @return QueryManager : The QueryManager instance associated with the Session instance.
184      */

185     QueryManager getQueryManager();
186
187     /**
188      * The currentTransaction method returns the Transaction instance associated with the Session instance.
189      *
190      * @return Transaction : The Transaction instance associated with the Session instance.
191      */

192     Transaction currentTransaction();
193
194     /**
195      * Get a MetaRepository instance to work on Jalisto schema of persistent classes.
196      *
197      * @return MetaRepository : the meta repository associated with Session instance.
198      */

199     MetaRepository getMetaRepository();
200
201     /**
202      * Get an internal view of Session instance.
203      * Users don't have to use this interface for commun functionalities.
204      *
205      * @return SessionInternal : A internal view of the Session instance.
206      */

207     SessionInternal getInternalSession();
208
209     /**
210      * Open the session. User can now work on the session.
211      */

212     void openSession();
213
214     /**
215      * Close the session. No more work will be done on this session.
216      */

217     void closeSession();
218
219     boolean isOpen();
220
221     void eraseStorage();
222 }
223
Popular Tags