Changeset 7281 for trunk/gli/src
- Timestamp:
- 2004-05-05T15:14:48+12:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/Collection.java
r6879 r7281 70 70 /** A reference to the Metadata Set Manager. */ 71 71 public MetadataSetManager msm; 72 /** true if an error has occurred during construction */ 73 public boolean error = false; 72 74 /** <i>true</i> if the currently loaded collection has been saved since the last significant change, <i>false</i> otherwise. */ 73 75 private boolean saved = false; … … 98 100 if(document == null) { 99 101 document = Utility.parse(COLLECTION_XML_TEMPLATE, true); 102 } 103 if (document == null) { 104 error = true; 105 return; 100 106 } 101 107 // Point the Configuration class at our gatherer config arguments. -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r7275 r7281 50 50 import org.greenstone.gatherer.cdm.CollectionMetaManager; 51 51 import org.greenstone.gatherer.cdm.CommandTokenizer; 52 import org.greenstone.gatherer.collection.BasicCollectionConfiguration;53 52 import org.greenstone.gatherer.collection.Collection; 54 53 import org.greenstone.gatherer.collection.SaveCollectionTask; … … 769 768 return false; 770 769 } 770 File collection_config_file = new File(collection_directory, Utility.CONFIG_FILE); 771 if (!collection_config_file.exists()) { 772 Gatherer.println("CollectionManager.loadCollection: No config file"); 773 collection_directory = null; 774 collection_config_file = null; 775 return false; 776 } 771 777 772 778 // Special case of a user trying to open an old greenstone collection. … … 793 799 lock_file = null; 794 800 collection_directory = null; 801 collection_config_file = null; 795 802 return false; 796 803 } … … 816 823 // Open the collection file 817 824 collection = new Collection(collection_file); 818 if (collection.getTitle().equals(StaticStrings.ERROR_STR)) {825 if (collection.error) { 819 826 collection = null; 820 827 // Remove lock file … … 822 829 lock_file.delete(); 823 830 } 824 throw(new Exception(Dictionary.get("CollectionManager.Missing_Config"))); 831 throw(new Exception(Dictionary.get("CollectionManager.Missing_Config"))); // this error message does not agree with the error 825 832 } 826 833 … … 840 847 } 841 848 842 collection.cdm = new CollectionDesignManager( new File(collection_file.getParent(), Utility.CONFIG_FILE));849 collection.cdm = new CollectionDesignManager(collection_config_file); 843 850 if (non_gatherer_collection) { 844 851 // We first recurse the Import folder tree, reading in any metadata.xml files, and then altering the non-namespaced element names to be valid GLI names … … 884 891 lock_file = null; 885 892 collection_directory = null; 893 collection_config_file = null; 886 894 887 895 args2 = null; -
trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java
r7224 r7281 225 225 ArrayTools.sort(collections); 226 226 for(int i = 0; collections != null && i < collections.length; i++) { 227 if( !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {228 File config_file = Utility.findConfigFile(collections[i]);229 if (config_file != null) {227 if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) { 228 File config_file = new File(collections[i], Utility.CONFIG_FILE); 229 if (config_file.exists()) { 230 230 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 231 if(!config.getName().equals(StaticStrings.EMPTY_STR)) { 232 list_model.addElement(config); 233 } 231 list_model.addElement(config); 232 config = null; 234 233 } 235 234 } -
trunk/gli/src/org/greenstone/gatherer/collection/ExportCollectionPrompt.java
r7224 r7281 353 353 ArrayTools.sort(collections); 354 354 for(int i = 0; collections != null && i < collections.length; i++) { 355 if( !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {356 File config_file = Utility.findConfigFile(collections[i]);357 if (config_file != null) {355 if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) { 356 File config_file = new File(collections[i], Utility.CONFIG_FILE); 357 if (config_file.exists()) { 358 358 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 359 if (!config.getName().equals(StaticStrings.EMPTY_STR)) { 360 all_collections.add(config); 361 } 359 all_collections.add(config); 362 360 config = null; 363 361 } -
trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
r7275 r7281 269 269 if(children == null) { 270 270 children = new ArrayList(); 271 // Super Special Case: if the name of this node is the Tree.World string, then we actually map the collections installed in greenstone. The file in this case will actually b ythe collect directory of greenstone.271 // Super Special Case: if the name of this node is the Tree.World string, then we actually map the collections installed in greenstone. The file in this case will actually be the collect directory of greenstone. 272 272 if(file == null && title.equals(Dictionary.get("Tree.World"))) { 273 273 ///atherer.println("Map the 'Greenstone Collections' node."); … … 283 283 File import_dir = new File(cols[i], StaticStrings.IMPORT_FOLDER); 284 284 if(import_dir.exists()) { 285 // we don't care if there is no config file 285 286 BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(new File(cols[i], Utility.CONFIG_FILE)); 286 287 FileNode collection_root = new FileNode(import_dir, collect_cfg.toString(), true); -
trunk/gli/src/org/greenstone/gatherer/gui/SimpleOpenCollectionDialog.java
r7275 r7281 214 214 File collection_folder = collection_folders[i]; 215 215 String collection_foldername = collection_folder.getName(); 216 if(!collection_folder.isFile() && !collection_foldername.equals(StaticStrings.MODEL_COLLECTION_NAME)) { 217 BasicCollectionConfiguration collection_configuration = new BasicCollectionConfiguration(new File(collection_folder, Utility.CONFIG_FILE)); 218 if(!collection_configuration.getName().equals(StaticStrings.ERROR_STR)) { 219 data.add(collection_configuration); 220 } 216 if(collection_folder.isDirectory() && !collection_foldername.equals(StaticStrings.MODEL_COLLECTION_NAME)) { 217 File config_file = new File(collection_folder, Utility.CONFIG_FILE); 218 if (config_file.exists()) { 219 BasicCollectionConfiguration collection_configuration = new BasicCollectionConfiguration(config_file); 220 data.add(collection_configuration); 221 } 222 config_file = null; 221 223 } 222 224 collection_foldername = null; -
trunk/gli/src/org/greenstone/gatherer/mem/MEMNode.java
r7275 r7281 160 160 if(is_descendant) { 161 161 // Create a basic config class 162 BasicCollectionConfiguration config = new BasicCollectionConfiguration(new File(source_path, Utility.CONFIG_FILE)); 163 text = config.toString(); 164 config = null; 162 File config_file = new File(source_path, Utility.CONFIG_FILE); 163 if (config_file.exists()) { 164 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 165 text = config.toString(); 166 config = null; 167 } else { 168 text = source_path.getAbsolutePath(); 169 } 170 config_file = null; 165 171 } 166 172 else { -
trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
r7251 r7281 98 98 static final public String ENUM_STR = "enum"; 99 99 static final public String EQUALS_CHARACTER = "="; 100 static final public String ERROR_STR = "Error";101 100 static final public String ESCAPE_PATTERN = "\\\\"; 102 101 static final public String ESCAPE_STR = "\\"; -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r7275 r7281 264 264 * @return The collect.cfg File or null if not found. 265 265 */ 266 static final public File findConfigFile(File start) {266 /* static final public File findConfigFile(File start) { 267 267 if(start == null) { 268 268 return null; … … 280 280 // Otherwise search this directories parent if its not null. 281 281 return findConfigFile(start.getParentFile()); 282 } 282 }*/ 283 283 284 284 /** Convert a long, detailing the length of a file in bytes, into a nice human readable string using b, kb, Mb and Gb. */
Note:
See TracChangeset
for help on using the changeset viewer.