- Timestamp:
- 2014-04-10T14:39:33+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ServiceUtil.java
r25635 r28966 8 8 import org.apache.log4j.Logger; 9 9 import org.greenstone.gsdl3.util.GSXML; 10 import org.greenstone.gsdl3.util.XMLConverter; 11 12 import org.w3c.dom.Document; 10 13 import org.w3c.dom.Element; 11 14 … … 34 37 for (int i = 0; i < services.length; i++) 35 38 { 36 Element service = this.d oc.createElement(GSXML.SERVICE_ELEM);39 Element service = this.desc_doc.createElement(GSXML.SERVICE_ELEM); 37 40 service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 38 41 service.setAttribute(GSXML.NAME_ATT, services[i]); … … 43 46 } 44 47 45 protected Element getServiceDescription( String service_id, String lang, String subset)48 protected Element getServiceDescription(Document doc, String service_id, String lang, String subset) 46 49 { 47 50 for (int i = 0; i < services.length; i++) … … 49 52 if (service_id.equals(services[i])) 50 53 { 51 Element service_elem = this.doc.createElement(GSXML.SERVICE_ELEM);54 Element service_elem = doc.createElement(GSXML.SERVICE_ELEM); 52 55 service_elem.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 53 56 service_elem.setAttribute(GSXML.NAME_ATT, services[i]); … … 61 64 protected Element processGetAllImagesInCollection(Element request) 62 65 { 63 Element result = GSXML.createBasicResponse(this.doc, GET_ALL_IMAGES_IN_COLLECTION); 66 Document result_doc = XMLConverter.newDOM(); 67 Element result = GSXML.createBasicResponse(result_doc, GET_ALL_IMAGES_IN_COLLECTION); 64 68 65 69 if (request == null) 66 70 { 67 GSXML.addError( this.doc,result, GET_ALL_IMAGES_IN_COLLECTION + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);71 GSXML.addError(result, GET_ALL_IMAGES_IN_COLLECTION + ": Request is null", GSXML.ERROR_TYPE_SYNTAX); 68 72 return result; 69 73 } … … 76 80 77 81 if (param_list == null) { 78 GSXML.addError( this.doc,result, GET_ALL_IMAGES_IN_COLLECTION + ": No param list specified", GSXML.ERROR_TYPE_SYNTAX);82 GSXML.addError(result, GET_ALL_IMAGES_IN_COLLECTION + ": No param list specified", GSXML.ERROR_TYPE_SYNTAX); 79 83 return result; // Return the empty result 80 84 } … … 85 89 if(regex == null) 86 90 { 87 GSXML.addError( this.doc,result, GET_ALL_IMAGES_IN_COLLECTION + ": No file name extensions specified", GSXML.ERROR_TYPE_SYNTAX);91 GSXML.addError(result, GET_ALL_IMAGES_IN_COLLECTION + ": No file name extensions specified", GSXML.ERROR_TYPE_SYNTAX); 88 92 return result; 89 93 } … … 93 97 if(collection == null) 94 98 { 95 GSXML.addError( this.doc,result, GET_ALL_IMAGES_IN_COLLECTION + ": No collection specified", GSXML.ERROR_TYPE_SYNTAX);99 GSXML.addError(result, GET_ALL_IMAGES_IN_COLLECTION + ": No collection specified", GSXML.ERROR_TYPE_SYNTAX); 96 100 return result; 97 101 } … … 101 105 getImagesRecursive(indexDir, regex, images); 102 106 103 Element imageListElem = this.doc.createElement("imageList");107 Element imageListElem = result_doc.createElement("imageList"); 104 108 result.appendChild(imageListElem); 105 109 for(String i : images) 106 110 { 107 Element imageElem = this.doc.createElement("image");108 imageElem.appendChild( this.doc.createTextNode(i));111 Element imageElem = result_doc.createElement("image"); 112 imageElem.appendChild(result_doc.createTextNode(i)); 109 113 imageListElem.appendChild(imageElem); 110 114 }
Note:
See TracChangeset
for help on using the changeset viewer.