diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-15 18:47:27 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-15 18:47:27 +0100 |
commit | 6f58c3a3ce15289e559360330896cfb0cc22ae4d (patch) | |
tree | eb227626101389495b8a7351da69c73290641505 /same/old/App.java | |
parent | 043dc32807afc0e82b3b89e99bc4eea254fa9062 (diff) |
Move old SameService files out of the way.
Diffstat (limited to 'same/old/App.java')
-rw-r--r-- | same/old/App.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/same/old/App.java b/same/old/App.java new file mode 100644 index 0000000..5d94678 --- /dev/null +++ b/same/old/App.java @@ -0,0 +1,43 @@ +package com.orbekk.same; + +import com.googlecode.jsonrpc4j.JsonRpcServer; +import org.eclipse.jetty.server.Server; + +public class App { + public static void main(String[] args) { + if (args.length < 3) { + System.err.println("Arguments: port networkName clientId"); + System.exit(1); + } + int port = Integer.parseInt(args[0]); + String networkName = args[1]; + String clientId = args[2]; + + ConnectionManagerImpl connections = new ConnectionManagerImpl(); + + SameState sameState = new SameState(networkName, clientId, + connections); + sameState.start(); + + SameServiceImpl service = new SameServiceImpl(sameState); + JsonRpcServer jsonServer = new JsonRpcServer(service, + SameService.class); + + Server server = new Server(port); + RpcHandler rpcHandler = new RpcHandler(jsonServer, sameState); + server.setHandler(rpcHandler); + + try { + server.start(); + } catch (Exception e) { + System.out.println("Could not start jetty server."); + e.printStackTrace(); + } + + try { + server.join(); + } catch (InterruptedException e) { + System.out.println("Interrupt"); + } + } +} |