Changeset 13591
- Timestamp:
- 2007-01-12T14:39:03+13:00 (17 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r13586 r13591 323 323 public void actionPerformed(ActionEvent event) { 324 324 // Open an almost standard file browser to the images folder of the current collection 325 File images_folder = new File( Gatherer.c_man.getCollectionImagesDirectoryPath());325 File images_folder = new File(CollectionManager.getLoadedCollectionImagesDirectoryPath()); 326 326 // If images isn't already there, create it 327 327 if(!images_folder.exists()) { -
trunk/gli/src/org/greenstone/gatherer/cdm/MacrosManager.java
r13586 r13591 178 178 private void readMacroFile() { 179 179 macros_textarea.setText(""); 180 File extra_dm = new File(CollectionManager.get CollectionDirectoryPath()+"macros"+File.separator+"extra.dm");180 File extra_dm = new File(CollectionManager.getLoadedCollectionMacrosDirectoryPath() + "extra.dm"); 181 181 182 182 if (extra_dm.exists()) { … … 198 198 199 199 private void writeMacroFile() { 200 File extra_dm_file = new File(CollectionManager.get CollectionDirectoryPath()+"macros"+File.separator+"extra.dm");200 File extra_dm_file = new File(CollectionManager.getLoadedCollectionMacrosDirectoryPath() + "extra.dm"); 201 201 try { 202 202 if (!extra_dm_file.exists()) { -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r13586 r13591 197 197 if(collection != null) { 198 198 // Determine if the collection has been built by looking for the build.cfg file 199 File build_cfg_file = new File(get CollectionIndexDirectoryPath() + "build.cfg");199 File build_cfg_file = new File(getLoadedCollectionIndexDirectoryPath() + "build.cfg"); 200 200 return build_cfg_file.exists(); 201 201 } … … 225 225 226 226 // Remove the lock on this file, then remove the collection. 227 File lock_file = new File(get CollectionDirectoryPath() + LOCK_FILE);227 File lock_file = new File(getLoadedCollectionDirectoryPath() + LOCK_FILE); 228 228 lock_file.delete(); 229 229 if (lock_file.exists()) { … … 458 458 addRequiredMetadataSets(); 459 459 460 collection.cdm = new CollectionDesignManager(new File(get CollectionConfigFilePath()));460 collection.cdm = new CollectionDesignManager(new File(getLoadedCollectionCfgFilePath())); 461 461 462 462 // We always set title and description here rather than calling mkcol.pl with Unicode arguments … … 565 565 566 566 567 /** Returns the absolute filename of the specified collection's directory. 568 */ 569 static public String getCollectionDirectoryPath(String collection_name) 570 { 571 return Gatherer.getCollectDirectoryPath() + collection_name + File.separator; 572 } 573 574 575 /** Returns the absolute filename of the loaded collection's archives directory. 576 */ 577 static public String getLoadedCollectionArchivesDirectoryPath() 578 { 579 return getLoadedCollectionDirectoryPath() + "archives" + File.separator; 580 } 581 582 583 /** Returns the absolute filename of the loaded collection's building directory. 584 */ 585 static public String getLoadedCollectionBuildingDirectoryPath() 586 { 587 return getLoadedCollectionDirectoryPath() + "building" + File.separator; 588 } 589 590 591 /** Returns the absolute filename of the loaded collection's collect.cfg file. 592 */ 593 static public String getLoadedCollectionCfgFilePath() 594 { 595 return getLoadedCollectionEtcDirectoryPath() + "collect.cfg"; 596 } 597 598 599 /** Returns the absolute filename of the loaded collection's directory. 600 */ 601 static public String getLoadedCollectionDirectoryPath() 602 { 603 return Gatherer.getCollectDirectoryPath() + collection.getName() + File.separator; 604 } 605 606 607 /** Returns the absolute filename of the loaded collection's etc directory. 608 */ 609 static public String getLoadedCollectionEtcDirectoryPath() 610 { 611 return getLoadedCollectionDirectoryPath() + "etc" + File.separator; 612 } 613 614 615 /** Returns the absolute filename of the loaded collection's .col file. 616 */ 617 static public String getLoadedCollectionColFilePath() 618 { 619 return getLoadedCollectionDirectoryPath() + collection.getName() + ".col"; 620 } 621 622 623 /** Returns the absolute filename of the loaded collection's images directory. 624 */ 625 static public String getLoadedCollectionImagesDirectoryPath() 626 { 627 return getLoadedCollectionDirectoryPath() + "images" + File.separator; 628 } 629 630 631 /** Returns the absolute filename of the loaded collection's import directory. 632 */ 633 static public String getLoadedCollectionImportDirectoryPath() 634 { 635 return getLoadedCollectionDirectoryPath() + "import" + File.separator; 636 } 637 638 639 /** Returns the absolute filename of the loaded collection's index directory. 640 */ 641 static public String getLoadedCollectionIndexDirectoryPath() 642 { 643 return getLoadedCollectionDirectoryPath() + "index" + File.separator; 644 } 645 646 647 /** Returns the absolute filename of the loaded collection's log directory. 648 */ 649 static public String getLoadedCollectionLogDirectoryPath() 650 { 651 return getLoadedCollectionDirectoryPath() + "log" + File.separator; 652 } 653 654 655 /** Returns the absolute filename of the loaded collection's macros directory. 656 */ 657 static public String getLoadedCollectionMacrosDirectoryPath() 658 { 659 return getLoadedCollectionDirectoryPath() + "macros" + File.separator; 660 } 661 662 663 /** Returns the absolute filename of the loaded collection's metadata directory. 664 */ 665 static public String getLoadedCollectionMetadataDirectoryPath() 666 { 667 return getLoadedCollectionDirectoryPath() + "metadata" + File.separator; 668 } 669 670 567 671 /** Returns the name of the loaded collection. 568 672 */ … … 577 681 578 682 579 static public String getCollectionDirectoryPath()580 {581 return Gatherer.getCollectDirectoryPath() + collection.getName() + File.separator;582 }583 584 585 /** Constructs the absolute filename of the collection's directory, which should resemble "$GSDLHOME/collect/<col_name>"586 * @return A <strong>String</strong> containing the directory name.587 */588 static public String getCollectionDirectoryPath(String collection_name)589 {590 return Gatherer.getCollectDirectoryPath() + collection_name + File.separator;591 }592 593 594 /** Constructs the absolute filename of the collection's .col file, which should resemble "$GSDLHOME/collect/<col_name>/<col_name>.col"595 * @return A <strong>String</strong> containing the filename.596 */597 public String getCollectionFilePath()598 {599 return getCollectionDirectoryPath() + collection.getName() + ".col";600 }601 602 603 /** Constructs the absolute filename of the collection's archives directory, which should resemble "$GSDLHOME/collect/<col_name>/archives/"604 * @return A <strong>String</strong> containing the filename.605 */606 public String getCollectionArchivesDirectoryPath()607 {608 return getCollectionDirectoryPath() + "archives" + File.separator;609 }610 611 612 /** Constructs the absolute filename of the collection's building directory, which should resemble "$GSDLHOME/collect/<col_name>/building/"613 * @return A <strong>String</strong> containing the filename.614 */615 public String getCollectionBuildingDirectoryPath()616 {617 return getCollectionDirectoryPath() + "building" + File.separator;618 }619 620 621 /** Constructs the absolute filename of the collection's collect.cfg file, which should resemble "$GSDLHOME/collect/<col_name>/etc/collect.cfg"622 * @return A <strong>String</strong> containing the filename.623 */624 public String getCollectionConfigFilePath()625 {626 return getCollectionEtcDirectoryPath() + "collect.cfg";627 }628 629 630 /** Constructs the absolute filename of the collection's etc directory, which should resemble "$GSDLHOME/collect/<col_name>/etc/"631 * @return A <strong>String</strong> containing the filename.632 */633 public String getCollectionEtcDirectoryPath()634 {635 return getCollectionDirectoryPath() + "etc" + File.separator;636 }637 638 639 /** Constructs the absolute filename of the collection's images directory, which should resemble "$GSDLHOME/collect/<col_name>/images/"640 * @return A <strong>String</strong> containing the filename.641 */642 public String getCollectionImagesDirectoryPath()643 {644 return getCollectionDirectoryPath() + "images" + File.separator;645 }646 647 648 /** Constructs the absolute filename of the collection's import directory, which should resemble "$GSDLHOME/collect/<col_name>/import/"649 * @return A <strong>String</strong> containing the filename.650 */651 public String getCollectionImportDirectoryPath()652 {653 return getCollectionDirectoryPath() + "import" + File.separator;654 }655 656 657 /** Constructs the absolute filename of the collection's index directory, which should resemble "$GSDLHOME/collect/<col_name>/index/"658 * @return A <strong>String</strong> containing the filename.659 */660 public String getCollectionIndexDirectoryPath()661 {662 return getCollectionDirectoryPath() + "index" + File.separator;663 }664 665 666 /** Constructs the absolute filename of the collection's log directory, which should resemble "$GSDLHOME/collect/<col_name>/log/"667 * @return A <strong>String</strong> containing the filename.668 */669 public String getCollectionLogDirectoryPath()670 {671 return getCollectionDirectoryPath() + "log" + File.separator;672 }673 674 675 /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/"676 * @return A <strong>String</strong> containing the filename.677 */678 public String getCollectionMetadataDirectoryPath()679 {680 return getCollectionDirectoryPath() + "metadata" + File.separator;681 }682 683 /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/"684 * @return A <strong>String</strong> containing the filename.685 */686 public String getCollectionPluginsDirectoryPath()687 {688 return getCollectionDirectoryPath() + "perllib" + File.separator +689 "plugins" + File.separator;690 }691 /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/"692 * @return A <strong>String</strong> containing the filename.693 */694 public String getCollectionClassifiersDirectoryPath()695 {696 return getCollectionDirectoryPath() + "perllib" + File.separator +697 "classify" + File.separator;698 }699 700 701 683 public CollectionTree getCollectionTree() 702 684 { … … 714 696 if (collection_tree_model == null && collection != null) { 715 697 // Use the import directory to generate a new CollectionTreeModel 716 collection_tree_model = new CollectionTreeModel(new CollectionTreeNode(new File(get CollectionImportDirectoryPath())));698 collection_tree_model = new CollectionTreeModel(new CollectionTreeNode(new File(getLoadedCollectionImportDirectoryPath()))); 717 699 // Ensure that the manager is a change listener for the tree. 718 700 if (fm_tree_model_listener == null) { … … 746 728 DebugStream.println("Is event dispatch thread: " + SwingUtilities.isEventDispatchThread()); 747 729 //check that we can remove the old index before starting import 748 File index_dir = new File(get CollectionIndexDirectoryPath());730 File index_dir = new File(getLoadedCollectionIndexDirectoryPath()); 749 731 if (index_dir.exists()) { 750 732 DebugStream.println("Old Index = " + index_dir.getAbsolutePath()+", testing for deletability"); … … 806 788 807 789 // ...and only if it doesn't already exist 808 File metadata_set_file = new File(get CollectionMetadataDirectoryPath(), external_metadata_set_file.getName());790 File metadata_set_file = new File(getLoadedCollectionMetadataDirectoryPath(), external_metadata_set_file.getName()); 809 791 if (!metadata_set_file.exists()) { 810 792 try { … … 1000 982 1001 983 // Read through the doc.xml files in the archives directory 1002 File collection_archives_directory = new File(get CollectionArchivesDirectoryPath());984 File collection_archives_directory = new File(getLoadedCollectionArchivesDirectoryPath()); 1003 985 DocXMLFileManager.clearDocXMLFiles(); 1004 986 DocXMLFileManager.loadDocXMLFiles(collection_archives_directory); … … 1267 1249 1268 1250 // Create a backup of the collection file, just in case anything goes wrong 1269 File collection_file = new File(get CollectionFilePath());1251 File collection_file = new File(getLoadedCollectionColFilePath()); 1270 1252 if (collection_file.exists()) { 1271 1253 File collection_file_backup = new File(collection_file.getAbsolutePath() + "~"); … … 1337 1319 Gatherer.configGS3Server(Configuration.site_name, ServletConfiguration.DEACTIVATE_COMMAND + collection.getName()); 1338 1320 } 1339 File index_dir = new File(get CollectionIndexDirectoryPath());1321 File index_dir = new File(getLoadedCollectionIndexDirectoryPath()); 1340 1322 DebugStream.println("Index = " + index_dir.getAbsolutePath()); 1341 1323 1342 File building_dir = new File(get CollectionBuildingDirectoryPath());1324 File building_dir = new File(getLoadedCollectionBuildingDirectoryPath()); 1343 1325 DebugStream.println("Building = " + building_dir.getAbsolutePath()); 1344 1326 … … 1362 1344 1363 1345 if (Gatherer.isGsdlRemote) { 1364 RemoteGreenstoneServer.deleteCollectionFile(collection.getName(), new File(get CollectionIndexDirectoryPath()));1365 RemoteGreenstoneServer.moveCollectionFile(collection.getName(), new File(get CollectionBuildingDirectoryPath()), new File(getCollectionIndexDirectoryPath()));1346 RemoteGreenstoneServer.deleteCollectionFile(collection.getName(), new File(getLoadedCollectionIndexDirectoryPath())); 1347 RemoteGreenstoneServer.moveCollectionFile(collection.getName(), new File(getLoadedCollectionBuildingDirectoryPath()), new File(getLoadedCollectionIndexDirectoryPath())); 1366 1348 } 1367 1349 -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java
r11622 r13591 36 36 import org.greenstone.gatherer.Dictionary; 37 37 import org.greenstone.gatherer.Gatherer; 38 import org.greenstone.gatherer.collection.CollectionManager; 38 39 import org.greenstone.gatherer.gui.CreateShortcutPrompt; 39 40 import org.greenstone.gatherer.gui.tree.DragTree; … … 120 121 if (refresh_reason == DragTree.COLLECTION_CONTENTS_CHANGED) { 121 122 DebugStream.println("...Reason: collection contents changed."); 122 String collection_import_directory_path = Gatherer.c_man.getCollectionImportDirectoryPath();123 String collection_import_directory_path = CollectionManager.getLoadedCollectionImportDirectoryPath(); 123 124 refreshEveryNodeShowingFolder(collection_import_directory_path); 124 125 } -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r13583 r13591 458 458 // If we have a collection open remember it for next time, then save it and close it 459 459 if (Gatherer.c_man.ready()) { 460 Configuration.setString("general.open_collection", true, Gatherer.c_man.getCollectionFilePath());460 Configuration.setString("general.open_collection", true, CollectionManager.getLoadedCollectionColFilePath()); 461 461 saveThenCloseCurrentCollection(); 462 462 } -
trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r12822 r13591 241 241 // Build a list of the log files available, ordering by last modified. Log files are like build_log.date.txt 242 242 DefaultListModel contents = new DefaultListModel(); 243 File log_directory = new File( Gatherer.c_man.getCollectionLogDirectoryPath());243 File log_directory = new File(CollectionManager.getLoadedCollectionLogDirectoryPath()); 244 244 File children[] = log_directory.listFiles(); 245 245 for(int i = 0; children != null && i < children.length; i++) { … … 293 293 name.append(".txt"); 294 294 // just in case there is no log directory 295 File file = new File( Gatherer.c_man.getCollectionLogDirectoryPath() + name.toString());295 File file = new File(CollectionManager.getLoadedCollectionLogDirectoryPath() + name.toString()); 296 296 File parent_file = file.getParentFile(); 297 297 parent_file.mkdirs(); -
trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java
r13464 r13591 456 456 457 457 // Delete the existing (local) collection archives 458 Utility.delete(new File( Gatherer.c_man.getCollectionArchivesDirectoryPath()));458 Utility.delete(new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath())); 459 459 460 460 // Unzip the collection archives just downloaded -
trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
r13458 r13591 53 53 import org.greenstone.gatherer.cdm.CollectionMetaManager; 54 54 import org.greenstone.gatherer.cdm.CollectionMeta; 55 import org.greenstone.gatherer.collection.CollectionManager; 55 56 import org.greenstone.gatherer.metadata.DocXMLFileManager; 56 57 import org.greenstone.gatherer.remote.RemoteGreenstoneServer; … … 392 393 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Start"), status, null); 393 394 DocXMLFileManager.clearDocXMLFiles(); 394 DocXMLFileManager.loadDocXMLFiles(new File( Gatherer.c_man.getCollectionArchivesDirectoryPath()));395 DocXMLFileManager.loadDocXMLFiles(new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath())); 395 396 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Complete"), status, null); 396 397 } … … 404 405 405 406 // Only need to download build.cfg file 406 File build_cfg_file = new File( Gatherer.c_man.getCollectionBuildingDirectoryPath(), "build.cfg");407 File build_cfg_file = new File(CollectionManager.getLoadedCollectionBuildingDirectoryPath(), "build.cfg"); 407 408 RemoteGreenstoneServer.downloadCollectionFile(col_name, build_cfg_file); 408 409
Note:
See TracChangeset
for help on using the changeset viewer.