KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > daemon > messageservice > message > TextMessageImpl


1 /*
2  * MessageQueueClient: The message queue client library
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * TextMessageImpl.java
20  */

21
22 // package path
23
package com.rift.coad.daemon.messageservice.message;
24
25 // java imports
26
import java.util.Date JavaDoc;
27 import java.util.List JavaDoc;
28
29
30 // coadunation imports
31
import com.rift.coad.daemon.messageservice.MessageServiceException;
32 import com.rift.coad.daemon.messageservice.TextMessage;
33
34 /**
35  * The implementation of the text message object.
36  *
37  * @author Brett Chaldecott
38  */

39 public class TextMessageImpl extends MessageImpl implements TextMessage {
40     
41     // private member variables
42
private String JavaDoc txtMessage = null;
43     
44     /**
45      * Creates a new instance of TextMessageImpl
46      *
47      * @param messageId The unique identifier for this message.
48      * @param user The user of this message.
49      * @param sessionId The id of this user session.
50      * @param principals The list of principals assigned to this message.
51      * @param status The status of this message.
52      */

53     public TextMessageImpl(String JavaDoc messageId,String JavaDoc user, String JavaDoc sessionId,
54             List JavaDoc principals, int status) {
55         super(messageId,user,sessionId,principals,status);
56     }
57     
58     
59     /**
60      * Creates a new instance of MessageImpl.
61      *
62      * @param messageId The id of the message that was created.
63      * @param create The created time stamp.
64      * @param retries The number of retries of this message.
65      * @param processedDate The last time this message was processed.
66      * @param user The name of the user.
67      * @param sessionId The id of this user session.
68      * @param principals The list of principals.
69      * @param from The from address of the message.
70      * @param messageType The type of message being used.
71      * @param status The status of this message.
72      */

73     public TextMessageImpl(String JavaDoc messageId, Date JavaDoc created, int retries,
74             Date JavaDoc processedDate,String JavaDoc user, String JavaDoc sessionId, List JavaDoc principals,
75             String JavaDoc from, int messageType, int status) {
76         super(messageId,created,retries,processedDate,user,sessionId,principals,
77                 from,messageType, status);
78     }
79     
80     
81     /**
82      * This clears the body of the message.
83      *
84      * @exception MessageServiceException
85      */

86     public void clearBody() throws MessageServiceException {
87         txtMessage = null;
88     }
89     
90     
91     /**
92      * This method sets the text body of a text message.
93      *
94      * @param text The text to set as the body of this message.
95      * @exception MessageServiceException
96      */

97     public void setTextBody(String JavaDoc text) throws MessageServiceException {
98         this.txtMessage = text;
99     }
100     
101     
102     /**
103      * This method returns the text body of this message.
104      *
105      * @return The string containing the text body.
106      * @exception MessageServiceException
107      */

108     public String JavaDoc getTextBody() throws MessageServiceException {
109         return txtMessage;
110     }
111     
112 }
113
Popular Tags