01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the License). You may not use this file except in
05: * compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://glassfish.dev.java.net/public/CDDLv1.0.html or
09: * glassfish/bootstrap/legal/CDDLv1.0.txt.
10: * See the License for the specific language governing
11: * permissions and limitations under the License.
12: *
13: * When distributing Covered Code, include this CDDL
14: * Header Notice in each file and include the License file
15: * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16: * If applicable, add the following below the CDDL Header,
17: * with the fields enclosed by brackets [] replaced by
18: * you own identifying information:
19: * "Portions Copyrighted [year] [name of copyright owner]"
20: *
21: * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22: */
23:
24: package javax.jms;
25:
26: /**
27: * A <CODE>TextMessage</CODE> object is used to send a message containing a
28: * <CODE>java.lang.String</CODE>. It inherits from the <CODE>Message</CODE>
29: * interface and adds a text message body.
30: *
31: * <P>
32: * This message type can be used to transport text-based messages, including
33: * those with XML content.
34: *
35: * <P>
36: * When a client receives a <CODE>TextMessage</CODE>, it is in read-only
37: * mode. If a client attempts to write to the message at this point, a <CODE>MessageNotWriteableException</CODE>
38: * is thrown. If <CODE>clearBody</CODE> is called, the message can now be both
39: * read from and written to.
40: *
41: * @version 1.1 - February 2, 2002
42: * @author Mark Hapner
43: * @author Rich Burridge
44: * @author Kate Stout
45: *
46: * @see javax.jms.Session#createTextMessage()
47: * @see javax.jms.Session#createTextMessage(String)
48: * @see javax.jms.BytesMessage
49: * @see javax.jms.MapMessage
50: * @see javax.jms.Message
51: * @see javax.jms.ObjectMessage
52: * @see javax.jms.StreamMessage
53: * @see java.lang.String
54: */
55:
56: public interface TextMessage extends Message {
57:
58: /**
59: * Sets the string containing this message's data.
60: *
61: * @param string
62: * the <CODE>String</CODE> containing the message's data
63: *
64: * @exception JMSException
65: * if the JMS provider fails to set the text due to some
66: * internal error.
67: * @exception MessageNotWriteableException
68: * if the message is in read-only mode.
69: */
70:
71: void setText(String string) throws JMSException;
72:
73: /**
74: * Gets the string containing this message's data. The default value is
75: * null.
76: *
77: * @return the <CODE>String</CODE> containing the message's data
78: *
79: * @exception JMSException
80: * if the JMS provider fails to get the text due to some
81: * internal error.
82: */
83:
84: String getText() throws JMSException;
85: }
|