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 32860)
+++ gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/service/IIIFPMH.java	(revision 32874)
@@ -23,5 +23,5 @@
 import org.greenstone.gsdl3.util.GSXML;
 import org.greenstone.gsdl3.util.IIIFXML;
-import org.greenstone.gsdl3.util.OAIXML; // ****
+//import org.greenstone.gsdl3.util.OAIXML; // ****
 import org.greenstone.gsdl3.util.OID;
 import org.greenstone.gsdl3.util.GSFile;
@@ -70,5 +70,4 @@
   protected Element meta_formats_definition = null;
   protected HashMap<String, HashSet<String>> format_elements_map = null;
-  protected HashMap<String, Element> format_response_map = null;
   protected HashMap<String, Element> format_meta_elem_map = null;
   
@@ -134,5 +133,5 @@
     Element get_record = this.desc_doc.createElement(GSXML.SERVICE_ELEM);
     get_record.setAttribute(GSXML.NAME_ATT, IIIFXML.GET_RECORD);
-    get_record.setAttribute(GSXML.TYPE_ATT, "oai");
+    get_record.setAttribute(GSXML.TYPE_ATT, "iiif");
     this.short_service_info.appendChild(get_record);
     
@@ -165,5 +164,5 @@
       Element get_record = doc.createElement(GSXML.SERVICE_ELEM);
       get_record.setAttribute(GSXML.NAME_ATT, IIIFXML.GET_RECORD);
-      get_record.setAttribute(GSXML.TYPE_ATT, "oai");
+      get_record.setAttribute(GSXML.TYPE_ATT, "iiif");
       return get_record;
     }
@@ -172,9 +171,8 @@
   }
     
-  /** returns the actual record element used in the OAI GetRecord response */
+  /** returns the actual record element used in the IIIF GetRecord response */
   protected Element processGetRecord(Element req) {
     /** arguments:
         identifier: required
-        metadataPrefix: required
      *  Exceptions: badArgument; cannotDisseminateFormat; idDoesNotExist
      */ 
@@ -182,29 +180,14 @@
     HashMap<String, String> param_map = GSXML.getParamMap(params);    
     
-    String prefix = param_map.get(OAIXML.METADATA_PREFIX);
-    if (prefix == null || prefix.equals("")) {
-      //Just a double-check
-      logger.error("the value of metadataPrefix att is not present in the request.");
-      return IIIFXML.createErrorResponse(OAIXML.CANNOT_DISSEMINATE_FORMAT, "");
-    }
-    
-    // check that we support this format
-    if (!format_response_map.containsKey(prefix)) {
-      logger.error("metadata prefix is not supported for collection "+this.coll_name);
-      return IIIFXML.createErrorResponse(OAIXML.CANNOT_DISSEMINATE_FORMAT, "");
-    }
-
     Document doc = XMLConverter.newDOM();
     
     String oid = param_map.get(IIIFXML.OID); // TODO should this be identifier???
     
-    //get a DBInfo object of the identifier; if this identifier is not present in the database,
+    // Get a DBInfo object of the identifier; if this identifier is not present in the database,
     // null is returned.
     DBInfo info = this.coll_db.getInfo(oid);
     if (info == null) {
-	//if(!OID_is_deleted) { // we don't expect to find entries for deleted docs in index db. // ****
-	    logger.error("OID: " + oid + " is not present in the collection index database.");
-	    return IIIFXML.createErrorResponse(IIIFXML.ID_DOES_NOT_EXIST, "");
-	    //} // if doc deleted, id missing in indexdb is not an error: doc id would exist only in oai-inf db, marked as deleted 'D' // ****
+	logger.error("OID: " + oid + " is not present in the collection index database.");
+	return IIIFXML.createErrorResponse(IIIFXML.ID_DOES_NOT_EXIST, "");
     }
 
@@ -218,5 +201,5 @@
     record.appendChild(createHeaderElement(doc, oid));      
     //compose the metadata element
-    record.appendChild(createMetadataElement(doc, prefix, info));
+    record.appendChild(createMetadataElement(doc, info));
     get_record.appendChild(record);
     return get_record_response;
@@ -224,46 +207,60 @@
 
     
- /** create the metadata element used when processing ListRecords/GetRecord requests
+ /** create the metadata element used when processing GetRecord request
    */
 
-  protected Element createMetadataElement(Document doc, String prefix, DBInfo info) {
+  protected Element createMetadataElement(Document doc, DBInfo info) {
     // the <metadata> element
-    Element metadata = doc.createElement(OAIXML.METADATA);
+    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);
+    //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);
-      Element map = (Element)GSXML.getChildByTagName(e, OAIXML.MAPPING);
-      if (map == null) {
-	// look up the element name
-	addMetadata(prfx_str_elem, e.getAttribute(GSXML.NAME_ATT), info);
-      } else {
-	// we go though the list of names in the mapping
-	addMetadata(prfx_str_elem, e.getAttribute(GSXML.NAME_ATT), map.getAttribute(OAIXML.SELECT), map.getAttribute(OAIXML.ELEMENTS), info);
-      }
-    }
+
+      // 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;
+    //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 addMetadata(Element meta_list_elem, String meta_name, DBInfo info) {
-    Vector<String> values = info.getMultiInfo(meta_name);
-    if (values != null && values.size()!=0) {
-      for (int i=0; i<values.size(); i++) {
-	addMetadataElement(meta_list_elem, meta_name, values.get(i));
-      }
-    }
-  }
-
+    
+  protected void addFirstMetadata(Element meta_list_elem, String meta_name, DBInfo info) {
+      Vector<String> values = info.getMultiInfo(meta_name);
+      if (values != null && values.size()>0) {
+	  addMetadataElement(meta_list_elem, meta_name, values.get(0));
+	  
+      }
+  }
+    
+    
   /** 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(",");
@@ -307,12 +304,15 @@
     }
   }
-  
+    */
+    
   // 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 */
 
@@ -328,5 +328,5 @@
   protected Element createHeaderElement(Document doc, String oid) {
 
-        Element header = doc.createElement(OAIXML.HEADER);
+        Element header = doc.createElement(IIIFXML.HEADER);
 	
         Element identifier = doc.createElement(IIIFXML.IDENTIFIER);
