Changeset 5031
- Timestamp:
- 2003-07-25T16:24:53+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r5000 r5031 466 466 // 2. If we now have an argument name we continue by attempting to parse a value. A value is taken to be the sequence of space seperated Strings between the last argument name and up to but not including the next argument name. Of course an argument needn't have any value (ie -debug, -help), in which case value will be null. 467 467 if(argument_name != null) { 468 String argument_value = null; 469 StringBuffer argument_value_buffer = new StringBuffer(""); 470 while(argument_index < args.length && next_token == null) { 471 next_token = args[argument_index]; 472 argument_index++; 473 // If we just parsed an arbitary String then append it to value, followed by a single space 474 if(!next_token.startsWith(StaticStrings.MINUS_CHARACTER)) { 475 argument_value_buffer.append(next_token); 476 argument_value_buffer.append(StaticStrings.SPACE_CHARACTER); 477 next_token = null; 478 } 479 // If the argument token retrieved is an argument name, then leave it in next_token, which will cause the argument parsing process to move onto the next step. 468 String argument_value = null; 469 StringBuffer argument_value_buffer = new StringBuffer(""); 470 while(argument_index < args.length && next_token == null) { 471 next_token = args[argument_index]; 472 argument_index++; 473 // If we just parsed an arbitary String then append it to value, followed by a single space 474 if(!next_token.startsWith(StaticStrings.MINUS_CHARACTER)) { 475 argument_value_buffer.append(next_token); 476 argument_value_buffer.append(StaticStrings.SPACE_CHARACTER); 477 next_token = null; 480 478 } 481 // If a value now exists in argument buffer, retrieve it. Remove the last character as it will be an erroneous space. 482 if(argument_value_buffer.length() > 0) { 483 argument_value = argument_value_buffer.substring(0, argument_value_buffer.length() - 1); 484 } 485 486 // 3. We now have the argument name, and any associated value. We are ready to store the data in the appropriate variables. 487 Gatherer.println("Parsed Argument: name=" + argument_name + (argument_value != null ? (", value=" + argument_value) : ", no value")); 488 // 3a. First those arguments that have no associated value 489 if(argument_value == null) { 490 if(argument_name.equals(StaticStrings.HELP_ARGUMENT)) { 491 printUsage(dictionary); 492 System.exit(0); 479 // If the argument token retrieved is an argument name, then leave it in next_token, which will cause the argument parsing process to move onto the next step. 480 } 481 // If a value now exists in argument buffer, retrieve it. Remove the last character as it will be an erroneous space. 482 if(argument_value_buffer.length() > 0) { 483 argument_value = argument_value_buffer.substring(0, argument_value_buffer.length() - 1); 484 } 485 486 // 3. We now have the argument name, and any associated value. We are ready to store the data in the appropriate variables. 487 Gatherer.println("Parsed Argument: name=" + argument_name + (argument_value != null ? (", value=" + argument_value) : ", no value")); 488 // 3a. First those arguments that have no associated value 489 if(argument_value == null) { 490 if(argument_name.equals(StaticStrings.HELP_ARGUMENT)) { 491 printUsage(dictionary); 492 System.exit(0); 493 493 } 494 494 // Run GLI in debug mode. Produces debug log plus extra messages. 495 495 else if(argument_name.equals(StaticStrings.DEBUG_ARGUMENT)) { 496 496 debug = true; 497 497 } 498 // Forces no loading on previous collection. 499 else if(argument_name.equals(StaticStrings.NO_LOAD_ARGUMENT)) { 500 no_load = true; 501 filename = null; 498 // Forces no loading on previous collection. 499 else if(argument_name.equals(StaticStrings.NO_LOAD_ARGUMENT)) { 500 no_load = true; 501 filename = null; 502 } 503 // Specify the use of Greenstone LAF. 504 else if(argument_name.equals(StaticStrings.SKIN_ARGUMENT)) { 505 // SkinLF 506 try { 507 SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePackDefinition(SkinUtils.toURL(new File(SKIN_DEFINITION_FILE)))); 508 SkinLookAndFeel.enable(); 502 509 } 503 // Specify the use of Greenstone LAF. 504 else if(argument_name.equals(StaticStrings.SKIN_ARGUMENT)) { 505 // SkinLF 506 try { 507 SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePackDefinition(SkinUtils.toURL(new File(SKIN_DEFINITION_FILE)))); 508 SkinLookAndFeel.enable(); 509 } 510 catch (Exception error) { 511 ///ystem.err.println("Error: " + error); 512 error.printStackTrace(); 513 } 510 catch (Exception error) { 511 ///ystem.err.println("Error: " + error); 512 error.printStackTrace(); 513 } 514 514 } 515 516 517 518 515 } 516 // 3b. Now for those that do 517 else { 518 // Parse the path to the GSDL. Required argument. 519 519 if(argument_name.equals(StaticStrings.GSDL_ARGUMENT)) { 520 521 522 523 524 525 520 if(argument_value.endsWith(File.separator)) { 521 gsdl_path = argument_value; 522 } 523 else { 524 gsdl_path = argument_value + File.separator; 525 } 526 526 } 527 527 // Specify a collection to load initially. Could be used for file associations. 528 528 else if(argument_name.equals(StaticStrings.LOAD_ARGUMENT)) { 529 530 529 filename = argument_value; 530 no_load = false; 531 531 } 532 532 // Parse the url to a running web server, or a file path to the local library server. 533 533 else if(argument_name.equals(StaticStrings.LIBRARY_ARGUMENT)) { 534 534 exec_path = argument_value;
Note:
See TracChangeset
for help on using the changeset viewer.