Ignore:
Timestamp:
2003-08-18T14:10:31+12:00 (21 years ago)
Author:
jmt12
Message:

I can't remember what has changed, but I bet it was for the better

File:
1 edited

Legend:

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

    r5076 r5164  
    7070import org.greenstone.gatherer.util.GSDLSiteConfig;
    7171import org.greenstone.gatherer.util.MetadataXML;
     72import org.greenstone.gatherer.util.StaticStrings;
    7273import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
    7374import org.greenstone.gatherer.util.Utility;
     
    197198    Gatherer.g_man.collectionChanged(false);
    198199    ///ystem.err.println("Closed collection.");
    199     // All of the consequences of a close should have been processed by now, so others should now see the collection as non-ready.
    200     closing_thread = null;
     200    // All of the consequences of a close should have been processed by now, so others should now see the collection as non-ready.
     201    closing_thread = null;
    201202    }
    202203
     
    226227        progress.setProgress(1);
    227228
    228         // ACTIVE_DIR/gimport/
    229229        String a_dir = Utility.getCollectionDir(Gatherer.config.gsdl_path) + name + File.separator;
    230 
    231         // Has to be done before creating greenstone directory metadata manager.
    232         File gimport_dir_temp = new File(Utility.getImportDir(a_dir)+"temp.dat");
    233         File gimport_dir = gimport_dir_temp.getParentFile();
    234         gimport_dir.mkdirs();
    235         if(progress != null) {
    236         progress.setNote(get("Gimport_Created"));
    237         }
    238230
    239231        // ACTIVE_DIR/gcache/
     
    260252        msm = collection.msm; // Legacy
    261253        collection.msm.load();
     254        // Always import the extracted metadata set
     255        collection.msm.importMDS(new File(Utility.METADATA_DIR + Utility.EXTRACTED_METADATA_NAMESPACE + StaticStrings.METADATA_SET_EXTENSION), false);
    262256        // Import default metadata sets if any.
    263257        for(int i = 0; metadata_sets != null && i < metadata_sets.size(); i++) {
     
    360354            // Find the import directory
    361355            File base_import = new File(base_collection_directory, Utility.IMPORT_DIR);
    362             if(!base_import.exists()) {
    363                 base_import = new File(base_collection_directory, Utility.OLD_IMPORT_DIR);
    364             }
    365356            if(base_import.exists()) {
    366357                searchForMetadata(base_import);
     
    536527    return Utility.getCollectionDir(Gatherer.config.gsdl_path) + collection.getName() + File.separator + collection.getName() + ".col";
    537528    }
    538     /** Constructs the absolute filename of the collection import directory, which should resemble "$GSDLHOME/collect/&lt;col_name&gt;/gimport/"
     529    /** Constructs the absolute filename of the collection import directory, which should resemble "$GSDLHOME/collect/&lt;col_name&gt;/import/"
    539530      * @return A <strong>String</strong> containing the filename.
    540531      * @see org.greenstone.gatherer.Configuration
     
    577568    }
    578569
    579     public String getCollectionOldImport() {
    580     return Utility.getCollectionDir(Gatherer.config.gsdl_path) + collection.getName() + File.separator + Utility.OLD_IMPORT_DIR;
    581     }
    582 
    583570    /** This method either returns the title of the current collection, or a placeholder string of 'No Collection'.
    584571      * @return A <strong>String</strong> which represents what we wish to display for a collection title.
     
    595582    public TreeModel getRecordSet() {
    596583    if(collection_model == null && collection != null) {
    597         // Check if the gimport directory exists, and if so use it.
    598         File gimport_directory = new File(getCollectionImport());
    599         if(gimport_directory.exists()) {
    600         // Generate a new FileSystemModel based on the collection gimport directory.
    601         collection_model = new FileSystemModel(new FileNode(gimport_directory, false));
    602         }
    603         else {
    604         ///ystem.err.println("No gimport directory exists.");
    605         // Otherwise default to the import directory. If it doesn't exist, there aint much more I can do.
    606         // Generate a new FileSystemModel based on the collection import directory.
    607         collection_model = new FileSystemModel(new FileNode(new File(getCollectionOldImport()), false));
    608         }
     584        // Use the import directory to generate a new FileSystemModel
     585        collection_model = new FileSystemModel(new FileNode(new File(getCollectionImport()), false));
    609586        // Ensure that the manager is a change listener for the tree.
    610587        if(fm_tree_model_listener == null) {
     
    661638    // If mirroring is enabled show the public and private caches.
    662639    if(Gatherer.config.get("workflow.mirror", false)) {
    663                 // Add Public workspace
     640        // Add Public workspace
    664641        FileNode public_root = new FileNode(new File(Utility.CACHE_DIR), get("Tree.Public"));
    665642        workspace_root.insert(public_root);
    666                 // Add Private workspace if a collection has been loaded.
     643        // Add Private workspace if a collection has been loaded.
    667644        if(ready()) {
    668645        FileNode private_root = new FileNode(new File(getCollectionCache()), get("Tree.Private"));
     
    973950    }
    974951    }
     952
     953    /** Refresh the Greenstone Collections special mapping in the workspace tree to account for collections being added/removed
     954     */
     955    public void refreshGreenstoneCollections() {
     956    FileNode root = (FileNode) workspace_model.getRoot();
     957    FileNode greenstone_collections_node = null;
     958    int root_child_count = root.getChildCount();
     959    String greenstone_collections_str = get("Tree.World");
     960    for(int i = 0; greenstone_collections_node == null && i < root_child_count; i++) {
     961        TreeNode child = root.getChildAt(i);
     962        if(child.toString().equals(greenstone_collections_str)) {
     963        greenstone_collections_node = (FileNode) child;
     964        }
     965        child = null;
     966    }
     967    greenstone_collections_str = null;
     968    root = null;
     969    if(greenstone_collections_node != null) {
     970        TreePath greenstone_collections_path = new TreePath(greenstone_collections_node.getPath());
     971        workspace_model.refresh(greenstone_collections_path);
     972        greenstone_collections_path = null;
     973        greenstone_collections_node = null;
     974    }
     975    }
     976
    975977    /** Called to refresh the models upon which the trees are based.
    976978     * @see org.greenstone.gatherer.collection.Collection
Note: See TracChangeset for help on using the changeset viewer.