Mercurial > hg > Applications > AliceVNC
view src/main/java/jp/ac/u_ryukyu/alicevnc/SendChangeRequest.java @ 47:9354e8a1d03b
working AliceVNC
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 19 Oct 2015 23:48:18 +0900 |
parents | aace9df1462e |
children | 57ca704f86a3 |
line wrap: on
line source
package jp.ac.u_ryukyu.alicevnc; import java.util.ArrayList; import java.util.List; import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class SendChangeRequest extends CodeSegment { private Receiver info = ids.create(CommandType.PEEK); // hostName private Receiver info1 = ids.create(CommandType.PEEK); // connection list private Receiver info2 = ids.create(CommandType.PEEK); // AliceVNCConfig private Receiver info3 = ids.create(CommandType.TAKE); // request public SendChangeRequest(CodeSegment cs){ this.aliceDaemon = cs.aliceDaemon; info.setKey("host", this); info1.setKey("_CLIST", this); info2.setKey("AliceVNCConfig", this); info3.setKey("Request", this); } @Override public void run() { AliceVNCConfig config = info2.asClass(AliceVNCConfig.class); String hostname = info.asString(); @SuppressWarnings("unchecked") List<String> clist = info1.asClass(List.class); AliceVNCMessage mes = new AliceVNCMessage(MessageType.ChangeRequest); mes.allowChange = config.getAllowChange(); mes.route = new ArrayList<String>(); mes.name = hostname; String address = "local"; if (clist.contains("parent")){ // this node is not root. compare node0 is better? address = "parent"; } ods.put(address, "AliceVNCMessage", mes); new SendChangeRequest(this); } }