Changeset 13752


Ignore:
Timestamp:
2007-01-23T14:48:57+13:00 (17 years ago)
Author:
mdewsnip
Message:

Removed a whole bunch more dead code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/collection/ScriptOptions.java

    r13748 r13752  
    22
    33import java.io.*;
    4 import java.lang.ref.*;
    5 import java.net.*;
    64import java.util.*;
    7 import org.apache.xerces.parsers.DOMParser;
    85import org.greenstone.gatherer.Configuration;
    96import org.greenstone.gatherer.DebugStream;
     
    1411import org.greenstone.gatherer.util.ArrayTools;
    1512import org.greenstone.gatherer.util.Codec;
    16 import org.greenstone.gatherer.util.StaticStrings;
    1713import org.greenstone.gatherer.util.Utility;
    1814import org.greenstone.gatherer.util.XMLTools;
    1915import org.w3c.dom.*;
    20 import org.xml.sax.InputSource;
     16
    2117
    2218/** Build options uses the argument list found in config.xml and the current settings from the loaded collection configuration to represent the options the user wants to use during import and build. If there are no arguments stored in config.xml, or if the user indicates the argument are out of date, this class tries to parse new ones. */
     
    2622    /** The root element of the values tree. */
    2723    private Element values_element;
    28     /** A cache of previously created arguments. */
    29     private Hashtable arguments_cache = new Hashtable();
    30     /** whether the values should be saved or not */
    3124    /** The name of an argument element. */
    3225    static final private String ARGUMENT = "Argument";
     
    5245
    5346    /** Retrieve the indexth argument */
    54     public Argument getArgument(int index) {
     47    public Argument getArgument(int index)
     48    {
    5549    Argument argument = null;
    56     // Try to find the argument in the cache.
    57     SoftReference reference = (SoftReference) arguments_cache.get(new Integer(index));
    58     if(reference != null) {
    59         argument = (Argument) reference.get();
    60     }
    61     // Otherwise generate a new argument.
    62     if(argument == null) {
    63         NodeList option_list = arguments_element.getElementsByTagName(OPTION);
    64         if(0 <= index && index < option_list.getLength()) {
    65         argument = new Argument();
    66         argument.parseXML((Element) option_list.item(index));
    67         }
    68     }
     50
     51    NodeList option_list = arguments_element.getElementsByTagName(OPTION);
     52    if (index >= 0 && index < option_list.getLength()) {
     53        argument = new Argument();
     54        argument.parseXML((Element) option_list.item(index));
     55    }
     56
    6957    return argument;
    7058    }
     
    7967    }
    8068
    81     /** Retrieve all the argument names and values  */
    82     public String[] getArguments() {
    83     String arguments[] = null;
    84     NodeList argument_list = null;
    85     argument_list = values_element.getElementsByTagName(ARGUMENT);
    86     for(int i = 0; i < argument_list.getLength(); i++) {
    87         Element argument = (Element) argument_list.item(i);
    88         ArrayTools.add(arguments, argument.getAttribute(NAME));
    89         String value = XMLTools.getValue(argument);
    90         if(value != null && value.length() > 0) {
    91         ArrayTools.add(arguments, value);
    92         }
    93     }
    94     return arguments;
    95     }
    9669
    9770    /** Retrieve the value of a certain argument. */
Note: See TracChangeset for help on using the changeset viewer.