NonQpidObjectMessage.java
001 /*
002  *
003  * Licensed to the Apache Software Foundation (ASF) under one
004  * or more contributor license agreements.  See the NOTICE file
005  * distributed with this work for additional information
006  * regarding copyright ownership.  The ASF licenses this file
007  * to you under the Apache License, Version 2.0 (the
008  * "License"); you may not use this file except in compliance
009  * with the License.  You may obtain a copy of the License at
010  
011  *   http://www.apache.org/licenses/LICENSE-2.0
012  
013  * Unless required by applicable law or agreed to in writing,
014  * software distributed under the License is distributed on an
015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016  * KIND, either express or implied.  See the License for the
017  * specific language governing permissions and limitations
018  * under the License.
019  *
020  */
021 package org.apache.qpid.client.message;
022 
023 import java.io.Serializable;
024 import java.util.Enumeration;
025 
026 import javax.jms.Destination;
027 import javax.jms.JMSException;
028 import javax.jms.ObjectMessage;
029 import javax.jms.Session;
030 
031 public class NonQpidObjectMessage implements ObjectMessage {
032 
033     private ObjectMessage _realMessage;
034     private String _contentString;
035 
036     /**
037      * Allows us to construct a JMS message which
038      * does not inherit from the Qpid message superclasses
039      * and expand our unit testing of MessageConverter et al
040      @param session
041      */
042     public NonQpidObjectMessage(Session sessionthrows JMSException
043     {
044         _realMessage = session.createObjectMessage();
045     }
046 
047     public String getJMSMessageID() throws JMSException {
048         return _realMessage.getJMSMessageID();
049     }
050 
051     public void setJMSMessageID(String stringthrows JMSException {
052         _realMessage.setJMSMessageID(string);
053     }
054 
055     public long getJMSTimestamp() throws JMSException {
056         return _realMessage.getJMSTimestamp();
057     }
058 
059     public void setJMSTimestamp(long lthrows JMSException {
060         _realMessage.setJMSTimestamp(l);
061     }
062 
063     public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
064         return _realMessage.getJMSCorrelationIDAsBytes();
065     }
066 
067     public void setJMSCorrelationIDAsBytes(byte[] bytesthrows JMSException {
068         _realMessage.setJMSCorrelationIDAsBytes(bytes);
069     }
070 
071     public void setJMSCorrelationID(String stringthrows JMSException {
072         _realMessage.setJMSCorrelationID(string);
073     }
074 
075     public String getJMSCorrelationID() throws JMSException {
076         return _realMessage.getJMSCorrelationID();
077     }
078 
079     public Destination getJMSReplyTo() throws JMSException {
080         return _realMessage.getJMSReplyTo();
081     }
082 
083     public void setJMSReplyTo(Destination destinationthrows JMSException {
084         _realMessage.setJMSReplyTo(destination);
085     }
086 
087     public Destination getJMSDestination() throws JMSException {
088         return _realMessage.getJMSDestination();
089     }
090 
091     public void setJMSDestination(Destination destinationthrows JMSException {
092         _realMessage.setJMSDestination(destination);
093     }
094 
095     public int getJMSDeliveryMode() throws JMSException {
096         return _realMessage.getJMSDeliveryMode();
097     }
098 
099     public void setJMSDeliveryMode(int ithrows JMSException {
100         _realMessage.setJMSDeliveryMode(i);
101     }
102 
103     public boolean getJMSRedelivered() throws JMSException {
104         return _realMessage.getJMSRedelivered();
105     }
106 
107     public void setJMSRedelivered(boolean bthrows JMSException {
108         _realMessage.setJMSRedelivered(b);
109     }
110 
111     public String getJMSType() throws JMSException {
112         return _realMessage.getJMSType();
113     }
114 
115     public void setJMSType(String stringthrows JMSException {
116         _realMessage.setJMSType(string);
117     }
118 
119     public long getJMSExpiration() throws JMSException {
120         return _realMessage.getJMSExpiration();
121     }
122 
123     public void setJMSExpiration(long lthrows JMSException {
124         _realMessage.setJMSExpiration(l);
125     }
126 
127     public int getJMSPriority() throws JMSException {
128         return _realMessage.getJMSPriority();
129     }
130 
131     public void setJMSPriority(int ithrows JMSException {
132         _realMessage.setJMSPriority(i);
133     }
134 
135     public void clearProperties() throws JMSException {
136         _realMessage.clearProperties();
137     }
138 
139     public boolean propertyExists(String stringthrows JMSException {
140         return _realMessage.propertyExists(string);
141     }
142 
143     public boolean getBooleanProperty(String stringthrows JMSException {
144         return _realMessage.getBooleanProperty(string);
145     }
146 
147     public byte getByteProperty(String stringthrows JMSException {
148         return _realMessage.getByteProperty(string);
149     }
150 
151     public short getShortProperty(String stringthrows JMSException {
152         return _realMessage.getShortProperty(string);
153     }
154 
155     public int getIntProperty(String stringthrows JMSException {
156         return _realMessage.getIntProperty(string);
157     }
158 
159     public long getLongProperty(String stringthrows JMSException {
160         return _realMessage.getLongProperty(string);
161     }
162 
163     public float getFloatProperty(String stringthrows JMSException {
164         return _realMessage.getFloatProperty(string);
165     }
166 
167     public double getDoubleProperty(String stringthrows JMSException {
168         return _realMessage.getDoubleProperty(string);
169     }
170 
171     public String getStringProperty(String stringthrows JMSException {
172         return _realMessage.getStringProperty(string);
173     }
174 
175     public Object getObjectProperty(String stringthrows JMSException {
176         return _realMessage.getObjectProperty(string);
177     }
178 
179     public Enumeration getPropertyNames() throws JMSException {
180         return _realMessage.getPropertyNames();
181     }
182 
183     public void setBooleanProperty(String string, boolean bthrows JMSException {
184         _realMessage.setBooleanProperty(string,b);
185     }
186 
187     public void setByteProperty(String string, byte bthrows JMSException {
188         _realMessage.setByteProperty(string,b);
189     }
190 
191     public void setShortProperty(String string, short ithrows JMSException {
192         _realMessage.setShortProperty(string,i);
193     }
194 
195     public void setIntProperty(String string, int ithrows JMSException {
196         _realMessage.setIntProperty(string,i);
197     }
198 
199     public void setLongProperty(String string, long lthrows JMSException {
200         _realMessage.setLongProperty(string,l);
201     }
202 
203     public void setFloatProperty(String string, float vthrows JMSException {
204         _realMessage.setFloatProperty(string,v);
205     }
206 
207     public void setDoubleProperty(String string, double vthrows JMSException {
208         _realMessage.setDoubleProperty(string,v);
209     }
210 
211     public void setStringProperty(String string, String string1throws JMSException {
212         _realMessage.setStringProperty(string,string1);
213     }
214 
215     public void setObjectProperty(String string, Object objectthrows JMSException {
216         _realMessage.setObjectProperty(string,object);
217     }
218 
219     public void acknowledge() throws JMSException {
220         _realMessage.acknowledge();
221     }
222 
223     public void clearBody() throws JMSException {
224         _realMessage.clearBody();
225     }
226 
227     public void setObject(Serializable serializablethrows JMSException {
228         if (serializable instanceof String)
229         {
230             _contentString = (String)serializable;
231         }
232     }
233 
234     public Serializable getObject() throws JMSException {
235         return _contentString;      }
236 }