Changeset 7679


Ignore:
Timestamp:
2004-06-30T16:26:05+12:00 (20 years ago)
Author:
kjdon
Message:

wget may be specified by the user in gli.sh, but otherwise we use teh greenstone version. theres a space for version testing but it doesn't do anything yet.

File:
1 edited

Legend:

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

    r7657 r7679  
    207207    try {
    208208        // Load Config
    209         loadConfig(gsdl_path, gsdl3_path, exec_path, perl_path, mirroring_enabled, wget_version_str, wget_path, site_name);
     209        loadConfig(gsdl_path, gsdl3_path, exec_path, perl_path, mirroring_enabled, site_name);
    210210
    211211        // the feedback dialog has been loaded with a default locale,
     
    264264        boolean mirror_workflow = config.get(StaticStrings.WORKFLOW_MIRROR, false);
    265265        if (mirror_workflow) {
    266         // we only bother to check if mirroring is turned on
    267         String wget_version =  config.getWGetVersion();
    268         if (wget_version.equals(StaticStrings.NO_WGET_STR)) {
    269             missingWGET();
    270         } else if (wget_version.equals(StaticStrings.WGET_OLD_STR)) {
    271             oldWGET();
    272         }
    273         // else ok
     266        wget_version_str = StaticStrings.NO_WGET_STR;
     267        // has the user specified a path?
     268        if (wget_path != null && !wget_path.equals("")) {
     269            File wget_file = new File(wget_path);
     270            if (wget_file.exists()) {
     271            // we assume its ok if its there
     272            wget_version_str = StaticStrings.WGET_STR;
     273            }
     274        }
     275       
     276        // it hasn't been set by the user so we use the greenstone one
     277        if (wget_version_str.equals(StaticStrings.NO_WGET_STR)) {
     278            // TODO fix for gs3
     279            wget_path = Utility.getWGetPath(gsdl_path);
     280            File wget_file = new File(wget_path);
     281            if (!wget_file.exists()) {
     282            // we give up trying to find one
     283            missingWGET();
     284            } else {
     285            // we have found one
     286            wget_version_str = StaticStrings.WGET_STR;
     287            }
     288        }
     289       
     290        if (wget_version_str.equals(StaticStrings.WGET_STR)) {
     291            // we have found one, should we check the version??
     292            wget_version_str = testWGetVersion(wget_path);
     293            if (wget_version_str.equals(StaticStrings.WGET_OLD_STR)) {
     294            oldWGET();
     295            }
     296        }
     297       
     298        // tell the config the new values
     299        config.setWGetPath(wget_path);
     300        config.setWGetVersion(wget_version_str);
    274301        }
    275302        // Size and place the frame on the screen
     
    709736            // Test for the presence of a WGet version. This is only useful if the user has enabled mirroring. Note that mirroring can be enabled by running the GLI with -mirror, editing the config.xml for GLI, or through a new option on the connections page of the preferences.
    710737            else if(argument_name.equals(StaticStrings.WGET_ARGUMENT)) {
    711             if(argument_value.startsWith(StaticStrings.WGET_STR)) {
    712                 wget_version_str = StaticStrings.WGET_STR;
    713                 wget_path = argument_value.substring(StaticStrings.WGET_STR.length());
    714             }
    715             else if(argument_value.startsWith(StaticStrings.WGET_OLD_STR)) {
    716                 wget_version_str = StaticStrings.WGET_OLD_STR;
    717                 wget_path = argument_value.substring(StaticStrings.WGET_OLD_STR.length());
    718             }
     738            wget_version_str = StaticStrings.WGET_STR;
     739            wget_path = argument_value;
    719740            }
    720741        }
     
    875896     * @see org.greenstone.gatherer.Configuration
    876897     */
    877     private void loadConfig(String gsdl_path, String gsdl3_path, String exec_path, String perl_path, boolean mirroring_enabled, String wget_version_str, String wget_path, String site_name) {
     898    private void loadConfig(String gsdl_path, String gsdl3_path, String exec_path, String perl_path, boolean mirroring_enabled, String site_name) {
    878899    try {
    879         config = new Configuration(gsdl_path, gsdl3_path, exec_path, perl_path, mirroring_enabled, wget_version_str, wget_path, site_name);
     900        config = new Configuration(gsdl_path, gsdl3_path, exec_path, perl_path, mirroring_enabled, site_name);
    880901    }
    881902    catch (Exception error) {
     
    10291050    }
    10301051
     1052    // TODO fill this in
     1053    private String testWGetVersion(String wget_path) {
     1054    return StaticStrings.WGET_STR;
     1055    }
     1056   
    10311057    /** 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. */
    10321058    private class ExternalApplication
Note: See TracChangeset for help on using the changeset viewer.