Changeset 16464
- Timestamp:
- 2008-07-18T15:29:15+12:00 (15 years ago)
- Location:
- gli/trunk/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/FedoraInfo.java
r16359 r16464 35 35 public class FedoraInfo 36 36 { 37 public static final int minimumSupportedMajorVersion = 2; 38 37 39 private boolean active = false; 38 40 private String home = null; 41 private String version = null; 39 42 40 43 private String hostname = null; … … 63 66 } 64 67 68 // Called when an environment variable was wrongly set for running Fedora 69 public void deactivate(String errorMessage) { 70 this.active = false; 71 // display an errormessage and exit cleanly 72 System.err.println(errorMessage); 73 Gatherer.exit(); 74 } 75 65 76 public boolean isActive() 66 77 { 67 return (home != null || active);78 return active; 68 79 } 69 80 … … 79 90 } 80 91 92 public void setVersion(String version) 93 { 94 String firstChar = version.substring(0, 1); 95 if(!Character.isDigit(version.charAt(0))) { // version is illegal if it does not begin with a number 96 deactivate("Incorrect format for major version: " + version + ". The Fedora version must start with a number."); 97 } 98 else if(Integer.parseInt(firstChar) < minimumSupportedMajorVersion) { 99 // major version number of Fedora must be more than this 100 deactivate("The major version number of Fedora must be at least " + minimumSupportedMajorVersion + "."); 101 } 102 else { // acceptable 103 this.version = version; 104 } 105 } 106 107 108 public String getVersion() 109 { 110 return version; 111 } 81 112 82 113 public void setHostname(String hostname) -
gli/trunk/src/org/greenstone/gatherer/GetOpt.java
r16360 r16464 254 254 // Fedora home - when running Fedora locally 255 255 if(argument_name.equals(StaticStrings.FEDORA_HOME)) { 256 fedora_info.setActive(true);257 258 256 if(argument_value.endsWith(File.separator)) { 259 257 fedora_info.setHome(argument_value); … … 264 262 } 265 263 264 if(argument_name.equals(StaticStrings.FEDORA_VERSION)) { 265 fedora_info.setVersion(argument_value); 266 } 267 266 268 // Fedora hostname 267 269 if(argument_name.equals(StaticStrings.FEDORA_HOSTNAME)) {
Note:
See TracChangeset
for help on using the changeset viewer.