1 24 25 package org.objectweb.tribe.adapters; 26 27 import java.io.Serializable ; 28 29 import org.objectweb.tribe.common.Member; 30 31 38 class MulticastRequestAdapterMessage implements Serializable 39 { 40 static final int REQUEST = 0; 41 static final int REQUEST_ONLY = 1; 42 static final int REPLY = 2; 43 private Serializable msg; 44 private Member sender; 45 private int uid; 46 private int requestReply; 47 48 56 public MulticastRequestAdapterMessage(Serializable msg, Member sender, 57 int uid, int requestOrReply) 58 { 59 this.msg = msg; 60 this.sender = sender; 61 this.uid = uid; 62 this.requestReply = requestOrReply; 63 } 64 65 70 public Serializable getMessage() 71 { 72 return msg; 73 } 74 75 80 public void setMessage(Serializable msg) 81 { 82 this.msg = msg; 83 } 84 85 90 public boolean isRequest() 91 { 92 return requestReply == REQUEST; 93 } 94 95 98 public void setRequest() 99 { 100 this.requestReply = REQUEST; 101 } 102 103 108 public boolean isRequestOnly() 109 { 110 return requestReply == REQUEST_ONLY; 111 } 112 113 116 public void setRequestOnly() 117 { 118 this.requestReply = REQUEST_ONLY; 119 } 120 121 126 public boolean isReply() 127 { 128 return requestReply == REPLY; 129 } 130 131 134 public void setReply() 135 { 136 this.requestReply = REPLY; 137 } 138 139 144 public Member getSender() 145 { 146 return sender; 147 } 148 149 154 public void setSender(Member sender) 155 { 156 this.sender = sender; 157 } 158 159 164 public int getUid() 165 { 166 return uid; 167 } 168 169 172 public String toString() 173 { 174 String type; 175 switch (requestReply) 176 { 177 case REQUEST : 178 type = "Request "; 179 break; 180 case REQUEST_ONLY : 181 type = "Request only "; 182 break; 183 case REPLY : 184 type = "Reply "; 185 break; 186 default : 187 type = "Unknown "; 188 break; 189 } 190 return type + uid + " from " + sender + " (" + msg + ")"; 191 } 192 } | Popular Tags |