Ignore:
Timestamp:
2004-10-08T09:46:12+13:00 (20 years ago)
Author:
mdewsnip
Message:

Replaced all Gatherer.print* with DebugStream.print*.

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  
    4040import java.util.*;
    4141import java.util.jar.*;
     42import org.greenstone.gatherer.DebugStream;
    4243import org.greenstone.gatherer.Gatherer;
    4344import org.greenstone.gatherer.file.FileNode;
     
    6667        name = name.substring(0, name.length() - 6);
    6768        load_these.add("org.greenstone.gatherer.msm.parsers." + name);
    68         Gatherer.println("Loaded metadata parser: " + name);
     69        DebugStream.println("Loaded metadata parser: " + name);
    6970        }
    7071        name = null;
     
    8586            if(!load_these.contains(name)) {
    8687                load_these.add(name);
    87                 Gatherer.println("Loaded metadata parser: " + name);
     88                DebugStream.println("Loaded metadata parser: " + name);
    8889            }
    8990            }                       
  • trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java

    r8231 r8236  
    4141import java.util.*;
    4242import org.greenstone.gatherer.Configuration;
     43import org.greenstone.gatherer.DebugStream;
    4344import org.greenstone.gatherer.Dictionary;
    4445import org.greenstone.gatherer.Gatherer;
     
    208209    }
    209210    catch (UnsupportedEncodingException error) {
    210         Gatherer.printStackTrace(error);
     211        DebugStream.printStackTrace(error);
    211212    }
    212213
     
    269270            }
    270271            catch (Exception error) {
    271             Gatherer.printStackTrace(error);
     272            DebugStream.printStackTrace(error);
    272273            }
    273274        }
  • trunk/gli/src/org/greenstone/gatherer/msm/LegacyCollectionImporter.java

    r7338 r8236  
    3131import java.util.*;
    3232import org.w3c.dom.*;
     33import org.greenstone.gatherer.DebugStream;
    3334import org.greenstone.gatherer.Gatherer;
    3435import org.greenstone.gatherer.cdm.Argument;
     
    132133        }
    133134        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());
    135136        }
    136137    }
  • trunk/gli/src/org/greenstone/gatherer/msm/MSMProfiler.java

    r6094 r8236  
    3939import java.io.*;
    4040import java.util.*;
     41import org.greenstone.gatherer.DebugStream;
    4142import org.greenstone.gatherer.Gatherer;
    4243import org.greenstone.gatherer.msm.MSMAdapter;
     
    112113     */
    113114    public void elementChanged(MSMEvent event) {
    114     Gatherer.println("Element changed: " + event);
     115    DebugStream.println("Element changed: " + event);
    115116    String new_name = null;
    116117    String old_name = event.getValue();
     
    207208        backup.deleteOnExit();
    208209        if(!profile_file.renameTo(backup)) {
    209             Gatherer.println("Error in MSMProfiler.save(): FileRenamedException");
     210            DebugStream.println("Error in MSMProfiler.save(): FileRenamedException");
    210211        }
    211212        backup = null;
     
    215216        Document document = Utility.parse(Utility.PROFILE_TEMPLATE, true);
    216217        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!");
    218219        return;
    219220        }
     
    249250    }
    250251    catch (Exception error) {
    251         Gatherer.printStackTrace(error);
     252        DebugStream.printStackTrace(error);
    252253    }
    253254    }
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataSet.java

    r8231 r8236  
    4242import org.apache.xerces.dom.*;
    4343import org.greenstone.gatherer.Configuration;
     44import org.greenstone.gatherer.DebugStream;
    4445import org.greenstone.gatherer.Dictionary;
    4546import org.greenstone.gatherer.Gatherer;
     
    345346
    346347    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"));
    348349    NodeList elements = parent_element.getElementsByTagName("Element");
    349350    for(int i = 0; i < elements.getLength(); i++) {
     
    609610            }
    610611            else {
    611             Gatherer.println("Error! Missing mdv file: " + value_file.getAbsolutePath());
     612            DebugStream.println("Error! Missing mdv file: " + value_file.getAbsolutePath());
    612613            }
    613614        }
     
    615616    }
    616617    else {
    617         Gatherer.println("Error! Missing mds file: " + file.getAbsolutePath());
     618        DebugStream.println("Error! Missing mds file: " + file.getAbsolutePath());
    618619    }
    619620    }
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataSetManager.java

    r8231 r8236  
    4343import javax.swing.tree.TreePath;
    4444import org.greenstone.gatherer.Configuration;
     45import org.greenstone.gatherer.DebugStream;
    4546import org.greenstone.gatherer.Dictionary;
    4647import org.greenstone.gatherer.Gatherer;
     
    927928    File file = new File(Gatherer.self.getCollectionMetadata());
    928929    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!");
    930931        file.mkdir();
    931932    }
     
    937938        backup.deleteOnExit();
    938939        if(!temp[i].renameTo(backup)) {
    939             Gatherer.println("Error in MetadataSetManager.save(): FileRenamedException");
     940            DebugStream.println("Error in MetadataSetManager.save(): FileRenamedException");
    940941        }
    941942        }
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataXMLFile.java

    r7624 r8236  
    2929import java.io.*;
    3030import java.util.*;
     31import org.greenstone.gatherer.DebugStream;
    3132import org.greenstone.gatherer.Gatherer;
    3233import org.greenstone.gatherer.msm.MetadataXMLFileManager;
     
    184185    }
    185186    catch (Exception error) {
    186         Gatherer.printStackTrace(error);
     187        DebugStream.printStackTrace(error);
    187188    }
    188189    }
     
    190191    /** 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 */
    191192    public void cleanUpMetadataRefs() {
    192     //Gatherer.println("clean up metadata refs!");
     193    //DebugStream.println("clean up metadata refs!");
    193194
    194195    String file_relative_path = "";
     
    208209            // If this raw_value contains a '\' character, but no '\\', '[' or ']' characters, then replace the '\' with a '\\'
    209210            if(raw_value.indexOf(StaticStrings.ESCAPE_STR) != -1) {
    210             Gatherer.println("Detected Legacy Path: " + raw_value);
     211            DebugStream.println("Detected Legacy Path: " + raw_value);
    211212            raw_value = raw_value.replaceAll(StaticStrings.ESCAPE_PATTERN, StaticStrings.PIPE_STR);
    212213            MSMUtils.setValue(metadata_element, raw_value);
     
    231232        metadata_elements = null;
    232233        } // for each metadata type
    233     } catch (Exception error) {
    234         Gatherer.self.printStackTrace(error);
     234    } catch (Exception exception) {
     235        DebugStream.printStackTrace(exception);
    235236    }
    236237    }
     
    279280    // Kath has cleaned up this version a bit
    280281    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);
    283284
    284285    // Determine the file's path relative to the location of the metadata.xml file
     
    335336            // If this raw_value contains a '\' character, but no '\\', '[' or ']' characters, then replace the '\' with a '\\'
    336337            if(raw_value.indexOf(StaticStrings.ESCAPE_STR) != -1) {
    337                 Gatherer.println("Detected Legacy Path: " + raw_value);
     338                DebugStream.println("Detected Legacy Path: " + raw_value);
    338339                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);
    340341                MSMUtils.setValue(metadata_element, raw_value);
    341342            }
     
    454455        directorymetadata_element = null;
    455456    }
    456     catch (Exception error) {
    457         Gatherer.self.printStackTrace(error);
     457    catch (Exception exception) {
     458        DebugStream.printStackTrace(exception);
    458459    }
    459460    ///ystem.err.println("Found " + metadatum.size() + " pieces of metadata.");
     
    480481    }
    481482    catch (Exception error) {
    482         Gatherer.printStackTrace(error);
     483        DebugStream.printStackTrace(error);
    483484    }
    484485    return has_meta;
     
    523524    }
    524525    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);
    527528    }
    528529    }
     
    530531    /** 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. */
    531532    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);
    533534    try {
    534535        boolean found = false;
     
    619620    }
    620621    catch (Exception error) {
    621         Gatherer.printStackTrace(error);
     622        DebugStream.printStackTrace(error);
    622623    }
    623624    }
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataXMLFileManager.java

    r8088 r8236  
    4444import javax.swing.event.*;
    4545import javax.swing.tree.*;
     46import org.greenstone.gatherer.DebugStream;
    4647import org.greenstone.gatherer.Gatherer;
    4748import org.greenstone.gatherer.file.FileNode;
     
    8384    Gatherer.c_man.getCollection().msm.addMSMListener(this);
    8485    // We also have a debug dialog
    85     if(Gatherer.debug != null) {
     86    if (DebugStream.isDebuggingEnabled()) {
    8687        display();
    8788    }
     
    213214        documents_in_cache_combobox.addItem(metadata_file);
    214215        }
    215         //Gatherer.println("[0ms]\tCached " + metadata_file);
     216        //DebugStream.println("[0ms]\tCached " + metadata_file);
    216217    }
    217218    return metadata_xml;
     
    388389    }
    389390    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);
    392393    }
    393394    }
     
    491492    private Metadata checkCache(Metadata metadata)
    492493    {
    493     Gatherer.println("Checking cache for " + metadata + "...");
     494    DebugStream.println("Checking cache for " + metadata + "...");
    494495
    495496    if (metadata == null) {
     
    501502    if (metadata_cache.contains(element_name, metadata.getValue())) {
    502503        // If so, return the cached metadata value
    503         Gatherer.println("In cache!");
     504        DebugStream.println("In cache!");
    504505        return (Metadata) metadata_cache.get(element_name, metadata.getValue());
    505506    }
  • trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java

    r8022 r8236  
    3939import javax.swing.*;
    4040import javax.swing.tree.*;
     41import org.greenstone.gatherer.DebugStream;
    4142import org.greenstone.gatherer.Gatherer;
    4243import org.greenstone.gatherer.cdm.CommandTokenizer;
     
    9394    /** Locate and import any metadata parsed by this metadata parser given the file involved and its previous incarnation. */
    9495    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 + ": ");
    9697    int counter = 0;
    9798    dialog_cancelled = false;
     
    114115        if(possible_cfg_file.exists() && (possible_gimport_directory.exists() || possible_import_directory.exists())) {
    115116        found = true;
    116         Gatherer.println("Found greenstone collection at " + collection_dir.getAbsolutePath());
     117        DebugStream.println("Found greenstone collection at " + collection_dir.getAbsolutePath());
    117118        }
    118119        else {
     
    131132
    132133    // 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.");
    134135    if(collect_cfg != null) {
    135136        ArrayList mdses = collect_cfg.getMetadataSets();
     
    143144
    144145    // 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");
    146147    ArrayList search_files = new ArrayList();
    147148    File file = origin.getFile();
     
    176177    for(int i = 0; i < search_files.size(); i++) {
    177178        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");
    180181        // Retrieve the document
    181182        BasicGDMDocument document = getDocument(a_search.file);
     
    194195    search_files = null;
    195196    // 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);
    197198    if(metadata.size() > 0) {
    198199        addMetadata(origin, destination, metadata, collection_dir, collect_cfg, dummy_run);
     
    493494        directorymetadata_element = null;
    494495        }
    495         catch (Exception error) {
    496         Gatherer.self.printStackTrace(error);
     496        catch (Exception exception) {
     497        DebugStream.printStackTrace(exception);
    497498        }
    498499        return metadatum;
     
    583584            directorymetadata_element = null;
    584585        }
    585         catch (Exception error) {
    586             Gatherer.self.printStackTrace(error);
     586        catch (Exception exception) {
     587            DebugStream.printStackTrace(exception);
    587588        }
    588589        // 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.
     
    703704        }
    704705        catch(Exception error) {
    705             Gatherer.printStackTrace(error);
     706            DebugStream.printStackTrace(error);
    706707            collect_cfg = null;
    707708        }
Note: See TracChangeset for help on using the changeset viewer.