40
|
1 package christie.topology;
|
|
2
|
|
3
|
|
4 import org.msgpack.annotation.Message;
|
|
5
|
94
|
6 import java.net.InetAddress;
|
|
7 import java.net.UnknownHostException;
|
|
8
|
40
|
9 @Message
|
|
10 public class HostMessage {
|
94
|
11 private String hostName;
|
|
12 private int port;
|
|
13 private String nodeName; // this is nodeName which have these IP and port.
|
|
14 private String connectionName;
|
|
15 private String remoteNodeName;
|
40
|
16
|
94
|
17 private String cookie; // MD5
|
40
|
18
|
94
|
19 private boolean alive;
|
40
|
20
|
|
21 public HostMessage() { }
|
94
|
22
|
|
23 public void setLocalHostAndPort(int port){
|
|
24 try {
|
|
25 this.hostName = InetAddress.getLocalHost().getHostAddress();
|
|
26 this.port = port;
|
|
27 } catch (UnknownHostException e) {
|
|
28 e.printStackTrace();
|
|
29 }
|
|
30 }
|
|
31
|
|
32 public void setHostAndPort(String hostName, int port) {
|
|
33 this.hostName = hostName;
|
40
|
34 this.port = port;
|
|
35 }
|
|
36
|
94
|
37 public void setNodeInfo(String nodeName, String connectionName, String remoteNodeName){
|
|
38 this.nodeName = nodeName;
|
40
|
39 this.connectionName = connectionName;
|
94
|
40 this.remoteNodeName = remoteNodeName;
|
|
41 }
|
|
42
|
|
43 public void setNodeName(String nodeName) {
|
|
44 this.nodeName = nodeName;
|
40
|
45 }
|
|
46
|
94
|
47 public String getHostName() { return hostName; }
|
|
48
|
|
49 public int getPort() { return port; }
|
|
50
|
|
51 public String getNodeName() { return nodeName; }
|
|
52
|
|
53 public String getConnectionName() { return connectionName; }
|
|
54
|
|
55 public String getRemoteNodeName() { return remoteNodeName; }
|
|
56
|
|
57 public void setAlive(boolean alive) { this.alive = alive; }
|
|
58
|
|
59 public boolean isAlive() { return alive; }
|
|
60
|
|
61 public void setCookie(String cookie) { this.cookie = cookie; }
|
|
62
|
|
63 public String getCookie() { return cookie; }
|
40
|
64
|
|
65 public String toString() {
|
50
|
66 return "HostMessage : name = " + hostName + ", port = " + Integer.toString(port) + " connectionName = " +
|
93
|
67 connectionName + " absName = " + nodeName + " remoteAbsName = " + remoteNodeName
|
40
|
68 + " cokkie = " + cookie ;
|
|
69 }
|
|
70 }
|