KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > composer > SendableMessage


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.mail.composer;
19
20 import java.io.IOException JavaDoc;
21 import java.io.InputStream JavaDoc;
22 import java.util.List JavaDoc;
23
24 import org.columba.core.io.CloneStreamMaster;
25 import org.columba.mail.message.ColumbaMessage;
26 import org.columba.ristretto.io.SourceInputStream;
27
28
29 public class SendableMessage extends ColumbaMessage {
30     private CloneStreamMaster sourceStream;
31
32     public SendableMessage() {
33         super();
34     }
35
36     /**
37  * Constructs the SendableMessage.java.
38  *
39  * @param m
40  */

41     public SendableMessage(ColumbaMessage m) {
42         super(m);
43
44         try {
45             setSourceStream(new SourceInputStream(m.getSource()));
46         } catch (IOException JavaDoc e) {
47             e.printStackTrace();
48         }
49     }
50
51     public int getAccountUid() {
52         return ((Integer JavaDoc) columbaHeader.getAttributes().get("columba.accountuid")).intValue();
53     }
54
55     public List JavaDoc getRecipients() {
56         return (List JavaDoc) columbaHeader.getAttributes().get("columba.recipients");
57     }
58
59     public void setAccountUid(int uid) {
60         columbaHeader.getAttributes().put("columba.accountuid", new Integer JavaDoc(uid));
61     }
62
63     public void setRecipients(List JavaDoc rcpt) {
64         columbaHeader.getAttributes().put("columba.recipients", rcpt);
65     }
66
67     /**
68  * @return Returns the sourceStream.
69  */

70     public InputStream JavaDoc getSourceStream() {
71         if (sourceStream == null) {
72             return new SourceInputStream(getSource());
73         }
74
75         return sourceStream.getClone();
76     }
77
78     /**
79  * @param sourceStream
80  * The sourceStream to set.
81  */

82     public void setSourceStream(InputStream JavaDoc sourceStream)
83         throws IOException JavaDoc {
84         this.sourceStream = new CloneStreamMaster(sourceStream);
85     }
86 }
87
Popular Tags