Changeset 13749


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

Removed the code for getting/setting script options in the config.xml files, as this is no longer used.

File:
1 edited

Legend:

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

    r13026 r13749  
    8282    /** The name of the other arguments element. */
    8383    static final private String OTHER = "Other";
    84     /** The name of an information Element within the Other subtree. */
    85     static final private String OTHER_INFO = "Info";
    8684    /** The name of the general Gatherer configuration template. */
    8785    static public String TEMPLATE_CONFIG_XML = "xml/config.xml";
     
    417415    }
    418416
    419     /** Retrieve the information subtree containing the arguments for the desired external program. If the program has marked superclasses append their arguments as well. */
    420     static public Element getArguments(String filename) {
    421     Element argument_element = null;
    422     try {
    423         // Retrieve the other information subtree.
    424         Element document_element = general_config.getDocumentElement();
    425         Element other_element = (Element) XMLTools.getNodeFromNamed(document_element, OTHER);
    426         NodeList argument_elements = other_element.getElementsByTagName(OTHER_INFO);
    427         for(int i = 0; argument_element == null && i < argument_elements.getLength(); i++) {
    428         Element possible_element = (Element) argument_elements.item(i);
    429         Element possible_name_element = (Element) XMLTools.getNodeFromNamed(possible_element, NAME);
    430         String possible_name = XMLTools.getValue(possible_name_element);
    431         ///ystem.err.println("Does " + possible_name + " equal " + filename);
    432         if(possible_name.equalsIgnoreCase(filename)) {
    433             argument_element = possible_element;
    434         }
    435         possible_name = null;
    436         possible_name_element = null;
    437         possible_element = null;
    438         }
    439         argument_elements = null;
    440         other_element = null;
    441         document_element = null;
    442     }
    443     catch (Exception exception) {
    444         DebugStream.printStackTrace(exception);
    445     }
    446     return argument_element;
    447     }
    448 
    449     /** Gets the language for the other arguments subtree
    450      @return empty string if no language specified */
    451     static public String getArgumentsLanguage() {
    452     Element document_element = general_config.getDocumentElement();
    453     Element other_element = (Element) XMLTools.getNodeFromNamed(document_element, OTHER);
    454     String lang = other_element.getAttribute(LANGUAGE);
    455     if (lang == null) {
    456         lang = "en";
    457     }
    458     return lang;
    459     }
    460 
    461417    /** Retrieve the value of the named property as a Rectangle. */
    462418    static public Rectangle getBounds(String property, boolean general) {
     
    756712    }
    757713
    758     /** Add a subtree of argument information to the other arguments part of the general configuration. This overwrites any such existing subtree. */
    759     static public void setArguments(Element arguments_element) {
    760     try {
    761         Element document_element = general_config.getDocumentElement();
    762         Element other_element = (Element) XMLTools.getNodeFromNamed(document_element, OTHER);
    763         // Retrieve the name of the information
    764         Element arguments_name_element = (Element)XMLTools.getNodeFromNamed(arguments_element, NAME);
    765         String filename = XMLTools.getValue(arguments_element);
    766         // Find any argument information subtree starting with the same name
    767         Element obsolete_arguments_element = getArguments(filename);
    768         // Create a copy of the arguments_element within our tree (import).
    769         Element our_arguments_element = (Element) general_config.importNode(arguments_element, true);
    770         // Now we insert this new node into the tree. If a previous node exists we replace it instead.
    771         if(obsolete_arguments_element == null) {
    772         other_element.appendChild(our_arguments_element);
    773         }
    774         else {
    775         other_element.replaceChild(our_arguments_element, obsolete_arguments_element);
    776         }
    777         our_arguments_element = null;
    778         obsolete_arguments_element = null;
    779         filename = null;
    780         arguments_name_element = null;
    781         other_element = null;
    782         document_element = null;
    783     }
    784     catch (Exception exception) {
    785         DebugStream.println("Error in Configuration.setArguments(): " + exception);
    786         DebugStream.printStackTrace(exception);
    787     }
    788     }
    789 
    790     /** Sets the language for the other arguments subtree */
    791     static public void setArgumentsLanguage(String lang) {
    792     Element document_element = general_config.getDocumentElement();
    793     Element other_element = (Element) XMLTools.getNodeFromNamed(document_element, OTHER);
    794     other_element.setAttribute(LANGUAGE, lang);
    795     }
    796 
    797    
    798714    /** Set the collection configuration. */
    799715    static public void setCollectionConfiguration(Document collection_config_arg) {
Note: See TracChangeset for help on using the changeset viewer.