Changeset 9093


Ignore:
Timestamp:
2005-02-18T11:23:49+13:00 (19 years ago)
Author:
mdewsnip
Message:

Now deletes the plugins.dat and classifiers.dat files when a new config file is created. This ensures that these two files stay up to date when new versions are released.

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

Legend:

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

    r9036 r9093  
    9797    static public Configuration self = null;
    9898
     99    static public boolean just_created_new_config_file = false;
    99100    /** The path to the Greenstone Suite installation directory. */
    100101    static public String gsdl_path = "";
     
    154155    }
    155156
    156     // 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.
     157    // If the version of the config we've loaded isn't recent enough, backup the old version and create a new one
     158    just_created_new_config_file = false;
    157159    if (general_config != null) {
    158160        Element configuration_element = general_config.getDocumentElement();
     
    166168    }
    167169
    168     // And if that fails retrieve the default configuration file from our xml library
     170    // Create a new config from the default configuration file from our xml library
    169171    if (general_config == null) {
    170172        general_config = Utility.parse(TEMPLATE_CONFIG_XML, true);
     173        just_created_new_config_file = true;
    171174    }
    172175
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r9061 r9093  
    4141import org.greenstone.gatherer.Configuration;
    4242import org.greenstone.gatherer.GAuthenticator;
     43import org.greenstone.gatherer.cdm.ClassifierManager;
     44import org.greenstone.gatherer.cdm.PluginManager;
    4345import org.greenstone.gatherer.collection.CollectionManager;
    4446import org.greenstone.gatherer.feedback.ActionRecorderDialog;
     
    146148
    147149    try {
    148         // Load Config
    149         loadConfig(gsdl_path, gsdl3_path, site_name);
     150        // Load GLI config file
     151        new Configuration(gsdl_path, gsdl3_path, site_name);
     152        if (Configuration.just_created_new_config_file) {
     153        // Delete the plugins.dat and classifiers.dat files
     154        PluginManager.clearPluginCache();
     155        ClassifierManager.clearClassifierCache();
     156        }
     157
     158        if (GS3) {
     159        // Load Greenstone 3 servelt configuration
     160        servlet_config = new ServletConfiguration(gsdl3_path);
     161        }
    150162
    151163        // Check we know where Perl is
     
    629641
    630642
    631     /** Loads the configuration file if one exists. Otherwise it creates a new one. Currently uses serialization.
    632      * @param gsdl_path The path to the gsdl directory, gathered from the startup arguments, and presented as a <strong>String</strong>.
    633      * @see org.greenstone.gatherer.Configuration
    634      */
    635     private void loadConfig(String gsdl_path, String gsdl3_path, String site_name) {
    636     try {
    637         new Configuration(gsdl_path, gsdl3_path, site_name);
    638     }
    639     catch (Exception error) {
    640         DebugStream.println(Configuration.CONFIG_XML+" is not a well formed XML document.");
    641         DebugStream.printStackTrace(error);
    642     }
    643     if (GS3) {
    644         try {
    645         servlet_config = new ServletConfiguration(gsdl3_path);
    646         } catch (Exception exception) {
    647         DebugStream.printStackTrace(exception);
    648         }
    649     }
    650     }
    651 
    652643    /** Causes the general configuration file to export itself to xml. Doesn't effect any remaining collection configuration, as its up to the collection manager to handle them (especially since we have no idea where they are going). */
    653644    private void saveConfig() {
Note: See TracChangeset for help on using the changeset viewer.