KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > util > queue > QueuePersistenceStrategy


1 /*
2  * $Id: QueuePersistenceStrategy.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.util.queue;
12
13 import java.io.IOException JavaDoc;
14 import java.util.List JavaDoc;
15
16 /**
17  * <code>QueuePersistenceStrategy</code> defines the The api to a persistent queue
18  * store. A persistence strategy can be transient (in memory or non-restorable) or
19  * non-transient such as File system or DB.
20  *
21  * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a>
22  * @version $Revision: 3798 $
23  */

24 public interface QueuePersistenceStrategy
25 {
26
27     public interface Holder
28     {
29         Object JavaDoc getId();
30
31         String JavaDoc getQueue();
32     }
33
34     /**
35      * Stores an object and returns its generated id.
36      *
37      * @param obj the object to be stored
38      * @return the id of the stored object
39      * @throws IOException
40      */

41     Object JavaDoc store(String JavaDoc queue, Object JavaDoc obj) throws IOException JavaDoc;
42
43     /**
44      * Loads an object specified by the given id.
45      *
46      * @param id the id of the stored object
47      * @return the object
48      * @throws IOException
49      */

50     Object JavaDoc load(String JavaDoc queue, Object JavaDoc id) throws IOException JavaDoc;
51
52     /**
53      * Removes the object specified by the given id from the store.
54      *
55      * @param id the id of the stored object
56      * @throws IOException
57      */

58     void remove(String JavaDoc queue, Object JavaDoc id) throws IOException JavaDoc;
59
60     /**
61      * Retrieves the ids of the stored objects.
62      *
63      * @return the list of ids
64      * @throws IOException
65      */

66     List JavaDoc restore() throws IOException JavaDoc;
67
68     /**
69      * Open the store.
70      *
71      * @throws IOException
72      */

73     void open() throws IOException JavaDoc;
74
75     /**
76      * Closes the store.
77      *
78      * @throws IOException
79      */

80     void close() throws IOException JavaDoc;
81
82     boolean isTransient();
83
84 }
85
Popular Tags