Ignore:
Timestamp:
2005-07-13T11:12:11+12:00 (19 years ago)
Author:
mdewsnip
Message:

New code for "incremental" building, by Matthew Whyte.

I've only had time to look at this briefly; I've fixed a few obvious problems but I imagine this will be pretty flaky for a while.

File:
1 edited

Legend:

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

    r9640 r10237  
    5050    /** This listener listens for any event on any of the components in any of the sub-views, and marks the collection as needing saving if any change occurs. */
    5151    static public CDMChangeListener change_listener;
     52    /** These listeners listen to changes in the Design mode so as to allow incremental building */
     53    static public DesignChangeListener all_change_listener;
     54    static public DesignChangeListener buildcol_change_listener;
     55    static public DesignChangeListener collect_cfg_change_listener;
    5256    /** A list of classifiers to use at build time. */
    5357    static public ClassifierManager classifier_manager;
     
    7882    /** The text translation manager. */
    7983    static public TranslationView translation_view;
     84    /** These mark what needs to happen when building a collection where ONLY design options have been changed.
     85        The build requirements of the higher numbers must include doing everything from the lower numbers. */
     86    static final public int ALL = 3;
     87    static final public int BUILDCOL = 2;
     88    static final public int UPDATE_COLLECT_CFG = 1;
     89    static final public int NOTHING = 0;
     90    static private int rebuildTypeRequired = NOTHING; //Rebuild type required if only design options have changed
     91    static protected boolean update_collect_cfg_required = false;
     92
    8093    /** Constructor. Loads a certain collection configuration file, which is parsed into a DOM. This model is then registered with the command information managers, each of whom knows how to, and provides controls to, alter certain commands.
    8194     * @param collect_config_file the File representing a collection configuration file either in its text (G2) or xml (G3) form
     
    8497    DebugStream.println("Initializaing CollectionDesignModule.");
    8598    change_listener = new CDMChangeListener();
     99    all_change_listener = new DesignChangeListener(ALL);
     100    buildcol_change_listener = new DesignChangeListener(BUILDCOL);
     101    collect_cfg_change_listener = new DesignChangeListener(UPDATE_COLLECT_CFG);
    86102    // Parse the collection configuration
    87103    collect_config = new CollectionConfiguration(collect_config_file);
     
    199215     */
    200216    public void save() {
     217    System.err.println("Config file saved. The level of processing needed is: " + CollectionDesignManager.getRebuildTypeRequired()); //debug
    201218    // Release collection as necessary
    202219    String collection_name = Gatherer.c_man.getCollection().getName();
    203220    boolean collection_released = false;
    204     boolean formats_changed = format_manager.formatsChanged();
    205 
    206     if (formats_changed && Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) {
     221
     222    if (update_collect_cfg_required && Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) {
    207223        // Release the collection
    208224        LocalLibraryServer.releaseCollection(collection_name);
     
    213229    collect_config.save();
    214230
    215     if (Gatherer.isGsdlRemote) {
    216         if (formats_changed && Gatherer.c_man.built()) {
    217         // upload etc/collect.cfg to server to reflect changes
    218         Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", "");
    219         GathererApplet.upload_url_zip(collection_name, "etc", "", null);
    220         }
    221     }
    222 
    223     // Readd collection
     231    if (update_collect_cfg_required && Gatherer.c_man.built() && Gatherer.isGsdlRemote) {
     232        //If the GLI is running as an applet, and Format Features or Cross-Collection Searching have changed,
     233        //upload etc/collect.cfg to the server to immediately reflect these changes.
     234        Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", "");
     235        GathererApplet.upload_url_zip(collection_name, "etc", "", null);
     236    }
     237   
     238    // Read collection
    224239    if (collection_released) {
    225240        // Now re-add collection to server to force format commands to be processed
     
    227242    }
    228243
    229     if (formats_changed) {
     244    if (update_collect_cfg_required) {
    230245        // Unset formats changed
    231         format_manager.setFormatsChanged(false);
     246        update_collect_cfg_required = false;
    232247    }
    233248    }
     
    263278    }
    264279
    265 
     280    public static int getRebuildTypeRequired() {
     281    return rebuildTypeRequired;
     282    }
     283    public static void resetRebuildTypeRequired() {
     284    setRebuildTypeRequired(NOTHING);
     285    }
     286    public static void setRebuildTypeRequired(int number) {
     287    rebuildTypeRequired = number;
     288    }
     289
     290    /**
     291     * What exactly does this do?
     292     */
    266293    private class CDMChangeListener
    267294    implements ActionListener, DocumentListener {
    268295
     296    /** Gives notification that an event has happened */
    269297    public void actionPerformed(ActionEvent event) {
    270298        Gatherer.c_man.getCollection().setSaved(false);
Note: See TracChangeset for help on using the changeset viewer.