Mercurial > hg > Applications > AliceVNC
changeset 32:7d65ad341cc9
refactor
author | sugi |
---|---|
date | Sun, 09 Nov 2014 11:40:40 +0900 |
parents | 556e27a53219 |
children | 6f5986d8ecd5 |
files | src/main/java/jp/ac/u_ryukyu/alicevnc/AliceVNCMessage.java src/main/java/jp/ac/u_ryukyu/alicevnc/ChangeRequestMessage.java src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java src/main/java/jp/ac/u_ryukyu/alicevnc/CreateWindow.java src/main/java/jp/ac/u_ryukyu/alicevnc/NegotiateVNCServer.java src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveChangeRequest.java src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java src/main/java/jp/ac/u_ryukyu/alicevnc/SendChangeRequest.java |
diffstat | 8 files changed, 59 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/AliceVNCMessage.java Sun Nov 09 11:40:40 2014 +0900 @@ -0,0 +1,38 @@ +package jp.ac.u_ryukyu.alicevnc; + +import java.util.List; + +import org.msgpack.annotation.Message; + +@Message +public class AliceVNCMessage { + //TODO class name change + public int messageID; + public List<String> route; + public boolean allowChange = false; + public String name; + + public AliceVNCMessage(){ + // constructor need for MessagePack + } + + public AliceVNCMessage(MessageType type){ + messageID = type.getId(); + } + + public enum MessageType{ + ChangeRequest(1), + StartNegotiate(2), + CurrentVNCInfo(3), + StopProxy(4); + + private final int id; + private MessageType(final int id) { + this.id = id; + } + + public int getId() { + return id; + } + } +}
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/ChangeRequestMessage.java Sat Nov 08 23:11:45 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -package jp.ac.u_ryukyu.alicevnc; - -import java.util.List; - -import org.msgpack.annotation.Message; - -@Message -public class ChangeRequestMessage { - //TODO class name change - public int messageID; - public List<String> route; - public boolean allowChange = false; - public String name; - - public ChangeRequestMessage(){ - // constructor need for MessagePack - } - - public ChangeRequestMessage(MessageType type){ - messageID = type.getId(); - } - - public enum MessageType{ - ChangeRequest(1), - StartNegotiate(2), - CurrentVNCInfo(3), - StopProxy(4); - - private final int id; - private MessageType(final int id) { - this.id = id; - } - - public int getId() { - return id; - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java Sat Nov 08 23:11:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java Sun Nov 09 11:40:40 2014 +0900 @@ -2,7 +2,7 @@ import java.util.ArrayList; -import jp.ac.u_ryukyu.alicevnc.ChangeRequestMessage.MessageType; +import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; @@ -10,9 +10,9 @@ public class CheckCurrentInfo extends CodeSegment { private Receiver info = ids.create(CommandType.TAKE); // current Server Info - private ChangeRequestMessage order; + private AliceVNCMessage order; - public CheckCurrentInfo(ChangeRequestMessage order){ + public CheckCurrentInfo(AliceVNCMessage order){ info.setKey("currentServer"); this.order = order; } @@ -20,7 +20,7 @@ @Override public void run() { System.out.println("check"); - ChangeRequestMessage current = info.asClass(ChangeRequestMessage.class); + AliceVNCMessage current = info.asClass(AliceVNCMessage.class); if (current.allowChange) { // send Stop message to current @@ -30,7 +30,7 @@ current.route.remove(last); ods.put(address, "changeRequest", current); - ChangeRequestMessage mes = new ChangeRequestMessage(MessageType.StartNegotiate); + AliceVNCMessage mes = new AliceVNCMessage(MessageType.StartNegotiate); mes.route = new ArrayList<String>(); for (String s : order.route) { mes.route.add(s);
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/CreateWindow.java Sat Nov 08 23:11:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/CreateWindow.java Sun Nov 09 11:40:40 2014 +0900 @@ -1,9 +1,10 @@ package jp.ac.u_ryukyu.alicevnc; +import jp.ac.u_ryukyu.ie.cr.DecodeInfomation; + import com.glavsoft.drawing.Renderer; import com.glavsoft.rfb.IRepaintController; import com.glavsoft.rfb.encoding.PixelFormat; -import com.glavsoft.rfb.encoding.decoder.AliceVNCMessage; import com.glavsoft.rfb.protocol.Protocol; import com.glavsoft.rfb.protocol.ProtocolSettings; import com.glavsoft.viewer.Viewer; @@ -42,7 +43,7 @@ Protocol context = new Protocol(null, null, null, settings); context.setMessageQueue(new MyMessageQueue()); - AliceVNCMessage message = info.asClass(AliceVNCMessage.class); + DecodeInfomation message = info.asClass(DecodeInfomation.class); pixelFormat = message.getPixelFormat(); width = message.width; height = message.height;
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/NegotiateVNCServer.java Sat Nov 08 23:11:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/NegotiateVNCServer.java Sun Nov 09 11:40:40 2014 +0900 @@ -2,7 +2,7 @@ import java.util.ArrayList; -import jp.ac.u_ryukyu.alicevnc.ChangeRequestMessage.MessageType; +import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType; import com.glavsoft.viewer.Viewer; @@ -30,7 +30,7 @@ Viewer.main(args); // currentServer Info - ChangeRequestMessage currentServerInfo = new ChangeRequestMessage(MessageType.CurrentVNCInfo); + AliceVNCMessage currentServerInfo = new AliceVNCMessage(MessageType.CurrentVNCInfo); currentServerInfo.name = hostname; currentServerInfo.allowChange = conf.getAllowChange(); ArrayList<String> list = new ArrayList<String>();
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveChangeRequest.java Sat Nov 08 23:11:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveChangeRequest.java Sun Nov 09 11:40:40 2014 +0900 @@ -2,7 +2,7 @@ import java.util.List; -import jp.ac.u_ryukyu.alicevnc.ChangeRequestMessage.MessageType; +import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; @@ -18,7 +18,7 @@ @Override public void run() { - ChangeRequestMessage order = info.asClass(ChangeRequestMessage.class); + AliceVNCMessage order = info.asClass(AliceVNCMessage.class); @SuppressWarnings("unchecked") List<String> clist = info1.asClass(List.class);
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java Sat Nov 08 23:11:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java Sun Nov 09 11:40:40 2014 +0900 @@ -2,9 +2,10 @@ import java.util.ArrayList; +import jp.ac.u_ryukyu.ie.cr.DecodeInfomation; + import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.encoding.EncodingType; -import com.glavsoft.rfb.encoding.decoder.AliceVNCMessage; import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder; import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder; @@ -22,8 +23,8 @@ public ReceiveUpdateRectangle(){ info.setKey("holder"); - info1.setKey("aliceVNCMessage"); - info2.setKey("pixelByteArray"); + info1.setKey("updateRectangle"); + info2.setKey("pixelData"); info3.setKey("_CLIST"); } @@ -36,9 +37,9 @@ if (!info1.from.equals(node)) { // not need send data comes from // Data Segment from other node is already serialized - ods.put(node, "aliceVNCMessage", info1.getReceiveData()); + ods.put(node, "updateRectangle", info1.getReceiveData()); //ods.setCompressFlag(true); - ods.put(node, "pixelByteArray", info2.getReceiveData()); + ods.put(node, "pixelData", info2.getReceiveData()); ods.setCompressFlag(false); } @@ -46,7 +47,7 @@ try { RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class); - AliceVNCMessage message = info1.asClass(AliceVNCMessage.class); + DecodeInfomation message = info1.asClass(DecodeInfomation.class); if (message.getEncodingType() == EncodingType.ZRLEE){ ZRLEDecoder decoder = new ZRLEDecoder();
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/SendChangeRequest.java Sat Nov 08 23:11:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/SendChangeRequest.java Sun Nov 09 11:40:40 2014 +0900 @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import jp.ac.u_ryukyu.alicevnc.ChangeRequestMessage.MessageType; +import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; @@ -30,7 +30,7 @@ @SuppressWarnings("unchecked") List<String> clist = info1.asClass(List.class); - ChangeRequestMessage mes = new ChangeRequestMessage(MessageType.ChangeRequest); + AliceVNCMessage mes = new AliceVNCMessage(MessageType.ChangeRequest); mes.allowChange = config.getAllowChange(); mes.route = new ArrayList<String>(); mes.name = hostname;