Changeset 3971
- Timestamp:
- 2003-03-25T09:46:40+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r3943 r3971 123 123 description_ = doc_.createElement(GSXML.RESPONSE_ELEM); 124 124 description_.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 125 description_.setAttribute(GSXML.FROM_ATT, ""); 125 126 collection_list_ = doc_.createElement(GSXML.COLLECTION_ELEM+GSXML.LIST_MODIFIER); 126 127 cluster_list_ = doc_.createElement(GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER); … … 186 187 */ 187 188 public Element process(Element message) { 188 189 189 190 // check that its a correct message tag 190 191 if (!message.getTagName().equals(GSXML.MESSAGE_ELEM)) { … … 236 237 237 238 } // for each request 238 239 239 240 return mainResult; 240 241 … … 518 519 String type = req.getAttribute(GSXML.TYPE_ATT); 519 520 Element response = doc_.createElement(GSXML.RESPONSE_ELEM); 520 521 response.setAttribute(GSXML.FROM_ATT, ""); 521 522 if (type.equals(GSXML.REQUEST_TYPE_DESCRIBE)) { 522 String info = req.getAttribute(GSXML.INFO_ATT); 523 if (info.equals("")) { 524 // return full description 525 return description_; 526 } 523 // check the param list 524 Element param_list = (Element) GSXML.getChildByTagName(req, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 525 if (param_list == null) { 526 // no params - just return teh full description 527 return description_; // this is already in a response elem 528 } 529 System.out.println("poarams found, getting subset"); 527 530 // use the new response with the appropriate info 528 531 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 529 532 530 if (info.equals(GSXML.COLLECTION_ELEM+GSXML.LIST_MODIFIER)) { 531 response.appendChild(collection_list_); 532 return response; 533 } else if (info.equals(GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER)) { 534 response.appendChild(cluster_list_); 535 return response; 536 } else if (info.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) { 537 response.appendChild(service_list_); 538 return response; 539 } else if (info.equals(GSXML.SITE_ELEM+GSXML.LIST_MODIFIER)) { 540 response.appendChild(site_list_); 541 return response; 542 } 543 533 // go through the param list and see what components are wanted 534 Element param = (Element) param_list.getFirstChild(); 535 while (param != null) { 536 if (!param.getNodeName().equals(GSXML.PARAM_ELEM)) { 537 System.err.println("Warning: Non-param in paramList (ignored)."); 538 continue; 539 } 540 // Identify the structure information desired 541 if (param.getAttribute(GSXML.NAME_ATT) == GSXML.INFO_PARAM ) { 542 String info = param.getAttribute(GSXML.VALUE_ATT); 543 if (info.equals(GSXML.COLLECTION_ELEM+GSXML.LIST_MODIFIER)) { 544 response.appendChild(collection_list_); 545 546 } else if (info.equals(GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER)) { 547 response.appendChild(cluster_list_); 548 549 } else if (info.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) { 550 return response; 551 } else if (info.equals(GSXML.SITE_ELEM+GSXML.LIST_MODIFIER)) { 552 response.appendChild(site_list_); 553 } 554 } 555 param = (Element)param.getNextSibling(); 556 } 557 return response; 558 544 559 } else if (type.equals(GSXML.REQUEST_TYPE_CONFIGURE)) { 545 560
Note:
See TracChangeset
for help on using the changeset viewer.