annotate src/main/java/jp/ac/u_ryukyu/alicevnc/NegotiateVNCServer.java @ 34:aace9df1462e

refactor
author sugi
date Thu, 13 Nov 2014 16:09:09 +0900
parents 7d65ad341cc9
children 9354e8a1d03b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
4faa4619a02f refactor
YU
parents:
diff changeset
1 package jp.ac.u_ryukyu.alicevnc;
4faa4619a02f refactor
YU
parents:
diff changeset
2
24
36a9a7de314d root can receive message
sugi
parents: 23
diff changeset
3 import java.util.ArrayList;
36a9a7de314d root can receive message
sugi
parents: 23
diff changeset
4
32
7d65ad341cc9 refactor
sugi
parents: 31
diff changeset
5 import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType;
24
36a9a7de314d root can receive message
sugi
parents: 23
diff changeset
6
7
4faa4619a02f refactor
YU
parents:
diff changeset
7 import com.glavsoft.viewer.Viewer;
4faa4619a02f refactor
YU
parents:
diff changeset
8
4faa4619a02f refactor
YU
parents:
diff changeset
9 import alice.codesegment.CodeSegment;
4faa4619a02f refactor
YU
parents:
diff changeset
10 import alice.datasegment.CommandType;
4faa4619a02f refactor
YU
parents:
diff changeset
11 import alice.datasegment.Receiver;
4faa4619a02f refactor
YU
parents:
diff changeset
12
20
15398aebb0ef refactor
sugi
parents: 15
diff changeset
13 public class NegotiateVNCServer extends CodeSegment {
7
4faa4619a02f refactor
YU
parents:
diff changeset
14 private Receiver info = ids.create(CommandType.PEEK);
20
15398aebb0ef refactor
sugi
parents: 15
diff changeset
15 private Receiver info1 = ids.create(CommandType.PEEK);
7
4faa4619a02f refactor
YU
parents:
diff changeset
16
20
15398aebb0ef refactor
sugi
parents: 15
diff changeset
17 public NegotiateVNCServer(){
15398aebb0ef refactor
sugi
parents: 15
diff changeset
18 info.setKey("host");
15398aebb0ef refactor
sugi
parents: 15
diff changeset
19 info1.setKey("AliceVNCConfig");
7
4faa4619a02f refactor
YU
parents:
diff changeset
20 }
22
fdb036159e61 create ServerChangeRequest
sugi
parents: 20
diff changeset
21
20
15398aebb0ef refactor
sugi
parents: 15
diff changeset
22 @Override
7
4faa4619a02f refactor
YU
parents:
diff changeset
23 public void run() {
20
15398aebb0ef refactor
sugi
parents: 15
diff changeset
24 AliceVNCConfig conf = info1.asClass(AliceVNCConfig.class);
15398aebb0ef refactor
sugi
parents: 15
diff changeset
25 String hostname = info.asString();
22
fdb036159e61 create ServerChangeRequest
sugi
parents: 20
diff changeset
26
31
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
27 // root node connect to vnc Server first time.
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
28 String[] args = {"localhost"};
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
29 // negotiate VNCServer by Viewer
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
30 Viewer.main(args);
24
36a9a7de314d root can receive message
sugi
parents: 23
diff changeset
31
31
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
32 // currentServer Info
32
7d65ad341cc9 refactor
sugi
parents: 31
diff changeset
33 AliceVNCMessage currentServerInfo = new AliceVNCMessage(MessageType.CurrentVNCInfo);
31
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
34 currentServerInfo.name = hostname;
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
35 currentServerInfo.allowChange = conf.getAllowChange();
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
36 ArrayList<String> list = new ArrayList<String>();
556e27a53219 refactor and bug fix
sugi
parents: 30
diff changeset
37 currentServerInfo.route = list;
34
aace9df1462e refactor
sugi
parents: 32
diff changeset
38 ods.put("AliceVNCMessage", currentServerInfo);
30
d8c6a4c7f16e change algotherm
sugi
parents: 27
diff changeset
39
7
4faa4619a02f refactor
YU
parents:
diff changeset
40 }
4faa4619a02f refactor
YU
parents:
diff changeset
41
4faa4619a02f refactor
YU
parents:
diff changeset
42 }