Changeset 8236 for trunk/gli/src/org/greenstone/gatherer/msm
- Timestamp:
- 2004-10-08T09:46:12+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/msm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/ExistingMetadataLoader.java
r8022 r8236 40 40 import java.util.*; 41 41 import java.util.jar.*; 42 import org.greenstone.gatherer.DebugStream; 42 43 import org.greenstone.gatherer.Gatherer; 43 44 import org.greenstone.gatherer.file.FileNode; … … 66 67 name = name.substring(0, name.length() - 6); 67 68 load_these.add("org.greenstone.gatherer.msm.parsers." + name); 68 Gatherer.println("Loaded metadata parser: " + name);69 DebugStream.println("Loaded metadata parser: " + name); 69 70 } 70 71 name = null; … … 85 86 if(!load_these.contains(name)) { 86 87 load_these.add(name); 87 Gatherer.println("Loaded metadata parser: " + name);88 DebugStream.println("Loaded metadata parser: " + name); 88 89 } 89 90 } -
trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java
r8231 r8236 41 41 import java.util.*; 42 42 import org.greenstone.gatherer.Configuration; 43 import org.greenstone.gatherer.DebugStream; 43 44 import org.greenstone.gatherer.Dictionary; 44 45 import org.greenstone.gatherer.Gatherer; … … 208 209 } 209 210 catch (UnsupportedEncodingException error) { 210 Gatherer.printStackTrace(error);211 DebugStream.printStackTrace(error); 211 212 } 212 213 … … 269 270 } 270 271 catch (Exception error) { 271 Gatherer.printStackTrace(error);272 DebugStream.printStackTrace(error); 272 273 } 273 274 } -
trunk/gli/src/org/greenstone/gatherer/msm/LegacyCollectionImporter.java
r7338 r8236 31 31 import java.util.*; 32 32 import org.w3c.dom.*; 33 import org.greenstone.gatherer.DebugStream; 33 34 import org.greenstone.gatherer.Gatherer; 34 35 import org.greenstone.gatherer.cdm.Argument; … … 132 133 } 133 134 catch (Exception e) { 134 Gatherer.println("Exception: couldn't move the file " + meta_file.getPath() + e.getMessage());135 DebugStream.println("Exception: couldn't move the file " + meta_file.getPath() + e.getMessage()); 135 136 } 136 137 } -
trunk/gli/src/org/greenstone/gatherer/msm/MSMProfiler.java
r6094 r8236 39 39 import java.io.*; 40 40 import java.util.*; 41 import org.greenstone.gatherer.DebugStream; 41 42 import org.greenstone.gatherer.Gatherer; 42 43 import org.greenstone.gatherer.msm.MSMAdapter; … … 112 113 */ 113 114 public void elementChanged(MSMEvent event) { 114 Gatherer.println("Element changed: " + event);115 DebugStream.println("Element changed: " + event); 115 116 String new_name = null; 116 117 String old_name = event.getValue(); … … 207 208 backup.deleteOnExit(); 208 209 if(!profile_file.renameTo(backup)) { 209 Gatherer.println("Error in MSMProfiler.save(): FileRenamedException");210 DebugStream.println("Error in MSMProfiler.save(): FileRenamedException"); 210 211 } 211 212 backup = null; … … 215 216 Document document = Utility.parse(Utility.PROFILE_TEMPLATE, true); 216 217 if(document == null) { 217 Gatherer.println("Error in MSMProfiler.save(): couldn't find and parse the profile template file!");218 DebugStream.println("Error in MSMProfiler.save(): couldn't find and parse the profile template file!"); 218 219 return; 219 220 } … … 249 250 } 250 251 catch (Exception error) { 251 Gatherer.printStackTrace(error);252 DebugStream.printStackTrace(error); 252 253 } 253 254 } -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataSet.java
r8231 r8236 42 42 import org.apache.xerces.dom.*; 43 43 import org.greenstone.gatherer.Configuration; 44 import org.greenstone.gatherer.DebugStream; 44 45 import org.greenstone.gatherer.Dictionary; 45 46 import org.greenstone.gatherer.Gatherer; … … 345 346 346 347 public Element getElement(Element parent_element, String name) { 347 Gatherer.println("Get element named " + name + " from " + parent_element.getAttribute("name"));348 DebugStream.println("Get element named " + name + " from " + parent_element.getAttribute("name")); 348 349 NodeList elements = parent_element.getElementsByTagName("Element"); 349 350 for(int i = 0; i < elements.getLength(); i++) { … … 609 610 } 610 611 else { 611 Gatherer.println("Error! Missing mdv file: " + value_file.getAbsolutePath());612 DebugStream.println("Error! Missing mdv file: " + value_file.getAbsolutePath()); 612 613 } 613 614 } … … 615 616 } 616 617 else { 617 Gatherer.println("Error! Missing mds file: " + file.getAbsolutePath());618 DebugStream.println("Error! Missing mds file: " + file.getAbsolutePath()); 618 619 } 619 620 } -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataSetManager.java
r8231 r8236 43 43 import javax.swing.tree.TreePath; 44 44 import org.greenstone.gatherer.Configuration; 45 import org.greenstone.gatherer.DebugStream; 45 46 import org.greenstone.gatherer.Dictionary; 46 47 import org.greenstone.gatherer.Gatherer; … … 927 928 File file = new File(Gatherer.self.getCollectionMetadata()); 928 929 if (!file.exists()) { 929 Gatherer.println("trying to save a collection and the metadata directory does not exist - creating it!");930 DebugStream.println("trying to save a collection and the metadata directory does not exist - creating it!"); 930 931 file.mkdir(); 931 932 } … … 937 938 backup.deleteOnExit(); 938 939 if(!temp[i].renameTo(backup)) { 939 Gatherer.println("Error in MetadataSetManager.save(): FileRenamedException");940 DebugStream.println("Error in MetadataSetManager.save(): FileRenamedException"); 940 941 } 941 942 } -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataXMLFile.java
r7624 r8236 29 29 import java.io.*; 30 30 import java.util.*; 31 import org.greenstone.gatherer.DebugStream; 31 32 import org.greenstone.gatherer.Gatherer; 32 33 import org.greenstone.gatherer.msm.MetadataXMLFileManager; … … 184 185 } 185 186 catch (Exception error) { 186 Gatherer.printStackTrace(error);187 DebugStream.printStackTrace(error); 187 188 } 188 189 } … … 190 191 /** this is used to 'purge' the metadata - I've taken the purge code out of getMetadata and put it in to here, cos its only called from one place and we dont want to retrieve the metadata, just update it */ 191 192 public void cleanUpMetadataRefs() { 192 // Gatherer.println("clean up metadata refs!");193 //DebugStream.println("clean up metadata refs!"); 193 194 194 195 String file_relative_path = ""; … … 208 209 // If this raw_value contains a '\' character, but no '\\', '[' or ']' characters, then replace the '\' with a '\\' 209 210 if(raw_value.indexOf(StaticStrings.ESCAPE_STR) != -1) { 210 Gatherer.println("Detected Legacy Path: " + raw_value);211 DebugStream.println("Detected Legacy Path: " + raw_value); 211 212 raw_value = raw_value.replaceAll(StaticStrings.ESCAPE_PATTERN, StaticStrings.PIPE_STR); 212 213 MSMUtils.setValue(metadata_element, raw_value); … … 231 232 metadata_elements = null; 232 233 } // for each metadata type 233 } catch (Exception e rror) {234 Gatherer.self.printStackTrace(error);234 } catch (Exception exception) { 235 DebugStream.printStackTrace(exception); 235 236 } 236 237 } … … 279 280 // Kath has cleaned up this version a bit 280 281 public ArrayList getMetadata(String filename, boolean remove, ArrayList metadatum_so_far, File file, boolean append_folder_level) { 281 Gatherer.println("Get metadata for " + filename);282 Gatherer.println("remove = " + remove + ", metadata_so_far = " + (metadatum_so_far != null ? String.valueOf(metadatum_so_far.size()) : "null") + ", file = " + file + ", append_folder_level = " + append_folder_level);282 DebugStream.println("Get metadata for " + filename); 283 DebugStream.println("remove = " + remove + ", metadata_so_far = " + (metadatum_so_far != null ? String.valueOf(metadatum_so_far.size()) : "null") + ", file = " + file + ", append_folder_level = " + append_folder_level); 283 284 284 285 // Determine the file's path relative to the location of the metadata.xml file … … 335 336 // If this raw_value contains a '\' character, but no '\\', '[' or ']' characters, then replace the '\' with a '\\' 336 337 if(raw_value.indexOf(StaticStrings.ESCAPE_STR) != -1) { 337 Gatherer.println("Detected Legacy Path: " + raw_value);338 DebugStream.println("Detected Legacy Path: " + raw_value); 338 339 raw_value = raw_value.replaceAll(StaticStrings.ESCAPE_PATTERN, StaticStrings.PIPE_STR); 339 Gatherer.println("Updated Path To: " + raw_value);340 DebugStream.println("Updated Path To: " + raw_value); 340 341 MSMUtils.setValue(metadata_element, raw_value); 341 342 } … … 454 455 directorymetadata_element = null; 455 456 } 456 catch (Exception e rror) {457 Gatherer.self.printStackTrace(error);457 catch (Exception exception) { 458 DebugStream.printStackTrace(exception); 458 459 } 459 460 ///ystem.err.println("Found " + metadatum.size() + " pieces of metadata."); … … 480 481 } 481 482 catch (Exception error) { 482 Gatherer.printStackTrace(error);483 DebugStream.printStackTrace(error); 483 484 } 484 485 return has_meta; … … 523 524 } 524 525 catch(Exception exception) { 525 Gatherer.println("Exception in MetadataXMLFile.removeExtractedMetadata() - unexpected");526 Gatherer.printStackTrace(exception);526 DebugStream.println("Exception in MetadataXMLFile.removeExtractedMetadata() - unexpected"); 527 DebugStream.printStackTrace(exception); 527 528 } 528 529 } … … 530 531 /** Remove the given metadata from this document.If filename is null, then removes directory level metadata, otherwise just removes it from the specified file. All directory level metadata is available under the FileSet with filename '.*'. There is at least one nasty case to consider, where the first overwriting metadata entry, of several with the same element, is removed. In this case the next entry must become overwrite to ensure proper inheritance. */ 531 532 public void removeMetadata(String filename, Metadata metadata) { 532 Gatherer.println("Remove metadata: " + metadata + "\nFrom filename: " + filename);533 DebugStream.println("Remove metadata: " + metadata + "\nFrom filename: " + filename); 533 534 try { 534 535 boolean found = false; … … 619 620 } 620 621 catch (Exception error) { 621 Gatherer.printStackTrace(error);622 DebugStream.printStackTrace(error); 622 623 } 623 624 } -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataXMLFileManager.java
r8088 r8236 44 44 import javax.swing.event.*; 45 45 import javax.swing.tree.*; 46 import org.greenstone.gatherer.DebugStream; 46 47 import org.greenstone.gatherer.Gatherer; 47 48 import org.greenstone.gatherer.file.FileNode; … … 83 84 Gatherer.c_man.getCollection().msm.addMSMListener(this); 84 85 // We also have a debug dialog 85 if (Gatherer.debug != null) {86 if (DebugStream.isDebuggingEnabled()) { 86 87 display(); 87 88 } … … 213 214 documents_in_cache_combobox.addItem(metadata_file); 214 215 } 215 // Gatherer.println("[0ms]\tCached " + metadata_file);216 //DebugStream.println("[0ms]\tCached " + metadata_file); 216 217 } 217 218 return metadata_xml; … … 388 389 } 389 390 catch (Exception exception) { 390 Gatherer.println("Exception in MetadataXMLFileManager.removeExtractedMetadata - unexpected");391 Gatherer.printStackTrace(exception);391 DebugStream.println("Exception in MetadataXMLFileManager.removeExtractedMetadata - unexpected"); 392 DebugStream.printStackTrace(exception); 392 393 } 393 394 } … … 491 492 private Metadata checkCache(Metadata metadata) 492 493 { 493 Gatherer.println("Checking cache for " + metadata + "...");494 DebugStream.println("Checking cache for " + metadata + "..."); 494 495 495 496 if (metadata == null) { … … 501 502 if (metadata_cache.contains(element_name, metadata.getValue())) { 502 503 // If so, return the cached metadata value 503 Gatherer.println("In cache!");504 DebugStream.println("In cache!"); 504 505 return (Metadata) metadata_cache.get(element_name, metadata.getValue()); 505 506 } -
trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java
r8022 r8236 39 39 import javax.swing.*; 40 40 import javax.swing.tree.*; 41 import org.greenstone.gatherer.DebugStream; 41 42 import org.greenstone.gatherer.Gatherer; 42 43 import org.greenstone.gatherer.cdm.CommandTokenizer; … … 93 94 /** Locate and import any metadata parsed by this metadata parser given the file involved and its previous incarnation. */ 94 95 public boolean process(FileNode destination, FileNode origin, boolean folder_level, boolean dummy_run) { 95 Gatherer.println("GreenstoneMetadataParser: Process " + origin + ": ");96 DebugStream.println("GreenstoneMetadataParser: Process " + origin + ": "); 96 97 int counter = 0; 97 98 dialog_cancelled = false; … … 114 115 if(possible_cfg_file.exists() && (possible_gimport_directory.exists() || possible_import_directory.exists())) { 115 116 found = true; 116 Gatherer.println("Found greenstone collection at " + collection_dir.getAbsolutePath());117 DebugStream.println("Found greenstone collection at " + collection_dir.getAbsolutePath()); 117 118 } 118 119 else { … … 131 132 132 133 // 2. If a collection configuration file was found, attempt to merge in any mdses and make note of those that are successfully imported (by removing reference from collect.cfg). 133 Gatherer.println("Merging in any metadata sets found.");134 DebugStream.println("Merging in any metadata sets found."); 134 135 if(collect_cfg != null) { 135 136 ArrayList mdses = collect_cfg.getMetadataSets(); … … 143 144 144 145 // 3. Locate all of the metadata.xml files that may have an affect on the origin file. Make sure the metadata.xml closest to the origin files directory is last (to ensure property inheritance regarding accumulate/overwrite). 145 Gatherer.println("Searching for metadata.xml files");146 DebugStream.println("Searching for metadata.xml files"); 146 147 ArrayList search_files = new ArrayList(); 147 148 File file = origin.getFile(); … … 176 177 for(int i = 0; i < search_files.size(); i++) { 177 178 MetadataXMLFileSearch a_search = (MetadataXMLFileSearch) search_files.get(i); 178 Gatherer.println("Search " + a_search.file.getAbsolutePath() + " for " + (a_search.filename != null ? a_search.filename : ".*"));179 Gatherer.println("Search at the " + (folder_level ? "Folder" : "Filename") + " level");179 DebugStream.println("Search " + a_search.file.getAbsolutePath() + " for " + (a_search.filename != null ? a_search.filename : ".*")); 180 DebugStream.println("Search at the " + (folder_level ? "Folder" : "Filename") + " level"); 180 181 // Retrieve the document 181 182 BasicGDMDocument document = getDocument(a_search.file); … … 194 195 search_files = null; 195 196 // Finally assign the metadata 196 Gatherer.println("Found " + metadata.size() + " pieces of metadata for " + destination);197 DebugStream.println("Found " + metadata.size() + " pieces of metadata for " + destination); 197 198 if(metadata.size() > 0) { 198 199 addMetadata(origin, destination, metadata, collection_dir, collect_cfg, dummy_run); … … 493 494 directorymetadata_element = null; 494 495 } 495 catch (Exception e rror) {496 Gatherer.self.printStackTrace(error);496 catch (Exception exception) { 497 DebugStream.printStackTrace(exception); 497 498 } 498 499 return metadatum; … … 583 584 directorymetadata_element = null; 584 585 } 585 catch (Exception e rror) {586 Gatherer.self.printStackTrace(error);586 catch (Exception exception) { 587 DebugStream.printStackTrace(exception); 587 588 } 588 589 // Cache the result, given that these external metadata.xmls are taken to be static at the time of reading (if you happen to be sourcing information from a opened collection that someone is working on, too bad. … … 703 704 } 704 705 catch(Exception error) { 705 Gatherer.printStackTrace(error);706 DebugStream.printStackTrace(error); 706 707 collect_cfg = null; 707 708 }
Note:
See TracChangeset
for help on using the changeset viewer.