1 24 package com.scalagent.kjoram; 25 26 import com.scalagent.kjoram.excepts.*; 27 28 29 public class TextMessage extends Message 30 { 31 32 private String text = null; 33 34 private boolean RObody = false; 35 36 39 TextMessage() 40 { 41 super(); 42 } 43 44 51 TextMessage(Session sess, com.scalagent.kjoram.messages.Message momMsg) 52 { 53 super(sess, momMsg); 54 text = momMsg.getText(); 55 RObody = true; 56 } 57 58 59 64 public void clearBody() throws JMSException 65 { 66 super.clearBody(); 67 text = null; 68 RObody = false; 69 } 70 71 77 public void setText(String text) throws MessageNotWriteableException 78 { 79 if (RObody) 80 throw new MessageNotWriteableException("Can't set a text as the" 81 + " message body is read-only."); 82 this.text = text; 83 } 84 85 90 public String getText() throws JMSException 91 { 92 return text; 93 } 94 95 101 protected void prepare() throws Exception 102 { 103 super.prepare(); 104 momMsg.clearBody(); 105 momMsg.setText(text); 106 } 107 } 108 | Popular Tags |