00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 package com.scalagent.kjoram;
00025
00026 import com.scalagent.kjoram.excepts.*;
00027
00028
00029 public class TextMessage extends Message
00030 {
00032 private String text = null;
00034 private boolean RObody = false;
00035
00039 TextMessage()
00040 {
00041 super();
00042 }
00043
00051 TextMessage(Session sess, com.scalagent.kjoram.messages.Message momMsg)
00052 {
00053 super(sess, momMsg);
00054 text = momMsg.getText();
00055 RObody = true;
00056 }
00057
00058
00064 public void clearBody() throws JMSException
00065 {
00066 super.clearBody();
00067 text = null;
00068 RObody = false;
00069 }
00070
00077 public void setText(String text) throws MessageNotWriteableException
00078 {
00079 if (RObody)
00080 throw new MessageNotWriteableException("Can't set a text as the"
00081 + " message body is read-only.");
00082 this.text = text;
00083 }
00084
00090 public String getText() throws JMSException
00091 {
00092 return text;
00093 }
00094
00101 protected void prepare() throws Exception
00102 {
00103 super.prepare();
00104 momMsg.clearBody();
00105 momMsg.setText(text);
00106 }
00107 }