Changeset 12803


Ignore:
Timestamp:
2006-09-21T14:17:38+12:00 (18 years ago)
Author:
mdewsnip
Message:

Moved dealing with the Local Library out of CollectionDesignManager and into CollectionConfiguration, as part of tidying up the saving of the collect.cfg file.

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

Legend:

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

    r12800 r12803  
    3535import org.greenstone.gatherer.DebugStream;
    3636import org.greenstone.gatherer.Gatherer;
     37import org.greenstone.gatherer.LocalLibraryServer;
    3738import org.greenstone.gatherer.gui.GLIButton;
    3839import org.greenstone.gatherer.metadata.MetadataElement;
     
    427428    }
    428429
    429     public void save() {
     430
     431    public void save()
     432    {
     433    // If we're using the Local Library we must release the collection before writing to the collect.cfg file
     434    String collection_name = Gatherer.c_man.getCollection().getName();
     435    boolean collection_released = false;
     436    if (Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) {
     437        // Release the collection
     438        LocalLibraryServer.releaseCollection(collection_name);
     439        collection_released = true;
     440    }
     441
    430442    if(collect_cfg_file.exists()) {
    431443        File original_file = new File(collect_cfg_file.getParentFile(), COLLECT_CFG);
     
    477489        // If we're using a remote Greenstone server, upload the new collect.cfg file
    478490        if (Gatherer.isGsdlRemote) {
    479         String collection_name = Gatherer.c_man.getCollection().getName();
    480491        RemoteGreenstoneServer.uploadCollectionFile(collection_name, collect_cfg_file);
    481492        }
     
    485496        DebugStream.printStackTrace(exception);
    486497    }
    487    
    488     }
     498
     499    // Now re-add the collection to the Local Library server
     500    if (collection_released) {
     501        LocalLibraryServer.addCollection(collection_name);
     502    }   
     503    }
     504
    489505
    490506    /** ************************** Private Methods ***************************/
  • trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java

    r12620 r12803  
    190190    }
    191191
    192 
    193192    public void save() {
    194193    save(false);
    195194    }
     195
    196196    /** Cause the current collection configuration to be written out to disk.
    197197     */
     
    205205
    206206    DebugStream.println("Saving the collection config file");
    207     // Release collection as necessary
    208     String collection_name = Gatherer.c_man.getCollection().getName();
    209     boolean collection_released = false;
    210 
    211     if (Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) {
    212         // Release the collection
    213         LocalLibraryServer.releaseCollection(collection_name);
    214         collection_released = true;
    215     }
    216207
    217208    collect_config.save();
    218 
    219     // Read collection
    220     if (collection_released) {
    221         // Now re-add collection to server to force format commands to be processed
    222         LocalLibraryServer.addCollection(collection_name);
    223     }
    224209
    225210    // Unset formats changed
    226211    update_collect_cfg_required = false;
    227    
    228212    }
    229213
Note: See TracChangeset for help on using the changeset viewer.