Changeset 8626


Ignore:
Timestamp:
2004-11-23T13:35:05+13:00 (19 years ago)
Author:
mdewsnip
Message:

Removed the now-redundant "-mirror" option.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
7 edited

Legend:

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

    r8625 r8626  
    113113    /** The servlet path if we are using GS3 */
    114114    static public String servlet_path = "";
    115     /** If true, overrides the mirroring enabled setting in the config.xml file. */
    116     static private boolean mirroring_enabled = false;
    117115    /** Collection level configuration (which in some cases overrides general configuration. */
    118116    static private Document collection_config;
    119117    /** The general configuration settings. */
    120118    static private Document general_config;
    121    
     119
    122120    /** The element, from glis config file, that contains the various directory mappings. */
    123121    static private Element directory_mappings_element;
     
    135133     * @param library_url A <strong>String</strong> containing the url of the Greenstone webserver.
    136134     * @param perl_path The path to the PERL executable, as a <strong>String</strong>.
    137      * @param mirroring_enabled If true will override the config.xml fiel setting for mirroring.
    138135     * @param site_name The name of the Greenstone 3 site currently in use.
    139136     */
    140     public Configuration(String gsdl_path, String gsdl3_path, String library_url, String perl_path, boolean mirroring_enabled, String site_name) {
     137    public Configuration(String gsdl_path, String gsdl3_path, String library_url, String perl_path, String site_name)
     138    {
    141139    super();
    142140    self = this;
     
    144142    this.gsdl_path = gsdl_path;
    145143    this.gsdl3_path = gsdl3_path;
    146     this.mirroring_enabled = mirroring_enabled;
    147144    this.site_name = site_name;
    148145
     
    166163    }
    167164
    168     // Try to reload the configuration. The first place we look is the user specific location
    169     String config_xml_name = CONFIG_XML;
     165    // Try to load the configuration file, first looking in the user specific location
     166    String config_xml_file_name = CONFIG_XML;
    170167    if (gsdl3_path != null) {
    171         config_xml_name = GS3_CONFIG_XML;
    172     }
    173     File config_xml = new File(Utility.getGLIUserFolder(), config_xml_name);
    174     if(config_xml != null && config_xml.exists()) {
    175         general_config = Utility.parse(config_xml.getAbsolutePath(), false);
     168        config_xml_file_name = GS3_CONFIG_XML;
     169    }
     170    File config_xml_file = new File(Utility.getGLIUserFolder(), config_xml_file_name);
     171    if (config_xml_file != null && config_xml_file.exists()) {
     172        general_config = Utility.parse(config_xml_file.getAbsolutePath(), false);
    176173    }
    177174
    178175    // We then try within the gli directory itself
    179     if(general_config == null) {
    180         config_xml = new File(config_xml_name);
    181         if(config_xml.exists()) {
    182         general_config = Utility.parse(config_xml_name, true);
     176    if (general_config == null) {
     177        config_xml_file = new File(config_xml_file_name);
     178        if (config_xml_file.exists()) {
     179        general_config = Utility.parse(config_xml_file_name, true);
    183180        }
    184181    }
    185182
    186183    // Check the version of the config we have loaded, and if it isn't recent enough, backup the old version, and then create a new config.
    187     if(general_config != null) {
     184    if (general_config != null) {
    188185        Element configuration_element = general_config.getDocumentElement();
    189186        String configuration_version = configuration_element.getAttribute(StaticStrings.VERSION_ATTRIBUTE);
    190         if(!configuration_version.equals(CURRENT_CONFIGURATION_VERSION)) {
    191         /** @todo - reenable this once we can change the dictionary. */
    192         //JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Configuration.Obsolete_Config"), Dictionary.get("Configuration.Obsolete_Config_Title"), JOptionPane.ERROR_MESSAGE);
     187        if (!configuration_version.equals(CURRENT_CONFIGURATION_VERSION)) {
     188        // !!! JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Configuration.Obsolete_Config"), Dictionary.get("Configuration.Obsolete_Config_Title"), JOptionPane.ERROR_MESSAGE);
     189        File backup = new File(config_xml_file.getAbsolutePath() + ".bak");
     190        config_xml_file.renameTo(backup);
    193191        general_config = null;
    194         configuration_element = null;
    195         File backup = new File(config_xml.getAbsolutePath() + ".bak");
    196         config_xml.renameTo(backup);
    197         backup = null;
    198         }
    199         else {
    200         configuration_element = null;
    201         }
    202         configuration_version = null;
    203     }
    204 
    205     // And if that fails retrieve the default configuration file from our xml library, which I'll personally guarantee to work.
    206     if(general_config == null) {
     192        }
     193    }
     194
     195    // And if that fails retrieve the default configuration file from our xml library
     196    if (general_config == null) {
    207197        general_config = Utility.parse(TEMPLATE_CONFIG_XML, true);
    208         DebugStream.println("Loaded default Gatherer configuration template.");
    209     }
    210     else {
    211         DebugStream.println("Loaded current Gatherer configuration.");
    212198    }
    213199
     
    287273    /** The default get action retrieves the named property from the desired configuration, and returns a true or false. */
    288274    static public boolean get(String property, boolean general) {
    289     if(general && mirroring_enabled && property.equals(StaticStrings.WORKFLOW_MIRROR)) {
    290         return mirroring_enabled;
    291     }
    292275    String raw = getString(property, general);
    293276    return (raw != null && raw.equalsIgnoreCase("true"));
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r8625 r8626  
    121121               boolean no_load, String open_collection,
    122122               String site_name, String servlet_path,
    123                boolean mirroring_enabled, String wget_version_str,
    124                String wget_path)
     123               String wget_version_str, String wget_path)
    125124    {
    126125    // This will hopefully catch ctrl-c and terminate, and exit gracefully. However it is platform specific, and may not be supported by some JVMs.
     
    153152    try {
    154153        // Load Config
    155         loadConfig(gsdl_path, gsdl3_path, library_url, perl_path, mirroring_enabled, site_name);
     154        loadConfig(gsdl_path, gsdl3_path, library_url, perl_path, site_name);
    156155
    157156        // I don't really know what this is for but I've moved it here from Configuration
     
    611610     * @param library_url The path to the library executable, gathered from the startup arguments, and presented as a <strong>String</strong>.
    612611     * @param perl_path The path to the PERL compiler as a <strong>String</strong>. Necessary for windows platform versions.
    613      * @param mirroring_enabled
    614      * @param wget_version_str
    615      * @param wget_path
    616612     * @see java.io.FileInputStream
    617613     * @see java.io.ObjectInputStream
     
    619615     * @see org.greenstone.gatherer.Configuration
    620616     */
    621     private void loadConfig(String gsdl_path, String gsdl3_path, String library_url, String perl_path, boolean mirroring_enabled, String site_name) {
     617    private void loadConfig(String gsdl_path, String gsdl3_path, String library_url, String perl_path, String site_name) {
    622618    try {
    623         new Configuration(gsdl_path, gsdl3_path, library_url, perl_path, mirroring_enabled, site_name);
     619        new Configuration(gsdl_path, gsdl3_path, library_url, perl_path, site_name);
    624620    }
    625621    catch (Exception error) {
  • trunk/gli/src/org/greenstone/gatherer/GathererApplet.java

    r8625 r8626  
    174174                    go.library_url, go.debug, go.perl_path,
    175175                    go.no_load, go.filename, go.site_name,
    176                     go.servlet_path, go.mirroring_enabled,
    177                     go.wget_version_str, go.wget_path);
     176                    go.servlet_path, go.wget_version_str, go.wget_path);
    178177
    179178
  • trunk/gli/src/org/greenstone/gatherer/GathererProg.java

    r8625 r8626  
    9393                 go.library_url, go.debug, go.perl_path,
    9494                 go.no_load, go.filename, go.site_name,
    95                  go.servlet_path, go.mirroring_enabled,
    96                  go.wget_version_str, go.wget_path);
     95                 go.servlet_path, go.wget_version_str, go.wget_path);
    9796    gatherer.run(size,splash,g_man);
    9897    }
  • trunk/gli/src/org/greenstone/gatherer/GetOpt.java

    r8625 r8626  
    3636    public boolean debug = false;
    3737    public boolean feedback_enabled = false;
    38     public boolean mirroring_enabled = false;
    3938    public boolean no_load = false;
    4039
     
    134133            filename = null;
    135134            }
    136             // Run the GLI with mirroring enabled
    137             else if(argument_name.equals(StaticStrings.MIRROR_ARGUMENT)) {
    138             mirroring_enabled = true;
    139             }
    140135            /* I've got a sneak suspicion Aqua look and feel is not free domain
    141136            // Specify the use of Greenstone LAF.
  • trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java

    r8625 r8626  
    190190    try {
    191191           
    192         config = new Configuration(go.gsdl_path, null, null, go.perl_path, false, null);
     192        config = new Configuration(go.gsdl_path, null, null, go.perl_path, null);
    193193    }
    194194    catch (Exception exception) {
  • trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java

    r8625 r8626  
    172172    static final public String MGPP_ATTRIBUTE                             = "mgpp_enabled";
    173173    static final public String MINUS_CHARACTER                            = "-";
    174     static final public String MIRROR_ARGUMENT                            = "-mirror";
    175174    static final public String MODE_STR                                   = "Mode: ";
    176175    static final public String MODEGLI_ELEMENT                            = "ModeGLI";
Note: See TracChangeset for help on using the changeset viewer.