001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.resource.adapter.jms;
023:
024: import java.util.Enumeration;
025:
026: import javax.jms.Destination;
027: import javax.jms.JMSException;
028: import javax.jms.Message;
029:
030: /**
031: * A wrapper for a message
032: *
033: * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
034: * @version $Revision: 57189 $
035: */
036: public class JmsMessage implements Message {
037: /** The message */
038: Message message;
039:
040: /** The session */
041: JmsSession session;
042:
043: /**
044: * Create a new wrapper
045: *
046: * @param message the message
047: * @param session the session
048: */
049: public JmsMessage(Message message, JmsSession session) {
050: this .message = message;
051: this .session = session;
052: }
053:
054: public void acknowledge() throws JMSException {
055: session.getSession(); // Check for closed
056: message.acknowledge();
057: }
058:
059: public void clearBody() throws JMSException {
060: message.clearBody();
061: }
062:
063: public void clearProperties() throws JMSException {
064: message.clearProperties();
065: }
066:
067: public boolean getBooleanProperty(String name) throws JMSException {
068: return message.getBooleanProperty(name);
069: }
070:
071: public byte getByteProperty(String name) throws JMSException {
072: return message.getByteProperty(name);
073: }
074:
075: public double getDoubleProperty(String name) throws JMSException {
076: return message.getDoubleProperty(name);
077: }
078:
079: public float getFloatProperty(String name) throws JMSException {
080: return message.getFloatProperty(name);
081: }
082:
083: public int getIntProperty(String name) throws JMSException {
084: return message.getIntProperty(name);
085: }
086:
087: public String getJMSCorrelationID() throws JMSException {
088: return message.getJMSCorrelationID();
089: }
090:
091: public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
092: return message.getJMSCorrelationIDAsBytes();
093: }
094:
095: public int getJMSDeliveryMode() throws JMSException {
096: return message.getJMSDeliveryMode();
097: }
098:
099: public Destination getJMSDestination() throws JMSException {
100: return message.getJMSDestination();
101: }
102:
103: public long getJMSExpiration() throws JMSException {
104: return message.getJMSExpiration();
105: }
106:
107: public String getJMSMessageID() throws JMSException {
108: return message.getJMSMessageID();
109: }
110:
111: public int getJMSPriority() throws JMSException {
112: return message.getJMSPriority();
113: }
114:
115: public boolean getJMSRedelivered() throws JMSException {
116: return message.getJMSRedelivered();
117: }
118:
119: public Destination getJMSReplyTo() throws JMSException {
120: return message.getJMSReplyTo();
121: }
122:
123: public long getJMSTimestamp() throws JMSException {
124: return message.getJMSTimestamp();
125: }
126:
127: public String getJMSType() throws JMSException {
128: return message.getJMSType();
129: }
130:
131: public long getLongProperty(String name) throws JMSException {
132: return message.getLongProperty(name);
133: }
134:
135: public Object getObjectProperty(String name) throws JMSException {
136: return message.getObjectProperty(name);
137: }
138:
139: public Enumeration getPropertyNames() throws JMSException {
140: return message.getPropertyNames();
141: }
142:
143: public short getShortProperty(String name) throws JMSException {
144: return message.getShortProperty(name);
145: }
146:
147: public String getStringProperty(String name) throws JMSException {
148: return message.getStringProperty(name);
149: }
150:
151: public boolean propertyExists(String name) throws JMSException {
152: return message.propertyExists(name);
153: }
154:
155: public void setBooleanProperty(String name, boolean value)
156: throws JMSException {
157: message.setBooleanProperty(name, value);
158: }
159:
160: public void setByteProperty(String name, byte value)
161: throws JMSException {
162: message.setByteProperty(name, value);
163: }
164:
165: public void setDoubleProperty(String name, double value)
166: throws JMSException {
167: message.setDoubleProperty(name, value);
168: }
169:
170: public void setFloatProperty(String name, float value)
171: throws JMSException {
172: message.setFloatProperty(name, value);
173: }
174:
175: public void setIntProperty(String name, int value)
176: throws JMSException {
177: message.setIntProperty(name, value);
178: }
179:
180: public void setJMSCorrelationID(String correlationID)
181: throws JMSException {
182: message.setJMSCorrelationID(correlationID);
183: }
184:
185: public void setJMSCorrelationIDAsBytes(byte[] correlationID)
186: throws JMSException {
187: message.setJMSCorrelationIDAsBytes(correlationID);
188: }
189:
190: public void setJMSDeliveryMode(int deliveryMode)
191: throws JMSException {
192: message.setJMSDeliveryMode(deliveryMode);
193: }
194:
195: public void setJMSDestination(Destination destination)
196: throws JMSException {
197: message.setJMSDestination(destination);
198: }
199:
200: public void setJMSExpiration(long expiration) throws JMSException {
201: message.setJMSExpiration(expiration);
202: }
203:
204: public void setJMSMessageID(String id) throws JMSException {
205: message.setJMSMessageID(id);
206: }
207:
208: public void setJMSPriority(int priority) throws JMSException {
209: message.setJMSPriority(priority);
210: }
211:
212: public void setJMSRedelivered(boolean redelivered)
213: throws JMSException {
214: message.setJMSRedelivered(redelivered);
215: }
216:
217: public void setJMSReplyTo(Destination replyTo) throws JMSException {
218: message.setJMSReplyTo(replyTo);
219: }
220:
221: public void setJMSTimestamp(long timestamp) throws JMSException {
222: message.setJMSTimestamp(timestamp);
223: }
224:
225: public void setJMSType(String type) throws JMSException {
226: message.setJMSType(type);
227: }
228:
229: public void setLongProperty(String name, long value)
230: throws JMSException {
231: message.setLongProperty(name, value);
232: }
233:
234: public void setObjectProperty(String name, Object value)
235: throws JMSException {
236: message.setObjectProperty(name, value);
237: }
238:
239: public void setShortProperty(String name, short value)
240: throws JMSException {
241: message.setShortProperty(name, value);
242: }
243:
244: public void setStringProperty(String name, String value)
245: throws JMSException {
246: message.setStringProperty(name, value);
247: }
248:
249: public int hashCode() {
250: return message.hashCode();
251: }
252:
253: public boolean equals(Object object) {
254: if (object != null && object instanceof JmsMessage)
255: return message.equals(((JmsMessage) object).message);
256: else
257: return message.equals(object);
258: }
259:
260: public String toString() {
261: return message.toString();
262: }
263: }
|