Index: /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/IIIFServerBridge.java
===================================================================
--- /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/IIIFServerBridge.java	(revision 32882)
+++ /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/IIIFServerBridge.java	(revision 32883)
@@ -86,21 +86,13 @@
 	}
 
-	/**
-	 * initialise the class
-	 */
+    /**
+     * initialise the class
+     */
     public void init(String site_name) throws UnavailableException, Exception
 	{
-	    ////GlobalProperties.loadGlobalProperties(config.getServletContext().getRealPath(""));
-			
 	    org.greenstone.util.GlobalProperties.loadGlobalProperties("");
-	    //org.greenstone.util.GlobalProperties.loadGlobalProperties(config.getServletContext().getRealPath(""));
-	    //org.greenstone.util.GlobalProperties.loadGlobalProperties("/home/osboxes/research/code/greenstone3-svn/web");
 	    java.io.InputStream in = Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties");
 
-	    //String gsdl3_writablehome = System.getProperty("gsdl3.writablehome");
 	    String tomcat_context = System.getProperty("tomcat.context");
-	    System.err.println("*** in = " + in);
-	    //System.err.println("*** gsdl3.writablehome = " + gsdl3_writablehome);
-	    System.err.println("*** tomcat.context = " + tomcat_context);
 	    
 	    // the receptionist -the servlet will talk to this
@@ -121,4 +113,8 @@
 	} // end of init()
 
+    /*
+      Written but never used/tested
+    */
+    
         public void remote_init(String remote_site_name, String remote_site_type, String remote_site_address) throws UnavailableException
         { 
@@ -166,8 +162,4 @@
         public String doGetDocumentMessage(String identifier)
 	{
-		// oai always requires the content type be text/xml
-		//request.setCharacterEncoding("UTF-8");
-	        //response.setContentType("text/xml;charset=UTF-8");
-		//PrintWriter out = response.getWriter();
 	    String result = "";
 	    
@@ -178,5 +170,5 @@
 		String verb = "GetRecord";
 		Document response_doc = XMLConverter.newDOM();
-		Element xml_response = IIIFXML.createBasicResponse(response_doc, verb, pairs);
+		//Element xml_response = IIIFXML.createBasicResponse(response_doc, verb, pairs);
 		Element verb_elem = null;
 		
@@ -185,11 +177,7 @@
 		Element xml_message = request_doc.createElement(GSXML.MESSAGE_ELEM);
 		Element xml_request = request_doc.createElement(GSXML.REQUEST_ELEM);
-		// The type attribute is set to be 'oaiService' from OAIServer to OAIReceptionist.
-		////xml_request.setAttribute(GSXML.TYPE_ATT, OAIXML.OAI_SERVICE); // ****
-		//xml_request.setAttribute(GSXML.LANG_ATT, lang);
 		xml_request.setAttribute(GSXML.TO_ATT, verb);
 		addParams(xml_request, pairs);
 
-		//xml_request.setAttribute(GSXML.OUTPUT_ATT, output);????
 		xml_message.appendChild(xml_request);
 
@@ -199,5 +187,5 @@
 			logger.info("xml_result is null");
 			verb_elem = IIIFXML.createErrorElement(response_doc, "Internal error", "");
-			xml_response.appendChild(verb_elem);
+			//xml_response.appendChild(verb_elem);
 		}
 		else
@@ -206,6 +194,5 @@
 			//
 			// All response elements are in the form (with a corresponding verb
-			// name): <message> <response> <verb> ... <resumptionToken> .. this
-			// is optional! </resumptionToken> </verb> </response> </message>
+			// name): <message> <response> <verb> ... </verb> </response> </message>
 			//
 			Node res = GSXML.getChildByTagName(xml_result, GSXML.RESPONSE_ELEM);
@@ -216,12 +203,8 @@
 			}
 			else {
-			    System.err.println("*** res (verb_elem) = " + XMLConverter.getPrettyString(res));
-			    
 			    verb_elem = GSXML.getFirstElementChild(res); // GetRecord
 			    Node record_node = GSXML.getFirstElementChild(verb_elem); // record
 			    Element metadata_list_elem = (Element)GSXML.getChildByTagName(record_node,"metadata"); // metadata
 
-			    System.err.println("*** metadata_list_elem = " + XMLConverter.getPrettyString(metadata_list_elem));
-
 			    Element assocfilepath_metadata_elem = (Element)GSXML.getChildByTagName(metadata_list_elem,"assocfilepath");
 			    String assocfilepath_metadata_val = GSXML.getNodeText(assocfilepath_metadata_elem);
@@ -233,31 +216,7 @@
 			}
 
-			// ******
-			xml_response.appendChild(response_doc.importNode(verb_elem, true));
-			/*
-			if ( verb_elem.getTagName().equals(IIIFXML.ERROR))
-			{
-			  xml_response.appendChild(response_doc.importNode(verb_elem, true));
-			}
-			else if (IIIFXML.iiif_version.equals(IIIFXML.IIIF_VERSION2)) {
-			  xml_response.appendChild(response_doc.importNode(verb_elem, true));
-			}
-			else
-			{
-				GSXML.copyAllChildren(xml_response, verb_elem);
-				}*/
-		}
-		/*
-		out.println("<?xml version='1.0' encoding='UTF-8' ?>");
-		if (this.use_oai_stylesheet)
-		{
-			out.println("<?xml-stylesheet type='text/xsl' href='" + this.oai_stylesheet + "' ?>\n");
-		}
-		out.println(XMLConverter.getPrettyString(xml_response));
-		*/
-		
-		//return XMLConverter.getPrettyString(xml_response);
+			//xml_response.appendChild(response_doc.importNode(verb_elem, true));
+		}
 		return result;
-		//return xml_response;
 	}
 
Index: /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/collection/IIIFCollection.java
===================================================================
--- /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/collection/IIIFCollection.java	(revision 32882)
+++ /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/collection/IIIFCollection.java	(revision 32883)
@@ -128,6 +128,4 @@
 	protected boolean configureServiceRackList(Element service_rack_list, Element extra_info)
 	{
-	    //logger.info("*** Away to call getNamedElement() for service_rack_list = " + XMLConverter.getPrettyString(service_rack_list));
-	    
 	  // find the IIIFPMH service
 	  Element iiif_service_xml = GSXML.getNamedElement(service_rack_list, GSXML.SERVICE_CLASS_ELEM, GSXML.NAME_ATT, "IIIFPMH");
@@ -143,5 +141,4 @@
 
 	  if(this.iiif_service_rack == null) {
-	      logger.info("*** away to call constructor to IIIFPMH");
 		this.iiif_service_rack = new IIIFPMH();
 	  }
@@ -153,6 +150,4 @@
 
 	  // pass the xml node to the service for configuration
-	  logger.info("*** away to configure service rack IIIFPMH");
-	  
 	  if (this.iiif_service_rack.configure(iiif_service_xml, extra_info)) {
     
Index: /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/core/IIIFMessageRouter.java
===================================================================
--- /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/core/IIIFMessageRouter.java	(revision 32882)
+++ /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/core/IIIFMessageRouter.java	(revision 32883)
@@ -75,8 +75,7 @@
 
 		// ****
-		// for oai, we don't do anything with the site config
+		// for iiif, we don't do anything with the site config
 		// file. But we'll read it in and keep it in case need
-		// it later, e.g. for replace elements when retrieving
-		// metadata - which I don't think has been implemented
+		// it later
 		File configFile = new File(GSFile.siteConfigFile(this.site_home));
 
Index: /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/core/IIIFReceptionist.java
===================================================================
--- /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/core/IIIFReceptionist.java	(revision 32882)
+++ /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/core/IIIFReceptionist.java	(revision 32883)
@@ -136,5 +136,5 @@
     if (!message.getTagName().equals(GSXML.MESSAGE_ELEM)) {
       logger.error(" Invalid message. GSDL message should start with <"+GSXML.MESSAGE_ELEM+">, instead it starts with:"+message.getTagName()+".");
-      return IIIFXML.createErrorMessage(OAIXML.BAD_ARGUMENT, "Internal messaging error");
+      return IIIFXML.createErrorMessage(IIIFXML.BAD_ARGUMENT, "Internal messaging error");
     }
    
@@ -143,5 +143,5 @@
     if (request == null) {
       logger.error(" message had no request!");
-      return IIIFXML.createErrorMessage(OAIXML.BAD_ARGUMENT, "Internal messaging error");
+      return IIIFXML.createErrorMessage(IIIFXML.BAD_ARGUMENT, "Internal messaging error");
     }
 
@@ -150,5 +150,4 @@
     if (!reset.equals("")) {
       resetMessageRouter();
-      // configureSetInfo(); // ****
       return IIIFXML.createResetResponse(true);
     }
@@ -156,13 +155,13 @@
     
     //At this stage, the value of 'to' attribute of the request must be the 'verb'
-    //The only thing that the oai receptionist can be sure is that these verbs are valid, nothing else.
+    //The only thing that the iiif receptionist can be sure is that these verbs are valid, nothing else.
     String verb = request.getAttribute(GSXML.TO_ATT);
     
-    if (verb.equals(OAIXML.GET_RECORD)) {
+    if (verb.equals(IIIFXML.GET_RECORD)) {
       return doGetRecord(request);
     }
 
     // should never get here as verbs were checked in IIIFServerBridge
-    return IIIFXML.createErrorMessage(OAIXML.BAD_VERB, "Unexpected things happened");
+    return IIIFXML.createErrorMessage(IIIFXML.BAD_VERB, "Unexpected things happened");
     
   }
@@ -174,14 +173,14 @@
     Element get_record = doc.createElement(IIIFXML.GET_RECORD);
 
-    HashSet<String> valid_strs = new HashSet<String>();
-    valid_strs.add(OAIXML.IDENTIFIER);
-    valid_strs.add(OAIXML.METADATA_PREFIX);
+    //HashSet<String> valid_strs = new HashSet<String>(); // ****
+    //valid_strs.add(IIIFXML.IDENTIFIER);
+    //valid_strs.add(IIIFXML.METADATA_PREFIX);
 
     NodeList params = GSXML.getChildrenByTagName(req, GSXML.PARAM_ELEM);
     HashMap<String, String> param_map = GSXML.getParamMap(params);    
 
-    // Any need to check all params are valid, like OAI??
-    
-    String identifier = param_map.get(OAIXML.IDENTIFIER);
+    // Any need to check all params are valid, like OAI?? // ****
+    
+    String identifier = param_map.get(IIIFXML.IDENTIFIER);
     
     // get the names
@@ -189,5 +188,5 @@
     if(strs == null || strs.length < 2) {
       logger.error("identifier is not in the form coll:id" + identifier);
-      return OAIXML.createErrorMessage(OAIXML.ID_DOES_NOT_EXIST, "");
+      return IIIFXML.createErrorMessage(IIIFXML.ID_DOES_NOT_EXIST, "");
     }    
     String coll_name = strs[0];
@@ -199,7 +198,7 @@
     req.setAttribute(GSXML.TO_ATT, coll_name + "/" + verb);
     // reset the identifier element
-    Element param = GSXML.getNamedElement(req, GSXML.PARAM_ELEM, GSXML.NAME_ATT, OAIXML.IDENTIFIER);
+    Element param = GSXML.getNamedElement(req, GSXML.PARAM_ELEM, GSXML.NAME_ATT, IIIFXML.IDENTIFIER);
     if (param != null) {
-      param.setAttribute(GSXML.NAME_ATT, OAIXML.OID);
+      param.setAttribute(GSXML.NAME_ATT, IIIFXML.OID);
       param.setAttribute(GSXML.VALUE_ATT, oid);
     }    
Index: /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/service/IIIFPMH.java
===================================================================
--- /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/service/IIIFPMH.java	(revision 32882)
+++ /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/service/IIIFPMH.java	(revision 32883)
@@ -23,5 +23,4 @@
 import org.greenstone.gsdl3.util.GSXML;
 import org.greenstone.gsdl3.util.IIIFXML;
-//import org.greenstone.gsdl3.util.OAIXML; // ****
 import org.greenstone.gsdl3.util.OID;
 import org.greenstone.gsdl3.util.GSFile;
@@ -67,10 +66,6 @@
   // set this up during configure
   protected Element list_sets_response = null;
-  
-  protected Element meta_formats_definition = null;
-  protected HashMap<String, HashSet<String>> format_elements_map = null;
-  protected HashMap<String, Element> format_meta_elem_map = null;
-  
-  protected String index_stem = "";
+      
+  protected String index_stem = ""; // ****
   protected String infodb_type = "";
   
@@ -214,41 +209,11 @@
     Element metadata_message = doc.createElement(IIIFXML.METADATA);
 
-    // the <oai:dc namespace...> element
-    //Element prfx_str_elem = (Element)doc.importNode(this.format_meta_elem_map.get(prefix), true); 
-    //metadata.appendChild(prfx_str_elem);
-    
-    //Element meta_format_element = GSXML.getNamedElement(this.meta_formats_definition, OAIXML.METADATA_FORMAT, GSXML.NAME_ATT, prefix);
-    //NodeList elements = meta_format_element.getElementsByTagName(OAIXML.ELEMENT);
-    // for each element in the definition
-
     addFirstMetadata(metadata_message, "assocfilepath", info);
     addFirstMetadata(metadata_message, "Image", info);
-
-    /*	    
-    Set<String> keys = info.getKeys();
-    if (keys != null && keys.size()!=0) {
-	for (String metaname: keys) {
-	    addMetadata(metadata_message, metaname, info);
-	}
-    }
-    */
-    
-    /*
-    for (int i=0; i<elements.getLength(); i++) {
-      Element e = (Element)elements.item(i);
-
-      // look up the element name
-      //addMetadata(prfx_str_elem, e.getAttribute(GSXML.NAME_ATT), info);
-      addMetadata(metadata, e.getAttribute(GSXML.NAME_ATT), info);
-    }
-    */
-    
-    // output any metadata that is not just a simple mapping
-    //addCustomMetadata(prfx_str_elem, prefix, info); // ****
+    
     return metadata_message;
   }
 
   /** a simple addMetadata where we look for meta_name metadata, and add as that name*/
-
     
   protected void addFirstMetadata(Element meta_list_elem, String meta_name, DBInfo info) {
@@ -261,58 +226,4 @@
     
     
-  /** more complicated addMetadata - can add multiple items. */
-    /*
-  protected void addMetadata(Element meta_list_elem, String new_meta_name, String select_type, String name_list, DBInfo info) {
-    String[] names = name_list.split(",");
-    for (int i=0; i<names.length; i++) {
-      Vector<String> values;
-      // some special words
-      if (names[i].startsWith(OAIXML.GSF_LINK_PREFIX)) {
-	values = new Vector<String>();
-	String base_url = OAIXML.getBaseURL(); // e.g. e.g. http://host:port/greenstone3/oaiserver
-	String link_url = null;
-	if (names[i].equals(OAIXML.GSF_LINK_PREFIX+OAIXML.LINK_TYPE_DOCUMENT)) {
-	  link_url =  base_url.replace("oaiserver", "library") + "/collection/" + this.coll_name + "/document/" + info.getInfo("Identifier");
-	} else if (names[i].equals(OAIXML.GSF_LINK_PREFIX+OAIXML.LINK_TYPE_SOURCE)) {
-	  String srcfile = info.getInfo("srclinkFile");
-	  if (!srcfile.equals("")) {
-	    link_url = base_url.replace("oaiserver", "") + "sites/"
-		     + this.site_name 
-		     + "/collect/" + this.coll_name + "/index/assoc/" 
-		     + info.getInfo("assocfilepath") + "/" + srcfile;
-	  }
-	}
-	if (link_url !=null) {
-	  values.add(link_url);
-	}
-      } else {
-	values = info.getMultiInfo(names[i]);
-      }
-      if (values == null || values.size()==0) {
-	continue;
-      }
-      for (int j=0; j<values.size(); j++) {
-	addMetadataElement(meta_list_elem, new_meta_name, values.get(j));
-	if (select_type.equals(OAIXML.SELECT_SINGLE_VALUE)) {
-	  return; // only want to add one value
-	}
-      }
-      if (select_type.equals(OAIXML.SELECT_FIRST_VALID_META)) {
-	return; // we have added all values of this meta elem
-      }
-      // otherwise, we will keep going through the list and add them all.
-    }
-  }
-    */
-    
-  // specific metadata formats might need to do some custom metadata that is not
-  //just a standard mapping.
-    /*
-  protected void addCustomMetadata(Element meta_list_elem, String prefix, DBInfo info) {
-    
-
-  }
-    */
-    
   /** create the actual metadata element for the list */
 
@@ -331,5 +242,5 @@
 	
         Element identifier = doc.createElement(IIIFXML.IDENTIFIER);
-	GSXML.setNodeText(identifier, coll_name + ":" + oid);
+	GSXML.setNodeText(identifier, coll_name + ":" + oid); // **** OID
         header.appendChild(identifier);
 
Index: /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/util/IIIFXML.java
===================================================================
--- /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/util/IIIFXML.java	(revision 32882)
+++ /gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/util/IIIFXML.java	(revision 32883)
@@ -56,8 +56,10 @@
   // IIIF error codes
   public static final String ID_DOES_NOT_EXIST = "idDoesNotExist";
-
+  public static final String BAD_ARGUMENT      = "badArgument";
+  public static final String BAD_VERB          = "badVerb";
+    
   // General
   public static final String IIIF_PMH = "IIIF-PMH"; // ****
-    public static final String RESPONSE_DATE = "responseDate"; // ****
+    //public static final String RESPONSE_DATE = "responseDate"; // ****
   public static final String REQUEST = "request";
     
@@ -71,22 +73,13 @@
   public static final String METADATA = "metadata";
 
-    //public static final String OAIPMH = "OAIPMH"; // ****
-    
-    //public static final String OAI_SET_LIST = "oaiSetList"; // ****
-    //public static final String OAI_SERVICE_UNAVAILABLE = "OAI service unavailable";
-    public static final String OID = "OID"; // ****
+  public static final String OID = "OID"; // ****
     
   public static final String IIIF_SERVICE_RACK = "IIIFPMH";
-  //system-dependent file separator, maybe '/' or '\'
-  //public static final String FILE_SEPARATOR = File.separator;
-    //public static final String OAI_VERSION1 = "1.0";
-    //public static final String IIIF_VERSION2 = "2.1"; // ****
+
   /*************************above are final values****************************/
-    
-    
-  //initialized in getIIIFConfigXML()
+
   public static Element iiif_config_elem = null;
     
-    public static final String iiif_version = "2.1"; // ****
+  public static final String iiif_version = "2.1"; // ****
   public static String baseURL = "";
     
@@ -169,6 +162,4 @@
     GSXML.setNodeText(request_elem, baseURL);
       
-    //Node resp_date = GSXML.getChildByTagName(response, RESPONSE_DATE); // ****
-    
     return response;
   }
@@ -211,6 +202,6 @@
   }
 
-  // This is the response message sent when there's a request to activate/deactivate a non-OAI collection
-  // A request to activate a non-existent/non-OAI collection is not invalid, it's just that we won't process it.
+  // This is the response message sent when there's a request to activate/deactivate a non-IIIF collection
+  // A request to activate a non-existent/non-IIIF collection is not invalid, it's just that we won't process it.
   // So we still return status code OK (OK status code is needed for servercontrol.pm of activate.pl to recognise
   // that the command had been "successful" when it runs de/activate).
@@ -278,4 +269,5 @@
    *  escaped sequences (eg, '%3A'). 
    */
+    /*
     public static String iiifEncode(String original_str) { // ****
     logger.info("iiifEncode() " + original_str);      
@@ -287,36 +279,14 @@
     return original_str;  
   }
-
+    */
+    
   public static Element createResponseHeader(Document response_doc, String verb) {
-      //String tag_name = (iiif_version.equals(IIIF_VERSION2))? IIIF_PMH : verb; // ****
-      String tag_name = IIIF_PMH;
+    String tag_name = IIIF_PMH;
     Element iiif = response_doc.createElement(tag_name);
-    //Element resp_date = response_doc.createElement(RESPONSE_DATE); // ****
     Element req = response_doc.createElement(REQUEST);
-    //oai.appendChild(resp_date);
     iiif.appendChild(req);
 
     return iiif;
-  }
-
-    /*
-  public static Element createOAIIdentifierXML(Document doc, String repository_id, String sample_collection, String sample_doc_id) {
-    String xml = "<oai-identifier xmlns=\"http://www.openarchives.org/OAI/2.0/oai-identifier\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai-identifier\n http://www.openarchives.org/OAI/2.0/oai-identifier.xsd\">\n <scheme>oai</scheme>\n<repositoryIdentifier>" + repository_id + "</repositoryIdentifier>\n<delimiter>:</delimiter>\n<sampleIdentifier>oai:"+repository_id+":"+sample_collection+":"+sample_doc_id+"</sampleIdentifier>\n</oai-identifier>";
-
-    Document xml_doc = converter.getDOM(xml);
-    return (Element)doc.importNode(xml_doc.getDocumentElement(), true);
-    
-
-  }
-    */
-
-    /*
-  public static Element createGSDLElement(Document doc) {
-    String xml = "<gsdl xmlns=\"http://www.greenstone.org/namespace/gsdl_oaiinfo/1.0/gsdl_oaiinfo\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.greenstone.org/namespace/gsdl_oaiinfo/1.0/gsdl_oaiinfo\n   http://www.greenstone.org/namespace/gsdl_oaiinfo/1.0/gsdl_oaiinfo.xsd\"></gsdl>";
-    Document xml_doc = converter.getDOM(xml);
-    return (Element)doc.importNode(xml_doc.getDocumentElement(), true);    
-  }
-    */
-    
+  }    
 }
 
