Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/utils
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9386/src/net/sf/magicmap/client/utils
Modified Files:
Settings.java
Log Message:
using of getopts added (by Gregor Maier)
Index: Settings.java
===================================================================
RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/utils/Settings.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Settings.java 8 Oct 2005 23:18:09 -0000 1.7
--- Settings.java 7 Feb 2006 16:05:00 -0000 1.8
***************
*** 1,12 ****
--- 1,28 ----
/*
* Created on 14.11.2004
+ *
+ * added gnu.getopt by gregor <gr...@ma...>
+ * gnu.getopt can be found at: http://www.urbanophile.com/arenn/hacking/download.html
*/
package net.sf.magicmap.client.utils;
+ import gnu.getopt.Getopt;
+ import gnu.getopt.LongOpt;
+
/**
* @author Martin
*/
public class Settings {
+
+ public static final LongOpt[] longopts = new LongOpt[] {
+ new LongOpt("webservicepath", LongOpt.REQUIRED_ARGUMENT, null, 'w'),
+ new LongOpt("nightly", LongOpt.REQUIRED_ARGUMENT, null, 'n'),
+ // New options. Mainly for console only mode
+ new LongOpt("server", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
+ };
+
+ public static final String optionsStr = "w:n:s:p:";
public static final String[] DEFAULT_SERVER_LIST = new String[]{"localhost", "phl.informatik.hu-berlin.de"};
***************
*** 27,30 ****
--- 43,47 ----
public static int port = 80;
+
public static final String TIME_DATE_FORMAT = "HH:mm:ss dd.MM.yyyy";
***************
*** 78,100 ****
}
/**
* @param args
*/
public static void setup(String[] args){
! if (args != null && args.length > 0){
! for (int i = 0; i < args.length; i++){
! boolean accepted = false;
! String arg = args[i].toLowerCase();
! if (arg.equals("--webservicepath")){
! i++;
! WEBSERVICE_PATH = args[i];
! }
! if (arg.equals("--nightly")){
! i++;
! NIGHTLY = args[i];
! }
}
}
-
}
--- 95,123 ----
}
+
/**
* @param args
*/
public static void setup(String[] args){
! Getopt g = new Getopt("magicmapclient", args, optionsStr, longopts);
! int c, tmpval;
!
! while ( (c=g.getopt()) != -1) {
! switch(c) {
! case 'w':
! WEBSERVICE_PATH = g.getOptarg(); break;
! case 'n':
! NIGHTLY = g.getOptarg(); break;
! case 's':
! hostname = g.getOptarg(); break;
! case 'p':
! port = Integer.parseInt(g.getOptarg()); break;
! case '?':
! break; // getopt already printed an error
! default:
! System.out.println("getopt() returned " + c);
! break;
}
}
}
***************
*** 112,114 ****
Settings.useNoServer = useNoServer;
}
! }
\ No newline at end of file
--- 135,137 ----
Settings.useNoServer = useNoServer;
}
! }
|