Changeset 3866
- Timestamp:
- 2003-03-12T16:29:43+13:00 (21 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/service
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Browse.java
r3851 r3866 94 94 result.setAttribute(GSXML.FROM_ATT, from); 95 95 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 96 Element result_content = doc_.createElement(GSXML.CONTENT_ELEM);97 result.appendChild(result_content);98 96 99 97 // get the classifier name out of request content - assume only one for now 100 String path = GSXML.CONTENT_ELEM;101 path = GSPath.appendLink(path, GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER);102 path = GSPath.appendLink(path, GSXML.DOCUMENT_ELEM);98 //String path = GSXML.CONTENT_ELEM; 99 String path = GSPath.appendLink(GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER, GSXML.CLASS_NODE_ELEM); 100 //path = GSPath.appendLink(path, GSXML.DOCUMENT_ELEM); 103 101 104 102 Element elem = (Element)GSXML.getNodeByPath(request, path); 105 String elem_name = elem.getAttribute(GSXML. NAME_ATT);103 String elem_name = elem.getAttribute(GSXML.CLASS_NODE_ID_ATT); 106 104 107 105 if (OID.needsTranslating(elem_name)) { … … 116 114 String classifier_name = OID.getTop(elem_name); 117 115 classifier.setAttribute(GSXML.NAME_ATT, classifier_name); 118 result _content.appendChild(classifier);116 result.appendChild(classifier); 119 117 120 118 // see if there is a stylesheet associated with this classifier … … 130 128 // add it to the result if the result isnt null 131 129 if (cl_format!=null) { 132 System.out.println("adding format info to browse result!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");133 130 result.appendChild(doc_.importNode(cl_format, true)); 134 131 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Retrieve.java
r3819 r3866 63 63 System.out.println("Configuring GS2Retrieve..."); 64 64 65 // these entries should reflect the build config file66 // some services may not be available depending on how the colleciton was built.67 65 // set up short_service_info_ - for now just has name and type 68 66 Element dsr_service = doc_.createElement(GSXML.SERVICE_ELEM); … … 170 168 result.setAttribute(GSXML.FROM_ATT, from); 171 169 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 172 Element result_content = doc_.createElement(GSXML.CONTENT_ELEM);173 result.appendChild(result_content);170 //Element result_content = doc_.createElement(GSXML.CONTENT_ELEM); 171 //result.appendChild(result_content); 174 172 175 173 // Get the parameters of the request … … 224 222 wantChildren = false; 225 223 226 // Get the request content 227 Element content = (Element) GSXML.getChildByTagName(request, GSXML.CONTENT_ELEM); 228 if (content == null) { 229 System.err.println("Error: DocumentStructureRetrieve request had no content."); 224 // // Get the request content 225 // Element content = (Element) GSXML.getChildByTagName(request, GSXML.CONTENT_ELEM); 226 // if (content == null) { 227 // System.err.println("Error: DocumentStructureRetrieve request had no content."); 228 // return result; 229 // } 230 231 Element query_doc_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 232 if (query_doc_list == null) { 233 System.err.println("Error: DocumentStructureRetrieve request specified no doc nodes.\n"); 230 234 return result; 231 235 } 232 236 233 Element doc_list = doc_.createElement(GSXML.DOC UMENT_ELEM+GSXML.LIST_MODIFIER);234 result _content.appendChild(doc_list);237 Element doc_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 238 result.appendChild(doc_list); 235 239 236 240 // Get the documents 237 String[] doc_ids = GSXML.getDocumentNameList(content); 241 String[] doc_ids = GSXML.getAttributeValuesFromList(query_doc_list, 242 GSXML.DOC_NODE_ID_ATT); 238 243 for (int i = 0; i < doc_ids.length; i++) { 239 244 String doc_id = doc_ids[i]; 240 245 241 246 // Add the document to the list 242 // !! TO DO: This should probably be a documentNode rather than a document !! 243 Element doc = doc_.createElement(GSXML.DOCUMENT_ELEM); 247 Element doc = doc_.createElement(GSXML.DOC_NODE_ELEM); 244 248 doc_list.appendChild(doc); 245 doc.setAttribute(GSXML.NAME_ATT, doc_id); 246 249 doc.setAttribute(GSXML.DOC_NODE_ID_ATT, doc_id); 250 // all structure info goes into a docNodestructure elem 251 Element structure_elem = doc_.createElement(GSXML.DOC_NODE_STRUCTURE_ELEM); 252 doc.appendChild(structure_elem); 247 253 // Add the requested structure information 248 254 Element current = doc_.createElement(GSXML.DOC_NODE_ELEM); … … 297 303 root = (Element) root.getParentNode(); 298 304 } 299 doc.appendChild(root);305 structure_elem.appendChild(root); 300 306 } 301 307 … … 312 318 result.setAttribute(GSXML.FROM_ATT, from); 313 319 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 314 Element result_content = doc_.createElement(GSXML.CONTENT_ELEM);315 result.appendChild(result_content);320 //Element result_content = doc_.createElement(GSXML.CONTENT_ELEM); 321 //result.appendChild(result_content); 316 322 317 323 // Get the parameters of the request … … 344 350 345 351 // Get the request content 346 Element content = (Element) GSXML.getChildByTagName(request, GSXML.CONTENT_ELEM); 347 if (content == null) { 348 System.err.println("Error: DocumentMetadataRetrieve request had no content.\n"); 349 return result; 350 } 351 352 Element doc_list = doc_.createElement(GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER); 353 result_content.appendChild(doc_list); 352 // Element content = (Element) GSXML.getChildByTagName(request, GSXML.CONTENT_ELEM); 353 // if (content == null) { 354 // System.err.println("Error: DocumentMetadataRetrieve request had no content.\n"); 355 // return result; 356 // } 357 358 Element doc_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 359 //result_content.appendChild(doc_list); 360 result.appendChild(doc_list); 354 361 355 362 // Get the documents 356 Element request_doc_list = (Element) GSXML.getChildByTagName(content, GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER); 363 //Element request_doc_list = (Element) GSXML.getChildByTagName(content, GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER); 364 Element request_doc_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 365 if (request_doc_list == null) { 366 System.err.println("Error: DocumentMetadataRetrieve request had no documentList.\n"); 367 return result; 368 } 357 369 NodeList request_docs = request_doc_list.getChildNodes(); 358 370 for (int i = 0; i < request_docs.getLength(); i++) { … … 369 381 370 382 // Add the requested metadata information 371 Element doc_meta_list = GSXML.addMetaList(doc_, doc_node); 383 Element doc_meta_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 384 doc_node.appendChild(doc_meta_list); 372 385 DBInfo info = gdbm_src_.getInfo(doc_id); 373 386 for (int m = 0; m < metadata_list.size(); m++) {
Note:
See TracChangeset
for help on using the changeset viewer.