KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > joram > mom > dest > ftp > FtpMessage


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2007 ScalAgent Distributed Technologies
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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Nicolas Tachker (ScalAgent)
21  * Contributor(s):
22  */

23 package com.scalagent.joram.mom.dest.ftp;
24
25 import java.util.Enumeration JavaDoc;
26
27 import org.objectweb.joram.shared.messages.Message;
28
29
30 /**
31  * A mail message encapsulates a proprietary message which is also used
32  * for effective MOM transport facility.
33  */

34 public class FtpMessage {
35   private Message sharedMsg;
36
37   /**
38    * Constructs a bright new <code>MailMessage</code>.
39    */

40   public FtpMessage() {
41     sharedMsg = new Message();
42   }
43
44   /**
45    * Instanciates a <code>MailMessage</code> wrapping a consumed
46    * MOM simple message.
47    *
48    * @param momMsg The MOM message to wrap.
49    */

50   public FtpMessage(org.objectweb.joram.shared.messages.Message momMsg) {
51     this.sharedMsg = momMsg;
52   }
53   
54   /**
55    *
56    * @return shared message structure
57    */

58   public Message getSharedMessage() {
59     return sharedMsg;
60   }
61   
62   /**
63    * The message identifier.
64    * @return identifier
65    */

66   public String JavaDoc getIdentifier() {
67     return sharedMsg.id;
68   }
69
70   /**
71    * <code>true</code> if the message could not be written on the dest.
72    * @param notWriteable
73    */

74   public void setNotWriteable(boolean notWriteable) {
75     sharedMsg.notWriteable = notWriteable;
76   }
77
78   public String JavaDoc getStringProperty(String JavaDoc key) {
79     return (String JavaDoc) sharedMsg.properties.get(key);
80   }
81
82   public long getLongProperty(String JavaDoc key) {
83     return ((Long JavaDoc) sharedMsg.properties.get(key)).longValue();
84   }
85
86   public boolean getBooleanProperty(String JavaDoc key) {
87     return ((Boolean JavaDoc) sharedMsg.properties.get(key)).booleanValue();
88   }
89
90   public Object JavaDoc getObjectProperty(String JavaDoc key) {
91     return sharedMsg.properties.get(key);
92   }
93   
94   public Object JavaDoc clone() {
95     Message cloneShared = null;
96     return new FtpMessage(cloneShared);
97   }
98
99   public void clearProperties() {
100     sharedMsg.properties.clear();
101   }
102
103   public Enumeration JavaDoc getPropertyNames() {
104     return sharedMsg.properties.keys();
105   }
106
107   public void setObjectProperty(String JavaDoc key, Object JavaDoc value) {
108     sharedMsg.setProperty(key, value);
109   }
110
111   public void setStringProperty(String JavaDoc key, String JavaDoc value) {
112     sharedMsg.setProperty(key, value);
113   }
114
115   public boolean propertyExists(String JavaDoc key) {
116     return sharedMsg.properties.containsKey(key);
117   }
118
119 }
120
Popular Tags