Mercurial > hg > Database > jungle-network
changeset 48:ab8c655ef457
implemented bbsPort setting
author | one |
---|---|
date | Fri, 12 Jul 2013 11:54:07 +0900 |
parents | 686057add8a4 |
children | a89c3539bff2 |
files | src/alice/jungle/remote/RemoteConfig.java src/jungle/test/bbs/DistributeApp.java src/jungle/test/bbs/codesegment/StartBBSCodeSegment.java |
diffstat | 3 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/jungle/remote/RemoteConfig.java Fri Jul 12 11:45:12 2013 +0900 +++ b/src/alice/jungle/remote/RemoteConfig.java Fri Jul 12 11:54:07 2013 +0900 @@ -4,8 +4,16 @@ public class RemoteConfig extends TopologyNodeConfig { + public int bbsPort = 8080; + public RemoteConfig(String[] args) { super(args); + for (int i = 0; i< args.length; i++) { + if ("-bbsPort".equals(args[i])) { + bbsPort = Integer.parseInt(args[++i]); + } else if("-bp".equals(args[i])) { + bbsPort = Integer.parseInt(args[++i]); + } + } } - }
--- a/src/jungle/test/bbs/DistributeApp.java Fri Jul 12 11:45:12 2013 +0900 +++ b/src/jungle/test/bbs/DistributeApp.java Fri Jul 12 11:54:07 2013 +0900 @@ -26,6 +26,6 @@ public static void main( String[] args ) throws Exception { RemoteConfig conf = new RemoteConfig(args); - new TopologyNode(conf, new StartBBSCodeSegment()); + new TopologyNode(conf, new StartBBSCodeSegment(conf.bbsPort)); } }
--- a/src/jungle/test/bbs/codesegment/StartBBSCodeSegment.java Fri Jul 12 11:45:12 2013 +0900 +++ b/src/jungle/test/bbs/codesegment/StartBBSCodeSegment.java Fri Jul 12 11:54:07 2013 +0900 @@ -25,9 +25,15 @@ public class StartBBSCodeSegment extends CodeSegment { + int bbsPort = 8080; Receiver host = ids.create(CommandType.PEEK); private Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); + public StartBBSCodeSegment(int p) { + bbsPort = p; + host.setKey("host"); + } + public StartBBSCodeSegment() { host.setKey("host"); } @@ -56,7 +62,7 @@ Servlet index = new ShowBoardsServlet(cassaBBS,createBoardPath,showBoardMessagePath); Servlet board = new ShowBoardMessageServlet(cassaBBS,createBoardMessagePath,editMessagePath); - Server serv = new Server(8080); + Server serv = new Server(bbsPort); ServletHandler context = new ServletHandler(); context.addServletWithMapping(new ServletHolder(createBoardMessage),createBoardMessagePath); context.addServletWithMapping(new ServletHolder(createBoard),createBoardPath);