View Javadoc

1   package org.codehaus.wadi.tribes;
2   
3   import java.io.Serializable;
4   import java.util.Collections;
5   import java.util.HashMap;
6   import java.util.Map;
7   
8   import org.codehaus.wadi.group.Address;
9   import org.codehaus.wadi.group.Envelope;
10  import org.codehaus.wadi.group.Quipu;
11  
12  /***
13   * <p>Title: </p>
14   *
15   * <p>Description: </p>
16   *
17   * <p>Copyright: Copyright (c) 2006</p>
18   *
19   * <p>Company: </p>
20   *
21   * @author not attributable
22   * @version 1.0
23   */
24  public class TribesEnvelope implements Envelope, Serializable {
25      protected Address address;
26      protected Serializable payload;
27      protected Address replyto;
28      protected String sourceCorrId;
29      protected String targetCorrId;
30      private final Map<String, Object> properties = new HashMap<String, Object>();
31      private transient Quipu quipu;
32      
33      public TribesEnvelope() {
34      }
35  
36      /***
37       * getAddress
38       *
39       * @return Address
40       * @todo Implement this org.codehaus.wadi.group.Message method
41       */
42      public Address getAddress() {
43          return address;
44      }
45  
46      /***
47       * getPayload
48       *
49       * @return Serializable
50       * @todo Implement this org.codehaus.wadi.group.Message method
51       */
52      public Serializable getPayload() {
53          return payload;
54      }
55  
56      /***
57       * getReplyTo
58       *
59       * @return Address
60       * @todo Implement this org.codehaus.wadi.group.Message method
61       */
62      public Address getReplyTo() {
63          return replyto;
64      }
65  
66      /***
67       * getSourceCorrelationId
68       *
69       * @return String
70       * @todo Implement this org.codehaus.wadi.group.Message method
71       */
72      public String getSourceCorrelationId() {
73          return sourceCorrId;
74      }
75  
76      /***
77       * getTargetCorrelationId
78       *
79       * @return String
80       * @todo Implement this org.codehaus.wadi.group.Message method
81       */
82      public String getTargetCorrelationId() {
83          return targetCorrId;
84      }
85  
86      /***
87       * setAddress
88       *
89       * @param address Address
90       * @todo Implement this org.codehaus.wadi.group.Message method
91       */
92      public void setAddress(Address address) {
93          this.address = address;
94      }
95  
96      /***
97       * setPayload
98       *
99       * @param payload Serializable
100      * @todo Implement this org.codehaus.wadi.group.Message method
101      */
102     public void setPayload(Serializable payload) {
103         this.payload = payload;
104     }
105 
106     /***
107      * setReplyTo
108      *
109      * @param replyTo Address
110      * @todo Implement this org.codehaus.wadi.group.Message method
111      */
112     public void setReplyTo(Address replyTo) {
113         this.replyto = replyTo;
114     }
115 
116     /***
117      * setSourceCorrelationId
118      *
119      * @param correlationId String
120      * @todo Implement this org.codehaus.wadi.group.Message method
121      */
122     public void setSourceCorrelationId(String correlationId) {
123         this.sourceCorrId = correlationId;
124     }
125 
126     /***
127      * setTargetCorrelationId
128      *
129      * @param correlationId String
130      * @todo Implement this org.codehaus.wadi.group.Message method
131      */
132     public void setTargetCorrelationId(String correlationId) {
133         this.targetCorrId = correlationId;
134     }
135 
136     public Map<String, Object> getProperties() {
137         return Collections.unmodifiableMap(properties);
138     }
139 
140     public Object getProperty(String key) {
141         return properties.get(key);
142     }
143 
144     public void removeProperty(String key) {
145         properties.remove(key);
146     }
147     
148     public void setProperty(String key, Object value) {
149         properties.put(key, value);
150     }
151     
152     public Quipu getQuipu() {
153         return quipu;
154     }
155     
156     public void setQuipu(Quipu quipu) {
157         this.quipu = quipu;
158         sourceCorrId = quipu.getCorrelationId();
159     }
160     
161     @Override
162     public String toString() {
163         return "Message: to [" + address + "]; replyTo [" + replyto + "]; payload [" + payload + "]";
164     }
165 
166 }