KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > api > internal > repositorypersistence > RepositoryPersistenceManager


1 package org.enhydra.shark.api.internal.repositorypersistence;
2
3 import java.util.List JavaDoc;
4 import org.enhydra.shark.api.RepositoryTransaction;
5 import org.enhydra.shark.api.RootException;
6 import org.enhydra.shark.api.TransactionException;
7 import org.enhydra.shark.api.internal.working.CallbackUtilities;
8
9 /**
10  * Interface for implementing Repository persistence interface.
11  *
12  * @author Sasa Bojanic
13  * @version 1.0
14  *
15  */

16 public interface RepositoryPersistenceManager {
17
18    /**
19     * Method configure is called at Shark start up, to configure
20     * implementation of RepositoryPersistenceManager.
21     *
22     * @param cus an instance of CallbackUtilities used to get
23     * properties for configuring Repository Manager in Shark.
24     *
25     * @exception RootException Thrown if configuring doesn't succeed.
26     */

27    void configure(CallbackUtilities cus) throws RootException;
28
29    /**
30     * Uploads XPDL represented by byte array into repository, and gives it
31     * specified Id. The version of XPDL is automatically set.
32     *
33     * @param t a RepositoryTransaction
34     * @param xpdlId a String representing Id of xpdl
35     * @param xpdl a byte[] representing XPDL
36     *
37     * @throws RepositoryException if something goes wrong
38     *
39     */

40    void uploadXPDL (RepositoryTransaction t,String JavaDoc xpdlId,byte[] xpdl,byte[] serializedPkg,long xpdlClassVer) throws RepositoryException;
41
42    /**
43     * Updates XPDL file in the repository.
44     *
45     * @param t a RepositoryTransaction
46     * @param xpdlId a String representing Id of xpdl
47     * @param xpdlVersion a String representing xpdl version
48     * @param xpdl a byte[] representing XPDL
49     *
50     * @throws RepositoryException if something goes wrong
51     *
52     */

53    void updateXPDL (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion,byte[] xpdl,byte[] serializedPkg,long xpdlClassVer) throws RepositoryException;
54
55    /**
56     * Deletes xpdl specified by given parameters from the repository.
57     *
58     * @param t a RepositoryTransaction
59     * @param xpdlId a String representing Id of xpdl
60     * @param xpdlVersion a String representing xpdl version
61     *
62     * @throws RepositoryException if something goes wrong
63     *
64     */

65    void deleteXPDL (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
66
67    /**
68     * Moves the specified XPDL into history. All referrences to external
69     * xpdls are removed also.
70     *
71     * @param t a RepositoryTransaction
72     * @param xpdlId a String representing Id of xpdl
73     * @param xpdlVersion a String representing xpdl version
74     *
75     * @throws RepositoryException if something goes wrong
76     *
77     */

78    void moveToHistory (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
79
80    /**
81     * Deletes specified file from history.
82     *
83     * @param t a RepositoryTransaction
84     * @param xpdlId a String representing Id of xpdl
85     * @param xpdlVersion a String representing xpdl version
86     *
87     * @throws RepositoryException if something goes wrong
88     *
89     */

90    void deleteFromHistory (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
91
92    /**
93     * Clears the repository.
94     *
95     * @param t a RepositoryTransaction
96     *
97     * @throws RepositoryException if something goes wrong
98     *
99     */

100    void clearRepository (RepositoryTransaction t) throws RepositoryException;
101
102    /**
103     * Gets the current version of package with specified Id.
104     *
105     * @param t a RepositoryTransaction
106     * @param xpdlId a String representing Id of xpdl
107     *
108     * @return a String representing the current version of XPDL specified
109     * by given Id.
110     *
111     * @throws RepositoryException if something goes wrong
112     *
113     */

114    String JavaDoc getCurrentVersion (RepositoryTransaction t,String JavaDoc xpdlId) throws RepositoryException;
115
116    /**
117     * Gets the next version of specified Id.
118     *
119     * @param t a RepositoryTransaction
120     * @param xpdlId a String representing Id of xpdl
121     *
122     * @return a String representing the next version of XPDL specified
123     * by given Id.
124     *
125     * @throws RepositoryException if something goes wrong
126     *
127     */

128    String JavaDoc getNextVersion (RepositoryTransaction t,String JavaDoc xpdlId) throws RepositoryException;
129
130    /**
131     * Gets the version of serialized object that represents given XPDL.
132     *
133     * @param t a RepositoryTransaction
134     * @param xpdlId a String representing Id of xpdl
135     * @param xpdlVersion a String representing xpdl version
136     *
137     * @return a String representing the version of serialized XPDL object
138     *
139     * @throws RepositoryException if something goes wrong
140     *
141     */

142    long getSerializedXPDLObjectVersion (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
143    
144    /**
145     * Gets the byte array for the last version of specified XPDL.
146     *
147     * @param t a RepositoryTransaction
148     * @param xpdlId a String representing Id of xpdl
149     *
150     * @return a byte[] representing last version of XPDL specified
151     * by given Id.
152     *
153     * @throws RepositoryException if repository does not contain
154     * the xpdl with given Id, or something else goes wrong.
155     *
156     */

157    byte[] getXPDL (RepositoryTransaction t,String JavaDoc xpdlId) throws RepositoryException;
158   
159    /**
160     * Gets the byte array for the last version of specified XPDL.
161     * This is actually serialized Java object representing the
162     * main object of XPDL object model.
163     *
164     * @param t a RepositoryTransaction
165     * @param xpdlId a String representing Id of xpdl
166     *
167     * @return a byte[] representing last version of XPDL specified
168     * by given Id.
169     *
170     * @throws RepositoryException if repository does not contain
171     * the xpdl with given Id, or something else goes wrong.
172     *
173     */

174    byte[] getSerializedXPDLObject (RepositoryTransaction t,String JavaDoc xpdlId) throws RepositoryException;
175
176    /**
177     * Gets the byte array representing specified XPDL.
178     *
179     * @param t a RepositoryTransaction
180     * @param xpdlId a String representing Id of xpdl
181     * @param xpdlVersion a String representing xpdl version
182     *
183     * @return a byte[] representing XPDL specified by given Id and version.
184     *
185     * @throws RepositoryException if repository does not contain
186     * the xpdl with given Id and version, or something else goes wrong.
187     *
188     */

189    byte[] getXPDL (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
190
191    /**
192     * Gets the byte array representing specified XPDL.
193     * This is actually serialized Java object representing the
194     * main object of XPDL object model.
195     *
196     * @param t a RepositoryTransaction
197     * @param xpdlId a String representing Id of xpdl
198     * @param xpdlVersion a String representing xpdl version
199     *
200     * @return a byte[] representing XPDL specified by given Id and version.
201     *
202     * @throws RepositoryException if repository does not contain
203     * the xpdl with given Id and version, or something else goes wrong.
204     *
205     */

206    byte[] getSerializedXPDLObject (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
207
208    /**
209     * Gets a list of all versions for specified XPDL.
210     *
211     * @param t a RepositoryTransaction
212     * @param xpdlId a String representing Id of xpdl
213     *
214     * @return a List of Strings representing versions of xpdl
215     * specified by given Id.
216     *
217     * @throws RepositoryException if repository does not contain
218     * the xpdl with given Id, or something else goes wrong.
219     *
220     */

221    List JavaDoc getXPDLVersions (RepositoryTransaction t,String JavaDoc xpdlId) throws RepositoryException;
222
223    /**
224     * Checks if xpdl with given id exists.
225     *
226     * @param t a RepositoryTransaction
227     * @param xpdlId a String representing Id of xpdl
228     *
229     * @return true if xpdl with given Id exists in repository.
230     *
231     * @throws RepositoryException if something goes wrong
232     *
233     */

234    boolean doesXPDLExist (RepositoryTransaction t,String JavaDoc xpdlId) throws RepositoryException;
235
236    /**
237     * Checks if xpdl with given id and version exists.
238     *
239     * @param t a RepositoryTransaction
240     * @param xpdlId a String representing Id of xpdl
241     * @param xpdlVersion a String representing xpdl version
242     *
243     * @return true if xpdl with given Id and version exists in repository.
244     *
245     * @throws RepositoryException if something goes wrong
246     *
247     */

248    boolean doesXPDLExist (RepositoryTransaction t,String JavaDoc xpdlId,String JavaDoc xpdlVersion) throws RepositoryException;
249
250    /**
251     * Used to retrieve the list of xpdl Ids currently hold in repository.
252     *
253     * @param t a RepositoryTransaction
254     *
255     * @return A list of strings representing the Ids of xpdls that
256     * currently exist in repository.
257     *
258     * @throws RepositoryException if something goes wrong
259     *
260     */

261    List JavaDoc getExistingXPDLIds (RepositoryTransaction t) throws RepositoryException;
262
263
264    /**
265     * Adds a information on referenced XPDL.
266     *
267     * @param t a RepositoryTransaction
268     * @param referredXPDLId Id of XPDL that is referred by some other XPDL
269     * @param referringXPDLId Id of XPDL that referrs some other XPDL
270     * @param referringXPDLVersion Version of XPDL that referrs some other XPDL
271     * @param referredXPDLNumber The ordinal numbe of referred XPDL
272     *
273     * @throws RepositoryException
274     *
275     */

276    void addXPDLReference (RepositoryTransaction t,
277                           String JavaDoc referredXPDLId,
278                           String JavaDoc referringXPDLId,
279                           String JavaDoc referringXPDLVersion,
280                           int referredXPDLNumber) throws RepositoryException;
281
282
283    /**
284     * Gets a list of Ids of XPDLs that referr to the given one.
285     *
286     * @param t a RepositoryTransaction
287     * @param referredXPDLId Id of XPDL that is referred by some other XPDLs.
288     *
289     * @return a List
290     *
291     * @throws RepositoryException
292     *
293     */

294    List JavaDoc getReferringXPDLIds (RepositoryTransaction t,String JavaDoc referredXPDLId) throws RepositoryException;
295
296    /**
297     * Gets a list of versions of XPDLs with given Id that referr to the given one.
298     *
299     * @param t a RepositoryTransaction
300     * @param referredXPDLId Id of XPDL that is referred by some other XPDLs.
301     * @param referringXPDLId Id of XPDL that referrs some other XPDL
302     *
303     * @return a List
304     *
305     * @throws RepositoryException
306     *
307     */

308    List JavaDoc getReferringXPDLVersions (RepositoryTransaction t,String JavaDoc referredXPDLId,String JavaDoc referringXPDLId) throws RepositoryException;
309
310
311    /**
312     * Gets a list of Ids of referred XPDLs Ids.
313     *
314     * @param t a RepositoryTransaction
315     * @param referringXPDLId Id of XPDL that referrs some other XPDLs
316     * @param referringXPDLVersion Version of XPDL that referrs some other XPDLs
317     *
318     * @return a List
319     *
320     * @throws RepositoryException
321     *
322     */

323    List JavaDoc getReferredXPDLIds (RepositoryTransaction t,String JavaDoc referringXPDLId,String JavaDoc referringXPDLVersion) throws RepositoryException;
324
325    /**
326     * Creates repository transaction.
327     *
328     * @return Created repository transaction.
329     *
330     * @exception TransactionException If something unexpected happens.
331     */

332    RepositoryTransaction createTransaction() throws TransactionException;
333
334 }
335
Popular Tags