Index: /trunk/gli/classes/xml/config.xml
===================================================================
--- /trunk/gli/classes/xml/config.xml	(revision 6629)
+++ /trunk/gli/classes/xml/config.xml	(revision 6630)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE Configuration [
-  <!ELEMENT Configuration  (GathererConfig, Other, DirectoryMappings)>
+  <!ELEMENT Configuration  (GathererConfig, Other, DirectoryMappings, Associations)>
   <!ELEMENT GathererConfig (Argument*)>
   <!ELEMENT Argument       (#PCDATA)>
@@ -22,7 +22,11 @@
             name              CDATA #REQUIRED
 	    file              CDATA #REQUIRED>
+  <!ELEMENT Associations (Entry*)>
+  <!ELEMENT Entry (#PCDATA)>
+  <!ATTLIST Entry
+            extension CDATA #REQUIRED>
 ]>
 
-<Configuration>
+<Configuration version="2.4">
   <GathererConfig>
     <!-- ***** General Options: apply globally to the Gatherers execution. ***** -->
@@ -131,3 +135,17 @@
   <Other/>
   <DirectoryMappings/>
+  <Associations>
+    <Entry extension="doc"/>
+    <Entry extension="gif"/>
+    <Entry extension="htm"/>
+    <Entry extension="html"/>
+    <Entry extension="jpg"/>
+    <Entry extension="jpeg"/>
+    <Entry extension="pdf"/>
+    <Entry extension="png"/>
+    <Entry extension="ps"/>
+    <Entry extension="rtf"/>
+    <Entry extension="txt"/>
+    <Entry extension="text"/>
+  </Associations>
 </Configuration>
Index: /trunk/gli/src/org/greenstone/gatherer/Configuration.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/Configuration.java	(revision 6629)
+++ /trunk/gli/src/org/greenstone/gatherer/Configuration.java	(revision 6630)
@@ -68,4 +68,6 @@
     /** The name of the general Gatherer configuration file. */
     static final private String CONFIG_XML = "config.xml";
+
+    static final private String CURRENT_CONFIGURATION_VERSION = "2.4";
     /** The name of the root element of the subtree containing gatherer configuration options. This is required as the document itself may contain several other subtrees of settings (such as in the case of a '.col' file). */
     static final private String GATHERER_CONFIG = "GathererConfig";
@@ -189,15 +191,33 @@
 
 	// Try to reload the configuration. The first place we look is the user specific location
-	File user_config_xml = new File(Utility.getGLIUserFolder(), CONFIG_XML);	    
-	if(user_config_xml != null && user_config_xml.exists()) {
-	    general_config = Utility.parse(user_config_xml.getAbsolutePath(), false);
+	File config_xml = new File(Utility.getGLIUserFolder(), CONFIG_XML);	    
+	if(config_xml != null && config_xml.exists()) {
+	    general_config = Utility.parse(config_xml.getAbsolutePath(), false);
 	}
 
 	// We then try within the gli directory itself
 	if(general_config == null) {
-	    File config_xml = new File(CONFIG_XML);
+	    config_xml = new File(CONFIG_XML);
 	    if(config_xml.exists()) {
 		general_config = Utility.parse(CONFIG_XML, false);
 	    }
+	}
+
+	// Check the version of the config we have loaded, and if it isn't recent enough, backup the old version, and then create a new config.
+	if(general_config != null) {
+	    Element configuration_element = general_config.getDocumentElement();
+	    String configuration_version = configuration_element.getAttribute(StaticStrings.VERSION_ATTRIBUTE);
+	    if(!configuration_version.equals(CURRENT_CONFIGURATION_VERSION)) {
+		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Configuration.Obsolete_Config"), Dictionary.get("Configuration.Obsolete_Config_Title"), JOptionPane.ERROR_MESSAGE);
+		general_config = null;
+		configuration_element = null;
+		File backup = new File(config_xml.getAbsolutePath() + ".bak");
+		config_xml.renameTo(backup);
+		backup = null;
+	    }
+	    else {
+		configuration_element = null;
+	    }
+	    configuration_version = null;
 	}
 
@@ -422,4 +442,9 @@
 	String email = getString(GENERAL_EMAIL_SETTING, true);
 	return (email.length() > 0 ? email : null);
+    }
+
+    public Element getFileAssociations() {
+	NodeList file_association_elements = general_config.getDocumentElement().getElementsByTagName(StaticStrings.ASSOCIATIONS_ELEMENT);
+	return (Element) file_association_elements.item(0);
     }
 
Index: /trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java	(revision 6629)
+++ /trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java	(revision 6630)
@@ -41,28 +41,18 @@
     extends AbstractTableModel {
     static final public String FILENAME_ARG = "%1";
-    static final private String DATA_FILENAME = "associations.xml";
-    static final private String ENTRY_ELEMENT = "Entry";
     static final private String ESCAPE = "\\\\"; // '\'
     static final private String ESCAPED_ESCAPE = "\\\\\\\\"; // '\\'
-    static final private String EXTENSION_ATTRIBUTE = "extension";
-    private Document document;
+    private Element associations_element;
     private File data_file;   
 
     public FileAssociationManager() {
-	// If a associations.xml is available in the GLI install directory load it.
-	data_file = new File(Utility.BASE_DIR + DATA_FILENAME);
-	if(data_file.exists()) {
-	    document = Utility.parse(data_file, true);
-	}
-	// Load the default associations xml data file. This can be done using the classloader.
-	else {
-	    document = Utility.parse(Utility.XML_DIRECTORY + DATA_FILENAME, true);
-	}
+	// Retrieve the associations_element from the config
+	associations_element = Gatherer.config.getFileAssociations();
 	// Initialize the associations. This involves looking through all current associations searching for those with a command of "".
-	if(document != null) {
-	    NodeList entries = (document.getDocumentElement()).getElementsByTagName(ENTRY_ELEMENT);
+	if(associations_element != null) {
+	    NodeList entries = associations_element.getElementsByTagName(StaticStrings.ENTRY_ELEMENT);
 	    for(int i = 0; i < entries.getLength(); i++) {
 		Element entry = (Element) entries.item(i);
-		String extension = entry.getAttribute(EXTENSION_ATTRIBUTE);
+		String extension = entry.getAttribute(StaticStrings.EXTENSION_ATTRIBUTE);
 		String command = MSMUtils.getValue(entry);
 		// If we encounter a command of ""...
@@ -139,27 +129,5 @@
 	// pretend we are trying to open an html file
 	// Mmmoooo. - jmt12
-	/*
-	String extension = "html";
-	Element entry = getCommand(extension);
-	if (entry != null) {
-	    command = MSMUtils.getValue(entry); 
-	}
-	
-	if(command == null || command.length() == 0) {
-	    FileAssociationDialog dialog = new FileAssociationDialog(this);
-	    command = dialog.display(extension);
-	    dialog = null;
-	}
-	if(command != null) {
-	    // If no previous entry existed create one.
-	    if(entry == null) {
-		entry = document.createElement(ENTRY_ELEMENT);
-		entry.setAttribute(EXTENSION_ATTRIBUTE, extension);
-		document.getDocumentElement().appendChild(entry);
-	    }
-	    // Replace the text in this node. Remember to replace the dummy filename with %1
-	    MSMUtils.setValue(entry, command.replaceAll("temp.html", FILENAME_ARG));
-	}
-	*/
+
 	// if we haven't got a command by now, we'll never get one
 	if (command == null) {
@@ -234,7 +202,7 @@
 		    // If no previous entry existed create one.
 		    if(entry == null) {
-			entry = document.createElement(ENTRY_ELEMENT);
-			entry.setAttribute(EXTENSION_ATTRIBUTE, extension);
-			document.getDocumentElement().appendChild(entry);
+			entry = associations_element.getOwnerDocument().createElement(StaticStrings.ENTRY_ELEMENT);
+			entry.setAttribute(StaticStrings.EXTENSION_ATTRIBUTE, extension);
+			associations_element.appendChild(entry);
 		    }
 		    // Replace the text in this node. Remember to replace the dummy filename with %1 - I dont think the filename will ever be in the comand now
@@ -258,8 +226,8 @@
 
     public Element getCommand(String target_extension) {
-	NodeList entries = document.getDocumentElement().getElementsByTagName(ENTRY_ELEMENT);
+	NodeList entries = associations_element.getElementsByTagName(StaticStrings.ENTRY_ELEMENT);
 	for(int i = 0; i < entries.getLength(); i++) { 
 	    Element entry = (Element) entries.item(i);
-	    String extension = entry.getAttribute(EXTENSION_ATTRIBUTE);
+	    String extension = entry.getAttribute(StaticStrings.EXTENSION_ATTRIBUTE);
 	    if(extension.equalsIgnoreCase(target_extension)) {
 		entries = null;
@@ -283,8 +251,8 @@
 
     public String getExtension(int index) {
-	NodeList entries = document.getDocumentElement().getElementsByTagName(ENTRY_ELEMENT);
+	NodeList entries = associations_element.getElementsByTagName(StaticStrings.ENTRY_ELEMENT);
 	if(0 <= index && index < entries.getLength()) {
 	    Element entry = (Element) entries.item(index);
-	    return entry.getAttribute(EXTENSION_ATTRIBUTE);
+	    return entry.getAttribute(StaticStrings.EXTENSION_ATTRIBUTE);
 	}
 	return "";
@@ -292,6 +260,5 @@
 
     public int getRowCount() {
-	NodeList entries = document.getDocumentElement().getElementsByTagName(ENTRY_ELEMENT);
-	return entries.getLength();
+	return size();
     }
 
@@ -307,5 +274,4 @@
 
     public void save() {
-	Utility.export(document, data_file);
     }
 
@@ -316,7 +282,7 @@
 	// If no previous entry existed create one.
 	if(entry == null && command != null) {
-	    entry = document.createElement(ENTRY_ELEMENT);
-	    entry.setAttribute(EXTENSION_ATTRIBUTE, extension);
-	    document.getDocumentElement().appendChild(entry);
+	    entry = associations_element.getOwnerDocument().createElement(StaticStrings.ENTRY_ELEMENT);
+	    entry.setAttribute(StaticStrings.EXTENSION_ATTRIBUTE, extension);
+	    associations_element.appendChild(entry);
 	}
 
@@ -327,5 +293,5 @@
 	else {
 	    // Remove the entry
-	    document.getDocumentElement().removeChild(entry);
+	    associations_element.removeChild(entry);
 	}
 	entry = null;
@@ -334,5 +300,5 @@
 
     public int size() {
-	NodeList entries = document.getDocumentElement().getElementsByTagName(ENTRY_ELEMENT);
+	NodeList entries = associations_element.getElementsByTagName(StaticStrings.ENTRY_ELEMENT);
 	return entries.getLength();
     }
