- Timestamp:
- 2007-01-12T14:39:03+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.