Changeset 13026
- Timestamp:
- 2006-10-06T09:44:45+13:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Configuration.java
r12054 r13026 126 126 static private int cache_miss = 0; 127 127 128 static private String wget_path = null;129 static private String wget_version_str = StaticStrings.NO_WGET_STR;130 131 128 static public URL gliserver_url = null; 132 129 static public URL library_url = null; … … 700 697 static public String getGS3ScriptPath() { 701 698 return gsdl3_src_path + "bin" + File.separator + "script" + File.separator; 702 }703 704 static public String getWGetPath() {705 return (wget_path != null ? wget_path : "");706 }707 708 static public String getWGetVersion() {709 return (wget_version_str != null ? wget_version_str : StaticStrings.NO_WGET_STR);710 699 } 711 700 … … 956 945 } 957 946 958 static public void setWGetPath(String path) {959 wget_path = path;960 }961 962 static public void setWGetVersion(String version) {963 wget_version_str = version;964 }965 966 947 static private void updateUI() { 967 948 // Buttons -
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r13014 r13026 184 184 init(go.gsdl_path, go.gsdl3_path, go.gsdl3_src_path, go.local_library_path, go.library_url_string, 185 185 go.gliserver_url_string, go.debug, go.perl_path, go.no_load, go.filename, go.site_name, 186 go.servlet_path , go.wget_path);186 go.servlet_path); 187 187 } 188 188 … … 191 191 String library_url_string, String gliserver_url_string, boolean debug_enabled, 192 192 String perl_path, boolean no_load, String open_collection, 193 String site_name, String servlet_path , String wget_path)193 String site_name, String servlet_path) 194 194 { 195 195 if (gsdl3_path != null && !gsdl3_path.equals("")) { … … 350 350 missingPERL(); 351 351 } 352 }353 354 boolean download_workflow = Configuration.get("workflow.download", false);355 if (download_workflow) {356 // If the WGet path hasn't been specified by the user, try the Greenstone one357 if (wget_path == null) {358 String wget_file_path = gsdl_path + "bin" + File.separator;359 if (Utility.isWindows()) {360 wget_file_path += "windows" + File.separator + "wget.exe";361 }362 else if (Utility.isMac()) {363 wget_file_path += "darwin" + File.separator + "wget";364 }365 else {366 wget_file_path += "linux" + File.separator + "wget";367 }368 if (new File(wget_file_path).exists()) {369 wget_path = wget_file_path;370 }371 }372 373 // If we still don't have a WGet path, give up (there isn't anything else we can do)374 String wget_version_str = null;375 if (wget_path == null) {376 wget_version_str = StaticStrings.NO_WGET_STR;377 missingWGET();378 }379 // Otherwise check the version of WGet380 else {381 wget_version_str = testWGetVersion(wget_path);382 if (wget_version_str.equals(StaticStrings.WGET_OLD_STR)) {383 oldWGET();384 }385 }386 387 // Store the new values in the configuration388 DebugStream.println("WGet path: " + wget_path);389 Configuration.setWGetPath(wget_path);390 Configuration.setWGetVersion(wget_version_str);391 352 } 392 353 … … 790 751 static private void missingPERL() { 791 752 WarningDialog dialog = new WarningDialog("warning.MissingPERL", "MissingPERL.Title", Dictionary.get("MissingPERL.Message"), null, false); 792 dialog.display();793 dialog.dispose();794 dialog = null;795 }796 797 /** Prints a warning message about missing a valid WGet path, which although not fatal means mirroring won't work */798 static public void missingWGET() {799 WarningDialog dialog = new WarningDialog("warning.MissingWGET", "MissingWGET.Title", Dictionary.get("MissingWGET.Message"), null, false);800 dialog.display();801 dialog.dispose();802 dialog = null;803 }804 805 /** Prints a warning message about having an old version of WGet. not fatal, but mirroring may not work properly */806 static public void oldWGET() {807 WarningDialog dialog = new WarningDialog("warning.OldWGET", "OldWGET.Title", Dictionary.get("OldWGET.Message"), null, false);808 753 dialog.display(); 809 754 dialog.dispose(); … … 837 782 } 838 783 839 840 // TODO fill this in841 private String testWGetVersion(String wget_path) {842 return StaticStrings.WGET_STR;843 }844 784 845 785 /** This private class contains an instance of an external application running within a JVM shell. It is important that this process sits in its own thread, but its more important that when we exit the Gatherer we don't actually System.exit(0) the Gatherer object until the user has volunteerily ended all of these child processes. Otherwise when we quit the Gatherer any changes the users may have made in external programs will be lost and the child processes are automatically deallocated. */ -
trunk/gli/src/org/greenstone/gatherer/GetOpt.java
r13014 r13026 52 52 public String site_name = null; // for GS3 53 53 public String servlet_path = null; 54 public String wget_path = null;55 54 public String metadata_path = null; 56 55 … … 230 229 // Otherwise it is fine as it is 231 230 } 232 // Parse the path to WGet233 else if (argument_name.equals(StaticStrings.WGET_ARGUMENT)) {234 // Check the specified WGet file exists235 if (argument_value != null && !argument_value.equals("")) {236 File wget_file = new File(argument_value);237 if (wget_file.exists()) {238 wget_path = argument_value;239 }240 }241 }242 231 else if(argument_name.equals(StaticStrings.METADATA_PATH)){ 243 232 if (argument_value != null && !argument_value.equals("")) { -
trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java
r12802 r13026 375 375 return; 376 376 } 377 // Lets see what warning message we should display, if any. 378 String wget_version_str = Configuration.getWGetVersion(); 379 if(wget_version_str.equals(StaticStrings.NO_WGET_STR)) { 380 // If there was no WGet available then downloading is disabled entirely 381 download_button_enabled = false; 382 // And we tell the user why. 383 Gatherer.missingWGET(); 384 } 385 else if(wget_version_str.equals(StaticStrings.WGET_OLD_STR)) { 386 // Downloading is enabled 387 download_button_enabled = true; 388 // But we display a preventable warning message about the path problems. 389 Gatherer.oldWGET(); 390 } 391 // Otherwise version must be ok 392 else { 393 download_button_enabled = true; 394 } 377 395 378 // It is also a good time to determine if the download should be enabled - ie if its allowed to be enabled and a valid URL is present in the field. 379 download_button_enabled = true; 396 380 //download_button.setEnabled(download_button_enabled); 397 381 } -
trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
r13014 r13026 160 160 static final public String NEWLINE_CHARACTER = "\\"; 161 161 static final public String NO_LOAD_ARGUMENT = "-no_load"; 162 static final public String NO_WGET_STR = "NoWGet";163 162 static final public String ONE_CHARACTER = "1"; 164 163 static final public String OPEN_PARENTHESIS_CHARACTER = "("; … … 211 210 static final public String VALUE_ATTRIBUTE = "value"; 212 211 static final public String VERSION_ATTRIBUTE = "version"; 213 static final public String WGET_ARGUMENT = "-wget";214 static final public String WGET_OLD_STR = "<WGet1.9";215 static final public String WGET_STR = "WGet1.9";216 212 static final public String WIN_9X_OPEN_COMMAND = "command.com /c start \"%1\""; 217 213 static final public String WIN_OPEN_COMMAND = "cmd.exe /c start \"\" \"%1\"";
Note:
See TracChangeset
for help on using the changeset viewer.