Mercurial > hg > Applications > AliceVNC
changeset 15:87d90513e8f5
add ServerChange Message
author | YU |
---|---|
date | Sat, 18 Oct 2014 22:05:42 +0900 |
parents | b175d5306b11 |
children | 2a6e2c89b708 |
files | build.gradle src/main/java/jp/ac/u_ryukyu/alicevnc/AliceVNC.java src/main/java/jp/ac/u_ryukyu/alicevnc/RequestStartVNCServer.java src/main/java/jp/ac/u_ryukyu/alicevnc/ServerChangeMessage.java src/main/java/jp/ac/u_ryukyu/alicevnc/StartVNCServer.java |
diffstat | 5 files changed, 59 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/build.gradle Tue Oct 07 15:52:31 2014 +0900 +++ b/build.gradle Sat Oct 18 22:05:42 2014 +0900 @@ -13,7 +13,7 @@ } dependencies { - compile 'com.glavsoft.viewer:tightvnc-jviewer:2.7.2' + //compile 'com.glavsoft.viewer:tightvnc-jviewer:2.7.2' } jar {
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/AliceVNC.java Tue Oct 07 15:52:31 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/AliceVNC.java Sat Oct 18 22:05:42 2014 +0900 @@ -14,12 +14,16 @@ if (conf.getProxyFlag()){ + ods.put("VNCServer", true); new StartVNCServer(); new ReceiveServerInitMessage(); + } if (conf.getViewerFlag()){ new ReceiveServerInitMessage("parent"); } + + new RequestStartVNCServer(); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/RequestStartVNCServer.java Sat Oct 18 22:05:42 2014 +0900 @@ -0,0 +1,30 @@ +package jp.ac.u_ryukyu.alicevnc; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class RequestStartVNCServer extends CodeSegment { + + private Receiver info = ids.create(CommandType.PEEK); // hostName + private Receiver info1 = ids.create(CommandType.TAKE); // Request + private Receiver info2 = ids.create(CommandType.PEEK); // vncServerFlag + + @Override + public void run() { + boolean vncServer = info2.asClass(boolean.class); + if (vncServer) { + // vncServer running + new RequestStartVNCServer(); + } else { + String hostname = info.asString(); + if ("node0".equals(hostname)) { + + } else { + // send message + } + } + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/ServerChangeMessage.java Sat Oct 18 22:05:42 2014 +0900 @@ -0,0 +1,15 @@ +package jp.ac.u_ryukyu.alicevnc; + +import org.msgpack.annotation.Message; + +@Message +public class ServerChangeMessage { + + public String[] route; + public boolean changeServer = false; + + public ServerChangeMessage(){ + // constructor need for MessagePack + } + +}
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/StartVNCServer.java Tue Oct 07 15:52:31 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/StartVNCServer.java Sat Oct 18 22:05:42 2014 +0900 @@ -10,11 +10,17 @@ private Receiver info = ids.create(CommandType.PEEK); public StartVNCServer(){ - info.setKey("host"); + info.setKey("VNCServer"); } public void run() { - String[] args = {}; - Viewer.main(args); + boolean vncFlag = info.asClass(boolean.class); + if (vncFlag) { + String[] args = {}; + Viewer.main(args); + } else { + // open window? + System.out.println("permission denied"); + } }