Index: /trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java (revision 13591)
@@ -323,5 +323,5 @@
public void actionPerformed(ActionEvent event) {
// Open an almost standard file browser to the images folder of the current collection
- File images_folder = new File(Gatherer.c_man.getCollectionImagesDirectoryPath());
+ File images_folder = new File(CollectionManager.getLoadedCollectionImagesDirectoryPath());
// If images isn't already there, create it
if(!images_folder.exists()) {
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/MacrosManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/MacrosManager.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/MacrosManager.java (revision 13591)
@@ -178,5 +178,5 @@
private void readMacroFile() {
macros_textarea.setText("");
- File extra_dm = new File(CollectionManager.getCollectionDirectoryPath()+"macros"+File.separator+"extra.dm");
+ File extra_dm = new File(CollectionManager.getLoadedCollectionMacrosDirectoryPath() + "extra.dm");
if (extra_dm.exists()) {
@@ -198,5 +198,5 @@
private void writeMacroFile() {
- File extra_dm_file = new File(CollectionManager.getCollectionDirectoryPath()+"macros"+File.separator+"extra.dm");
+ File extra_dm_file = new File(CollectionManager.getLoadedCollectionMacrosDirectoryPath() + "extra.dm");
try {
if (!extra_dm_file.exists()) {
Index: /trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java (revision 13591)
@@ -197,5 +197,5 @@
if(collection != null) {
// Determine if the collection has been built by looking for the build.cfg file
- File build_cfg_file = new File(getCollectionIndexDirectoryPath() + "build.cfg");
+ File build_cfg_file = new File(getLoadedCollectionIndexDirectoryPath() + "build.cfg");
return build_cfg_file.exists();
}
@@ -225,5 +225,5 @@
// Remove the lock on this file, then remove the collection.
- File lock_file = new File(getCollectionDirectoryPath() + LOCK_FILE);
+ File lock_file = new File(getLoadedCollectionDirectoryPath() + LOCK_FILE);
lock_file.delete();
if (lock_file.exists()) {
@@ -458,5 +458,5 @@
addRequiredMetadataSets();
- collection.cdm = new CollectionDesignManager(new File(getCollectionConfigFilePath()));
+ collection.cdm = new CollectionDesignManager(new File(getLoadedCollectionCfgFilePath()));
// We always set title and description here rather than calling mkcol.pl with Unicode arguments
@@ -565,4 +565,108 @@
+ /** Returns the absolute filename of the specified collection's directory.
+ */
+ static public String getCollectionDirectoryPath(String collection_name)
+ {
+ return Gatherer.getCollectDirectoryPath() + collection_name + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's archives directory.
+ */
+ static public String getLoadedCollectionArchivesDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "archives" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's building directory.
+ */
+ static public String getLoadedCollectionBuildingDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "building" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's collect.cfg file.
+ */
+ static public String getLoadedCollectionCfgFilePath()
+ {
+ return getLoadedCollectionEtcDirectoryPath() + "collect.cfg";
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's directory.
+ */
+ static public String getLoadedCollectionDirectoryPath()
+ {
+ return Gatherer.getCollectDirectoryPath() + collection.getName() + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's etc directory.
+ */
+ static public String getLoadedCollectionEtcDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "etc" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's .col file.
+ */
+ static public String getLoadedCollectionColFilePath()
+ {
+ return getLoadedCollectionDirectoryPath() + collection.getName() + ".col";
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's images directory.
+ */
+ static public String getLoadedCollectionImagesDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "images" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's import directory.
+ */
+ static public String getLoadedCollectionImportDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "import" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's index directory.
+ */
+ static public String getLoadedCollectionIndexDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "index" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's log directory.
+ */
+ static public String getLoadedCollectionLogDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "log" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's macros directory.
+ */
+ static public String getLoadedCollectionMacrosDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "macros" + File.separator;
+ }
+
+
+ /** Returns the absolute filename of the loaded collection's metadata directory.
+ */
+ static public String getLoadedCollectionMetadataDirectoryPath()
+ {
+ return getLoadedCollectionDirectoryPath() + "metadata" + File.separator;
+ }
+
+
/** Returns the name of the loaded collection.
*/
@@ -577,126 +681,4 @@
- static public String getCollectionDirectoryPath()
- {
- return Gatherer.getCollectDirectoryPath() + collection.getName() + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's directory, which should resemble "$GSDLHOME/collect/<col_name>"
- * @return A String containing the directory name.
- */
- static public String getCollectionDirectoryPath(String collection_name)
- {
- return Gatherer.getCollectDirectoryPath() + collection_name + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's .col file, which should resemble "$GSDLHOME/collect/<col_name>/<col_name>.col"
- * @return A String containing the filename.
- */
- public String getCollectionFilePath()
- {
- return getCollectionDirectoryPath() + collection.getName() + ".col";
- }
-
-
- /** Constructs the absolute filename of the collection's archives directory, which should resemble "$GSDLHOME/collect/<col_name>/archives/"
- * @return A String containing the filename.
- */
- public String getCollectionArchivesDirectoryPath()
- {
- return getCollectionDirectoryPath() + "archives" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's building directory, which should resemble "$GSDLHOME/collect/<col_name>/building/"
- * @return A String containing the filename.
- */
- public String getCollectionBuildingDirectoryPath()
- {
- return getCollectionDirectoryPath() + "building" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's collect.cfg file, which should resemble "$GSDLHOME/collect/<col_name>/etc/collect.cfg"
- * @return A String containing the filename.
- */
- public String getCollectionConfigFilePath()
- {
- return getCollectionEtcDirectoryPath() + "collect.cfg";
- }
-
-
- /** Constructs the absolute filename of the collection's etc directory, which should resemble "$GSDLHOME/collect/<col_name>/etc/"
- * @return A String containing the filename.
- */
- public String getCollectionEtcDirectoryPath()
- {
- return getCollectionDirectoryPath() + "etc" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's images directory, which should resemble "$GSDLHOME/collect/<col_name>/images/"
- * @return A String containing the filename.
- */
- public String getCollectionImagesDirectoryPath()
- {
- return getCollectionDirectoryPath() + "images" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's import directory, which should resemble "$GSDLHOME/collect/<col_name>/import/"
- * @return A String containing the filename.
- */
- public String getCollectionImportDirectoryPath()
- {
- return getCollectionDirectoryPath() + "import" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's index directory, which should resemble "$GSDLHOME/collect/<col_name>/index/"
- * @return A String containing the filename.
- */
- public String getCollectionIndexDirectoryPath()
- {
- return getCollectionDirectoryPath() + "index" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's log directory, which should resemble "$GSDLHOME/collect/<col_name>/log/"
- * @return A String containing the filename.
- */
- public String getCollectionLogDirectoryPath()
- {
- return getCollectionDirectoryPath() + "log" + File.separator;
- }
-
-
- /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/"
- * @return A String containing the filename.
- */
- public String getCollectionMetadataDirectoryPath()
- {
- return getCollectionDirectoryPath() + "metadata" + File.separator;
- }
-
- /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/"
- * @return A String containing the filename.
- */
- public String getCollectionPluginsDirectoryPath()
- {
- return getCollectionDirectoryPath() + "perllib" + File.separator +
- "plugins" + File.separator;
- }
- /** Constructs the absolute filename of the collection's metadata directory, which should resemble "$GSDLHOME/collect/<col_name>/metadata/"
- * @return A String containing the filename.
- */
- public String getCollectionClassifiersDirectoryPath()
- {
- return getCollectionDirectoryPath() + "perllib" + File.separator +
- "classify" + File.separator;
- }
-
-
public CollectionTree getCollectionTree()
{
@@ -714,5 +696,5 @@
if (collection_tree_model == null && collection != null) {
// Use the import directory to generate a new CollectionTreeModel
- collection_tree_model = new CollectionTreeModel(new CollectionTreeNode(new File(getCollectionImportDirectoryPath())));
+ collection_tree_model = new CollectionTreeModel(new CollectionTreeNode(new File(getLoadedCollectionImportDirectoryPath())));
// Ensure that the manager is a change listener for the tree.
if (fm_tree_model_listener == null) {
@@ -746,5 +728,5 @@
DebugStream.println("Is event dispatch thread: " + SwingUtilities.isEventDispatchThread());
//check that we can remove the old index before starting import
- File index_dir = new File(getCollectionIndexDirectoryPath());
+ File index_dir = new File(getLoadedCollectionIndexDirectoryPath());
if (index_dir.exists()) {
DebugStream.println("Old Index = " + index_dir.getAbsolutePath()+", testing for deletability");
@@ -806,5 +788,5 @@
// ...and only if it doesn't already exist
- File metadata_set_file = new File(getCollectionMetadataDirectoryPath(), external_metadata_set_file.getName());
+ File metadata_set_file = new File(getLoadedCollectionMetadataDirectoryPath(), external_metadata_set_file.getName());
if (!metadata_set_file.exists()) {
try {
@@ -1000,5 +982,5 @@
// Read through the doc.xml files in the archives directory
- File collection_archives_directory = new File(getCollectionArchivesDirectoryPath());
+ File collection_archives_directory = new File(getLoadedCollectionArchivesDirectoryPath());
DocXMLFileManager.clearDocXMLFiles();
DocXMLFileManager.loadDocXMLFiles(collection_archives_directory);
@@ -1267,5 +1249,5 @@
// Create a backup of the collection file, just in case anything goes wrong
- File collection_file = new File(getCollectionFilePath());
+ File collection_file = new File(getLoadedCollectionColFilePath());
if (collection_file.exists()) {
File collection_file_backup = new File(collection_file.getAbsolutePath() + "~");
@@ -1337,8 +1319,8 @@
Gatherer.configGS3Server(Configuration.site_name, ServletConfiguration.DEACTIVATE_COMMAND + collection.getName());
}
- File index_dir = new File(getCollectionIndexDirectoryPath());
+ File index_dir = new File(getLoadedCollectionIndexDirectoryPath());
DebugStream.println("Index = " + index_dir.getAbsolutePath());
- File building_dir = new File(getCollectionBuildingDirectoryPath());
+ File building_dir = new File(getLoadedCollectionBuildingDirectoryPath());
DebugStream.println("Building = " + building_dir.getAbsolutePath());
@@ -1362,6 +1344,6 @@
if (Gatherer.isGsdlRemote) {
- RemoteGreenstoneServer.deleteCollectionFile(collection.getName(), new File(getCollectionIndexDirectoryPath()));
- RemoteGreenstoneServer.moveCollectionFile(collection.getName(), new File(getCollectionBuildingDirectoryPath()), new File(getCollectionIndexDirectoryPath()));
+ RemoteGreenstoneServer.deleteCollectionFile(collection.getName(), new File(getLoadedCollectionIndexDirectoryPath()));
+ RemoteGreenstoneServer.moveCollectionFile(collection.getName(), new File(getLoadedCollectionBuildingDirectoryPath()), new File(getLoadedCollectionIndexDirectoryPath()));
}
Index: /trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java (revision 13591)
@@ -36,4 +36,5 @@
import org.greenstone.gatherer.Dictionary;
import org.greenstone.gatherer.Gatherer;
+import org.greenstone.gatherer.collection.CollectionManager;
import org.greenstone.gatherer.gui.CreateShortcutPrompt;
import org.greenstone.gatherer.gui.tree.DragTree;
@@ -120,5 +121,5 @@
if (refresh_reason == DragTree.COLLECTION_CONTENTS_CHANGED) {
DebugStream.println("...Reason: collection contents changed.");
- String collection_import_directory_path = Gatherer.c_man.getCollectionImportDirectoryPath();
+ String collection_import_directory_path = CollectionManager.getLoadedCollectionImportDirectoryPath();
refreshEveryNodeShowingFolder(collection_import_directory_path);
}
Index: /trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java (revision 13591)
@@ -458,5 +458,5 @@
// If we have a collection open remember it for next time, then save it and close it
if (Gatherer.c_man.ready()) {
- Configuration.setString("general.open_collection", true, Gatherer.c_man.getCollectionFilePath());
+ Configuration.setString("general.open_collection", true, CollectionManager.getLoadedCollectionColFilePath());
saveThenCloseCurrentCollection();
}
Index: /trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java (revision 13591)
@@ -241,5 +241,5 @@
// Build a list of the log files available, ordering by last modified. Log files are like build_log.date.txt
DefaultListModel contents = new DefaultListModel();
- File log_directory = new File(Gatherer.c_man.getCollectionLogDirectoryPath());
+ File log_directory = new File(CollectionManager.getLoadedCollectionLogDirectoryPath());
File children[] = log_directory.listFiles();
for(int i = 0; children != null && i < children.length; i++) {
@@ -293,5 +293,5 @@
name.append(".txt");
// just in case there is no log directory
- File file = new File(Gatherer.c_man.getCollectionLogDirectoryPath() + name.toString());
+ File file = new File(CollectionManager.getLoadedCollectionLogDirectoryPath() + name.toString());
File parent_file = file.getParentFile();
parent_file.mkdirs();
Index: /trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java (revision 13591)
@@ -456,5 +456,5 @@
// Delete the existing (local) collection archives
- Utility.delete(new File(Gatherer.c_man.getCollectionArchivesDirectoryPath()));
+ Utility.delete(new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath()));
// Unzip the collection archives just downloaded
Index: /trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/shell/GShell.java (revision 13590)
+++ /trunk/gli/src/org/greenstone/gatherer/shell/GShell.java (revision 13591)
@@ -53,4 +53,5 @@
import org.greenstone.gatherer.cdm.CollectionMetaManager;
import org.greenstone.gatherer.cdm.CollectionMeta;
+import org.greenstone.gatherer.collection.CollectionManager;
import org.greenstone.gatherer.metadata.DocXMLFileManager;
import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
@@ -392,5 +393,5 @@
fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Start"), status, null);
DocXMLFileManager.clearDocXMLFiles();
- DocXMLFileManager.loadDocXMLFiles(new File(Gatherer.c_man.getCollectionArchivesDirectoryPath()));
+ DocXMLFileManager.loadDocXMLFiles(new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath()));
fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Complete"), status, null);
}
@@ -404,5 +405,5 @@
// Only need to download build.cfg file
- File build_cfg_file = new File(Gatherer.c_man.getCollectionBuildingDirectoryPath(), "build.cfg");
+ File build_cfg_file = new File(CollectionManager.getLoadedCollectionBuildingDirectoryPath(), "build.cfg");
RemoteGreenstoneServer.downloadCollectionFile(col_name, build_cfg_file);