Index: trunk/gli/src/org/greenstone/gatherer/Configuration.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/Configuration.java	(revision 8229)
+++ trunk/gli/src/org/greenstone/gatherer/Configuration.java	(revision 8230)
@@ -95,38 +95,40 @@
     static final private String TOKENIZER_PATTERN3 = ",\n\t";
 
-    public File exec_file;
+    static public Configuration self = null;
+
+    static public File exec_file;
     /** The path (or url) to the webserver which is serving the Greenstone collection. */
-    public String exec_path = null;
+    static public String exec_path = null;
     /** The path to the Greenstone Suite installation directory. */
-    public String gsdl_path = "";
+    static public String gsdl_path = "";
     /** If we are using GLI in Greenstone 3, the path to gsdl3 directory */
-    public String gsdl3_path = "";
+    static public String gsdl3_path = "";
     /** The path to the PERL executable, up to and including Perl.exe. */
-    public String perl_path = "";
+    static public String perl_path = "";
     /** The password for the proxy server indicated above. */
-    public String proxy_pass = null;
+    static public String proxy_pass = null;
     /** The username for the proxy server indicated above. */
-    public String proxy_user = null;
+    static public String proxy_user = null;
     /** The screen size of the desktop the Gatherer will be displayed on. */
-    public Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
+    static public Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
     /** The site name if we are using GS3 */
-    public String site_name = "";
+    static public String site_name = "";
     /** The servlet path if we are using GS3 */
-    private String servlet_path = "";
+    static private String servlet_path = "";
     /** If true, overrides the mirroring enabled setting in the config.xml file. */
-    private boolean mirroring_enabled = false;
+    static private boolean mirroring_enabled = false;
     /** Collection level configuration (which in some cases overrides general configuration. */
-    private Document collection_config;
+    static private Document collection_config;
     /** The general configuration settings. */
-    private Document general_config;
+    static private Document general_config;
     
     /** The element, from glis config file, that contains the various directory mappings. */
-    private Element directory_mappings_element;
-
-    private int cache_hit = 0;
-    private int cache_miss = 0;
-
-    private String wget_path = null;
-    private String wget_version_str = StaticStrings.NO_WGET_STR;
+    static private Element directory_mappings_element;
+
+    static private int cache_hit = 0;
+    static private int cache_miss = 0;
+
+    static private String wget_path = null;
+    static private String wget_version_str = StaticStrings.NO_WGET_STR;
 
     public URL exec_address = null;
@@ -141,4 +143,6 @@
     public Configuration(String gsdl_path, String gsdl3_path, String exec_path, String perl_path, boolean mirroring_enabled, String site_name) {
 	super();
+	self = this;
+
 	this.gsdl_path = gsdl_path;
 	this.gsdl3_path = gsdl3_path;
@@ -293,5 +297,5 @@
 
     /** Add a special directory mapping. */
-    public boolean addDirectoryMapping(String name, File file) {
+    static public boolean addDirectoryMapping(String name, File file) {
 	boolean result = false;
 	try {
@@ -324,5 +328,5 @@
 
     /** The default get action retrieves the named property from the desired configuration, and returns a true or false. */
-    public boolean get(String property, boolean general) {
+    static public boolean get(String property, boolean general) {
 	if(general && mirroring_enabled && property.equals(StaticStrings.WORKFLOW_MIRROR)) {
 	    return mirroring_enabled;
@@ -333,5 +337,5 @@
 
     /** Retrieve all of the configuration preferences which match a certain string. They are returned as a hash map of property names to String objects. */
-    public HashMap getAll(String property_pattern, boolean general) {
+    static public HashMap getAll(String property_pattern, boolean general) {
 	HashMap properties = new HashMap();
 	try {
@@ -353,5 +357,5 @@
 			String result = XMLTools.getValue(argument_element);
 			// Store a mapping in the cache. Sometimes we will overwrite an existing value (say for collection and general level workflow options) but the processing overhead of detecting these clashes far exceeds any savings.
-			put(argument_element.getAttribute(ARGUMENT_NAME) + general, new SoftReference(argument_element));
+			self.put(argument_element.getAttribute(ARGUMENT_NAME) + general, new SoftReference(argument_element));
 			// Add mapping to the properties we're going to return
 			properties.put(argument_element.getAttribute(ARGUMENT_NAME), result);
@@ -366,5 +370,5 @@
 
     /** Retrieve the information subtree containing the arguments for the desired external program. If the program has marked superclasses append their arguments as well. */
-    public Element getArguments(String filename) {
+    static public Element getArguments(String filename) {
 	Element argument_element = null;
 	try {
@@ -396,5 +400,5 @@
     /** Gets the language for the other arguments subtree 
      @return empty string if no language specified */
-    public String getArgumentsLanguage() {
+    static public String getArgumentsLanguage() {
 	Element document_element = general_config.getDocumentElement();
 	Element other_element = (Element) XMLTools.getNodeFromNamed(document_element, OTHER);
@@ -407,5 +411,5 @@
 
     /** Retrieve the value of the named property as a Rectangle. */
-    public Rectangle getBounds(String property, boolean general) {
+    static public Rectangle getBounds(String property, boolean general) {
 	Rectangle result = null;
 	try {
@@ -426,5 +430,5 @@
 
     /** Retrieve the value of the named property as a Color. */
-    public Color getColor(String property, boolean general) {
+    static public Color getColor(String property, boolean general) {
 	Color result = Color.white; // Default
 	try {
@@ -438,30 +442,14 @@
 	}
 	catch(Exception error) {
-	    Gatherer.printStackTrace(error);
+	    error.printStackTrace();
 	}
 	return result;
     }
 
-    /** Retrieve the value of the named property as a Dimension. */
-    /* private Dimension getDimension(String property, boolean general) {
-	Dimension result = new Dimension(100, 100); // Default
-	try {
-	    String raw = getString(property, general);
-	    // Dimension is a width by height pair, comma separated (also remove whitespace)
-	    StringTokenizer tokenizer = new StringTokenizer(raw, TOKENIZER_PATTERN1);
-	    int width = Integer.parseInt(tokenizer.nextToken());
-	    int height = Integer.parseInt(tokenizer.nextToken());
-	    result = new Dimension(width, height);
-	}
-	catch(Exception error) {
-	    Gatherer.printStackTrace(error);
-	}
-	return result;
-	} */
 
     /** Retrieve the special directory mappings associated with this collection.
      * @return A <strong>HashMap</strong> containing mappings from names to directories.
      */
-    public HashMap getDirectoryMappings() {
+    static public HashMap getDirectoryMappings() {
 	HashMap special_directories = new HashMap();
 	try {
@@ -489,10 +477,10 @@
      * @return the email address, if it is set, as a String
      */
-    public String getEmail() {
+    static public String getEmail() {
 	String email = getString(GENERAL_EMAIL_SETTING, true);
 	return (email.length() > 0 ? email : null);
     }
 
-    public Element getFileAssociations() {
+    static public Element getFileAssociations() {
 	NodeList file_association_elements = general_config.getDocumentElement().getElementsByTagName(StaticStrings.ASSOCIATIONS_ELEMENT);
 	return (Element) file_association_elements.item(0);
@@ -500,5 +488,5 @@
 
     /** Retrieve the value of the named property as a FontUIResource. */
-    public FontUIResource getFont(String property, boolean general) {
+    static public FontUIResource getFont(String property, boolean general) {
 	FontUIResource result = new FontUIResource("Times New Roman", Font.PLAIN, 10);
 	try {
@@ -528,5 +516,5 @@
 
     /** Retrieve the value of the named property as an integer. */
-    public int getInt(String property, boolean general) {
+    static public int getInt(String property, boolean general) {
 	int result = 0;
 	try {
@@ -541,5 +529,5 @@
 
     /** Retrieves the current interface language two letter code. */
-    public String getLanguage() {
+    static public String getLanguage() {
 	Locale locale = getLocale("general.locale", GENERAL_SETTING);
 	String code = "en"; // Default
@@ -551,5 +539,5 @@
 
     /** Retrieve the value of the named property as a Locale. */
-    public Locale getLocale(String property, boolean general) {
+    static public Locale getLocale(String property, boolean general) {
 	Locale result = Locale.getDefault();
 	try {
@@ -575,5 +563,5 @@
      * @return an int representing the mode
      */
-    public int getMode() {
+    static public int getMode() {
 	return getInt("general.mode", GENERAL_SETTING);
     }
@@ -582,5 +570,5 @@
      * @return the mode as a String
      */
-    public String getModeAsString() {
+    static public String getModeAsString() {
 	String result;
 	switch(getInt("general.mode", GENERAL_SETTING)) {
@@ -600,9 +588,9 @@
     }
 
-    public String getPreviewCommand() {
+    static public String getPreviewCommand() {
 	return getString("general.preview_program", GENERAL_SETTING);
     }
 
-    public String getServletPath() {
+    static public String getServletPath() {
 	if (servlet_path == null) {
 	    servlet_path = Gatherer.servlet_config.getServletPath(site_name);
@@ -611,10 +599,10 @@
     }
     /** Retrieve the value of the named property, and noting whether we consult the general or collection specific configuration. */
-    public String getString(String property, boolean general) {
+    static public String getString(String property, boolean general) {
 	// Its up to this method to find the appropriate node and retrieve the data itself.
 	String result = "";
 	try {
 	    // First of all we look in the cache to see if we have a match.
-	    SoftReference reference = (SoftReference) get(property + general);
+	    SoftReference reference = (SoftReference) self.get(property + general);
 	    if(reference != null) {
 		Element argument_element = (Element) reference.get();
@@ -644,5 +632,5 @@
 			    result = XMLTools.getValue(argument_element);
 			    // Store a mapping in the cache. Sometimes we will overwrite an existing value (say for collection and general level workflow options) but the processing overhead of detecting these clashes far exceeds any savings.
-			    put(property + general, new SoftReference(argument_element));
+			    self.put(property + general, new SoftReference(argument_element));
 			}
 		    }
@@ -651,5 +639,5 @@
 	}
 	catch (Exception error) {
-	    Gatherer.printStackTrace(error);
+	    error.printStackTrace();
 	}
 	// If we still have no result, and the search was made in the collection configuration, retrieve the general one instead.
@@ -663,18 +651,18 @@
      * @return A <strong>String</strong> containing the path.
      */
-    public String getScriptPath() {
+    static public String getScriptPath() {
 	return gsdl_path + "bin" + File.separator + "script" + File.separator;
     }
 
-    public String getGS3ScriptPath() {
+    static public String getGS3ScriptPath() {
 	return gsdl3_path + "bin" + File.separator + "script" + File.separator;
     }
 
 
-    public String getWGetPath() {
+    static public String getWGetPath() {
 	return (wget_path != null ? wget_path : "");
     }
 
-    public String getWGetVersion() {
+    static public String getWGetVersion() {
 	return (wget_version_str != null ? wget_version_str : StaticStrings.NO_WGET_STR);
     }
@@ -684,5 +672,5 @@
      * @return The <strong>File</strong> of the mapping removed.
      */
-    public File removeDirectoryMapping(String name) {
+    static public File removeDirectoryMapping(String name) {
 	File file = null;
 	try {
@@ -708,5 +696,5 @@
 
     /** Export the general configuration to file. */
-    public void save() {
+    static public void save() {
 	///ystem.err.println("Hits " + cache_hit + " vs Misses " + cache_miss);
 	// We first try exporting to a user specific place
@@ -734,5 +722,5 @@
 
     /** Set the named property, from the specified configuration, using the given boolean value. */
-    public void set(String property, boolean general, boolean value) {
+    static public void set(String property, boolean general, boolean value) {
 	if(property.startsWith("workflow")) {
 	    Gatherer.println("Set property: " + property + ", general=" + general + ", value=" + value);
@@ -742,5 +730,5 @@
 
     /** Add a subtree of argument information to the other arguments part of the general configuration. This overwrites any such existing subtree. */
-    public void setArguments(Element arguments_element) {
+    static public void setArguments(Element arguments_element) {
 	try {
 	    Element document_element = general_config.getDocumentElement();
@@ -774,5 +762,5 @@
 
     /** Sets the language for the other arguments subtree */
-    public void setArgumentsLanguage(String lang) {
+    static public void setArgumentsLanguage(String lang) {
 	Element document_element = general_config.getDocumentElement();
 	Element other_element = (Element) XMLTools.getNodeFromNamed(document_element, OTHER);
@@ -782,8 +770,8 @@
 	
     /** Set the collection configuration. */
-    public void setCollectionConfiguration(Document collection_config) {
+    static public void setCollectionConfiguration(Document collection_config) {
 	// clear the cached values
-	clear();
-	this.collection_config = collection_config;
+	self.clear();
+	collection_config = collection_config;
 	updateUI();
 	///atherer.println("Collection configuration set.");
@@ -791,5 +779,5 @@
 
     /** Set the named property, from the specified configuration, using the given Rectangle value. */
-    public void setBounds(String property, boolean general, Rectangle value) {
+    static public void setBounds(String property, boolean general, Rectangle value) {
 	StringBuffer text = new StringBuffer("");
 	text.append(value.x);
@@ -804,5 +792,5 @@
 
     /** Set the named property, from the specified configuration, using the given Color value. */
-    public void setColor(String property, boolean general, Color value) {
+    static public void setColor(String property, boolean general, Color value) {
 	StringBuffer text = new StringBuffer("");
 	text.append(value.getRed());
@@ -814,22 +802,13 @@
     }
 
-    /** Set the named property, from the specified configuration, using the given Dimension value. */
-    /* private void setDimension(String property, boolean general, Dimension value) {
-	StringBuffer text = new StringBuffer("");
-	text.append(value.width);
-	text.append(", ");
-	text.append(value.height);
-	setString(property, general, text.toString());
-	} */
-
     /** Establish the current users email.
      * @param email the email as a String
      */
-    public void setEmail(String email) {
+    static public void setEmail(String email) {
 	setString(GENERAL_EMAIL_SETTING, true, email);
     }
 
     /** Set the named property, from the specified configuration, using the given Font value. */
-    public void setFont(String property, boolean general, Font value) {
+    static public void setFont(String property, boolean general, Font value) {
 	StringBuffer text = new StringBuffer("");
 	text.append(value.getName());
@@ -851,10 +830,10 @@
 
     /** Set the named property, from the specified configuration, using the given integer value. */
-    public void setInt(String property, boolean general, int value) {
+    static public void setInt(String property, boolean general, int value) {
         setString(property, general, String.valueOf(value));
     } 
 
     /** Set the named property, from the specified configuration, using the given Locale value. */
-    public void setLocale(String property, boolean general, Locale value) {
+    static public void setLocale(String property, boolean general, Locale value) {
 	StringBuffer text = new StringBuffer("");
 	text.append(value.getLanguage());
@@ -871,15 +850,15 @@
      * @param value the new value for mode
      */
-    public void setMode(int value) {
+    static public void setMode(int value) {
 	setInt("general.mode", GENERAL_SETTING, value);
     }
 
-    public void setPreviewCommand(String value) {
+    static public void setPreviewCommand(String value) {
 	setString("general.preview_program", GENERAL_SETTING, value);
     }
 
-    public void setSiteAndServlet(String site, String servlet) {
-	this.site_name = site;
-	this.servlet_path = servlet;
+    static public void setSiteAndServlet(String site, String servlet) {
+	site_name = site;
+	servlet_path = servlet;
 	setString("general.site_name", GENERAL_SETTING, site);
 	setString("general.servlet_path", GENERAL_SETTING, servlet);
@@ -887,5 +866,5 @@
     }
     /** Sets the value of the named property argument using the given string. */
-    public void setString(String property, boolean general, String value) {
+    static public void setString(String property, boolean general, String value) {
 	Gatherer.println("Set configuration property: " + property + " = " + value + (general ? "" : " [Collection]"));
 	try {
@@ -897,5 +876,5 @@
 		Element argument_element = null;
 		// Try to retrieve from cache
-		SoftReference reference = (SoftReference) get(property + general);
+		SoftReference reference = (SoftReference) self.get(property + general);
 		if(reference != null) {
 		    argument_element = (Element) reference.get();
@@ -919,5 +898,5 @@
 		    }
 		    // Update cache
-		    put(property + general, new SoftReference(argument_element));
+		    self.put(property + general, new SoftReference(argument_element));
 
 		}
@@ -938,13 +917,13 @@
     }
 
-    public void setWGetPath(String path) {
+    static public void setWGetPath(String path) {
 	wget_path  = path;
     }
 
-    public void setWGetVersion(String version) {
+    static public void setWGetVersion(String version) {
 	wget_version_str = version;
     }
 
-    private void updateUI() {
+    static private void updateUI() {
 	// Buttons
 	UIManager.put("Button.select", new ColorUIResource(getColor("coloring.button_selected_background", false)));
