Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/util/CGIArgConverter.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/util/CGIArgConverter.java	(revision 3640)
+++ 	(revision )
@@ -1,145 +1,0 @@
-package org.greenstone.gsdl3.util;
-
-import java.util.HashMap;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/** converts long names for parameters into short names for cgi args, and vice versa */
-public class CGIArgConverter {
-
-    /** long to short mapping */
-    protected HashMap long_map_=null;
-    /** short to long mapping */
-    protected HashMap short_map_=null;
-    
-    /** initialises the maps with known parameters */
-    public CGIArgConverter() {
-	long_map_ = new HashMap();
-	short_map_ = new HashMap();
-
-	// initialize with the ones we know about
-	short_map_.put("a", "action"); 
-	long_map_.put("action", "a");
-
-	short_map_.put("sa", "subaction"); 
-	long_map_.put("subaction", "sa");	
-
-	short_map_.put("sn", "serviceName"); 
-	long_map_.put("serviceName", "sn");	
-
-	short_map_.put("sc", "serviceCluster");
-	long_map_.put("serviceCluster", "sc");
-
-	short_map_.put("l", "lang"); 
-	long_map_.put("lang", "l");
-
-	short_map_.put("c", "collection"); 
-	long_map_.put("collection", "c");
-
-	long_map_.put("resource", "r");
-	short_map_.put("r", "resource");
-
-	// these are service specific - should we have these here??
-	long_map_.put("case", "k");
-	short_map_.put("k", "case");
-
-	long_map_.put("stem", "s");
-	short_map_.put("s", "stem");
-	
-	long_map_.put("queryLevel", "ql");
-	short_map_.put("ql", "queryLevel");
-	
-	long_map_.put("index", "i");
-	short_map_.put("i", "index");
-	
-	long_map_.put("matchMode", "mm");
-	short_map_.put("mm", "matchMode");
-
-	long_map_.put("sortBy", "sb");
-	short_map_.put("sb", "sortBy");
-	
-	long_map_.put("maxDocs", "md");
-	short_map_.put("md", "maxDocs");
-
-	long_map_.put("query", "q");
-	short_map_.put("q", "query");
-	
-	short_map_.put("cl", "classifier"); 
-	long_map_.put("classifier", "cl");
-    }
-
-    /** takes a paramList element  - contains <param name="x"> elements
-     * converts all the short names to long names 
-     * returns true if successful, false otherwise */
-    public boolean toLong(Element param_list) {
-	
-	if (!param_list.getNodeName().equals(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER)) {
-	    System.err.println("CGIArgConverter Error: wrong element passed to toLong");
-	    return false;
-	}
-	NodeList params = param_list.getElementsByTagName(GSXML.PARAM_ELEM);
-	for (int i=0; i< params.getLength(); i++) {
-	    Element param = (Element)params.item(i);
-	    String name = param.getAttribute(GSXML.NAME_ATT);
-	    param.setAttribute(GSXML.NAME_ATT, toLong(name));
-	}
-	return true;
-
-    }
-    /** adds shortnames to the params in the list */
-    public boolean addShortNames(Element param_list) {
-	if (!param_list.getNodeName().equals(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER)) {
-	    System.err.println("CGIArgConverter Error: wrong element passed to addShortNames");
-	    return false;
-	}
-	
-	NodeList params = param_list.getElementsByTagName(GSXML.PARAM_ELEM);
-	for (int i=0; i< params.getLength(); i++) {
-	    Element param = (Element)params.item(i);
-	    String name = param.getAttribute(GSXML.NAME_ATT);
-	    param.setAttribute(GSXML.PARAM_SHORTNAME_ATT, toShort(name));
-	}
-	return true;
-
-    }
-    
-    /** returns the long form of a short arg - 
-     * returns the original if it doesn't know about this short arg */
-    public String toLong(String short_name) {
-	
-	if (short_map_.containsKey(short_name)) {
-	    return (String)short_map_.get(short_name);
-	}
-	return short_name; // just return the original
-    }
-    /** returns the short form of a long arg */
-    public String toShort(String long_name) {
-
-	if (long_map_.containsKey(long_name)) {
-	    return (String)long_map_.get(long_name);
-	}
-
-	// else need to create a new mapping
-	String short_name = newShortName(long_name);
-	long_map_.put(long_name, short_name);
-	short_map_.put(short_name, long_name);
-	return short_name;
-    }
-    
-    /** tries to create a new short form of the long name - 
-     * if it cant, it just returns the original name */
-    protected String newShortName(String long_name) {
-	
-	// for now, try the first letter, then first two etc.
-	int i=1;
-	String short_try= long_name.substring(0,1);
-	while(short_map_.containsKey(short_try)&& i<long_name.length()) {
-	    i++;
-	    short_try = long_name.substring(0, i);
-	}
-	return short_try;
-	
-    }
-}
-
-
Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSCGI.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSCGI.java	(revision 3641)
+++ trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSCGI.java	(revision 3641)
@@ -0,0 +1,133 @@
+package org.greenstone.gsdl3.util;
+
+import java.util.HashMap;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/** GSCGI holds the cgi args / xml parameters fro cgi type requests to the receptionist
+ * it includes methods to convert long parameter names to short cgi arg names
+ */
+public class GSCGI {
+
+    // the args that are used in the interface
+    public static final String ACTION_ARG = "a";
+    public static final String SUBACTION_ARG = "sa";
+    public static final String CLUSTER_ARG = "c";  
+    public static final String COLLECTION_ARG = "c"; 
+    public static final String LANGUAGE_ARG = "l";
+    public static final String DOCUMENT_ARG = "d";
+    public static final String RESOURCE_ARG = "r";
+    public static final String OUTPUT_ARG = "o";
+    public static final String SERVICE_ARG = "s";
+    public static final String PROCESS_HANDLE_ARG = "id";
+    
+    /** long to short mapping */
+    protected HashMap long_map_=null;
+    /** short to long mapping */
+    protected HashMap short_map_=null;
+    
+    /** initialises the maps with known parameters */
+    public GSCGI() {
+	long_map_ = new HashMap();
+	short_map_ = new HashMap();
+
+	// initialize with the ones we know about
+	addStaticParam(ACTION_ARG); // action
+	addStaticParam(SUBACTION_ARG); // subaction
+	addStaticParam(CLUSTER_ARG); // cluster
+	addStaticParam(COLLECTION_ARG); // collection
+	addStaticParam(LANGUAGE_ARG); // language
+	addStaticParam(DOCUMENT_ARG); // document
+	addStaticParam(RESOURCE_ARG); // resource
+	addStaticParam(OUTPUT_ARG); // output type
+	addStaticParam(SERVICE_ARG); // service name
+	addStaticParam(PROCESS_HANDLE_ARG); // an id used to query the status of a specified process
+    }
+
+    /* static params - have only one form */
+    public boolean addStaticParam(String param) {
+	return addParam(param, param);
+    }
+    /** adds another param to teh list 
+     * should check that its not already present? */
+    public boolean addParam(String long_name, String short_name) {
+	long_map_.put(long_name, short_name);
+	short_map_.put(short_name, long_name);
+	return true;
+    }
+	
+    /** takes a paramList element  - contains <param name="x"> elements
+     * converts all the short names to long names 
+     * returns true if successful, false otherwise */
+    public boolean paramListToLongNames(Element param_list) {
+	
+	if (!param_list.getNodeName().equals(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER)) {
+	    System.err.println("GSCGI Error: wrong element passed to toLong");
+	    return false;
+	}
+	NodeList params = param_list.getElementsByTagName(GSXML.PARAM_ELEM);
+	for (int i=0; i< params.getLength(); i++) {
+	    Element param = (Element)params.item(i);
+	    String name = param.getAttribute(GSXML.NAME_ATT);
+	    param.setAttribute(GSXML.NAME_ATT, toLong(name));
+	}
+	return true;
+
+    }
+    /** adds shortnames to the params in the list */
+    public boolean paramListAddShortNames(Element param_list) {
+	if (!param_list.getNodeName().equals(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER)) {
+	    System.err.println("GSCGI Error: wrong element passed to addShortNames");
+	    return false;
+	}
+	
+	NodeList params = param_list.getElementsByTagName(GSXML.PARAM_ELEM);
+	for (int i=0; i< params.getLength(); i++) {
+	    Element param = (Element)params.item(i);
+	    String name = param.getAttribute(GSXML.NAME_ATT);
+	    param.setAttribute(GSXML.PARAM_SHORTNAME_ATT, toShort(name));
+	}
+	return true;
+
+    }
+    
+    /** returns the long form of a short arg - 
+     * returns the original if it doesn't know about this short arg */
+    public String toLong(String short_name) {
+	
+	if (short_map_.containsKey(short_name)) {
+	    return (String)short_map_.get(short_name);
+	}
+	return short_name; // just return the original
+    }
+    /** returns the short form of a long arg */
+    public String toShort(String long_name) {
+
+	if (long_map_.containsKey(long_name)) {
+	    return (String)long_map_.get(long_name);
+	}
+
+	// else need to create a new mapping
+	String short_name = newShortName(long_name);
+	long_map_.put(long_name, short_name);
+	short_map_.put(short_name, long_name);
+	return short_name;
+    }
+    
+    /** tries to create a new short form of the long name - 
+     * if it cant, it just returns the original name */
+    protected String newShortName(String long_name) {
+	
+	// for now, try the first letter, then first two etc.
+	int i=1;
+	String short_try= long_name.substring(0,1);
+	while(short_map_.containsKey(short_try)&& i<long_name.length()) {
+	    i++;
+	    short_try = long_name.substring(0, i);
+	}
+	return short_try;
+	
+    }
+}
+
+
