KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > command > ActiveMQMessage


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.command;
19
20 import java.io.IOException JavaDoc;
21 import java.io.UnsupportedEncodingException JavaDoc;
22 import java.util.Enumeration JavaDoc;
23 import java.util.HashMap JavaDoc;
24 import java.util.Iterator JavaDoc;
25 import java.util.List JavaDoc;
26 import java.util.Map JavaDoc;
27 import java.util.Vector JavaDoc;
28
29 import javax.jms.DeliveryMode JavaDoc;
30 import javax.jms.Destination JavaDoc;
31 import javax.jms.JMSException JavaDoc;
32 import javax.jms.MessageFormatException JavaDoc;
33 import javax.jms.MessageNotWriteableException JavaDoc;
34
35 import org.apache.activemq.ActiveMQConnection;
36 import org.apache.activemq.filter.PropertyExpression;
37 import org.apache.activemq.state.CommandVisitor;
38 import org.apache.activemq.util.Callback;
39 import org.apache.activemq.util.JMSExceptionSupport;
40 import org.apache.activemq.util.TypeConversionSupport;
41
42 /**
43  * @openwire:marshaller code="23"
44  *
45  * @version $Revision:$
46  */

47 public class ActiveMQMessage extends Message implements org.apache.activemq.Message {
48
49     public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_MESSAGE;
50
51     public byte getDataStructureType() {
52         return DATA_STRUCTURE_TYPE;
53     }
54
55     transient protected Callback acknowledgeCallback;
56     transient int hashCode;
57
58     public Message copy() {
59         ActiveMQMessage copy = new ActiveMQMessage();
60         copy(copy);
61         return copy;
62     }
63
64
65     protected void copy(ActiveMQMessage copy) {
66         super.copy(copy);
67         copy.acknowledgeCallback = acknowledgeCallback;
68     }
69
70     public int hashCode() {
71         MessageId id = getMessageId();
72         if (id != null) {
73             return id.hashCode();
74         }
75         else {
76             return super.hashCode();
77         }
78     }
79
80     public boolean equals(Object JavaDoc o) {
81         if (this == o)
82             return true;
83         if (o == null || o.getClass() != getClass())
84             return false;
85
86         ActiveMQMessage msg = (ActiveMQMessage) o;
87         MessageId oMsg = msg.getMessageId();
88         MessageId thisMsg = this.getMessageId();
89         return thisMsg != null && oMsg != null && oMsg.equals(thisMsg);
90     }
91
92     public void acknowledge() throws JMSException JavaDoc {
93         if (acknowledgeCallback != null) {
94             try {
95                 acknowledgeCallback.execute();
96             } catch (JMSException JavaDoc e) {
97                 throw e;
98             } catch (Throwable JavaDoc e) {
99                 throw JMSExceptionSupport.create(e);
100             }
101         }
102     }
103
104     public void clearBody() throws JMSException JavaDoc {
105         setContent(null);
106         readOnlyBody = false;
107     }
108
109     public String JavaDoc getJMSMessageID() {
110         MessageId messageId = this.getMessageId();
111         if (messageId == null) {
112             return null;
113         }
114         return messageId.toString();
115     }
116
117     /**
118      * Seems to be invalid because the parameter doesn't initialize MessageId instance variables ProducerId and
119      * ProducerSequenceId
120      *
121      * @param value
122      * @throws JMSException
123      */

124     public void setJMSMessageID(String JavaDoc value) throws JMSException JavaDoc {
125         if( value !=null ) {
126             try {
127                 MessageId id = new MessageId(value);
128                 this.setMessageId(id);
129             }
130             catch (NumberFormatException JavaDoc e) {
131                 // we must be some foreign JMS provider or strange user-supplied String
132
// so lets set the IDs to be 1
133
MessageId id = new MessageId();
134                 id.setTextView(value);
135                 this.setMessageId(messageId);
136             }
137         } else {
138             this.setMessageId(null);
139         }
140     }
141
142     /**
143      * This will create an object of MessageId. For it to be valid, the instance variable ProducerId and
144      * producerSequenceId must be initialized.
145      *
146      * @param producerId
147      * @param producerSequenceId
148      * @throws JMSException
149      */

150     public void setJMSMessageID(ProducerId producerId, long producerSequenceId) throws JMSException JavaDoc {
151         MessageId id = null;
152         try {
153             id = new MessageId(producerId, producerSequenceId);
154             this.setMessageId(id);
155         } catch (Throwable JavaDoc e) {
156             throw JMSExceptionSupport.create("Invalid message id '" + id + "', reason: " + e.getMessage(), e);
157         }
158     }
159
160     public long getJMSTimestamp() {
161         return this.getTimestamp();
162     }
163
164     public void setJMSTimestamp(long timestamp) {
165         this.setTimestamp(timestamp);
166     }
167
168     public String JavaDoc getJMSCorrelationID() {
169         return this.getCorrelationId();
170     }
171
172     public void setJMSCorrelationID(String JavaDoc correlationId) {
173         this.setCorrelationId(correlationId);
174     }
175
176     public byte[] getJMSCorrelationIDAsBytes() throws JMSException JavaDoc {
177         return encodeString(this.getCorrelationId());
178     }
179
180     public void setJMSCorrelationIDAsBytes(byte[] correlationId) throws JMSException JavaDoc {
181         this.setCorrelationId(decodeString(correlationId));
182     }
183
184     public String JavaDoc getJMSXMimeType() {
185         return "jms/message";
186     }
187
188     static protected String JavaDoc decodeString(byte[] data) throws JMSException JavaDoc {
189         try {
190             if (data == null) {
191                 return null;
192             }
193             return new String JavaDoc(data, "UTF-8");
194         } catch (UnsupportedEncodingException JavaDoc e) {
195             throw new JMSException JavaDoc("Invalid UTF-8 encoding: " + e.getMessage());
196         }
197     }
198
199     static protected byte[] encodeString(String JavaDoc data) throws JMSException JavaDoc {
200         try {
201             if (data == null) {
202                 return null;
203             }
204             return data.getBytes("UTF-8");
205         } catch (UnsupportedEncodingException JavaDoc e) {
206             throw new JMSException JavaDoc("Invalid UTF-8 encoding: " + e.getMessage());
207         }
208     }
209
210     public Destination JavaDoc getJMSReplyTo() {
211         return this.getReplyTo();
212     }
213
214     public void setJMSReplyTo(Destination JavaDoc destination) throws JMSException JavaDoc {
215         this.setReplyTo(ActiveMQDestination.transform(destination));
216     }
217
218     public Destination JavaDoc getJMSDestination() {
219         return this.getDestination();
220     }
221
222     public void setJMSDestination(Destination JavaDoc destination) throws JMSException JavaDoc {
223         this.setDestination(ActiveMQDestination.transform(destination));
224     }
225
226     public int getJMSDeliveryMode() {
227         return this.isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
228     }
229
230     public void setJMSDeliveryMode(int mode) {
231         this.setPersistent(mode==DeliveryMode.PERSISTENT);
232     }
233
234     public boolean getJMSRedelivered() {
235         return this.isRedelivered();
236     }
237
238     public void setJMSRedelivered(boolean redelivered) {
239         this.setRedelivered(redelivered);
240     }
241
242     public String JavaDoc getJMSType() {
243         return this.getType();
244     }
245
246     public void setJMSType(String JavaDoc type) {
247         this.setType(type);
248     }
249
250     public long getJMSExpiration() {
251         return this.getExpiration();
252     }
253
254     public void setJMSExpiration(long expiration) {
255         this.setExpiration(expiration);
256     }
257
258     public int getJMSPriority() {
259         return this.getPriority();
260     }
261
262     public void setJMSPriority(int priority) {
263         this.setPriority((byte) priority);
264     }
265
266     public void clearProperties() {
267         super.clearProperties();
268         readOnlyProperties = false;
269     }
270
271     public boolean propertyExists(String JavaDoc name) throws JMSException JavaDoc {
272         try {
273             return this.getProperties().containsKey(name);
274         } catch (IOException JavaDoc e) {
275             throw JMSExceptionSupport.create(e);
276         }
277     }
278
279     public Enumeration JavaDoc getPropertyNames() throws JMSException JavaDoc {
280         try {
281             return new Vector JavaDoc(this.getProperties().keySet()).elements();
282         } catch (IOException JavaDoc e) {
283             throw JMSExceptionSupport.create(e);
284         }
285     }
286
287     interface PropertySetter {
288         public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc;
289     }
290     
291     static final private HashMap JavaDoc JMS_PROPERTY_SETERS = new HashMap JavaDoc();
292     static {
293         JMS_PROPERTY_SETERS.put("JMSXDeliveryCount", new PropertySetter() {
294             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
295                 Integer JavaDoc rc = (Integer JavaDoc)TypeConversionSupport.convert(value, Integer JavaDoc.class);
296                 if( rc == null ) {
297                     throw new MessageFormatException JavaDoc("Property JMSXDeliveryCount cannot be set from a "+value.getClass().getName()+".");
298                 }
299                 message.setRedeliveryCounter(rc.intValue()-1);
300             }
301         });
302         JMS_PROPERTY_SETERS.put("JMSXGroupID", new PropertySetter() {
303             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
304                 String JavaDoc rc = (String JavaDoc)TypeConversionSupport.convert(value, String JavaDoc.class);
305                 if( rc == null ) {
306                     throw new MessageFormatException JavaDoc("Property JMSXGroupID cannot be set from a "+value.getClass().getName()+".");
307                 }
308                 message.setGroupID(rc);
309             }
310         });
311         JMS_PROPERTY_SETERS.put("JMSXGroupSeq", new PropertySetter() {
312             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
313                 Integer JavaDoc rc = (Integer JavaDoc)TypeConversionSupport.convert(value, Integer JavaDoc.class);
314                 if( rc == null ) {
315                     throw new MessageFormatException JavaDoc("Property JMSXGroupSeq cannot be set from a "+value.getClass().getName()+".");
316                 }
317                 message.setGroupSequence(rc.intValue());
318             }
319         });
320         JMS_PROPERTY_SETERS.put("JMSCorrelationID", new PropertySetter() {
321             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
322                 String JavaDoc rc = (String JavaDoc)TypeConversionSupport.convert(value, String JavaDoc.class);
323                 if( rc == null ) {
324                     throw new MessageFormatException JavaDoc("Property JMSCorrelationID cannot be set from a "+value.getClass().getName()+".");
325                 }
326                 ((ActiveMQMessage)message).setJMSCorrelationID(rc);
327             }
328         });
329         JMS_PROPERTY_SETERS.put("JMSExpiration", new PropertySetter() {
330             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
331                 Long JavaDoc rc = (Long JavaDoc)TypeConversionSupport.convert(value, Long JavaDoc.class);
332                 if( rc == null ) {
333                     throw new MessageFormatException JavaDoc("Property JMSExpiration cannot be set from a "+value.getClass().getName()+".");
334                 }
335                 ((ActiveMQMessage)message).setJMSExpiration(rc.longValue());
336             }
337         });
338         JMS_PROPERTY_SETERS.put("JMSPriority", new PropertySetter() {
339             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
340                 Integer JavaDoc rc = (Integer JavaDoc)TypeConversionSupport.convert(value, Integer JavaDoc.class);
341                 if( rc == null ) {
342                     throw new MessageFormatException JavaDoc("Property JMSPriority cannot be set from a "+value.getClass().getName()+".");
343                 }
344                 ((ActiveMQMessage)message).setJMSPriority(rc.intValue());
345             }
346         });
347         JMS_PROPERTY_SETERS.put("JMSRedelivered", new PropertySetter() {
348             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
349                 Boolean JavaDoc rc = (Boolean JavaDoc)TypeConversionSupport.convert(value, Boolean JavaDoc.class);
350                 if( rc == null ) {
351                     throw new MessageFormatException JavaDoc("Property JMSRedelivered cannot be set from a "+value.getClass().getName()+".");
352                 }
353                 ((ActiveMQMessage)message).setJMSRedelivered(rc.booleanValue());
354             }
355         });
356         JMS_PROPERTY_SETERS.put("JMSReplyTo", new PropertySetter() {
357             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
358                 ActiveMQDestination rc = (ActiveMQDestination)TypeConversionSupport.convert(value, ActiveMQDestination.class);
359                 if( rc == null ) {
360                     throw new MessageFormatException JavaDoc("Property JMSReplyTo cannot be set from a "+value.getClass().getName()+".");
361                 }
362                 ((ActiveMQMessage)message).setReplyTo(rc);
363             }
364         });
365         JMS_PROPERTY_SETERS.put("JMSTimestamp", new PropertySetter() {
366             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
367                 Long JavaDoc rc = (Long JavaDoc)TypeConversionSupport.convert(value, Long JavaDoc.class);
368                 if( rc == null ) {
369                     throw new MessageFormatException JavaDoc("Property JMSTimestamp cannot be set from a "+value.getClass().getName()+".");
370                 }
371                 ((ActiveMQMessage)message).setJMSTimestamp(rc.longValue());
372             }
373         });
374         JMS_PROPERTY_SETERS.put("JMSType", new PropertySetter() {
375             public void set(Message message, Object JavaDoc value) throws MessageFormatException JavaDoc {
376                 String JavaDoc rc = (String JavaDoc)TypeConversionSupport.convert(value, String JavaDoc.class);
377                 if( rc == null ) {
378                     throw new MessageFormatException JavaDoc("Property JMSType cannot be set from a "+value.getClass().getName()+".");
379                 }
380                 ((ActiveMQMessage)message).setJMSType(rc);
381             }
382         });
383     }
384     
385     public void setObjectProperty(String JavaDoc name, Object JavaDoc value) throws JMSException JavaDoc{
386         setObjectProperty(name,value,true);
387     }
388
389     public void setObjectProperty(String JavaDoc name, Object JavaDoc value, boolean checkReadOnly) throws JMSException JavaDoc {
390         
391         if (checkReadOnly) {
392             checkReadOnlyProperties();
393         }
394         if (name == null || name.equals("")) {
395             throw new IllegalArgumentException JavaDoc("Property name cannot be empty or null");
396         }
397         
398         checkValidObject(value);
399         PropertySetter setter = (PropertySetter) JMS_PROPERTY_SETERS.get(name);
400         
401         if( setter != null ) {
402             setter.set(this,value);
403         } else {
404             try {
405                 this.setProperty(name, value);
406             } catch (IOException JavaDoc e) {
407                 throw JMSExceptionSupport.create(e);
408             }
409         }
410     }
411     
412     public void setProperties(Map JavaDoc properties) throws JMSException JavaDoc {
413         for (Iterator JavaDoc iter = properties.entrySet().iterator(); iter.hasNext();) {
414             Map.Entry JavaDoc entry = (Map.Entry JavaDoc) iter.next();
415             
416             // Lets use the object property method as we may contain standard extension headers like JMSXGroupID
417
setObjectProperty((String JavaDoc) entry.getKey(), entry.getValue());
418         }
419     }
420     
421
422     protected void checkValidObject(Object JavaDoc value) throws MessageFormatException JavaDoc {
423         if (!(value instanceof Boolean JavaDoc || value instanceof Byte JavaDoc || value instanceof Short JavaDoc || value instanceof Integer JavaDoc || value instanceof Long JavaDoc
424                 || value instanceof Float JavaDoc || value instanceof Double JavaDoc || value instanceof Character JavaDoc || value instanceof String JavaDoc || value == null)) {
425
426             ActiveMQConnection conn = getConnection();
427             // conn is null if we are in the broker rather than a JMS client
428
if (conn == null || conn.isNestedMapAndListEnabled()) {
429                 if (!(value instanceof Map JavaDoc || value instanceof List JavaDoc)) {
430                     throw new MessageFormatException JavaDoc("Only objectified primitive objects, String, Map and List types are allowed but was: " + value + " type: "
431                             + value.getClass());
432                 }
433             }
434             else {
435                 throw new MessageFormatException JavaDoc("Only objectified primitive objects and String types are allowed but was: " + value + " type: "
436                         + value.getClass());
437             }
438         }
439     }
440
441     public Object JavaDoc getObjectProperty(String JavaDoc name) throws JMSException JavaDoc {
442         if (name == null) {
443             throw new NullPointerException JavaDoc("Property name cannot be null");
444         }
445         
446         // PropertyExpression handles converting message headers to properties.
447
PropertyExpression expression = new PropertyExpression(name);
448         return expression.evaluate(this);
449     }
450
451     public boolean getBooleanProperty(String JavaDoc name) throws JMSException JavaDoc {
452         Object JavaDoc value = getObjectProperty(name);
453         if( value == null )
454             return false;
455         Boolean JavaDoc rc = (Boolean JavaDoc)TypeConversionSupport.convert(value, Boolean JavaDoc.class);
456         if( rc == null ) {
457             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a boolean");
458         }
459         return rc.booleanValue();
460     }
461
462     public byte getByteProperty(String JavaDoc name) throws JMSException JavaDoc {
463         Object JavaDoc value = getObjectProperty(name);
464         if( value == null )
465             throw new NumberFormatException JavaDoc("property "+name+" was null");
466         Byte JavaDoc rc = (Byte JavaDoc)TypeConversionSupport.convert(value, Byte JavaDoc.class);
467         if( rc == null ) {
468             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a byte");
469         }
470         return rc.byteValue();
471     }
472
473     public short getShortProperty(String JavaDoc name) throws JMSException JavaDoc {
474         Object JavaDoc value = getObjectProperty(name);
475         if( value == null )
476             throw new NumberFormatException JavaDoc("property "+name+" was null");
477         Short JavaDoc rc = (Short JavaDoc)TypeConversionSupport.convert(value, Short JavaDoc.class);
478         if( rc == null ) {
479             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a short");
480         }
481         return rc.shortValue();
482     }
483
484     public int getIntProperty(String JavaDoc name) throws JMSException JavaDoc {
485         Object JavaDoc value = getObjectProperty(name);
486         if( value == null )
487             throw new NumberFormatException JavaDoc("property "+name+" was null");
488         Integer JavaDoc rc = (Integer JavaDoc)TypeConversionSupport.convert(value, Integer JavaDoc.class);
489         if( rc == null ) {
490             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as an integer");
491         }
492         return rc.intValue();
493     }
494
495     public long getLongProperty(String JavaDoc name) throws JMSException JavaDoc {
496         Object JavaDoc value = getObjectProperty(name);
497         if( value == null )
498             throw new NumberFormatException JavaDoc("property "+name+" was null");
499         Long JavaDoc rc = (Long JavaDoc)TypeConversionSupport.convert(value, Long JavaDoc.class);
500         if( rc == null ) {
501             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a long");
502         }
503         return rc.longValue();
504     }
505
506     public float getFloatProperty(String JavaDoc name) throws JMSException JavaDoc {
507         Object JavaDoc value = getObjectProperty(name);
508         if( value == null )
509             throw new NullPointerException JavaDoc("property "+name+" was null");
510         Float JavaDoc rc = (Float JavaDoc)TypeConversionSupport.convert(value, Float JavaDoc.class);
511         if( rc == null ) {
512             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a float");
513         }
514         return rc.floatValue();
515     }
516
517     public double getDoubleProperty(String JavaDoc name) throws JMSException JavaDoc {
518         Object JavaDoc value = getObjectProperty(name);
519         if( value == null )
520             throw new NullPointerException JavaDoc("property "+name+" was null");
521         Double JavaDoc rc = (Double JavaDoc)TypeConversionSupport.convert(value, Double JavaDoc.class);
522         if( rc == null ) {
523             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a double");
524         }
525         return rc.doubleValue();
526     }
527
528     public String JavaDoc getStringProperty(String JavaDoc name) throws JMSException JavaDoc {
529         Object JavaDoc value = getObjectProperty(name);
530         if( value == null ) {
531             if (name.equals("JMSXUserID")) {
532                 value = getUserID();
533             }
534         }
535         if( value == null )
536             return null;
537         String JavaDoc rc = (String JavaDoc)TypeConversionSupport.convert(value, String JavaDoc.class);
538         if( rc == null ) {
539             throw new MessageFormatException JavaDoc("Property "+name+" was a "+value.getClass().getName()+" and cannot be read as a String");
540         }
541         return rc;
542     }
543
544     public void setBooleanProperty(String JavaDoc name, boolean value) throws JMSException JavaDoc {
545         setBooleanProperty(name,value,true);
546     }
547     public void setBooleanProperty(String JavaDoc name, boolean value,boolean checkReadOnly) throws JMSException JavaDoc {
548         setObjectProperty(name, value ? Boolean.TRUE : Boolean.FALSE,checkReadOnly);
549     }
550
551     public void setByteProperty(String JavaDoc name, byte value) throws JMSException JavaDoc {
552         setObjectProperty(name, new Byte JavaDoc(value));
553     }
554
555     public void setShortProperty(String JavaDoc name, short value) throws JMSException JavaDoc {
556         setObjectProperty(name, new Short JavaDoc(value));
557     }
558
559     public void setIntProperty(String JavaDoc name, int value) throws JMSException JavaDoc {
560         setObjectProperty(name, new Integer JavaDoc(value));
561     }
562
563     public void setLongProperty(String JavaDoc name, long value) throws JMSException JavaDoc {
564         setObjectProperty(name, new Long JavaDoc(value));
565     }
566
567     public void setFloatProperty(String JavaDoc name, float value) throws JMSException JavaDoc {
568         setObjectProperty(name, new Float JavaDoc(value));
569     }
570
571     public void setDoubleProperty(String JavaDoc name, double value) throws JMSException JavaDoc {
572         setObjectProperty(name, new Double JavaDoc(value));
573     }
574
575     public void setStringProperty(String JavaDoc name, String JavaDoc value) throws JMSException JavaDoc {
576         setObjectProperty(name, value);
577     }
578
579
580     private void checkReadOnlyProperties() throws MessageNotWriteableException JavaDoc {
581         if (readOnlyProperties) {
582             throw new MessageNotWriteableException JavaDoc("Message properties are read-only");
583         }
584     }
585
586     protected void checkReadOnlyBody() throws MessageNotWriteableException JavaDoc {
587         if (readOnlyBody) {
588             throw new MessageNotWriteableException JavaDoc("Message body is read-only");
589         }
590     }
591
592     public boolean isExpired() {
593         long expireTime = this.getExpiration();
594         if (expireTime > 0 && System.currentTimeMillis() > expireTime) {
595             return true;
596         }
597         return false;
598     }
599
600     public Callback getAcknowledgeCallback() {
601         return acknowledgeCallback;
602     }
603
604     public void setAcknowledgeCallback(Callback acknowledgeCallback) {
605         this.acknowledgeCallback = acknowledgeCallback;
606     }
607     
608     /**
609      * Send operation event listener. Used to get the message ready to be sent.
610      */

611     public void onSend() throws JMSException JavaDoc {
612         setReadOnlyBody(true);
613         setReadOnlyProperties(true);
614     }
615
616
617     public Response visit(CommandVisitor visitor) throws Exception JavaDoc {
618         return visitor.processMessage( this );
619     }
620 }
621
Popular Tags