KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exolab > jms > messagemgr > MessageCache


1 package org.exolab.jms.messagemgr;
2
3 import java.sql.Connection JavaDoc;
4 import javax.jms.JMSException JavaDoc;
5
6 import org.exolab.jms.message.MessageImpl;
7
8
9 /**
10  * MessageCache is responsible for managing a collection of messages.
11  * Messages in the cache are referenced via {@link MessageRef} instances
12  *
13  * @version $Revision: 1.2 $ $Date: 2005/03/18 03:58:39 $
14  * @author <a HREF="mailto:tma@netspace.net.au">Tim Anderson</a>
15  */

16 public interface MessageCache {
17
18     /**
19      * Add a reference and its corresponding message to the cache
20      *
21      * @param reference the reference to the message
22      * @param message the message
23      */

24     void addMessage(MessageRef reference, MessageImpl message);
25
26     /**
27      * Adds a message reference to the cache
28      *
29      * @param reference the message reference to add
30      */

31     void addMessageRef(MessageRef reference);
32
33     /**
34      * Returns a message reference, given its identifier
35      *
36      * @param messageId the message identifier
37      * @return the message reference associated with <code>messageId</code>,
38      * or <code>null</code> if none exists
39      */

40     MessageRef getMessageRef(String JavaDoc messageId);
41
42     /**
43      * Returns the message corresponding to the specified reference
44      *
45      * @param reference the message reference
46      * @return the associated message, or <code>null</code> if none exists
47      * @throws JMSException for any error
48      */

49     MessageImpl getMessage(MessageRef reference)
50             throws JMSException JavaDoc;
51
52     /**
53      * Destroys the message corresponding to the reference
54      *
55      * @throws JMSException for any error
56      */

57     void destroy(MessageRef reference) throws JMSException JavaDoc;
58
59     /**
60      * Destroys the message corresponding to the reference
61      *
62      * @param connection the database connection to use
63      * @throws JMSException for any error
64      */

65     void destroy(MessageRef reference, Connection JavaDoc connection)
66             throws JMSException JavaDoc;
67
68 }
69
Popular Tags