KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > joram > mom > dest > mail > MailMessage


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2007 ScalAgent Distributed Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Nicolas Tachker (ScalAgent)
21  * Contributor(s):
22  */

23 package com.scalagent.joram.mom.dest.mail;
24
25 import org.objectweb.joram.shared.messages.Message;
26
27
28 /**
29  * A mail message encapsulates a proprietary message which is also used
30  * for effective MOM transport facility.
31  */

32 public class MailMessage {
33   private Message sharedMsg;
34
35   /**
36    * Constructs a bright new <code>MailMessage</code>.
37    */

38   public MailMessage() {
39     sharedMsg = new Message();
40   }
41
42   /**
43    * Instanciates a <code>MailMessage</code> wrapping a consumed
44    * MOM simple message.
45    *
46    * @param momMsg The MOM message to wrap.
47    */

48   public MailMessage(org.objectweb.joram.shared.messages.Message momMsg) {
49     this.sharedMsg = momMsg;
50   }
51   
52   /**
53    *
54    * @return shared message structure
55    */

56   public Message getSharedMessage() {
57     return sharedMsg;
58   }
59   
60   /**
61    * The client message type: SIMPLE, TEXT, OBJECT, MAP, STREAM, BYTES.
62    * By default, the message type is SIMPLE.
63    *
64    * @return int
65    */

66   public int getType() {
67     return sharedMsg.type;
68   }
69
70   /**
71    * The message identifier.
72    * @return identifier
73    */

74   public String JavaDoc getIdentifier() {
75     return sharedMsg.id;
76   }
77
78   /**
79    * <code>true</code> if the message must be persisted.
80    * @return persistent
81    */

82   public boolean getPersistent() {
83     return sharedMsg.persistent;
84   }
85
86   /**
87    * The message priority from 0 to 9, 9 being the highest.
88    * By default, the priority is 4?
89    *
90    * @return priority
91    */

92   public int getJMSPriority() {
93     return sharedMsg.priority;
94   }
95
96   /**
97    * The message expiration time, by default 0 for infinite time-to-live.
98    * @return expiration
99    */

100   public long getJMSExpiration() {
101     return sharedMsg.expiration;
102   }
103
104   /**
105    * The message time stamp.
106    * @return time
107    */

108   public long getTimestamp() {
109     return sharedMsg.timestamp;
110   }
111
112   /**
113    * The message destination identifier.
114    * @return destination id.
115    */

116   public String JavaDoc getDestinationId() {
117     return sharedMsg.toId;
118   }
119
120   /**
121    * The message destination type.
122    * @return destination type
123    */

124   public String JavaDoc getToType() {
125     return sharedMsg.toType;
126   }
127
128   /**
129    * The correlation identifier field.
130    * @return correlation id
131    */

132   public String JavaDoc getCorrelationId() {
133     return sharedMsg.correlationId;
134   }
135
136   /**
137    * The reply to destination identifier.
138    * @return reply id
139    */

140   public String JavaDoc getReplyToId() {
141     return sharedMsg.replyToId;
142   }
143
144   /**
145    * <code>true</code> if the "reply to" destination is a queue.
146    * @return reply type
147    */

148   public String JavaDoc replyToType() {
149     return sharedMsg.replyToType;
150   }
151
152   /**
153    * The number of delivery attempts for this message.
154    * @return delivery attempts
155    */

156   public int getDeliveryCount() {
157     return sharedMsg.deliveryCount;
158   }
159
160   /**
161    * <code>true</code> if the message has been denied at least once by a
162    * consumer.
163    * @return denied
164    */

165   public boolean getDenied() {
166     return sharedMsg.redelivered;
167   }
168
169   /**
170    * <code>true</code> if the message target destination is deleted.
171    * @return deleted destination
172    */

173   public boolean getDeletedDest() {
174     return sharedMsg.deletedDest;
175   }
176
177   /**
178    * <code>true</code> if the message expired.
179    * @return expired
180    */

181   public boolean getExpired() {
182     return sharedMsg.expired;
183   }
184
185   /**
186    * <code>true</code> if the message could not be written on the dest.
187    * @return written on the destination
188    */

189   public boolean getNotWriteable() {
190     return sharedMsg.notWriteable;
191   }
192
193   public boolean getUndeliverable() {
194     return sharedMsg.undeliverable;
195   }
196
197   /**
198    * <code>true</code> if the message is considered as undeliverable.
199    * @param name
200    * @return property value
201    */

202   public Object JavaDoc getProperty(String JavaDoc name) {
203     return sharedMsg.getProperty(name);
204   }
205
206   /**
207    * The text body of the message.
208    * @return the text body of the message.
209    */

210   public String JavaDoc getText() {
211     return sharedMsg.getText();
212   }
213
214   /**
215    * The message identifier.
216    * @param id
217    */

218   public void setIdentifier(String JavaDoc id) {
219     sharedMsg.id = id;
220   }
221
222   /**
223    * <code>true</code> if the message must be persisted.
224    * @param persistent
225    */

226   public void setPersistent(boolean persistent) {
227     sharedMsg.persistent = persistent;
228   }
229
230   /**
231    * The message priority from 0 to 9, 9 being the highest.
232    * By default, the priority is 4?
233    * @param priority
234    */

235   public void setPriority(int priority) {
236     sharedMsg.priority = priority;
237   }
238
239   /**
240    * The message expiration time, by default 0 for infinite time-to-live.
241    * @param expiration
242    */

243   public void setExpiration(long expiration) {
244     sharedMsg.expiration = expiration;
245   }
246
247   /**
248    * The message time stamp.
249    * @param timestamp
250    */

251   public void setTimestamp(long timestamp) {
252     sharedMsg.timestamp = timestamp;
253   }
254
255   /**
256    * Sets the message destination.
257    *
258    * @param id The destination identifier.
259    * @param type The type of the destination.
260    */

261   public void setDestination(String JavaDoc id, String JavaDoc type) {
262     sharedMsg.setDestination(id, type);
263   }
264
265   /**
266    * The correlation identifier field.
267    * @param correlationId
268    */

269   public void setCorrelationId(String JavaDoc correlationId) {
270     sharedMsg.correlationId = correlationId;
271   }
272
273   /**
274    * Sets the destination to which a reply should be sent.
275    *
276    * @param id The destination identifier.
277    * @param type The destination type.
278    */

279   public void setReplyTo(String JavaDoc id, String JavaDoc type) {
280     sharedMsg.setReplyTo(id, type);
281   }
282
283   /**
284    * The number of delivery attempts for this message.
285    * @param deliveryCount
286    */

287   public void setDeliveryCount(int deliveryCount) {
288     sharedMsg.deliveryCount = deliveryCount;
289   }
290
291   /**
292    * <code>true</code> if the message has been denied at least once by a
293    * consumer.
294    * @param redelivered
295    */

296   public void setDenied(boolean redelivered) {
297     sharedMsg.redelivered = redelivered;
298   }
299
300   /**
301    * <code>true</code> if the message target destination is deleted.
302    * @param deletedDest
303    */

304   public void setDeletedDest(boolean deletedDest) {
305     sharedMsg.deletedDest = deletedDest;
306   }
307
308   /**
309    * <code>true</code> if the message expired.
310    * @param expired
311    */

312   public void setExpired(boolean expired) {
313     sharedMsg.expired = expired;
314   }
315
316   /**
317    * <code>true</code> if the message could not be written on the dest.
318    * @param notWriteable
319    */

320   public void setNotWriteable(boolean notWriteable) {
321     sharedMsg.notWriteable = notWriteable;
322   }
323
324   /**
325    * <code>true</code> if the message is considered as undeliverable.
326    * @param undeliverable
327    */

328   public void setUndeliverable(boolean undeliverable) {
329     sharedMsg.undeliverable = undeliverable;
330   }
331
332   /**
333    * Sets a String as the body of the message.
334    * @param text
335    */

336   public void setText(String JavaDoc text) {
337     sharedMsg.setText(text);
338   }
339 }
340
Popular Tags