01: /*
02: * $Id: QueuePersistenceStrategy.java 8077 2007-08-27 20:15:25Z aperepel $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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: public interface QueuePersistenceStrategy {
22:
23: public interface Holder {
24: Object getId();
25:
26: String getQueue();
27: }
28:
29: /**
30: * Stores an object and returns its generated id.
31: *
32: * @param obj the object to be stored
33: * @return the id of the stored object
34: * @throws IOException
35: */
36: Object store(String queue, Object obj) throws IOException;
37:
38: /**
39: * Loads an object specified by the given id.
40: *
41: * @param id the id of the stored object
42: * @return the object
43: * @throws IOException
44: */
45: Object load(String queue, Object id) throws IOException;
46:
47: /**
48: * Removes the object specified by the given id from the store.
49: *
50: * @param id the id of the stored object
51: * @throws IOException
52: */
53: void remove(String queue, Object id) throws IOException;
54:
55: /**
56: * Retrieves the ids of the stored objects.
57: *
58: * @return the list of ids
59: * @throws IOException
60: */
61: List restore() throws IOException;
62:
63: /**
64: * Open the store.
65: *
66: * @throws IOException
67: */
68: void open() throws IOException;
69:
70: /**
71: * Closes the store.
72: *
73: * @throws IOException
74: */
75: void close() throws IOException;
76:
77: boolean isTransient();
78:
79: }
|