Changeset 16464

Show
Ignore:
Timestamp:
18.07.2008 15:29:15 (11 years ago)
Author:
ak19
Message:

FEDORA_VERSION has become the secondary environment variable when running FLI. It has replaced FEDORA2_HOME/FEDORA3_HOME.

Location:
gli/trunk/src/org/greenstone/gatherer
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/FedoraInfo.java

    r16359 r16464  
    3535public class FedoraInfo  
    3636{ 
     37    public static final int minimumSupportedMajorVersion = 2; 
     38 
    3739    private boolean active = false; 
    3840    private String home = null; 
     41    private String version = null; 
    3942 
    4043    private String hostname = null; 
     
    6366    } 
    6467 
     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 
    6576    public boolean isActive() 
    6677    { 
    67     return (home != null || active); 
     78    return active; 
    6879    } 
    6980 
     
    7990    } 
    8091 
     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    } 
    81112 
    82113    public void setHostname(String hostname) 
  • gli/trunk/src/org/greenstone/gatherer/GetOpt.java

    r16360 r16464  
    254254            // Fedora home - when running Fedora locally 
    255255            if(argument_name.equals(StaticStrings.FEDORA_HOME)) { 
    256             fedora_info.setActive(true); 
    257  
    258256            if(argument_value.endsWith(File.separator)) { 
    259257                fedora_info.setHome(argument_value); 
     
    264262            } 
    265263 
     264            if(argument_name.equals(StaticStrings.FEDORA_VERSION)) { 
     265            fedora_info.setVersion(argument_value); 
     266            } 
     267             
    266268            // Fedora hostname 
    267269            if(argument_name.equals(StaticStrings.FEDORA_HOSTNAME)) {