Mercurial > hg > Applications > AliceVNC
view src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java @ 56:9f1289c78b22
update maven change compressed DSM to only pixelData
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 16 Nov 2015 23:19:26 +0900 |
parents | 57ca704f86a3 |
children | fe627049e289 4a8755a30aa8 |
line wrap: on
line source
package jp.ac.u_ryukyu.alicevnc; import java.util.ArrayList; import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class CheckCurrentInfo extends CodeSegment { private Receiver info = ids.create(CommandType.TAKE); // current Server Info private AliceVNCMessage order; public CheckCurrentInfo(AliceVNCMessage order){ info.setKey("currentServer"); this.order = order; } @Override public void run() { AliceVNCMessage current = info.asClass(AliceVNCMessage.class); if (order.name.equals(current.name)) { // need check route and node name ods.update("currentServer", current); } else { if (current.allowChange) { // send Stop message to current current.messageID = MessageType.StopProxy.getId(); String address = current.getNextAddress(); ods.put(address, "AliceVNCMessage", current); AliceVNCMessage mes = new AliceVNCMessage(MessageType.StartNegotiate); mes.route = new ArrayList<String>(); for (String s : order.route) { mes.route.add(s); } mes.name = "node0"; address = mes.getNextAddress(); ods.put(address, "AliceVNCMessage", mes); } else { // not allow to change order.messageID = MessageType.DeniedRequest.getId(); order.name = "node0"; String address = order.getNextAddress(); ods.put(address, "AliceVNCMessage", order); // update current server info ods.update("currentServer", current); } } new ReceiveAliceVNCMessage(); } }