01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package javax.jms;
23:
24: /** A <CODE>TextMessage</CODE> object is used to send a message containing a
25: * <CODE>java.lang.String</CODE>.
26: * It inherits from the <CODE>Message</CODE> interface and adds a text message
27: * body.
28: *
29: * <P>This message type can be used to transport text-based messages, including
30: * those with XML content.
31: *
32: * <P>When a client receives a <CODE>TextMessage</CODE>, it is in read-only
33: * mode. If a client attempts to write to the message at this point, a
34: * <CODE>MessageNotWriteableException</CODE> is thrown. If
35: * <CODE>clearBody</CODE> is
36: * called, the message can now be both read from and written to.
37: *
38: * @see javax.jms.Session#createTextMessage()
39: * @see javax.jms.Session#createTextMessage(String)
40: * @see javax.jms.BytesMessage
41: * @see javax.jms.MapMessage
42: * @see javax.jms.Message
43: * @see javax.jms.ObjectMessage
44: * @see javax.jms.StreamMessage
45: * @see java.lang.String
46: */
47:
48: public interface TextMessage extends Message {
49:
50: /** Sets the string containing this message's data.
51: *
52: * @param string the <CODE>String</CODE> containing the message's data
53: *
54: * @exception JMSException if the JMS provider fails to set the text due to
55: * some internal error.
56: * @exception MessageNotWriteableException if the message is in read-only
57: * mode.
58: */
59:
60: void setText(String string) throws JMSException;
61:
62: /** Gets the string containing this message's data. The default
63: * value is null.
64: *
65: * @return the <CODE>String</CODE> containing the message's data
66: *
67: * @exception JMSException if the JMS provider fails to get the text due to
68: * some internal error.
69: */
70:
71: String getText() throws JMSException;
72: }
|