Index: /trunk/gli/src/org/greenstone/gatherer/cdm/Classifier.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/Classifier.java	(revision 12630)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/Classifier.java	(revision 12631)
@@ -27,9 +27,4 @@
 package org.greenstone.gatherer.cdm;
 
-/**************************************************************************************
- * Written:      01/05/02
- * Revised:      16/08/02 Optimized and Commented.
- *               11/07/03 DOM support
- **************************************************************************************/
 import java.io.*;
 import java.util.*;
@@ -38,4 +33,5 @@
 import org.w3c.dom.*;
 
+
 /** This class is responsible for storing information from a parsed classinfo.pl call in such a way that it allows easy access to parsed details for the purposes of user design and specification of classifiers.
  * @author John Thompson, Greenstone Digital Library, University of Waikato
@@ -43,8 +39,8 @@
  */
 public class Classifier
-    extends ArgumentContainer {
-    
+    extends ArgumentContainer
+{
+    static final public String CLASSIFIER_PREFIX = "CL";
 
-    static final public String CLASSIFIER_PREFIX = "CL";
 
     /** Constructor used only in DOMProxyListModel initializations.
@@ -52,8 +48,10 @@
     public Classifier() {
     }
+
     
     public Classifier(Element element, Classifier base_classifier) {
 	super(element, base_classifier);
     }
+
 
     /** The assigned classifier constructor.
@@ -63,5 +61,5 @@
 	String classifier_name = element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
 	// Determine the base classifier from the classifier name
-	Classifier base_classifier = CollectionDesignManager.classifier_manager.getBaseClassifier(classifier_name);
+	Classifier base_classifier = CollectionDesignManager.classifier_manager.getClassifier(classifier_name, true);
 	Classifier classifier = new Classifier(element, base_classifier);
 	if (base_classifier == null) {
@@ -73,4 +71,5 @@
 	return classifier;
     }
+
 
     /** Generate the string showing this classifiers position. */
@@ -86,4 +85,3 @@
 	return position_string;
     }
-
 }
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java	(revision 12630)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java	(revision 12631)
@@ -57,8 +57,9 @@
  */
 public class ClassifierManager
-    extends DOMProxyListModel {
-
-    /** A list of known, but currently unassigned, classifiers. */
-    private ArrayList library = null;
+    extends DOMProxyListModel
+{
+    // A list of all the classifiers in the core Greenstone "perllib/classify" folder (arguments may not be loaded)
+    private ArrayList core_greenstone_classifiers_list = null;
+
     /** The controls for editing the contents of this manager. */
     private Control controls = null;
@@ -74,18 +75,201 @@
 	this.model = this;
 	DebugStream.println("ClassifierManager: " + getSize() + " classifiers parsed.");
-	// Reload/Create the library
-	loadClassifiers();
-	saveClassifiers();
-    }
-
-    /** Method to add a new classifier to library.
-     * @param classifier The new <strong>Classifier</strong>.
-     * @see org.greenstone.gatherer.cdm.DynamicListModel
-     */
-    private void addClassifier(Classifier classifier) {
-	if(!library.contains(classifier)) {
-	    library.add(classifier);
-	}
-    }
+
+	core_greenstone_classifiers_list = loadClassifiersList();
+    }
+
+
+    // --------------------------------------------------------------------------------------------------------
+
+
+    /** Retrieve a list of the classifiers that are available to be added to the collection. */
+    private Object[] getAvailableClassifiers()
+    {
+	ArrayList available = new ArrayList();
+
+	// Add all the non-abstract core Greenstone classifiers
+	for (int i = 0; i < core_greenstone_classifiers_list.size(); i++) {
+	    Classifier classifier = (Classifier) core_greenstone_classifiers_list.get(i);
+	    if (!classifier.isAbstract()) {
+		available.add(classifier);
+	    }
+	}
+
+	// Sort the available classifiers into alphabetical order
+	Collections.sort(available);
+
+	return available.toArray();
+    }
+
+
+    public Classifier getClassifier(String classifier_name, boolean arguments_required)
+    {
+	for (int i = 0; i < core_greenstone_classifiers_list.size(); i++) {
+	    Classifier classifier = (Classifier) core_greenstone_classifiers_list.get(i);
+	    if (classifier.getName().equals(classifier_name)) {
+		if (arguments_required) {
+		    if (classifier.getArguments().size() == 0) {
+			loadClassifierInfo(classifier);
+		    }
+		    else {
+			System.err.println("Already loaded arguments for " + classifier_name + "!");
+		    }
+		}
+		return classifier;
+	    }
+	}
+
+	return null;
+    }
+
+
+    private void loadClassifierInfo(Classifier classifier)
+    {
+	System.err.println("Loading arguments for " + classifier.getName() + "...");
+
+	// Run classifierfo.pl to get the list of classifiers
+	try {
+	    StringBuffer xml = null;
+	    if (Gatherer.isGsdlRemote) {
+		// !! TO DO
+	    }
+	    else {
+		ArrayList args = new ArrayList();
+		if (Utility.isWindows()) {
+		    args.add(Configuration.perl_path);
+		    args.add("-S");
+		}
+		args.add(LocalGreenstone.getBinScriptDirectoryPath() + "classinfo.pl");
+		args.add("-xml");
+		args.add("-language");
+		args.add(Configuration.getLanguage());
+		args.add(classifier.getName());
+
+		// Run the classinfo.pl process
+		Runtime runtime = Runtime.getRuntime();
+		Process process = runtime.exec((String[]) args.toArray(new String[] { }));
+		InputStream input_stream = process.getErrorStream();
+		xml = XMLTools.readXMLStream(input_stream);
+	    }
+
+	    if (xml.length() > 0) {
+		parseClassifierInfoXML(classifier, xml.toString());
+	    }
+	    else {
+		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.ClassifierManager.Classifier_XML_Parse_Failed", classifier.getName()), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
+	    }
+	}
+	catch (Exception exception) {
+	    DebugStream.printStackTrace(exception);
+	}
+    }
+
+
+    private ArrayList loadClassifiersList()
+    {
+	System.err.println("In loadClassifiersList()...");
+
+	// Run classifierfo.pl to get the list of classifiers
+	try {
+	    StringBuffer xml = null;
+	    if (Gatherer.isGsdlRemote) {
+		// !! TO DO
+	    }
+	    else {
+		ArrayList args = new ArrayList();
+		if (Utility.isWindows()) {
+		    args.add(Configuration.perl_path);
+		    args.add("-S");
+		}
+		args.add(LocalGreenstone.getBinScriptDirectoryPath() + "classinfo.pl");
+		args.add("-listall");
+		args.add("-xml");
+
+		// Run the classinfo.pl process
+		Runtime runtime = Runtime.getRuntime();
+		Process process = runtime.exec((String[]) args.toArray(new String[] { }));
+		InputStream input_stream = process.getErrorStream();
+		xml = XMLTools.readXMLStream(input_stream);
+	    }
+
+	    if (xml.length() > 0) {
+		return parseClassifiersListXML(xml.toString());
+	    }
+	    else {
+		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.ClassifierManager.Classifier_List_XML_Parse_Failed"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
+	    }
+	}
+	catch (Exception exception) {
+	    DebugStream.printStackTrace(exception);
+	}
+
+	return null;
+    }
+
+
+    private void parseClassifierInfoXML(Classifier classifier, String xml)
+    {
+	Document document = XMLTools.parseXML(new StringReader(xml));
+	parseClassifierInfoXMLNode(classifier, document.getDocumentElement());
+    }
+
+
+    private void parseClassifierInfoXMLNode(Classifier classifier, Node root_node)
+    {
+	for (Node node = root_node.getFirstChild(); node != null; node = node.getNextSibling()) {
+	    String node_name = node.getNodeName();
+
+	    if (node_name.equalsIgnoreCase("Name")) {
+		classifier.setName(XMLTools.getValue(node));
+	    }
+	    else if (node_name.equals("Desc")) {
+		classifier.setDescription(XMLTools.getValue(node));
+	    }
+	    else if (node_name.equals("Abstract")) {
+		classifier.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase(CollectionConfiguration.YES_STR));
+	    }
+	    // Parse the classifier arguments
+	    else if (node_name.equalsIgnoreCase("Arguments")) {
+		for (Node argument_node = node.getFirstChild(); argument_node != null; argument_node = argument_node.getNextSibling()) {
+		    // An option
+		    if (argument_node.getNodeName().equalsIgnoreCase("Option")) {
+			Argument argument = new Argument();
+			argument.parseXML((Element) argument_node);
+			classifier.addArgument(argument);
+		    }
+		}
+	    }
+	    // A super classifier class
+	    else if (node_name.equalsIgnoreCase("ClassInfo")) {
+		Classifier super_classifier = new Classifier();
+		parseClassifierInfoXMLNode(super_classifier, node);
+		classifier.setSuper(super_classifier);
+	    }
+	}
+    }
+
+
+    private ArrayList parseClassifiersListXML(String xml)
+    {
+	ArrayList classifiers_list = new ArrayList();
+
+	Document document = XMLTools.parseXML(new StringReader(xml));
+	Node root = document.getDocumentElement();
+	for (Node node = root.getFirstChild(); node != null; node = node.getNextSibling()) {
+	    String node_name = node.getNodeName();
+
+	    if (node_name.equals("ClassInfo")) {
+		Classifier classifier = new Classifier();
+		parseClassifierInfoXMLNode(classifier, node);
+		classifiers_list.add(classifier);
+	    }
+	}
+
+	return classifiers_list;
+    }
+
+
+    // --------------------------------------------------------------------------------------------------------
+
 
     /** Method to assign a classifier.
@@ -112,29 +296,15 @@
 	return true;
     }
-    /** Destructor.
-     * @see org.greenstone.gatherer.Gatherer
-     * @see org.greenstone.gatherer.cdm.CollectionDesignManager
-     * @see org.greenstone.gatherer.cdm.DynamicListModel
-     */
-    public void destroy() {
-	if(controls != null) {
+
+
+    /** Destructor. */
+    public void destroy()
+    {
+	if (controls != null) {
 	    controls.destroy();
 	    controls = null;
 	}
-	library.clear();
-	library = null;
-    }
-
-    public Classifier getBaseClassifier(String name) {
-	int library_size = library.size();
-	for(int i = 0; i < library_size; i++) {
-	    Classifier classifier = (Classifier) library.get(i);
-	    if(classifier.getName().equals(name)) {
-		return classifier;
-	    }
-	}
-	// No success.
-	return null;
-    }
+    }
+
 
     /** Method to retrieve the classifier with the given index.
@@ -255,264 +425,4 @@
     }
 
-    /** Method to cache the current contents of library (known classifiers) to file.
-     * @see org.greenstone.gatherer.util.Utility
-     */
-    private void saveClassifiers() {
-	try {
-	    File classifiers_dat_file = new File(Gatherer.getGLIUserDirectoryPath() + "classifiers.dat");
-	    FileOutputStream file = new FileOutputStream(classifiers_dat_file);
-	    ObjectOutputStream out = new ObjectOutputStream(file);
-	    out.writeObject(library);
-	    out.close();
-	}
-	catch (Exception error) {
-	}
-    }
-
-    private Object[] getAvailable() {
-	ArrayList available = new ArrayList();
-	int library_size = library.size();
-	for(int i = 0; i < library_size; i++) {
-	    Classifier classifier = (Classifier) library.get(i);
-	    if(!classifier.isAbstract()) {
-		available.add(classifier);
-	    }
-	    classifier = null;
-	}
-	return available.toArray();
-    }
-
-    /** Method to extract just the classifiers name from a file object.
-     * @param classifier The <strong>File</strong> which references a certain classifier.
-     * @return A <strong>String</strong> containing just the classifiers name, without extension.
-     */
-    private String getClassifierName(String filename) {
-	String name = filename;
-	if(name.indexOf(".") != -1) {
-	    name = name.substring(0, name.indexOf("."));
-	}
-	return name;
-    }
-
-    /** Method to load the details of a single plug-in.
-     * @param classifier The classifier <strong>File</strong> you wish to load.
-     */
-    private void loadClassifier(String classifier, String lang, String collection) {
-	///ystem.err.println("Attempting to parse " + classifier + " for collection "+collection);
-	Document document = null;
-	InputStream input_stream = null;
-
-	long start;
-	long end;
-	// Run classinfo on this classifier, and then send the results for parsing.
-	try {
-	    StringBuffer xml = null;
-	    if (Gatherer.isGsdlRemote) {
-		String classinfo_output = RemoteGreenstoneServer.getScriptOptions("classinfo.pl", "&classifier=" + classifier);
-		xml = new StringBuffer(classinfo_output);
-	    }
-	    else {
-		ArrayList args = new ArrayList();
-		if (Utility.isWindows()) {
-		    args.add(Configuration.perl_path);
-		    args.add("-S");
-		}
-		args.add(LocalGreenstone.getBinScriptDirectoryPath() + "classinfo.pl");
-		args.add("-xml");
-		args.add("-language");
-		args.add(lang);
-		args.add("-collect");
-		args.add(collection);
-		args.add(getClassifierName(classifier));
-
-		// Create the process.
-		Runtime runtime = Runtime.getRuntime();
-		Process process = runtime.exec((String[])args.toArray(new String [0]));
-
-		input_stream = process.getErrorStream();
-		xml = XMLTools.readXMLStream(input_stream);
-	    }
-
-	    if (xml.length() > 0) {
-		document = XMLTools.parseXML(new StringReader(xml.toString()));
-	    }
-	    else {
-		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.ClassifierManager.Classifier_XML_Parse_Failed", classifier), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
-	    }
-	}
-	catch (Exception exception) {
-	    DebugStream.println("Failed when trying to parse: " + classifier);
-	    DebugStream.printStackTrace(exception);
-	}
-
-	if (document != null) {
-	    parseXML(document.getDocumentElement());
-	}
-    }
-
-    /** Method to initially load information from the standard classifiers within the gsdl Perl library.
-     * @see org.greenstone.gatherer.util.Utility
-     */
-    private void loadClassifiers() {
-	// Attempt to restore the cached file.
-	File classifiers_dat_file = new File(Gatherer.getGLIUserDirectoryPath() + "classifiers.dat");
-	try {
-	    FileInputStream file = new FileInputStream(classifiers_dat_file);
-	    ObjectInputStream input = new ObjectInputStream(file);
-	    library = (ArrayList) input.readObject();
-	}
-	catch (Exception error) {
-	    DebugStream.println("Unable to open " + classifiers_dat_file);
-	}
-
-	if(library == null) {
-	    library = new ArrayList();
-
-	    if (Gatherer.isGsdlRemote) {
-		String classinfo_output = RemoteGreenstoneServer.getScriptOptions("classinfo.pl", "&listall=");
-		loadClassifiers(new StringBuffer(classinfo_output));
-	    }
-
-	    else {
-		// Retrieve the gsdl home directory...
-		String directory = LocalGreenstone.getDirectoryPath();
-		directory = directory + "perllib" + File.separator + "classify" + File.separator;
-
-		String current_lang = Configuration.getLanguage();
-		String collection_name = Gatherer.c_man.getCollection().getName();
-		File files[] = (new File(directory)).listFiles();
-		File coll_files[] = (new File(Gatherer.c_man.getCollectionClassifiersDirectoryPath())).listFiles();
-		int num_files =0;
-		if (files != null) {
-		    num_files += files.length;
-		}
-		if (coll_files != null) {
-		    num_files += coll_files.length;
-		}
-		if(num_files > 0) {
-		    // Create a progress indicator.
-		    ParsingProgress progress = new ParsingProgress(Dictionary.get("CDM.ClassifierManager.Parsing.Title"), Dictionary.get("CDM.ClassifierManager.Parsing.Message"), num_files);
-		    if (coll_files != null) {
-			for (int i=0; i<coll_files.length; i++) {
-			    
-			    if(coll_files[i].getName().endsWith(".pm")) {
-				loadClassifier(coll_files[i].getName(), current_lang, collection_name);
-			    }
-			    progress.inc();
-			}
-		    }
-		    if (files != null) {
-			for(int i = 0; i < files.length; i++) {
-			    // We only want to check Perl Modules.
-			    if(files[i].getName().endsWith(".pm")) {
-				loadClassifier(files[i].getName(), current_lang, collection_name);
-			    }
-			    progress.inc();
-			}
-		    }
-		    progress.dispose();
-		    progress.destroy();
-		    progress = null;
-		}
-	    }
-	}
-    }
-
-
-
-    /** Method to load classifier information from a specified input stream (could be local or through URL). Of course no classifiers may be found at this location.
-     * @param input_stream An <strong>InputStream</strong> indicating the where list of classifiers -- encoded in XML -- can be read from
-     */
-    private void loadClassifiers(StringBuffer xml)
-    {
-	Document document = XMLTools.parseXML(new StringReader(xml.toString()));
-
-	// Parse XML to build up list of classifier names
-	Element root = document.getDocumentElement();
-	
-	String num_classifiers_str = root.getAttribute("length");
-	int num_classifiers = Integer.parseInt(num_classifiers_str);
-	String class_list[] = new String[num_classifiers];
-
-	Node node = root.getFirstChild();
-	int i = 0;
-	while (node != null) {
-	    if (node.getNodeName().equalsIgnoreCase("ClassifyName")) {
-		class_list[i] = XMLTools.getValue(node);
-		i++;		
-	    }
-
-	    node = node.getNextSibling();
-	}
-	
-	String current_lang = Configuration.getLanguage();
-	String collection_name = Gatherer.c_man.getCollection().getName();
-	if (num_classifiers>0) {
-	    // Create a progress indicator.
-	    ParsingProgress progress = new ParsingProgress(Dictionary.get("CDM.ClassifierManager.Parsing.Title"), Dictionary.get("CDM.ClassifierManager.Parsing.Message"), num_classifiers);
-
-	    for (i=0; i<num_classifiers; i++) {
-		String classifier = class_list[i];
-		loadClassifier(classifier, current_lang, collection_name);
-		progress.inc();
-	    }
-	    progress.dispose();
-	    progress.destroy();
-	    progress = null;
-	}
-    }
-
-
-    /** Parses a DOM tree model turning it into a Classifier and its associated arguments.
-     * @param root The <strong>Node</strong> at the root of the DOM model.
-     * @return A newly created <strong>Classifier</strong> based on the information parsed from the DOM model.
-     * @see org.greenstone.gatherer.cdm.Argument
-     */
-    private Classifier parseXML(Node root) {
-	Classifier classifier = new Classifier();
-	String node_name = null;
-	for(Node node = root.getFirstChild(); node != null;
-	    node = node.getNextSibling()) {
-	    node_name = node.getNodeName();
-	    if(node_name.equals("Name")) {
-		String name = XMLTools.getValue(node);
-		// We can save ourselves some processing time if a classifier with this name already exists in our manager. If so retrieve it and return it.
-		Classifier existing = getBaseClassifier(name);
-		if(existing != null) {
-		    return existing;
-		}
-		classifier.setName(name);
-	    }
-	    else if(node_name.equals("Desc")) {
-		classifier.setDescription(XMLTools.getValue(node));
-	    }
-	    else if(node_name.equals("Abstract")) {
-		classifier.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase(CollectionConfiguration.YES_STR));
-	    }
-	    // Parse the multitude of arguments.
-	    else if(node_name.equals("Arguments")) {
-		for(Node arg = node.getFirstChild(); arg != null; arg = arg.getNextSibling()) {
-		    node_name = arg.getNodeName();
-		    // An option.
-		    if(node_name.equals("Option")) {
-			Argument argument = new Argument();
-			argument.parseXML((Element)arg);
-			classifier.addArgument(argument);
-		    }
-		}
-	    }
-	    // A super classifier class.
-	    else if(node_name.equals("ClassInfo")) {
-		Classifier super_classifier = parseXML(node);
-		classifier.setSuper(super_classifier);
-	    }
-	    
-	}
-	if(classifier.getName() != null) {
-	    addClassifier(classifier);
-	    return classifier;
-	}
-	return null;
-    }
 
     /** A class which provides controls for assigned and editing classifiers. */
@@ -540,6 +450,6 @@
 	 * @see org.greenstone.gatherer.cdm.ClassifierManager.ClassifierControl.RemoveListener
 	 */
-	public ClassifierControl() {
-	    Collections.sort(library);
+	public ClassifierControl()
+	{
 	    // Create
 	    add = new GLIButton(Dictionary.get("CDM.ClassifierManager.Add"), Dictionary.get("CDM.ClassifierManager.Add_Tooltip"));
@@ -554,5 +464,5 @@
 
 	    ClassifierComboboxListener ccl = new ClassifierComboboxListener();
-	    classifier_combobox = new JComboBox(getAvailable());
+	    classifier_combobox = new JComboBox(getAvailableClassifiers());
 	    classifier_combobox.setEditable(false);
 	    if(classifier_combobox.getItemCount() > 0) {
@@ -674,5 +584,5 @@
 		if(selected_object != null) {
 		    // Retrieve the base classifier
-		    Classifier base_classifier = getBaseClassifier(selected_object.toString());
+		    Classifier base_classifier = getClassifier(selected_object.toString(), true);
 
 		    // Create a new element in the DOM
@@ -702,8 +612,8 @@
     private class ClassifierComboboxListener
         implements ItemListener {
-        /** When a user selects a certain plugin, update the tooltip to show the plugin description. */
+        /** When a user selects a certain classifier, update the tooltip to show the classifier description. */
         public void itemStateChanged(ItemEvent event) {
             if(event.getStateChange() == ItemEvent.SELECTED) {
-                // Retrieve the selected plugin
+                // Retrieve the selected classifier
                 Classifier current_selection = (Classifier) classifier_combobox.getSelectedItem();
                 // And reset the tooltip. 
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/Plugin.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/Plugin.java	(revision 12630)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/Plugin.java	(revision 12631)
@@ -33,8 +33,13 @@
 import org.w3c.dom.*;
 
+
 /** This class is responsible for storing information from a parsed pluginfo call in such a way that it allows easy access to parsed details for the purposes of user design and specification of plugins. */
 public class Plugin
-    extends ArgumentContainer {
+    extends ArgumentContainer
+{
+    private String default_block_expression = "";
+    private String default_process_expression = "";
     private boolean does_explode_metadata_databases = false; 
+
     
     /** Constructor used in DOMProxyListModel initializations, and Library Level. Used for Base plugins (those in the list of available plugins, not ones that are in the DOMProxyList)
@@ -42,8 +47,10 @@
     public Plugin() {
     }
+
     
     public Plugin(Element element, Plugin base_plugin) {
 	super(element, base_plugin);
     }
+
 
     /** Method to compare two plugins for ordering.
@@ -56,4 +63,5 @@
 	return -1;
     }
+
     
     /** The assigned plugin constructor.
@@ -63,5 +71,5 @@
 	String plugin_name = element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
 	// Determine the base plugin from the plugin name
-	Plugin base_plugin = CollectionDesignManager.plugin_manager.getBasePlugin(plugin_name);
+	Plugin base_plugin = CollectionDesignManager.plugin_manager.getPlugin(plugin_name, true);
 	Plugin plugin = new Plugin(element, base_plugin);
 	if (base_plugin == null) {
@@ -77,5 +85,5 @@
     public boolean doesExplodeMetadataDatabases()
     {
-	Plugin base_plugin = CollectionDesignManager.plugin_manager.getBasePlugin(getName());
+	Plugin base_plugin = CollectionDesignManager.plugin_manager.getPlugin(getName(), false);
 	if (base_plugin == null) {
 	    return false;
@@ -89,5 +97,4 @@
     {
 	// Check the filename against the plugin's block_exp value
-	//ArrayList arguments = getArguments(true, true);
 	ArrayList arguments = getArguments();
 	for (int i = 0; i < arguments.size(); i++) {
@@ -104,18 +111,13 @@
 		}
 
-		// The $ at the end doesn't seem to work in Java, so need to add ".*" at the start
-		if (regular_expression.startsWith("(?i)")) {
-		    // Don't mess up case-insensitive matching though
-		    regular_expression = "(?i)" + ".*" + regular_expression.substring("(?i)".length());
-		}
-		else {
-		    regular_expression = ".*" + regular_expression;
-		}
-
-		// If the filename matches the regular expression, this plugin will deal with the file in some way
-		if (file.getName().matches(regular_expression)) {
+		if (doesFileMatchRegularExpression(file, regular_expression)) {
 		    return true;
 		}
 	    }
+	}
+
+	// Try the plugin's default block expression
+	if (!default_block_expression.equals("") && doesFileMatchRegularExpression(file, default_block_expression)) {
+	    return true;
 	}
 
@@ -129,5 +131,4 @@
     {
 	// Check the filename against the plugin's process_exp value
-	//ArrayList arguments = getArguments(true, true);
 	ArrayList arguments = getArguments();
 	for (int i = 0; i < arguments.size(); i++) {
@@ -144,18 +145,13 @@
 		}
 
-		// The $ at the end doesn't seem to work in Java, so need to add ".*" at the start
-		if (regular_expression.startsWith("(?i)")) {
-		    // Don't mess up case-insensitive matching though
-		    regular_expression = "(?i)" + ".*" + regular_expression.substring("(?i)".length());
-		}
-		else {
-		    regular_expression = ".*" + regular_expression;
-		}
-
-		// If the filename matches the regular expression, this plugin will deal with the file in some way
-		if (file.getName().matches(regular_expression)) {
+		if (doesFileMatchRegularExpression(file, regular_expression)) {
 		    return true;
 		}
 	    }
+	}
+
+	// Try the plugin's default process expression
+	if (!default_process_expression.equals("") && doesFileMatchRegularExpression(file, default_process_expression)) {
+	    return true;
 	}
 
@@ -164,11 +160,45 @@
     }
 
+
+    private boolean doesFileMatchRegularExpression(File file, String regular_expression)
+    {
+	// The $ at the end doesn't seem to work in Java, so need to add ".*" at the start
+	if (regular_expression.startsWith("(?i)")) {
+	    // Don't mess up case-insensitive matching though
+	    regular_expression = "(?i)" + ".*" + regular_expression.substring("(?i)".length());
+	}
+	else {
+	    regular_expression = ".*" + regular_expression;
+	}
+
+	// If the filename matches the regular expression, this plugin will deal with the file in some way
+	if (file.getName().matches(regular_expression)) {
+	    return true;
+	}
+
+	return false;
+    }
+
+
     public boolean isSeparator() {
 	return (element != null && element.getAttribute(StaticStrings.SEPARATOR_ATTRIBUTE).equals(StaticStrings.TRUE_STR));
     }
 
-    public void setDoesExplodeMetadataDatabases(boolean does_explode_metadata_databases) {
+
+    public void setDefaultBlockExpression(String default_block_expression)
+    {
+	this.default_block_expression = default_block_expression;
+    }
+
+
+    public void setDefaultProcessExpression(String default_process_expression)
+    {
+	this.default_process_expression = default_process_expression;
+    }
+
+
+    public void setDoesExplodeMetadataDatabases(boolean does_explode_metadata_databases)
+    {
 	this.does_explode_metadata_databases = does_explode_metadata_databases;
     }
-
 }
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java	(revision 12630)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java	(revision 12631)
@@ -62,6 +62,7 @@
     implements CollectionContentsChangedListener
 {
-    /** The library 'reserve' of base plugins. */
-    private ArrayList library = null;
+    // A list of all the plugins in the core Greenstone "perllib/plugins" folder (arguments may not be loaded)
+    private ArrayList core_greenstone_plugins_list = null;
+
     /** When asking how many rows are in the model, and if this variables value is true, then this modifier alters the number returned. This funtionality is used to hide the last three rows of the list in low detail modes. */
     private boolean modify_row_count = false;
@@ -77,7 +78,7 @@
 	DebugStream.println("PluginManager: " + super.getSize() + " plugins parsed.");
 	model = this;
-	// Reload/Create the library
-	loadPlugins(); // adds all the plugins to the library
-	savePlugins();
+
+	core_greenstone_plugins_list = loadPluginsList();
+
 	// Create the separator, cause we can reuse it.
 	separator = getSeparator();
@@ -87,12 +88,242 @@
     }
 
-    /** Method to add a new plugin to the library
-     * @param plugin the new base Plugin
-     */
-    private void addPlugin(Plugin plugin) {
-  	if(!library.contains(plugin)) {
-  	    library.add(plugin);
-  	}
-    }
+
+    // --------------------------------------------------------------------------------------------------------
+
+
+    /** Retrieve a list of the plugins that are available to be added to the collection. */
+    private Object[] getAvailablePlugins()
+    {
+	ArrayList available = new ArrayList();
+
+	// Add all the non-abstract core Greenstone plugins, except for ArcPlug and RecPlug
+	for (int i = 0; i < core_greenstone_plugins_list.size(); i++) {
+	    Plugin plugin = (Plugin) core_greenstone_plugins_list.get(i);
+	    if (!plugin.isAbstract()) {
+		String plugin_name = plugin.getName();
+		if (!plugin_name.equals(StaticStrings.ARCPLUG_STR) && !plugin_name.equals(StaticStrings.RECPLUG_STR)) {
+		    available.add(plugin);
+		}
+	    }
+	}
+
+	// Now remove any assigned plugins
+	if (Configuration.getMode() <= Configuration.SYSTEMS_MODE) {
+	    available.removeAll(children());
+	}
+
+	// Sort the available plugins into alphabetical order
+	Collections.sort(available);
+
+	return available.toArray();
+    }
+
+
+    public ArrayList getExploderPlugins(File file)
+    {
+	ArrayList exploder_plugins = new ArrayList();
+	for (int i = 0; i < core_greenstone_plugins_list.size(); i++) {
+	    Plugin plugin = (Plugin) core_greenstone_plugins_list.get(i);
+	    if (plugin.doesExplodeMetadataDatabases() == true && plugin.doesProcessFile(file)) {
+		exploder_plugins.add(plugin);
+	    }
+	}
+
+	return exploder_plugins;	
+    }
+
+
+    public Plugin getPlugin(String plugin_name, boolean arguments_required)
+    {
+	for (int i = 0; i < core_greenstone_plugins_list.size(); i++) {
+	    Plugin plugin = (Plugin) core_greenstone_plugins_list.get(i);
+	    if (plugin.getName().equals(plugin_name)) {
+		if (arguments_required) {
+		    if (plugin.getArguments().size() == 0) {
+			loadPluginInfo(plugin);
+		    }
+		    else {
+			System.err.println("Already loaded arguments for " + plugin_name + "!");
+		    }
+		}
+		return plugin;
+	    }
+	}
+
+	return null;
+    }
+
+    
+    public boolean isFileExplodable(File file)
+    {
+	for (int i = 0; i < core_greenstone_plugins_list.size(); i++) {
+	    Plugin plugin = (Plugin) core_greenstone_plugins_list.get(i);
+	    if (plugin.doesExplodeMetadataDatabases() == true && plugin.doesProcessFile(file) == true) { 
+		return true;
+	    }
+	}
+
+	return false;
+    }
+
+
+    private void loadPluginInfo(Plugin plugin)
+    {
+	System.err.println("Loading arguments for " + plugin.getName() + "...");
+
+	// Run pluginfo.pl to get the list of plugins
+	try {
+	    StringBuffer xml = null;
+	    if (Gatherer.isGsdlRemote) {
+		// !! TO DO
+	    }
+	    else {
+		ArrayList args = new ArrayList();
+		if (Utility.isWindows()) {
+		    args.add(Configuration.perl_path);
+		    args.add("-S");
+		}
+		args.add(LocalGreenstone.getBinScriptDirectoryPath() + "pluginfo.pl");
+		args.add("-xml");
+		args.add("-language");
+		args.add(Configuration.getLanguage());
+		args.add(plugin.getName());
+
+		// Run the pluginfo.pl process
+		Runtime runtime = Runtime.getRuntime();
+		Process process = runtime.exec((String[]) args.toArray(new String[] { }));
+		InputStream input_stream = process.getErrorStream();
+		xml = XMLTools.readXMLStream(input_stream);
+	    }
+
+	    if (xml.length() > 0) {
+		parsePluginInfoXML(plugin, xml.toString());
+	    }
+	    else {
+		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", plugin.getName()), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
+	    }
+	}
+	catch (Exception exception) {
+	    DebugStream.printStackTrace(exception);
+	}
+    }
+
+
+    private ArrayList loadPluginsList()
+    {
+	System.err.println("In loadPluginsList()...");
+
+	// Run pluginfo.pl to get the list of plugins
+	try {
+	    StringBuffer xml = null;
+	    if (Gatherer.isGsdlRemote) {
+		// !! TO DO
+	    }
+	    else {
+		ArrayList args = new ArrayList();
+		if (Utility.isWindows()) {
+		    args.add(Configuration.perl_path);
+		    args.add("-S");
+		}
+		args.add(LocalGreenstone.getBinScriptDirectoryPath() + "pluginfo.pl");
+		args.add("-listall");
+		args.add("-xml");
+
+		// Run the pluginfo.pl process
+		Runtime runtime = Runtime.getRuntime();
+		Process process = runtime.exec((String[]) args.toArray(new String[] { }));
+		InputStream input_stream = process.getErrorStream();
+		xml = XMLTools.readXMLStream(input_stream);
+	    }
+
+	    if (xml.length() > 0) {
+		return parsePluginsListXML(xml.toString());
+	    }
+	    else {
+		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.PluginManager.Plugin_List_XML_Parse_Failed"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
+	    }
+	}
+	catch (Exception exception) {
+	    DebugStream.println("Failed when trying to list plugins.");
+	    DebugStream.printStackTrace(exception);
+	}
+
+	return null;
+    }
+
+
+    private void parsePluginInfoXML(Plugin plugin, String xml)
+    {
+	Document document = XMLTools.parseXML(new StringReader(xml));
+	parsePluginInfoXMLNode(plugin, document.getDocumentElement());
+    }
+
+
+    private void parsePluginInfoXMLNode(Plugin plugin, Node root_node)
+    {
+	for (Node node = root_node.getFirstChild(); node != null; node = node.getNextSibling()) {
+	    String node_name = node.getNodeName();
+
+	    if (node_name.equalsIgnoreCase("Name")) {
+		plugin.setName(XMLTools.getValue(node));
+	    }
+	    else if (node_name.equals("Desc")) {
+		plugin.setDescription(XMLTools.getValue(node));
+	    }
+	    else if (node_name.equals("Abstract")) {
+		plugin.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase(CollectionConfiguration.YES_STR));
+	    }
+	    else if (node_name.equalsIgnoreCase("Explodes")) {
+		plugin.setDoesExplodeMetadataDatabases(XMLTools.getValue(node).equalsIgnoreCase(StaticStrings.YES_STR));
+	    }
+	    else if (node_name.equalsIgnoreCase("Processes")) {
+		plugin.setDefaultProcessExpression(XMLTools.getValue(node));
+	    }
+	    else if (node_name.equalsIgnoreCase("Blocks")) {
+		plugin.setDefaultBlockExpression(XMLTools.getValue(node));
+	    }
+	    // Parse the plugin arguments
+	    else if (node_name.equalsIgnoreCase("Arguments")) {
+		for (Node argument_node = node.getFirstChild(); argument_node != null; argument_node = argument_node.getNextSibling()) {
+		    // An option
+		    if (argument_node.getNodeName().equalsIgnoreCase("Option")) {
+			Argument argument = new Argument();
+			argument.parseXML((Element) argument_node);
+			plugin.addArgument(argument);
+		    }
+		}
+	    }
+	    // A super plugin class
+	    else if (node_name.equalsIgnoreCase("PlugInfo")) {
+		Plugin super_plugin = new Plugin();
+		parsePluginInfoXMLNode(super_plugin, node);
+		plugin.setSuper(super_plugin);
+	    }
+	}
+    }
+
+
+    private ArrayList parsePluginsListXML(String xml)
+    {
+	ArrayList plugins_list = new ArrayList();
+
+	Document document = XMLTools.parseXML(new StringReader(xml));
+	Node root = document.getDocumentElement();
+	for (Node node = root.getFirstChild(); node != null; node = node.getNextSibling()) {
+	    String node_name = node.getNodeName();
+
+	    if (node_name.equals("PlugInfo")) {
+		Plugin plugin = new Plugin();
+		parsePluginInfoXMLNode(plugin, node);
+		plugins_list.add(plugin);
+	    }
+	}
+
+	return plugins_list;
+    }
+
+
+    // --------------------------------------------------------------------------------------------------------
+
 
     /** Method to assign a plugin
@@ -128,7 +359,4 @@
 	    controls = null;
 	}
-
-	library.clear();
-	library = null;
     }
 
@@ -149,5 +377,5 @@
 	// Next try the plugins NOT already assigned in the collection
 	ArrayList suitable_plugins = new ArrayList();
-	Object[] unassigned_plugins = getAvailable();
+	Object[] unassigned_plugins = getAvailablePlugins();
 	for (int i = 0; i < unassigned_plugins.length; i++) {
 	    Plugin unassigned_plugin = (Plugin) unassigned_plugins[i];
@@ -173,29 +401,4 @@
 
 
-    public boolean isFileExplodable(File file)
-    {
-
-	for (int i = 0; i < library.size(); i++) {
-	    Plugin plugin = (Plugin) library.get(i);
-	    if (plugin.doesExplodeMetadataDatabases() == true && plugin.doesProcessFile(file) == true) { 
-		return true;
-	    }
-	}
-
-	return false;
-    }
-
-    public ArrayList getExploderPlugins(File file)
-    {
-	ArrayList exp_plugins = new ArrayList();
-	for (int i = 0; i < library.size(); i++) {
-	    Plugin plugin = (Plugin) library.get(i);
-	    if (plugin.doesProcessFile(file) == true && plugin.doesExplodeMetadataDatabases() == true) {
-		exp_plugins.add(plugin);
-	    }
-	}
-	return exp_plugins;	
-    }
-
     /** Method to retrieve the control for this manager.
      * @return the Control
@@ -209,19 +412,4 @@
     }
 
-    /** Retrieve the base plugin of the given name, or null if no such plugin.
-     * @param name the name of the base plugin to retrieve as a String
-     * @return the Plugin requested or null if no such plugin
-     */
-    public Plugin getBasePlugin(String name) {
-	int library_size = library.size();
-	for(int i = 0; i < library_size; i++) {
-	    Plugin plugin = (Plugin) library.get(i);
-	    if(plugin.getName().equals(name)) {
-		return plugin;
-	    }
-	}
-	// No success.
-	return null;
-    }
 
     /** Overrides getSize in DOMProxyListModel to take into account the row count modifier used to hide the last three rows in lower detail modes
@@ -359,18 +547,4 @@
     }
 
-    /** Method to cache the current contents of library (known plugins) to file.
-     */
-    private void savePlugins() {
-	try {
-	    File plugins_dat_file = new File(Gatherer.getGLIUserDirectoryPath() + "plugins.dat");
-	    FileOutputStream file = new FileOutputStream(plugins_dat_file);
-	    ObjectOutputStream out = new ObjectOutputStream(file);
-	    out.writeObject(library);
-	    out.close();
-	}
-	catch (Exception error) {
-	    DebugStream.printStackTrace(error);
-	}
-    }
 
     /** Inform the model to hide/show the last three lines on the list.
@@ -401,275 +575,4 @@
     }
 
-
-    /** Retrieve a list of those plugins that are in library but not in the assigned plugins. */
-    private Object[] getAvailable() {
-	ArrayList available = new ArrayList();
-	int library_size = library.size();
-	for(int i = 0; i < library_size; i++) {
-	    Plugin plugin = (Plugin) library.get(i);
-	    String plugin_name = plugin.getName();
-	    if(!plugin.isAbstract() && !plugin_name.equals(StaticStrings.ARCPLUG_STR) && !plugin_name.equals(StaticStrings.RECPLUG_STR)) {
-		available.add(plugin);
-	    }
-	    plugin = null;
-	}
-	// Now go through the assigned plugins, and remove any that match.
-	// only for < lib sys specialist mode
-	if (Configuration.getMode()<=Configuration.SYSTEMS_MODE) {
-	    available.removeAll(children());
-	}
-	//DebugStream.println("There are a total of " + library.size() + " plugins in the library.");
-	//DebugStream.println("However " + children().size() + " are in use,");
-	//DebugStream.println("So only " + available.size() + " remain.");
-	Collections.sort(available);
-	return available.toArray();
-    }
-
-    /** Method to extract just the plugins name from a file object.
-     * @param plugin The <strong>File</strong> which references a certain plugin.
-     * @return A <strong>String</strong> containing just the plugins name, without extension.
-     */
-    private String getPluginName(String filename) {
-	String name = filename;
-	if(name.indexOf(".") != -1) {
-	    name = name.substring(0, name.indexOf("."));
-	}
-	return name;
-    }
-
-
-    /** Method to load the details of a single plug-in.
-     * @param plugin The plugin <strong>File</strong> you wish to load.
-     */
-    private void loadPlugin(String plugin, String lang, String collection_name) {
-	Document document = null;
-	InputStream input_stream = null;
-	
-	// Run pluginfo on this plugin, and then send the results for parsing.
-	try {
-	    StringBuffer xml = null;
-	    if (Gatherer.isGsdlRemote) {
-		String pluginfo_output = RemoteGreenstoneServer.getScriptOptions("pluginfo.pl", "&plugin=" + plugin);
-		xml = new StringBuffer(pluginfo_output);
-	    }
-	    else {
-		ArrayList args = new ArrayList();
-		if (Utility.isWindows()) {
-		    args.add(Configuration.perl_path);
-		    args.add("-S");
-		}
-		args.add(LocalGreenstone.getBinScriptDirectoryPath() + "pluginfo.pl");
-		args.add("-xml");
-		args.add("-language");
-		args.add(lang);
-		args.add("-collect");
-		args.add(collection_name);
-		args.add(getPluginName(plugin));
-
-		// Create the process.
-		Runtime runtime = Runtime.getRuntime();
-		Process process = runtime.exec((String[])args.toArray(new String [0]));
-		input_stream = process.getErrorStream();
-		xml = XMLTools.readXMLStream(input_stream);
-	    }
-
-	    if (xml.length() > 0) {
-		document = XMLTools.parseXML(new StringReader(xml.toString()));
-	    }
-	    else {
-		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", plugin), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
-	    }
-	}
-	catch (Exception exception) {
-	    DebugStream.println("Failed when trying to parse: " + plugin);
-	    DebugStream.printStackTrace(exception);
-	}
-
-	if (document != null) {
-	    parseXML(document.getDocumentElement());
-	}
-    }
-
-    /** Method to initially load information from the standard plug-ins within the gsdl Perl library.
-     */
-    private void loadPlugins() {
-	// Attempt to restore the cached file.
-	File plugins_dat_file = new File(Gatherer.getGLIUserDirectoryPath() + "plugins.dat");
-	try {
-	    FileInputStream file = new FileInputStream(plugins_dat_file);
-	    ObjectInputStream input = new ObjectInputStream(file);
-	    library = (ArrayList) input.readObject();
-	}
-	catch (Exception error) {
-	    DebugStream.println("Unable to open " + plugins_dat_file);
-	}
-
-	if(library == null) {
-	    library = new ArrayList();
-
-	    if (Gatherer.isGsdlRemote) {
-		String pluginfo_output = RemoteGreenstoneServer.getScriptOptions("pluginfo.pl", "&listall=");
-		loadPlugins(new StringBuffer(pluginfo_output));
-	    }
-
-	    else {
-		// Retrieve the gsdl home directory...
-		String directory = LocalGreenstone.getDirectoryPath();
-		directory = directory + "perllib" + File.separator + "plugins" + File.separator;
-		String current_lang = Configuration.getLanguage();
-		String collection_name = Gatherer.c_man.getCollection().getName();
-
-		boolean is_windows = Utility.isWindows();
-		boolean is_mac = Utility.isMac();
-	
-		File files[] = (new File(directory)).listFiles();
-		File coll_files[] = (new File(Gatherer.c_man.getCollectionPluginsDirectoryPath())).listFiles();
-		int num_files = 0;
-		if (files != null) {
-		    num_files += files.length;
-		}
-		if (coll_files != null) {
-		    num_files += coll_files.length;
-		}
-		if(num_files > 0) {
-		
-		    // Create a progress indicator.
-		    ParsingProgress progress = new ParsingProgress(Dictionary.get("CDM.PlugInManager.Parsing.Title"), Dictionary.get("CDM.PlugInManager.Parsing.Message"), num_files);
-		    if (coll_files != null) {
-			for (int i=0; i<coll_files.length; i++) {   
-			    if(coll_files[i].getName().endsWith(".pm")) {
-				loadPlugin(coll_files[i].getName(), current_lang, collection_name);
-			    }
-			    progress.inc();
-			}
-		    }
-
-		    if (files != null) {
-			for(int i = 0; i < files.length; i++) {
-			    // We only want to check Perl Modules.
-			    if(files[i].getName().endsWith(".pm")) {
-				if (files[i].getName().equals("GMLPlug.pm") || ((is_windows || is_mac) && files[i].getName().equals("DBPlug.pm"))) {
-				    // don't load GMLPlug or DBPlug for windows
-				} else {
-				    loadPlugin(files[i].getName(), current_lang, collection_name);
-				}
-			    }
-			    progress.inc();
-			}
-		    }
-		    progress.dispose();
-		    progress.destroy();
-		    progress = null;
-		}   
-	    }
-	}
-    }
-
-
-    /** Method to load plug-in information from a specified input stream (could be local or through URL). Of course no plug-ins may be found at this location.
-     * @param input_stream An <strong>InputStream</strong> indicating the where list of plugins -- encoded in XML -- can be read from
-     */
-    private void loadPlugins(StringBuffer xml)
-    {
-	Document document = XMLTools.parseXML(new StringReader(xml.toString()));
-
-	// Parse XML to build up list of plugin names
-	Node root = document.getDocumentElement();
-
-	NamedNodeMap attributes = root.getAttributes();
-	Node length_node = attributes.getNamedItem("length");
-	String num_plugins_str = length_node.getNodeValue();
-	int num_plugins = Integer.parseInt(num_plugins_str);
-	String plugin_list[] = new String[num_plugins];
-
-	Node node = root.getFirstChild();
-	int i = 0;
-	while (node != null) {
-	    String node_name = node.getNodeName();
-	    if (node_name.equalsIgnoreCase("PluginName")) {
-		String name = XMLTools.getValue(node);
-		plugin_list[i] = name;
-		i++;		
-	    }
-
-	    node = node.getNextSibling();
-	}
-
-
-	boolean is_windows = Utility.isWindows();
-	boolean is_mac = Utility.isMac();
-
-	String current_lang = Configuration.getLanguage();
-	String collection_name = Gatherer.c_man.getCollection().getName();
-	if (num_plugins>0) {
-	    // Create a progress indicator.
-	    ParsingProgress progress = new ParsingProgress(Dictionary.get("CDM.PlugInManager.Parsing.Title"), Dictionary.get("CDM.PlugInManager.Parsing.Message"), num_plugins);
-
-	    for (i=0; i<num_plugins; i++) {
-		String plugin = plugin_list[i];
-		if (plugin.equals("GMLPlug.pm") || ((is_windows || is_mac) && plugin.equals("DBPlug.pm"))) {
-		    // don't load GMLPlug or DBPlug for windows
-		} else {
-		    loadPlugin(plugin, current_lang, collection_name);
-		}
-		
-		progress.inc();
-	    }
-	    progress.dispose();
-	    progress.destroy();
-	    progress = null;
-	}
-    }
-
-
-    private Plugin parseXML(Node root) {
-	Plugin plugin = new Plugin();
-	String node_name = null;
-	for (Node node = root.getFirstChild(); node != null; node = node.getNextSibling()) {
-	    node_name = node.getNodeName();
-	    if(node_name.equalsIgnoreCase("Name")) {
-		String name = XMLTools.getValue(node);
-		// We can save ourselves some processing time if a plugin with this name already exists in our manager. If so retrieve it and return it.
-		Plugin existing = getBasePlugin(name);
-		if(existing != null) {
-		    return existing;
-		}
-		plugin.setName(name);
-	    }
-	    else if (node_name.equalsIgnoreCase("Desc")) {
-		plugin.setDescription(XMLTools.getValue(node));
-	    }
-	    else if (node_name.equalsIgnoreCase("Abstract")) {
-		plugin.setIsAbstract(XMLTools.getValue(node).equalsIgnoreCase(StaticStrings.YES_STR));
-	    }
-	    else if (node_name.equalsIgnoreCase("Explodes")) {
-		plugin.setDoesExplodeMetadataDatabases(XMLTools.getValue(node).equalsIgnoreCase(StaticStrings.YES_STR));
-		//System.err.println("Plugin " + plugin.getName() + " explodes metadata databases: " + plugin.doesExplodeMetadataDatabases());
-	    }
-	    // Parse the multitude of arguments
-	    else if(node_name.equalsIgnoreCase("Arguments")) {
-		for(Node arg = node.getFirstChild(); arg != null; arg = arg.getNextSibling()) {
-		    node_name = arg.getNodeName();
-		    // An option.
-		    if(node_name.equalsIgnoreCase("Option")) {
-			Argument argument = new Argument();
-			argument.parseXML((Element)arg);
-			plugin.addArgument(argument);
-		    }
-		}
-	    } 
-	    // A super plugin class.
-	    else if(node_name.equalsIgnoreCase("PlugInfo")) {
-		Plugin super_plugin = parseXML(node);
-		plugin.setSuper(super_plugin);
-	    }
-
-	}
-	if(plugin.getName() != null) {
-	    addPlugin(plugin);
-	    return plugin;
-	}
-	return null;
-    }
 
     /** A class which provodes controls for assigned and editing plugins. */
@@ -708,5 +611,6 @@
 	/** Constructor.
 	 */
-	public PluginControl() {
+	public PluginControl()
+	{
 	    // Create
 	    add = new GLIButton(Dictionary.get("CDM.PlugInManager.Add"), Dictionary.get("CDM.PlugInManager.Add_Tooltip"));
@@ -728,5 +632,5 @@
 
 	    PluginComboboxListener picl = new PluginComboboxListener();
-	    plugin_combobox = new JComboBox(getAvailable());
+	    plugin_combobox = new JComboBox(getAvailablePlugins());
 	    plugin_combobox.setEditable(false);
 	    picl.itemStateChanged(new ItemEvent(plugin_combobox, 0, null, ItemEvent.SELECTED));
@@ -849,5 +753,5 @@
 		if(selected_object != null) {
 		    // Retrieve the base plugin 
-		    Plugin base_plugin = getBasePlugin(selected_object.toString());
+		    Plugin base_plugin = getPlugin(selected_object.toString(), true);
 		    if (base_plugin == null) {
 			// shouldn't happen
@@ -1114,5 +1018,5 @@
 		    }
 		    // Refresh the available plugins
-		    plugin_combobox.setModel(new DefaultComboBoxModel(getAvailable()));
+		    plugin_combobox.setModel(new DefaultComboBoxModel(getAvailablePlugins()));
 		}
 		else {
@@ -1199,5 +1103,5 @@
 		// add the selected plugin to the list
 		Object selected_object = suitable_plugins_combobox.getSelectedItem();
-		Plugin base_plugin = getBasePlugin(selected_object.toString());
+		Plugin base_plugin = getPlugin(selected_object.toString(), true);
 		if (base_plugin == null) {
 		    // shouldn't happen - we are not allowed custom plugins anymore
