- Timestamp:
- 2005-02-15T15:39:48+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r9039 r9045 69 69 /** All of the external applications that must exit before we close the Gatherer. */ 70 70 public Vector apps = new Vector(); 71 static private String non_standard_collect_directory_path = null; 71 72 static public String open_collection_file_path = null; 72 73 /** A public reference to the FileAssociationManager. */ … … 410 411 if(c_man.saved()) { 411 412 ///ystem.err.println("Collection has been recently saved, so I'll remember it for next time."); 412 Configuration.setString("general.open_collection", true, c_man.getCollectionFile name());413 Configuration.setString("general.open_collection", true, c_man.getCollectionFilePath()); 413 414 } 414 415 c_man.closeCollection(); … … 448 449 g_man.setVisible(false); 449 450 } 451 } 452 453 454 static public String getCollectDirectoryPath() 455 { 456 if (non_standard_collect_directory_path != null) { 457 return non_standard_collect_directory_path; 458 } 459 460 if (!GS3) { 461 return Configuration.gsdl_path + "collect" + File.separator; 462 } 463 else { 464 return getSitesDirectoryPath() + Configuration.site_name + File.separator + "collect" + File.separator; 465 } 466 } 467 468 469 static public String getSitesDirectoryPath() 470 { 471 return Configuration.gsdl3_path + File.separator + "web" + File.separator + "sites" + File.separator; 472 } 473 474 475 static public void setCollectDirectoryPath(String collect_directory_path) 476 { 477 non_standard_collect_directory_path = collect_directory_path; 450 478 } 451 479 -
trunk/gli/src/org/greenstone/gatherer/GathererApplet.java
r9039 r9045 143 143 } 144 144 145 File col_dir = new File(Utility.getCollectDir(go.gsdl_path)); 145 Gatherer.setCollectDirectoryPath(go.gsdl_path + "collect" + File.separator); 146 File col_dir = new File(Gatherer.getCollectDirectoryPath()); 146 147 if (!col_dir.exists()) { 147 148 col_dir.mkdir(); … … 242 243 243 244 // set up output stream for zip download 244 String col _dir = Utility.getCollectDir(Configuration.gsdl_path);245 String zip_fname = col _dir+ col_name + ".zip";245 String collect_directory_path = Gatherer.getCollectDirectoryPath(); 246 String zip_fname = collect_directory_path + col_name + ".zip"; 246 247 FileOutputStream zip_fos = new FileOutputStream(zip_fname); 247 248 BufferedOutputStream zip_bfos = new BufferedOutputStream(zip_fos); … … 271 272 final int maxBufferSize = 1024; 272 273 273 String col _dir = Utility.getCollectDir(Configuration.gsdl_path);274 String zip_fname = col _dir+ col_name + ".zip";274 String collect_directory_path = Gatherer.getCollectDirectoryPath(); 275 String zip_fname = collect_directory_path + col_name + ".zip"; 275 276 String upload_cgi = Gatherer.cgiBase + "upload"; 276 277 -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r8620 r9045 216 216 if (formats_changed && Gatherer.c_man.built()) { 217 217 // upload etc/collect.cfg to server to reflect changes 218 Utility.zipup( collection_name, Utility.CONFIG_FILE);218 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE); 219 219 GathererApplet.upload_url_zip(collection_name, "etc"); 220 220 } -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r8606 r9045 473 473 public void actionPerformed(ActionEvent event) { 474 474 // Open an almost standard file browser to the images folder of the current collection 475 File images_folder = new File(Gatherer.c_man.getCollectionImages ());475 File images_folder = new File(Gatherer.c_man.getCollectionImagesDirectoryPath()); 476 476 // If images isn't already there, create it 477 477 if(!images_folder.exists()) { -
trunk/gli/src/org/greenstone/gatherer/cdm/MetadataSetView.java
r8386 r9045 300 300 // Re-read all the metadata.xml files to account for this case 301 301 MetadataXMLFileManager.clearMetadataXMLFiles(); 302 MetadataXMLFileManager.loadMetadataXMLFiles(new File(Gatherer.c_man.getCollectionImport ()));302 MetadataXMLFileManager.loadMetadataXMLFiles(new File(Gatherer.c_man.getCollectionImportDirectoryPath())); 303 303 } 304 304 } -
trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java
r8884 r9045 196 196 current_coll_name = Gatherer.c_man.getCollection().getName(); 197 197 198 File gsdl_collection_directory; 199 if (Gatherer.GS3) { 200 gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name)); 201 } 202 else { 203 gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path)); 204 } 205 206 File[] possible_collections = gsdl_collection_directory.listFiles(); 198 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 199 File[] possible_collections = collect_directory.listFiles(); 207 200 for(int i = 0; possible_collections != null && i < possible_collections.length; i++) { 208 201 File collect_cfg_file = new File(possible_collections[i], Utility.CONFIG_FILE); -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r9039 r9045 172 172 if(collection != null) { 173 173 // Determine if the collection has been built by looking for the build.cfg file 174 File build_cfg_file = new File(getCollectionIndex () + Utility.BUILD_CFG_FILENAME);174 File build_cfg_file = new File(getCollectionIndexDirectoryPath() + Utility.BUILD_CFG_FILENAME); 175 175 return build_cfg_file.exists(); 176 176 } … … 200 200 201 201 // Remove the lock on this file, then remove the collection. 202 String collection_dir; 203 if (Gatherer.GS3) { 204 collection_dir = Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()); 205 } else { 206 collection_dir = Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()); 207 208 } 209 File lock_file = new File(collection_dir + LOCK_FILE); 202 String collection_directory_path = getCollectionDirectoryPath(collection.getName()); 203 File lock_file = new File(collection_directory_path + LOCK_FILE); 210 204 lock_file.delete(); 211 205 if(lock_file.exists()) { … … 328 322 // ******************* 329 323 //check that this creation has worked - simply by checking for the existence of the collect.cfg file 330 String collection_dir; 331 if (Gatherer.GS3) { 332 collection_dir = Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, name); 333 } else { 334 collection_dir = Utility.getCollectionDir(Configuration.gsdl_path, name); 335 } 336 File config_file = new File(Utility.getConfigFile(collection_dir)); 324 String collection_directory_path = getCollectionDirectoryPath(name); 325 File config_file = new File(Utility.getConfigFile(collection_directory_path)); 337 326 if (!config_file.exists()) { 338 327 // no point continuing … … 343 332 344 333 // ACTIVE_DIR/log/ 345 File log_dir_temp = new File(Utility.getLogDir(collection_dir )+"temp.dat");334 File log_dir_temp = new File(Utility.getLogDir(collection_directory_path)+"temp.dat"); 346 335 File log_dir = log_dir_temp.getParentFile(); 347 336 log_dir.mkdirs(); … … 349 338 350 339 // Make sure an import folder exists 351 File import_directory = new File(Utility.getImportDir(collection_dir ));340 File import_directory = new File(Utility.getImportDir(collection_directory_path)); 352 341 if (!import_directory.exists()) { 353 342 import_directory.mkdirs(); … … 357 346 358 347 // Now create the collection object around the directory. 359 collection = new Collection(new File(collection_dir , name + ".col"));348 collection = new Collection(new File(collection_directory_path, name + ".col")); 360 349 361 350 MetadataSetManager.clearMetadataSets(); … … 368 357 } 369 358 370 ProfileXMLFileManager.loadProfileXMLFile(new File(collection_dir , Utility.META_DIR));359 ProfileXMLFileManager.loadProfileXMLFile(new File(collection_directory_path, Utility.META_DIR)); 371 360 372 361 // Before creating the CollectionDesignManager check if we are basing it upon some other collection … … 375 364 collection.setBaseCollection(base_collection_directory.getAbsolutePath()); 376 365 // copy over other needed directories 377 copyExtraBaseCollStuff(new File(collection_dir ), base_collection_directory);366 copyExtraBaseCollStuff(new File(collection_directory_path), base_collection_directory); 378 367 // Try to import any existing metadata sets for this collection 379 368 // Look in base_collection_directory/metadata and import any metadata sets found. … … 407 396 // Now we update our collect.cfg 408 397 DebugStream.println("Copy and update collect.cfg from base collection."); 409 updateCollectionCFG(new File(base_collection_directory, Utility.CONFIG_FILE), new File(collection_dir , Utility.CONFIG_FILE), description, email, title);398 updateCollectionCFG(new File(base_collection_directory, Utility.CONFIG_FILE), new File(collection_directory_path, Utility.CONFIG_FILE), description, email, title); 410 399 } 411 400 … … 416 405 } 417 406 418 collection.cdm = new CollectionDesignManager(new File(getCollectionConfig ()));407 collection.cdm = new CollectionDesignManager(new File(getCollectionConfigFilePath())); 419 408 420 409 // Now that we have a CDM, update several settings, such as if we created this collection by basing it on another, set it as public automatically … … 455 444 456 445 // Create a lock file. 457 File lock_file = new File(collection_dir , LOCK_FILE);446 File lock_file = new File(collection_directory_path, LOCK_FILE); 458 447 FileOutputStream out = new FileOutputStream(lock_file); 459 448 out.write(LOCK_FILE.getBytes()); … … 499 488 public boolean deleteCollection(String collection_name) 500 489 { 501 File collection_directory = null; 502 if (Gatherer.GS3) { 503 collection_directory = new File(Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection_name)); 504 } 505 else { 506 collection_directory = new File(Utility.getCollectionDir(Configuration.gsdl_path, collection_name)); 507 } 508 490 File collection_directory = new File(getCollectionDirectoryPath(collection_name)); 509 491 return Utility.delete(collection_directory); 510 492 } … … 528 510 529 511 530 /** Constructs the absolute filename of the collection archive directory, which should resemble "$GSDLHOME/collect/<col_name>/archive/" 512 /** Constructs the absolute filename of the collection's directory, which should resemble "$GSDLHOME/collect/<col_name>" 513 * @return A <strong>String</strong> containing the directory name. 514 */ 515 static public String getCollectionDirectoryPath(String collection_name) 516 { 517 return Gatherer.getCollectDirectoryPath() + collection_name + File.separator; 518 } 519 520 521 /** Constructs the absolute filename of the collection's .col file, which should resemble "$GSDLHOME/collect/<col_name>/<col_name>.col" 531 522 * @return A <strong>String</strong> containing the filename. 532 * @see org.greenstone.gatherer.Configuration 533 * @see org.greenstone.gatherer.Gatherer 534 * @see org.greenstone.gatherer.collection.Collection 535 * @see org.greenstone.gatherer.util.Utility 536 */ 537 public String getCollectionArchives() { 538 if (Gatherer.GS3) { 539 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()) + "archives" + File.separator; 540 } else { 541 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()) + "archives" + File.separator; 542 } 543 } 544 /** Constructs the absolute filename of the collection building directory, which should resemble "$GSDLHOME/collect/<col_name>/building/" 523 */ 524 public String getCollectionFilePath() 525 { 526 return getCollectionDirectoryPath(collection.getName()) + collection.getName() + ".col"; 527 } 528 529 530 /** Constructs the absolute filename of the collection's archives directory, which should resemble "$GSDLHOME/collect/<col_name>/archives/" 545 531 * @return A <strong>String</strong> containing the filename. 546 * @see org.greenstone.gatherer.Configuration 547 * @see org.greenstone.gatherer.Gatherer 548 * @see org.greenstone.gatherer.collection.Collection 549 * @see org.greenstone.gatherer.util.Utility 550 */ 551 public String getCollectionBuild() { 552 if (Gatherer.GS3) { 553 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()) + "building" + File.separator; 554 } else { 555 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()) + "building" + File.separator; 556 } 557 } 558 /** Constructs the absolute filename of the collection config file, which should resemble "$GSDLHOME/collect/<col_name>/etc/collect.cfg" 532 */ 533 public String getCollectionArchivesDirectoryPath() 534 { 535 return getCollectionDirectoryPath(collection.getName()) + "archives" + File.separator; 536 } 537 538 539 /** Constructs the absolute filename of the collection's building directory, which should resemble "$GSDLHOME/collect/<col_name>/building/" 559 540 * @return A <strong>String</strong> containing the filename. 560 * @see org.greenstone.gatherer.Configuration 561 * @see org.greenstone.gatherer.Gatherer 562 * @see org.greenstone.gatherer.collection.Collection 563 * @see org.greenstone.gatherer.util.Utility 564 */ 565 public String getCollectionConfig() { 566 if (Gatherer.GS3) { 567 return Utility.getConfigFile(Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName())); 568 } else { 569 return Utility.getConfigFile(Utility.getCollectionDir(Configuration.gsdl_path, collection.getName())); 570 } 571 } 572 573 /** Constructs the absolute filename of the collection directory, which should resemble "$GSDLHOME/collect/<col_name>" 574 * @return A <strong>String</strong> containing the directory name. 575 * @see org.greenstone.gatherer.Configuration 576 * @see org.greenstone.gatherer.Gatherer 577 * @see org.greenstone.gatherer.collection.Collection 578 * @see org.greenstone.gatherer.util.Utility 579 */ 580 public String getCollectionDirectory() { 581 if (Gatherer.GS3) { 582 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()); 583 } else { 584 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()); 585 } 586 } 587 588 /** Constructs the absolute filename of the collection etc directory, which should resemble "$GSDLHOME/collect/<col_name>/etc/" 541 */ 542 public String getCollectionBuildingDirectoryPath() 543 { 544 return getCollectionDirectoryPath(collection.getName()) + "building" + File.separator; 545 } 546 547 548 /** Constructs the absolute filename of the collection's collect.cfg file, which should resemble "$GSDLHOME/collect/<col_name>/etc/collect.cfg" 589 549 * @return A <strong>String</strong> containing the filename. 590 * @see org.greenstone.gatherer.Configuration 591 * @see org.greenstone.gatherer.Gatherer 592 * @see org.greenstone.gatherer.collection.Collection 593 * @see org.greenstone.gatherer.util.Utility 594 */ 595 public String getCollectionEtc() { 596 if (Gatherer.GS3) { 597 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()) + "etc" + File.separator; 598 } else { 599 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()) + "etc" + File.separator; 600 } 601 } 602 /** Constructs the absolute filename of the collection file, which should resemble "$GSDLHOME/collect/<col_name>/<col_name>.col" 550 */ 551 public String getCollectionConfigFilePath() 552 { 553 return getCollectionEtcDirectoryPath() + "collect.cfg"; 554 } 555 556 557 /** Constructs the absolute filename of the collection's etc directory, which should resemble "$GSDLHOME/collect/<col_name>/etc/" 603 558 * @return A <strong>String</strong> containing the filename. 604 * @see org.greenstone.gatherer.Configuration 605 * @see org.greenstone.gatherer.Gatherer 606 * @see org.greenstone.gatherer.collection.Collection 607 * @see org.greenstone.gatherer.util.Utility 608 */ 609 public String getCollectionFilename() { 610 if (Gatherer.GS3) { 611 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()) + collection.getName() + ".col"; 612 } else { 613 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()) + collection.getName() + ".col"; 614 } 615 } 616 /** Constructs the absolute filename of the collection images directory, which should resemble "$GSDLHOME/collect/<col_name>/images/" 559 */ 560 public String getCollectionEtcDirectoryPath() 561 { 562 return getCollectionDirectoryPath(collection.getName()) + "etc" + File.separator; 563 } 564 565 566 /** Constructs the absolute filename of the collection's images directory, which should resemble "$GSDLHOME/collect/<col_name>/images/" 617 567 * @return A <strong>String</strong> containing the filename. 618 * @see org.greenstone.gatherer.Configuration 619 * @see org.greenstone.gatherer.Gatherer 620 * @see org.greenstone.gatherer.collection.Collection 621 * @see org.greenstone.gatherer.util.Utility 622 */ 623 public String getCollectionImages() { 624 if (Gatherer.GS3) { 625 return Utility.getImagesDir(Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName())); 626 } else { 627 return Utility.getImagesDir(Utility.getCollectionDir(Configuration.gsdl_path, collection.getName())); 628 } 629 } 630 /** Constructs the absolute filename of the collection import directory, which should resemble "$GSDLHOME/collect/<col_name>/import/" 568 */ 569 public String getCollectionImagesDirectoryPath() 570 { 571 return getCollectionDirectoryPath(collection.getName()) + "images" + File.separator; 572 } 573 574 575 /** Constructs the absolute filename of the collection's import directory, which should resemble "$GSDLHOME/collect/<col_name>/import/" 631 576 * @return A <strong>String</strong> containing the filename. 632 * @see org.greenstone.gatherer.Configuration 633 * @see org.greenstone.gatherer.Gatherer 634 * @see org.greenstone.gatherer.collection.Collection 635 * @see org.greenstone.gatherer.util.Utility 636 */ 637 public String getCollectionImport() { 638 if (Gatherer.GS3) { 639 return Utility.getImportDir(Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName())); 640 } else { 641 return Utility.getImportDir(Utility.getCollectionDir(Configuration.gsdl_path, collection.getName())); 642 } 643 } 644 /** Constructs the absolute filename of the collection index directory, which should resemble "$GSDLHOME/collect/<col_name>/index/" 577 */ 578 public String getCollectionImportDirectoryPath() 579 { 580 return getCollectionDirectoryPath(collection.getName()) + "import" + File.separator; 581 } 582 583 584 /** Constructs the absolute filename of the collection's index directory, which should resemble "$GSDLHOME/collect/<col_name>/index/" 645 585 * @return A <strong>String</strong> containing the filename. 646 * @see org.greenstone.gatherer.Configuration 647 * @see org.greenstone.gatherer.Gatherer 648 * @see org.greenstone.gatherer.collection.Collection 649 * @see org.greenstone.gatherer.util.Utility 650 */ 651 public String getCollectionIndex() { 652 if (Gatherer.GS3) { 653 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()) + "index" + File.separator; 654 } else { 655 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()) + "index" + File.separator; 656 } 657 } 658 /** Constructs the absolute filename of the collection log directory, which should resemble "$GSDLHOME/collect/<col_name>/log/" 586 */ 587 public String getCollectionIndexDirectoryPath() 588 { 589 return getCollectionDirectoryPath(collection.getName()) + "index" + File.separator; 590 } 591 592 593 /** Constructs the absolute filename of the collection's log directory, which should resemble "$GSDLHOME/collect/<col_name>/log/" 659 594 * @return A <strong>String</strong> containing the filename. 660 * @see org.greenstone.gatherer.Configuration 661 * @see org.greenstone.gatherer.Gatherer 662 * @see org.greenstone.gatherer.collection.Collection 663 * @see org.greenstone.gatherer.util.Utility 664 */ 665 public String getCollectionLog() { 666 if (Gatherer.GS3) { 667 return Utility.getLogDir(Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName())); 668 } else { 669 return Utility.getLogDir(Utility.getCollectionDir(Configuration.gsdl_path, collection.getName())); 670 } 671 } 672 /** Constructs the absolute filename of the collection metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/" 595 */ 596 public String getCollectionLogDirectoryPath() 597 { 598 return getCollectionDirectoryPath(collection.getName()) + "log" + File.separator; 599 } 600 601 602 /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/" 673 603 * @return A <strong>String</strong> containing the filename. 674 * @see org.greenstone.gatherer.Configuration 675 * @see org.greenstone.gatherer.Gatherer 676 * @see org.greenstone.gatherer.collection.Collection 677 * @see org.greenstone.gatherer.util.Utility 678 */ 679 public String getCollectionMetadata() { 680 if (Gatherer.GS3) { 681 return Utility.getCollectionDir(Configuration.gsdl3_path, Configuration.site_name, collection.getName()) + "metadata" + File.separator; 682 } else { 683 return Utility.getCollectionDir(Configuration.gsdl_path, collection.getName()) + "metadata" + File.separator; 684 } 604 */ 605 public String getCollectionMetadataDirectoryPath() 606 { 607 return getCollectionDirectoryPath(collection.getName()) + "metadata" + File.separator; 685 608 } 686 609 … … 691 614 if (collection_model == null && collection != null) { 692 615 // Use the import directory to generate a new CollectionTreeModel 693 collection_model = new CollectionTreeModel(new CollectionTreeNode(new File(getCollectionImport ())));616 collection_model = new CollectionTreeModel(new CollectionTreeNode(new File(getCollectionImportDirectoryPath()))); 694 617 // Ensure that the manager is a change listener for the tree. 695 618 if (fm_tree_model_listener == null) { … … 722 645 DebugStream.println("CollectionManager.importCollection()"); 723 646 //check that we can remove the old index before starting import 724 File index_dir = new File(getCollectionIndex(), "temp.txt"); 725 index_dir = index_dir.getParentFile(); 726 if(index_dir.exists()) { 647 File index_dir = new File(getCollectionIndexDirectoryPath()); 648 if (index_dir.exists()) { 727 649 DebugStream.println("Old Index = " + index_dir.getAbsolutePath()+", testing for deletability"); 728 650 if (!canDelete(index_dir)) { … … 788 710 789 711 // ...and only if it doesn't already exist 790 File metadata_set_file = new File(getCollectionMetadata (), external_metadata_set_file.getName());712 File metadata_set_file = new File(getCollectionMetadataDirectoryPath(), external_metadata_set_file.getName()); 791 713 if (!metadata_set_file.exists()) { 792 714 try { … … 953 875 954 876 // Read through the doc.xml files in the archives directory 955 File collection_archives_directory = new File(getCollectionArchives ());877 File collection_archives_directory = new File(getCollectionArchivesDirectoryPath()); 956 878 DocXMLFileManager.clearDocXMLFiles(); 957 879 DocXMLFileManager.loadDocXMLFiles(collection_archives_directory); … … 987 909 988 910 989 p ublicvoid makeCollection(String description, String email, String name, String title) {911 private void makeCollection(String description, String email, String name, String title) { 990 912 // Encode the description so it is safe to write to shell 991 913 if(Utility.isWindows()) { … … 1239 1161 1240 1162 // Create a backup of the collection file, just in case anything goes wrong 1241 File collection_file = new File( Gatherer.c_man.getCollectionFilename());1163 File collection_file = new File(getCollectionFilePath()); 1242 1164 if (collection_file.exists()) { 1243 1165 File collection_file_backup = new File(collection_file.getAbsolutePath() + "~"); … … 1255 1177 1256 1178 // Write hfiles for the loaded metadata elements into the collection "etc" directory 1257 MetadataSetManager.writeHierarchyFiles(new File( Gatherer.c_man.getCollectionEtc()));1179 MetadataSetManager.writeHierarchyFiles(new File(getCollectionEtcDirectoryPath())); 1258 1180 1259 1181 // Change cursor back to normal … … 1294 1216 // used as arg in the perl scripts 1295 1217 private String getCollectDirectory() { 1296 String collect_dir; 1297 if (Gatherer.GS3) { 1298 collect_dir = Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name); 1299 } else { 1300 collect_dir = Utility.getCollectDir(Configuration.gsdl_path); 1301 } 1218 String collect_dir = Gatherer.getCollectDirectoryPath(); 1302 1219 1303 1220 // Remove erroneous file windows file separator as it causes problems when running import.pl … … 1324 1241 } 1325 1242 1326 File index_dir = new File(getCollectionIndex ());1243 File index_dir = new File(getCollectionIndexDirectoryPath()); 1327 1244 DebugStream.println("Index = " + index_dir.getAbsolutePath()); 1328 1245 1329 File building_dir = new File(getCollectionBuild ());1246 File building_dir = new File(getCollectionBuildingDirectoryPath()); 1330 1247 DebugStream.println("Building = " + building_dir.getAbsolutePath()); 1331 1248 -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java
r8846 r9045 79 79 if (refresh_reason == DragTree.COLLECTION_CONTENTS_CHANGED) { 80 80 DebugStream.println("...Reason: collection contents changed."); 81 String import_directory_str = Gatherer.c_man.getCollectionImport ();81 String import_directory_str = Gatherer.c_man.getCollectionImportDirectoryPath(); 82 82 refreshEveryNodeShowingFolder(import_directory_str); 83 83 } -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java
r8787 r9045 128 128 File start; 129 129 if (is_gs3_site_node) { 130 start = new File( Utility.getCollectDir(Configuration.gsdl3_path, title));130 start = new File(Gatherer.getSitesDirectoryPath() + title + File.separator + "collect" + File.separator); 131 131 } else { 132 start = new File( Utility.getCollectDir(Configuration.gsdl_path));132 start = new File(Gatherer.getCollectDirectoryPath()); 133 133 } 134 134 File cols[] = start.listFiles(); -
trunk/gli/src/org/greenstone/gatherer/gui/DeleteCollectionPrompt.java
r9018 r9045 215 215 private void scanForCollections() { 216 216 // Start at the collect dir. 217 File collect_directory; 218 if (Gatherer.GS3) { 219 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name)); 220 } else { 221 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl_path)); 222 } 223 if(collect_directory.exists()) { 217 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 218 if (collect_directory.exists()) { 224 219 // Now for each child directory see if it contains a .col file and 225 220 // if so try to load it.. -
trunk/gli/src/org/greenstone/gatherer/gui/ExportCollectionPrompt.java
r9018 r9045 335 335 private void scanForCollections() { 336 336 // Start at the collect dir. 337 File collect_directory; 338 if (Gatherer.GS3) { 339 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name)); 340 } else { 341 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl_path)); 342 } 343 if(collect_directory.exists()) { 337 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 338 if (collect_directory.exists()) { 344 339 // Now for each child directory see if it contains a .col file and 345 340 // if so try to load it.. -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r9035 r9045 621 621 } 622 622 else if(user_choice == SimpleOpenCollectionDialog.BROWSE_OPTION) { 623 File file;623 File collect_directory; 624 624 if (Gatherer.GS3) { 625 if (Configuration.gsdl3_path != null) { 626 file = new File(Utility.getSitesDir(Configuration.gsdl3_path)); 627 } else { 628 file = new File(Utility.BASE_DIR); 629 } 630 631 } else { 632 633 if(Configuration.gsdl_path != null) { 634 file = new File(Utility.getCollectDir(Configuration.gsdl_path)); 635 } 636 else { 637 file = new File(Utility.BASE_DIR); 638 } 639 } 640 OpenCollectionDialog chooser = new OpenCollectionDialog(file); 641 file = null; 625 collect_directory = new File(Utility.getSitesDir(Configuration.gsdl3_path)); 626 } 627 else { 628 collect_directory = new File(Gatherer.getCollectDirectoryPath()); 629 } 630 OpenCollectionDialog chooser = new OpenCollectionDialog(collect_directory); 642 631 filename = chooser.getFileName(); 643 632 chooser.destroy(); -
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java
r8803 r9045 49 49 return false; 50 50 } 51 File collection_directory; 52 if (Gatherer.GS3) { 53 collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name)); 54 } else { 55 collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path)); 56 } 57 File children[] = collection_directory.listFiles(); 51 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 52 File children[] = collect_directory.listFiles(); 58 53 for(int i = 0; children != null && i < children.length; i++) { 59 54 if(children[i].isDirectory()) { … … 102 97 // need to modify this to base a coll on any collection from any site 103 98 if (Gatherer.GS3) { 104 File sites_dir = new File( Utility.getSitesDir(Configuration.gsdl3_path));99 File sites_dir = new File(Gatherer.getSitesDirectoryPath()); 105 100 File [] sites = sites_dir.listFiles(); 106 101 for (int i=0; i<sites.length; i++) { 107 File collect_dir = new File(Utility.getCollectDir(Configuration.gsdl3_path, sites[i].getName()));108 if (collect_dir .exists()) {109 addCollectionsToModel(base_collection_model, collect_dir , sites[i].getName());102 File collect_directory = new File(sites_dir + sites[i].getName() + File.separator + "collect"); 103 if (collect_directory.exists()) { 104 addCollectionsToModel(base_collection_model, collect_directory, sites[i].getName()); 110 105 } 111 106 } 112 107 } else { 113 File gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));114 addCollectionsToModel(base_collection_model, gsdl_collection_directory, null);108 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 109 addCollectionsToModel(base_collection_model, collect_directory, null); 115 110 } 116 111 … … 266 261 } 267 262 268 private boolean filenameClashes(String filename) { 269 File collection_directory; 270 if (Gatherer.GS3) { 271 collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name)); 272 } else { 273 collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path)); 274 } 275 276 File children[] = collection_directory.listFiles(); 263 private boolean filenameClashes(String filename) 264 { 265 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 266 File children[] = collect_directory.listFiles(); 277 267 for(int i = 0; children != null && i < children.length; i++) { 278 268 if(children[i].getName().equals(filename)) { -
trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r8313 r9045 236 236 // Build a list of the log files available, ordering by last modified. Log files are like build_log.date.txt 237 237 DefaultListModel contents = new DefaultListModel(); 238 File log_directory = new File(Gatherer.c_man.getCollectionLog ());238 File log_directory = new File(Gatherer.c_man.getCollectionLogDirectoryPath()); 239 239 File children[] = log_directory.listFiles(); 240 240 for(int i = 0; children != null && i < children.length; i++) { … … 289 289 name.append(".txt"); 290 290 // just in case there is no log directory 291 File file = new File(Gatherer.c_man.getCollectionLog () + name.toString());291 File file = new File(Gatherer.c_man.getCollectionLogDirectoryPath() + name.toString()); 292 292 File parent_file = file.getParentFile(); 293 293 parent_file.mkdirs(); -
trunk/gli/src/org/greenstone/gatherer/gui/SimpleOpenCollectionDialog.java
r8243 r9045 264 264 public CollectionListModel() { 265 265 data = new TreeSet(); 266 File collect_folder; 267 if (Gatherer.GS3) { 268 collect_folder = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name) ); 269 } else { 270 collect_folder = new File(Utility.getCollectDir(Configuration.gsdl_path)); 271 } 272 if (!collect_folder.exists()) { 273 collect_folder = null; 266 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 267 if (!collect_directory.exists()) { 268 collect_directory = null; 274 269 return; 275 270 } 276 File[] collection_folders = collect_ folder.listFiles();271 File[] collection_folders = collect_directory.listFiles(); 277 272 for(int i = 0; i < collection_folders.length; i++) { 278 273 File collection_folder = collection_folders[i]; … … 290 285 } 291 286 collection_folders = null; 292 collect_ folder= null;287 collect_directory = null; 293 288 } 294 289 -
trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
r9021 r9045 464 464 } 465 465 466 String collect_directory_path = Gatherer.getCollectDirectoryPath(); 467 466 468 // zip up import folder 467 Utility.zipup(col _name,"import");469 Utility.zipup(collect_directory_path, col_name, "import"); 468 470 // upload it to gsdl server 469 GathererApplet.upload_url_zip(col_name, "import");471 GathererApplet.upload_url_zip(col_name, "import"); 470 472 471 473 // upload etc folder to server (need collect.cfg and any hfiles) 472 Utility.zipup(col _name, "etc");473 GathererApplet.upload_url_zip(col_name, "etc");474 475 String col _dir = Utility.getCollectionDir(Configuration.gsdl_path,col_name);476 File img_dir = new File( Utility.getImagesDir(col_dir));474 Utility.zipup(collect_directory_path, col_name, "etc"); 475 GathererApplet.upload_url_zip(col_name, "etc"); 476 477 String collection_directory_path = Gatherer.c_man.getCollectionDirectoryPath(col_name); 478 File img_dir = new File(Gatherer.c_man.getCollectionImagesDirectoryPath()); 477 479 if (img_dir.exists() && img_dir.list().length > 0) { 478 480 // upload images/ directory to server 479 Utility.zipup(col _name,"images");480 GathererApplet.upload_url_zip(col_name, "images");481 Utility.zipup(collect_directory_path, col_name, "images"); 482 GathererApplet.upload_url_zip(col_name, "images"); 481 483 } 482 484 … … 520 522 if (Gatherer.isGsdlRemote) { 521 523 GathererApplet.download_url_zip(col_name,"."); 522 Utility.unzip( col_name);524 Utility.unzip(Gatherer.getCollectDirectoryPath(), col_name); 523 525 } 524 526 } … … 533 535 534 536 535 Utility.delete(Gatherer.c_man.getCollectionArchives ()); // remove current archives537 Utility.delete(Gatherer.c_man.getCollectionArchivesDirectoryPath()); // remove current archives 536 538 GathererApplet.download_url_zip(col_name,"archives"); 537 Utility.unzip( col_name);539 Utility.unzip(Gatherer.getCollectDirectoryPath(), col_name); 538 540 539 541 if (progress!=null) { … … 545 547 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Start"), status, null); 546 548 DocXMLFileManager.clearDocXMLFiles(); 547 DocXMLFileManager.loadDocXMLFiles(new File(Gatherer.c_man.getCollectionArchives ()));549 DocXMLFileManager.loadDocXMLFiles(new File(Gatherer.c_man.getCollectionArchivesDirectoryPath())); 548 550 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Complete"), status, null); 549 551 } … … 556 558 } 557 559 558 Utility.delete(Gatherer.c_man.getCollectionBuild ()); // remove current build dir560 Utility.delete(Gatherer.c_man.getCollectionBuildingDirectoryPath()); // remove current build dir 559 561 GathererApplet.download_url_zip(col_name,"building"); 560 Utility.unzip( col_name);562 Utility.unzip(Gatherer.getCollectDirectoryPath(), col_name); 561 563 562 564 if (progress!=null) { -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r9036 r9045 345 345 return new File(getGLIUserFolder(), StaticStrings.CACHE_FOLDER); 346 346 } 347 /** Method which constructs the collect directory for Greenstone.348 * @param gsdl_path The location of the gsdl installation directory as a <strong>String</strong>.349 * @return The location of the collection directory, also as a <strong>String</strong>.350 */351 public static String getCollectDir(String gsdl_path) {352 return gsdl_path + COL_DIR;353 }354 static public String getCollectDir(String gsdl3_path, String site_name) {355 return getSitesDir(gsdl3_path) + site_name + File.separator + COL_DIR;356 }357 358 359 /** Method which constructs a collection's top level directory360 * @@param gsdl_path The location of the gsdl installation directory as a <strong>String</strong>.361 * @param The name of the collection as a <strong>String</strong>.362 * @return The location of the collection's base directory363 */364 public static String getCollectionDir(String gsdl_path, String coll_name) {365 return getCollectDir(gsdl_path) + coll_name + File.separator;366 }367 public static String getCollectionDir(String gsdl3_path, String site_name, String coll_name) {368 return getCollectDir(gsdl3_path, site_name) + coll_name + File.separator;369 }370 347 371 348 … … 485 462 } 486 463 487 /** Method which constructs the images directory given a certain collection. 488 * @param col_dir The location of the collection directory as a <strong>String</strong>. 489 * @return The location of the given collections images directory, also as a <strong>String</strong>. 490 */ 491 public static String getImagesDir(String col_dir) { 492 return col_dir + IMAGES_DIR; 493 } 464 494 465 /** Method which constructs the import directory given a certain collection. 495 466 * @param col_dir The location of the collection directory as a <strong>String</strong>. … … 709 680 710 681 711 static public void zipup(String col_name, String dir_or_file) 712 { 713 String col_dir = Utility.getCollectDir(Configuration.gsdl_path); 682 static public void zipup(String col_dir, String col_name, String dir_or_file) 683 { 714 684 int prefix_strip = col_dir.length(); 715 685 … … 762 732 763 733 764 static public void unzip(String col_name) 765 { 766 String col_dir = Utility.getCollectDir(Configuration.gsdl_path); 734 static public void unzip(String col_dir, String col_name) 735 { 767 736 String zip_fname = col_dir + col_name + ".zip"; 768 737 int zip_mode = ZipFile.OPEN_READ | ZipFile.OPEN_DELETE;
Note:
See TracChangeset
for help on using the changeset viewer.