- Timestamp:
- 2003-08-18T14:10:31+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r5076 r5164 70 70 import org.greenstone.gatherer.util.GSDLSiteConfig; 71 71 import org.greenstone.gatherer.util.MetadataXML; 72 import org.greenstone.gatherer.util.StaticStrings; 72 73 import org.greenstone.gatherer.util.SynchronizedTreeModelTools; 73 74 import org.greenstone.gatherer.util.Utility; … … 197 198 Gatherer.g_man.collectionChanged(false); 198 199 ///ystem.err.println("Closed collection."); 199 200 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; 201 202 } 202 203 … … 226 227 progress.setProgress(1); 227 228 228 // ACTIVE_DIR/gimport/229 229 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 }238 230 239 231 // ACTIVE_DIR/gcache/ … … 260 252 msm = collection.msm; // Legacy 261 253 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); 262 256 // Import default metadata sets if any. 263 257 for(int i = 0; metadata_sets != null && i < metadata_sets.size(); i++) { … … 360 354 // Find the import directory 361 355 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 }365 356 if(base_import.exists()) { 366 357 searchForMetadata(base_import); … … 536 527 return Utility.getCollectionDir(Gatherer.config.gsdl_path) + collection.getName() + File.separator + collection.getName() + ".col"; 537 528 } 538 /** Constructs the absolute filename of the collection import directory, which should resemble "$GSDLHOME/collect/<col_name>/ gimport/"529 /** Constructs the absolute filename of the collection import directory, which should resemble "$GSDLHOME/collect/<col_name>/import/" 539 530 * @return A <strong>String</strong> containing the filename. 540 531 * @see org.greenstone.gatherer.Configuration … … 577 568 } 578 569 579 public String getCollectionOldImport() {580 return Utility.getCollectionDir(Gatherer.config.gsdl_path) + collection.getName() + File.separator + Utility.OLD_IMPORT_DIR;581 }582 583 570 /** This method either returns the title of the current collection, or a placeholder string of 'No Collection'. 584 571 * @return A <strong>String</strong> which represents what we wish to display for a collection title. … … 595 582 public TreeModel getRecordSet() { 596 583 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)); 609 586 // Ensure that the manager is a change listener for the tree. 610 587 if(fm_tree_model_listener == null) { … … 661 638 // If mirroring is enabled show the public and private caches. 662 639 if(Gatherer.config.get("workflow.mirror", false)) { 663 640 // Add Public workspace 664 641 FileNode public_root = new FileNode(new File(Utility.CACHE_DIR), get("Tree.Public")); 665 642 workspace_root.insert(public_root); 666 643 // Add Private workspace if a collection has been loaded. 667 644 if(ready()) { 668 645 FileNode private_root = new FileNode(new File(getCollectionCache()), get("Tree.Private")); … … 973 950 } 974 951 } 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 975 977 /** Called to refresh the models upon which the trees are based. 976 978 * @see org.greenstone.gatherer.collection.Collection
Note:
See TracChangeset
for help on using the changeset viewer.