2 import org.opensrf.util.*;
5 public class Message implements OSRFSerializable {
7 public static final String REQUEST = "REQUEST";
8 public static final String STATUS = "STATUS";
9 public static final String RESULT = "RESULT";
10 public static final String CONNECT = "CONNECT";
11 public static final String DISCONNECT = "DISCONNECT";
13 /** Message ID. This number is used to relate requests to responses */
15 /** String of message. */
17 /** message payload */
18 private Object payload;
20 /** Go ahead and register the Message object */
21 private static OSRFRegistry registry =
22 OSRFRegistry.registerObject(
24 OSRFRegistry.WireProtocol.HASH,
25 new String[] {"threadTrace", "type", "payload"});
28 * @param id This message's ID
29 * @param type The type of message
31 public Message(int id, String type) {
35 public Message(int id, String type, Object payload) {
44 public String getType() {
47 public Object getPayload() {
50 public void setId(int id) {
53 public void setString(String type) {
56 public void setPayload(Object p) {
61 * Implements the generic get() API required by OSRFSerializable
63 public Object get(String field) {
64 if("threadTrace".equals(field))
66 if("type".equals(field))
67 return getType().toString();
68 if("payload".equals(field))
73 public OSRFRegistry getRegistry() {