Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
QueuePersistenceStrategy |
|
| 1.0;1 | ||||
QueuePersistenceStrategy$Holder |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: QueuePersistenceStrategy.java 7976 2007-08-21 14:26:13Z dirk.olmes $ | |
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 CPAL v1.0 | |
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; | |
14 | import java.util.List; | |
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: 7976 $ | |
23 | */ | |
24 | public interface QueuePersistenceStrategy | |
25 | { | |
26 | ||
27 | public interface Holder | |
28 | { | |
29 | Object getId(); | |
30 | ||
31 | String 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 store(String queue, Object obj) throws IOException; | |
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 load(String queue, Object id) throws IOException; | |
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 queue, Object id) throws IOException; | |
59 | ||
60 | /** | |
61 | * Retrieves the ids of the stored objects. | |
62 | * | |
63 | * @return the list of ids | |
64 | * @throws IOException | |
65 | */ | |
66 | List restore() throws IOException; | |
67 | ||
68 | /** | |
69 | * Open the store. | |
70 | * | |
71 | * @throws IOException | |
72 | */ | |
73 | void open() throws IOException; | |
74 | ||
75 | /** | |
76 | * Closes the store. | |
77 | * | |
78 | * @throws IOException | |
79 | */ | |
80 | void close() throws IOException; | |
81 | ||
82 | boolean isTransient(); | |
83 | ||
84 | } |