home *** CD-ROM | disk | FTP | other *** search
- package com.everyware.tango.jas;
-
- public class JASMain {
- private JAS jas = new JAS();
-
- public static void main(String[] var0) {
- new JASMain(var0);
- }
-
- public JASMain(String[] var1) {
- try {
- this.parseArgs(var1);
- } catch (Exception var3) {
- System.err.println("Exception: " + var3);
- this.usage();
- System.exit(1);
- }
-
- this.jas.run();
- }
-
- private void usage() {
- System.err.println("Usage: JASMain [-trace|notrace] [-port P] [-hostname H] [-serversockettimeout S] [-maxnumthreads T] [-maxnumbacklog B] [-clientsockettimeout C] [-actiontimeout A] [-help]");
- }
-
- private void parseArgs(String[] var1) throws Exception {
- for(int var2 = 0; var2 < var1.length; ++var2) {
- if (var1[var2].equals("-port")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The port number was not specified");
- }
-
- ++var2;
-
- try {
- this.jas.setPort(Integer.parseInt(var1[var2]));
- } catch (NumberFormatException var8) {
- throw new Exception("An invalid port number was specified");
- }
- } else if (var1[var2].equals("-hostname")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The hostname was not specified");
- }
-
- ++var2;
- this.jas.setHostName(var1[var2]);
- } else if (var1[var2].equals("-actiontimeout")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The actiontimeout duration was not specified");
- }
-
- ++var2;
-
- try {
- this.jas.setActionTimeout(Integer.parseInt(var1[var2]));
- } catch (NumberFormatException var7) {
- throw new Exception("An invalid actiontimeout was specified");
- }
- } else if (var1[var2].equals("-serversockettimeout")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The serversockettimeout duration was not specified");
- }
-
- ++var2;
-
- try {
- this.jas.setServerSocketTimeout(Integer.parseInt(var1[var2]));
- } catch (NumberFormatException var6) {
- throw new Exception("An invalid serversockettimeout was specified");
- }
- } else if (var1[var2].equals("-clientsockettimeout")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The clientsockettimeout duration was not specified");
- }
-
- ++var2;
-
- try {
- this.jas.setClientSocketTimeout(Integer.parseInt(var1[var2]));
- } catch (NumberFormatException var5) {
- throw new Exception("An invalid clientsockettimeout was specified");
- }
- } else if (var1[var2].equals("-maxnumthreads")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The maxnumthreads number was not specified");
- }
-
- ++var2;
-
- try {
- this.jas.setMaxNumThreads(Integer.parseInt(var1[var2]));
- } catch (NumberFormatException var4) {
- throw new Exception("An invalid maxnumthread number was specified");
- }
- } else if (var1[var2].equals("-maxnumbacklog")) {
- if (var2 + 1 >= var1.length) {
- throw new Exception("The maxnumbacklog number was not specified");
- }
-
- ++var2;
-
- try {
- this.jas.setMaxNumBacklog(Integer.parseInt(var1[var2]));
- } catch (NumberFormatException var3) {
- throw new Exception("An invalid maxnumbacklog number was specified");
- }
- } else if (var1[var2].equals("-trace")) {
- this.jas.setTracing(true);
- } else if (var1[var2].equals("-notrace")) {
- this.jas.setTracing(false);
- } else {
- if (!var1[var2].equals("-help")) {
- throw new Exception("Unknown argument: " + var1[var2]);
- }
-
- this.usage();
- System.exit(0);
- }
- }
-
- }
- }
-