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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java

    r8231 r8236  
    3333import javax.swing.*;
    3434import org.greenstone.gatherer.Configuration;
     35import org.greenstone.gatherer.DebugStream;
    3536import org.greenstone.gatherer.Gatherer;
    3637import org.greenstone.gatherer.cdm.CommandTokenizer;
     
    463464        }
    464465        if(!original_file.renameTo(backup_file)) {
    465         Gatherer.println("Can't rename collect.cfg");
     466        DebugStream.println("Can't rename collect.cfg");
    466467        }
    467468    }
     
    514515        }
    515516        catch (Exception exception) {
    516         Gatherer.println("Error in CollectionConfiguration.save(boolean): " + exception);
    517         Gatherer.printStackTrace(exception);
     517        DebugStream.println("Error in CollectionConfiguration.save(boolean): " + exception);
     518        DebugStream.printStackTrace(exception);
    518519        }
    519520    }
     
    903904            // Why can't you switch on strings eh? We pass it to the various subparsers who each have a bash at parsing the command. If none can parse the command, an unknown element is created
    904905            if(command_element == null && command_type.equals(BUILDTYPE_STR)) {
    905             Gatherer.println("G2.39 Buildtype command detected. Ignoring.");
     906            DebugStream.println("G2.39 Buildtype command detected. Ignoring.");
    906907            command_element = document.createElement(UNKNOWN_ELEMENT);
    907908            append_element = false;
     
    916917            // If this was a G2.39 config file then we manipulate the command string a bit before we submit it to the parser. We start by adding allfields as the first index. We then space separate the remaining indexes, and remove duplicates when encountered. Of course before we do any of that we record the various space separated indexes so that we can remove the collection meta assigned to them.
    917918            if(is_twopointthreenine) {
    918                 Gatherer.println("G2.39 Index command detected. Modifying.");
    919                 Gatherer.println("Before: " + command_str);
     919                DebugStream.println("G2.39 Index command detected. Modifying.");
     920                DebugStream.println("Before: " + command_str);
    920921                StringBuffer new_command_str = new StringBuffer(command_type);
    921922                new_command_str.append(SPACE_CHARACTER);
     
    958959                command_str = new_command_str.toString();
    959960                new_command_str = null;
    960                 Gatherer.println("After: " + command_str);
     961                DebugStream.println("After: " + command_str);
    961962            }
    962963            command_element = parseIndex(command_str);
     
    967968            // If this was a G2.39 config file then we squelch the default index (no such thing in G2.4)
    968969            if(is_twopointthreenine) {
    969                 Gatherer.println("G2.39 Default Index command detected. Ignoring.");
     970                DebugStream.println("G2.39 Default Index command detected. Ignoring.");
    970971                append_element = false;
    971972            }
     
    980981            // Again if this is G2.39 we have to do a tiny bit of magic to the levels command. We need to add document level, and change the remainder to lower case.
    981982            if(is_twopointthreenine) {
    982                 Gatherer.println("G2.39 Levels command detected. Modifying.");
    983                 Gatherer.println("Before: " + command_str);
     983                DebugStream.println("G2.39 Levels command detected. Modifying.");
     984                DebugStream.println("Before: " + command_str);
    984985                StringBuffer new_command_str = new StringBuffer(command_type);
    985986                new_command_str.append(SPACE_CHARACTER);
     
    10001001                command_str = new_command_str.toString();
    10011002                new_command_str = null;
    1002                 Gatherer.println("After: " + command_str);
     1003                DebugStream.println("After: " + command_str);
    10031004            }
    10041005            command_element = parseLevels(command_str);
     
    10661067        Element document_element = document.getDocumentElement();
    10671068        NodeList collectionmeta_elements = document_element.getElementsByTagName(COLLECTIONMETADATA_ELEMENT);
    1068         Gatherer.println("There are " + obsolete_collectionmeta_names.size() + " collectionmeta to remove.");
    1069         Gatherer.println("There are " + changed_collectionmeta_names.size() + " collectionmeta to change.");
     1069        DebugStream.println("There are " + obsolete_collectionmeta_names.size() + " collectionmeta to remove.");
     1070        DebugStream.println("There are " + changed_collectionmeta_names.size() + " collectionmeta to change.");
    10701071        for(int z = collectionmeta_elements.getLength(); z > 0; z--) {
    10711072            Element collectionmeta_element = (Element) collectionmeta_elements.item(z - 1);
    10721073            String name = collectionmeta_element.getAttribute(NAME_ATTRIBUTE);
    1073             Gatherer.println("Checking " + name);
     1074            DebugStream.println("Checking " + name);
    10741075            // Remove any obsolete metadata
    10751076            if(obsolete_collectionmeta_names.contains(name)) {
    1076             Gatherer.println("G2.39 CollectMeta detected. Removing: " + name);
     1077            DebugStream.println("G2.39 CollectMeta detected. Removing: " + name);
    10771078            document_element.removeChild(collectionmeta_element);
    10781079            }
     
    10801081            else if(changed_collectionmeta_names.containsKey(name)) {
    10811082            String new_name = (String) changed_collectionmeta_names.get(name);
    1082             Gatherer.println("G2.39 CollectMeta detected. Changing: " + name + " -> " + new_name);
     1083            DebugStream.println("G2.39 CollectMeta detected. Changing: " + name + " -> " + new_name);
    10831084            collectionmeta_element.setAttribute(NAME_ATTRIBUTE, new_name);
    10841085            new_name = null;
     
    10881089
    10891090        // Finally add any newly acquired collectionmeta. This general defaults to the collectionmeta name less the full stop
    1090         Gatherer.println("There are " + acquired_collectionmeta_names.size() + " collectionmeta to add.");
     1091        DebugStream.println("There are " + acquired_collectionmeta_names.size() + " collectionmeta to add.");
    10911092        for(int y = 0; y < acquired_collectionmeta_names.size(); y++) {
    10921093            String name = (String) acquired_collectionmeta_names.get(y);
    10931094            String value = name.substring(1);
    1094             Gatherer.println("G2.39 CollectMeta missing. Adding: " + name + " [l=" + Configuration.getLanguage() + "] \"" + value + "\"");
     1095            DebugStream.println("G2.39 CollectMeta missing. Adding: " + name + " [l=" + Configuration.getLanguage() + "] \"" + value + "\"");
    10951096            Element element = document.createElement(COLLECTIONMETADATA_ELEMENT);
    10961097            element.setAttribute(NAME_ATTRIBUTE, name);
     
    11081109    }
    11091110    catch(Exception exception) {
    1110         Gatherer.println("Error in CollectionConfiguration.parse(java.io.File): " + exception);
    1111         Gatherer.printStackTrace(exception);
     1111        DebugStream.println("Error in CollectionConfiguration.parse(java.io.File): " + exception);
     1112        DebugStream.printStackTrace(exception);
    11121113    }
    11131114    }
     
    12011202    }
    12021203    catch (Exception exception) {
    1203         Gatherer.printStackTrace(exception);
     1204        DebugStream.printStackTrace(exception);
    12041205        command_element = null;
    12051206    }
     
    13941395    }
    13951396    catch (Exception exception) {
    1396         Gatherer.printStackTrace(exception);
     1397        DebugStream.printStackTrace(exception);
    13971398        command_element = null;
    13981399    }
Note: See TracChangeset for help on using the changeset viewer.