Changeset 24465 for main/trunk
- Timestamp:
- 2011-08-24T16:52:43+12:00 (13 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/server/Server2.java
r24455 r24465 31 31 { 32 32 private static final int WAITING_TIME = 10; // time to wait and check for whether the server is running 33 private static final String URL_PENDING="URL_pending"; 34 33 private static final String URL_PENDING="URL_pending"; 34 35 35 protected String libraryURL; 36 36 37 37 private class QuitListener extends Thread 38 38 { … … 103 103 104 104 105 public Server2(String gsdl2_home, String lang, String configfile, int quitPort )105 public Server2(String gsdl2_home, String lang, String configfile, int quitPort, String property_prefix) 106 106 { 107 107 super(gsdl2_home, lang, configfile, "etc"+File.separator+"logs-gsi"); 108 // configfile can be either glisite.cfg or llssite.cfg 109 110 Property = new Server2Property(); 108 // configfile can be either glisite.cfg or llssite.cfg 109 110 //logger_.error("gsdlhome: " + gsdl2_home + " | lang: " + lang + " | configfile: " 111 //+ configfile + " | mode: " + property_prefix + " | quitport: " + quitPort); 112 113 // property_prefix is the mode we're running in (gli or empty) and contains the prefix 114 // string to look for in config file for auto_enter and start_browser properties 115 if(!property_prefix.equals("") && !property_prefix.endsWith(".")) { // ensure a '.' is suffixed if non-empty 116 property_prefix += "."; 117 } 118 Property = new Server2Property(property_prefix); 119 111 120 112 121 String frame_title = dictionary.get("ServerControl.Frame_Title"); … … 422 431 public static void main (String[] args) 423 432 { 424 if ((args.length < 1) || (args.length > 4)) {433 if ((args.length < 1) || (args.length > 5)) { 425 434 System.err.println( 426 "Usage: java org.greenstone.server.Server2 <gsdl2-home-dir> [lang] [-- config=configfile] [--quitport=portNum]");435 "Usage: java org.greenstone.server.Server2 <gsdl2-home-dir> [lang] [--mode=\"gli\"] [--config=configfile] [--quitport=portNum]"); 427 436 System.exit(1); 428 }437 } 429 438 430 439 String gsdl2_home = args[0]; … … 435 444 } 436 445 437 String lang = (args.length>=2) ? args[1] : "en"; 438 446 int index = 1; // move onto any subsequent arguments 447 448 // defaults for optional arguments 439 449 // if no config file is given, then it defaults to llssite.cfg (embedded in quotes to preserve spaces in the filepath) 440 File defaultConfigFile = new File(gsdl2_dir, "llssite.cfg"); 441 String configfile = (args.length>=3 && args[2].startsWith("--config=")) ? args[2] : defaultConfigFile.getAbsolutePath(); 442 gsdl2_dir = null; 443 defaultConfigFile = null; 444 445 int equalSign = configfile.indexOf('='); 446 if(equalSign != -1) { 447 configfile = configfile.substring(equalSign+1); 448 } 449 450 String quitport = (args.length == 4 && args[3].startsWith("--quitport=")) ? args[3] : ""; 451 equalSign = quitport.indexOf('='); 450 File defaultConfigFile = new File(gsdl2_dir, "llssite.cfg"); 451 String configfile = defaultConfigFile.getAbsolutePath(); 452 452 int port = -1; 453 if(equalSign != -1) { 454 try { 455 quitport = quitport.substring(equalSign+1); 456 port = Integer.parseInt(quitport); 457 } catch(Exception e) { // parse fails 458 System.err.println("Port must be numeric. Continuing without it."); 459 } 460 } 461 462 //System.err.println("Running server with config file: " + configfile); 463 464 new Server2(gsdl2_home, lang, configfile, port); 453 String mode = ""; 454 String lang = "en"; 455 456 // cycle through arguments, parsing and storing them 457 while(args.length > index) { 458 459 if(args[index].startsWith("--config=")) { 460 configfile = args[index].substring(args[index].indexOf('=')+1); // get value after '=' sign 461 gsdl2_dir = null; 462 defaultConfigFile = null; 463 } 464 465 else if(args[index].startsWith("--quitport=")) { 466 String quitport = args[index].substring(args[index].indexOf('=')+1); 467 try { 468 port = Integer.parseInt(quitport); 469 } catch(Exception e) { // parse fails 470 System.err.println("Port must be numeric. Continuing without it."); 471 } 472 } 473 474 // mode can be: "gli" if launched by GLI or unspecified. If unspecified, then 475 // the gs2-server was launched independently. 476 else if(args[index].startsWith("--mode=")) { 477 mode = args[index].substring(args[index].indexOf('=')+1); 478 } 479 480 else if(args[index].length() == 2) { 481 // there is an optional argument, but without a --FLAGNAME= prefix, so it's a language code 482 lang = args[index]; 483 } 484 485 index++; 486 } 487 488 new Server2(gsdl2_home, lang, configfile, port, mode); 465 489 } 466 490 } -
main/trunk/greenstone3/src/java/org/greenstone/server/Server2Property.java
r24207 r24465 5 5 public class Server2Property extends BaseProperty 6 6 { 7 Server2Property( )7 Server2Property(String property_prefix) 8 8 { 9 9 // Initialising customised final variables 10 10 // Version number, WEB_PORT 11 super("2", "portnumber", "autoenter","start_browser", "keepport");11 super("2", "portnumber", property_prefix+"autoenter", property_prefix+"start_browser", "keepport"); 12 12 } 13 13
Note:
See TracChangeset
for help on using the changeset viewer.