KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > resource > adapter > jms > JmsMessage


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.resource.adapter.jms;
23
24 import java.util.Enumeration JavaDoc;
25
26 import javax.jms.Destination JavaDoc;
27 import javax.jms.JMSException JavaDoc;
28 import javax.jms.Message JavaDoc;
29
30 /**
31  * A wrapper for a message
32  *
33  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>
34  * @version $Revision: 38315 $
35  */

36 public class JmsMessage implements Message JavaDoc
37 {
38    /** The message */
39    Message JavaDoc message;
40    
41    /** The session */
42    JmsSession session;
43
44    /**
45     * Create a new wrapper
46     *
47     * @param message the message
48     * @param session the session
49     */

50    public JmsMessage(Message JavaDoc message, JmsSession session)
51    {
52       this.message = message;
53       this.session = session;
54    }
55
56    public void acknowledge() throws JMSException JavaDoc
57    {
58       session.getSession(); // Check for closed
59
message.acknowledge();
60    }
61    
62    public void clearBody() throws JMSException JavaDoc
63    {
64       message.clearBody();
65    }
66    
67    public void clearProperties() throws JMSException JavaDoc
68    {
69       message.clearProperties();
70    }
71    
72    public boolean getBooleanProperty(String JavaDoc name) throws JMSException JavaDoc
73    {
74       return message.getBooleanProperty(name);
75    }
76    
77    public byte getByteProperty(String JavaDoc name) throws JMSException JavaDoc
78    {
79       return message.getByteProperty(name);
80    }
81
82    public double getDoubleProperty(String JavaDoc name) throws JMSException JavaDoc
83    {
84       return message.getDoubleProperty(name);
85    }
86    
87    public float getFloatProperty(String JavaDoc name) throws JMSException JavaDoc
88    {
89       return message.getFloatProperty(name);
90    }
91    
92    public int getIntProperty(String JavaDoc name) throws JMSException JavaDoc
93    {
94       return message.getIntProperty(name);
95    }
96    
97    public String JavaDoc getJMSCorrelationID() throws JMSException JavaDoc
98    {
99       return message.getJMSCorrelationID();
100    }
101    
102    public byte[] getJMSCorrelationIDAsBytes() throws JMSException JavaDoc
103    {
104       return message.getJMSCorrelationIDAsBytes();
105    }
106    
107    public int getJMSDeliveryMode() throws JMSException JavaDoc
108    {
109       return message.getJMSDeliveryMode();
110    }
111    
112    public Destination JavaDoc getJMSDestination() throws JMSException JavaDoc
113    {
114       return message.getJMSDestination();
115    }
116    
117    public long getJMSExpiration() throws JMSException JavaDoc
118    {
119       return message.getJMSExpiration();
120    }
121    
122    public String JavaDoc getJMSMessageID() throws JMSException JavaDoc
123    {
124       return message.getJMSMessageID();
125    }
126    
127    public int getJMSPriority() throws JMSException JavaDoc
128    {
129       return message.getJMSPriority();
130    }
131    
132    public boolean getJMSRedelivered() throws JMSException JavaDoc
133    {
134       return message.getJMSRedelivered();
135    }
136    
137    public Destination JavaDoc getJMSReplyTo() throws JMSException JavaDoc
138    {
139       return message.getJMSReplyTo();
140    }
141    
142    public long getJMSTimestamp() throws JMSException JavaDoc
143    {
144       return message.getJMSTimestamp();
145    }
146    
147    public String JavaDoc getJMSType() throws JMSException JavaDoc
148    {
149       return message.getJMSType();
150    }
151    
152    public long getLongProperty(String JavaDoc name) throws JMSException JavaDoc
153    {
154       return message.getLongProperty(name);
155    }
156    
157    public Object JavaDoc getObjectProperty(String JavaDoc name) throws JMSException JavaDoc
158    {
159       return message.getObjectProperty(name);
160    }
161    
162    public Enumeration JavaDoc getPropertyNames() throws JMSException JavaDoc
163    {
164       return message.getPropertyNames();
165    }
166    
167    public short getShortProperty(String JavaDoc name) throws JMSException JavaDoc
168    {
169       return message.getShortProperty(name);
170    }
171    
172    public String JavaDoc getStringProperty(String JavaDoc name) throws JMSException JavaDoc
173    {
174       return message.getStringProperty(name);
175    }
176    
177    public boolean propertyExists(String JavaDoc name) throws JMSException JavaDoc
178    {
179       return message.propertyExists(name);
180    }
181    
182    public void setBooleanProperty(String JavaDoc name, boolean value) throws JMSException JavaDoc
183    {
184       message.setBooleanProperty(name, value);
185    }
186    
187    public void setByteProperty(String JavaDoc name, byte value) throws JMSException JavaDoc
188    {
189       message.setByteProperty(name, value);
190    }
191    
192    public void setDoubleProperty(String JavaDoc name, double value) throws JMSException JavaDoc
193    {
194       message.setDoubleProperty(name, value);
195    }
196    
197    public void setFloatProperty(String JavaDoc name, float value) throws JMSException JavaDoc
198    {
199       message.setFloatProperty(name, value);
200    }
201    
202    public void setIntProperty(String JavaDoc name, int value) throws JMSException JavaDoc
203    {
204       message.setIntProperty(name, value);
205    }
206    
207    public void setJMSCorrelationID(String JavaDoc correlationID) throws JMSException JavaDoc
208    {
209       message.setJMSCorrelationID(correlationID);
210    }
211
212    public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException JavaDoc
213    {
214       message.setJMSCorrelationIDAsBytes(correlationID);
215    }
216
217    public void setJMSDeliveryMode(int deliveryMode) throws JMSException JavaDoc
218    {
219       message.setJMSDeliveryMode(deliveryMode);
220    }
221
222    public void setJMSDestination(Destination JavaDoc destination) throws JMSException JavaDoc
223    {
224       message.setJMSDestination(destination);
225    }
226    
227    public void setJMSExpiration(long expiration) throws JMSException JavaDoc
228    {
229       message.setJMSExpiration(expiration);
230    }
231    
232    public void setJMSMessageID(String JavaDoc id) throws JMSException JavaDoc
233    {
234       message.setJMSMessageID(id);
235    }
236    
237    public void setJMSPriority(int priority) throws JMSException JavaDoc
238    {
239       message.setJMSPriority(priority);
240    }
241    
242    public void setJMSRedelivered(boolean redelivered) throws JMSException JavaDoc
243    {
244       message.setJMSRedelivered(redelivered);
245    }
246
247    public void setJMSReplyTo(Destination JavaDoc replyTo) throws JMSException JavaDoc
248    {
249       message.setJMSReplyTo(replyTo);
250    }
251
252    public void setJMSTimestamp(long timestamp) throws JMSException JavaDoc
253    {
254       message.setJMSTimestamp(timestamp);
255    }
256    
257    public void setJMSType(String JavaDoc type) throws JMSException JavaDoc
258    {
259       message.setJMSType(type);
260    }
261    
262    public void setLongProperty(String JavaDoc name, long value) throws JMSException JavaDoc
263    {
264       message.setLongProperty(name, value);
265    }
266    
267    public void setObjectProperty(String JavaDoc name, Object JavaDoc value) throws JMSException JavaDoc
268    {
269       message.setObjectProperty(name, value);
270    }
271    
272    public void setShortProperty(String JavaDoc name, short value) throws JMSException JavaDoc
273    {
274       message.setShortProperty(name, value);
275    }
276    
277    public void setStringProperty(String JavaDoc name, String JavaDoc value) throws JMSException JavaDoc
278    {
279       message.setStringProperty(name, value);
280    }
281    
282    public int hashCode()
283    {
284       return message.hashCode();
285    }
286    
287    public boolean equals(Object JavaDoc object)
288    {
289       if (object != null && object instanceof JmsMessage)
290          return message.equals(((JmsMessage) object).message);
291       else
292          return message.equals(object);
293    }
294    
295    public String JavaDoc toString()
296    {
297       return message.toString();
298    }
299 }
300
Popular Tags