View Javadoc

1   /***
2    * Redistribution and use of this software and associated documentation
3    * ("Software"), with or without modification, are permitted provided
4    * that the following conditions are met:
5    *
6    * 1. Redistributions of source code must retain copyright
7    *    statements and notices.  Redistributions must also contain a
8    *    copy of this document.
9    *
10   * 2. Redistributions in binary form must reproduce the
11   *    above copyright notice, this list of conditions and the
12   *    following disclaimer in the documentation and/or other
13   *    materials provided with the distribution.
14   *
15   * 3. The name "Exolab" must not be used to endorse or promote
16   *    products derived from this Software without prior written
17   *    permission of Exoffice Technologies.  For written permission,
18   *    please contact info@exolab.org.
19   *
20   * 4. Products derived from this Software may not be called "Exolab"
21   *    nor may "Exolab" appear in their names without prior written
22   *    permission of Exoffice Technologies. Exolab is a registered
23   *    trademark of Exoffice Technologies.
24   *
25   * 5. Due credit should be given to the Exolab Project
26   *    (http://www.exolab.org/).
27   *
28   * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
32   * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39   * OF THE POSSIBILITY OF SUCH DAMAGE.
40   *
41   * Copyright 2001-2003 (C) Exoffice Technologies Inc. All Rights Reserved.
42   *
43   * $Id: MessageHandle.java,v 1.9 2003/08/17 01:32:24 tanderson Exp $
44   *
45   * Date         Author  Changes
46   * 3/1/2001     jima    Created
47   */
48  package org.exolab.jms.message;
49  
50  import java.io.Externalizable;
51  
52  import javax.jms.DeliveryMode;
53  import javax.jms.JMSException;
54  import javax.jms.Message;
55  
56  import org.exolab.jms.client.JmsDestination;
57  
58  
59  /***
60   * A message handle is used to indirectly reference a message in
61   * the message manager.
62   *
63   * @version     $Revision: 1.9 $ $Date: 2003/08/17 01:32:24 $
64   * @author      <a href="mailto:jima@exoffice.com">Jim Alateras</a>
65   * @see         org.exolab.jms.messagemgr.MessageMgr
66   * @see         org.exolab.jms.messagemgr.TransientMessageHandle
67   * @see         org.exolab.jms.messagemgr.PersistentMessageHandle
68   */
69  public interface MessageHandle
70      extends Externalizable {
71  
72      /***
73       * Return the message id
74       *
75       * @return MessgeId
76       */
77      public MessageId getMessageId();
78  
79      /***
80       * Set the message, corresponding to this handle, has already been
81       * delivered once before
82       */
83      public void setDelivered();
84  
85      /***
86       * Set the state of the delivered flag to the specified value
87       *
88       * @param boolean value
89       */
90      public void setDelivered(boolean value);
91  
92      /***
93       * Check whether an attempt has already been made to deliver the message
94       * before.
95       *
96       * @return boolean - true implies redelivery attempted
97       */
98      public boolean getDelivered();
99  
100     /***
101      * Set the priority of the message handle
102      *
103      * @param priority
104      */
105     public void setPriority(int priority);
106 
107     /***
108      * Return the priority of the underlying message
109      */
110     public int getPriority();
111 
112     /***
113      * Set the time that the message was accepted by the server
114      *
115      * @param time - time that it was set in ms
116      */
117     public void setAcceptedTime(long time);
118 
119     /***
120      * Return time that the corresponding message was accepted.
121      */
122     public long getAcceptedTime();
123 
124     /***
125      * Set the time that the message will expire
126      *
127      * @param time - time that it was set in ms
128      */
129     public void setExpiryTime(long time);
130 
131     /***
132      * Return time that the message expires.
133      */
134     public long getExpiryTime();
135 
136     /***
137      * Set the sequence nmber for the handle. This is set by the
138      * message manager.
139      *
140      * @param seq - the sequence number
141      */
142     public void setSequenceNumber(long seq);
143 
144     /***
145      * Retrieve the handle's sequence number
146      *
147      * @return long
148      */
149     public long getSequenceNumber();
150 
151     /***
152      * Set the destination for this handle
153      *
154      * @param dest - the message destination
155      */
156     public void setDestination(JmsDestination dest);
157 
158     /***
159      * Retrieve the destination for this handle
160      *
161      * @return JmsDestination
162      */
163     public JmsDestination getDestination();
164 
165     /***
166      * Set the client id, that owns this handle
167      *
168      * @param clientId - client identity
169      */
170     public void setClientId(long clientId);
171 
172     /***
173      * Retrieve the client identity associated with this handle
174      *
175      * @return long
176      */
177     public long getClientId();
178 
179     /***
180      * Set the consumer endpoint that owns this handle. If it is
181      * set then a consumer owns it exclusively, otherwise the handle
182      * may be shared across a number of consumers.
183      *
184      * @param name - consumer name
185      */
186     public void setConsumerName(String name);
187 
188     /***
189      * Check whether the the {@link DeliveryMode} of the underlying message
190      * is PERSISTENT
191      */
192     public boolean isPersistent();
193 
194     /***
195      * Return the consumer namne
196      *
197      * @return String
198      */
199     public String getConsumerName();
200 
201     /***
202      * Return the associated message or null if it is invalid
203      *
204      * @return  MessageImpl
205      */
206     public MessageImpl getMessage();
207 
208     /***
209      * Destory this handle
210      */
211     public void destroy();
212 
213     /***
214      * Clear the message handle
215      */
216     public void clear();
217 }
218