Changeset 5098
- Timestamp:
- 2003-08-06T12:02:10+12:00 (21 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/service
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java
r4979 r5098 61 61 protected static final String ANNOTATION_TYPE_PARAM = "annotationType"; 62 62 63 protected Element config_info _= null;64 65 protected CorpusController application _;66 67 protected Corpus corpus _;68 69 protected String[] annotation_types _= { "Date", "Location",63 protected Element config_info = null; 64 65 protected CorpusController application; 66 67 protected Corpus corpus; 68 69 protected String[] annotation_types = { "Date", "Location", 70 70 "Organization", "Person" }; 71 71 // Address, … … 81 81 { 82 82 System.out.println("Configuring GATEServices..."); 83 config_info_= info;83 this.config_info = info; 84 84 85 85 // set up short_service_info_ - for now just has name and type 86 Element tag_service = doc_.createElement(GSXML.SERVICE_ELEM);86 Element tag_service = this.doc.createElement(GSXML.SERVICE_ELEM); 87 87 tag_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_ENRICH); 88 88 tag_service.setAttribute(GSXML.NAME_ATT, GATE_POS_TAG_SERVICE); 89 short_service_info_.appendChild(tag_service);89 this.short_service_info.appendChild(tag_service); 90 90 91 91 … … 103 103 URL applicationFileURL = ClassLoader.getSystemResource("gate.app"); 104 104 File applicationFile = new File(applicationFileURL.getFile()); 105 application_= (CorpusController) PersistenceManager.loadObjectFromFile(applicationFile);105 this.application = (CorpusController) PersistenceManager.loadObjectFromFile(applicationFile); 106 106 107 107 /* Collection processing_resources = application.getPRs(); … … 118 118 119 119 // Create a new corpus 120 corpus_= Factory.newCorpus("GSDL3 Corpus");121 application_.setCorpus(corpus_);120 this.corpus = Factory.newCorpus("GSDL3 Corpus"); 121 this.application.setCorpus(this.corpus); 122 122 } 123 123 catch (Exception e) { … … 133 133 return null; 134 134 } 135 Element tag_service = doc_.createElement(GSXML.SERVICE_ELEM);135 Element tag_service = this.doc.createElement(GSXML.SERVICE_ELEM); 136 136 tag_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_ENRICH); 137 137 tag_service.setAttribute(GSXML.NAME_ATT, GATE_POS_TAG_SERVICE); 138 tag_service.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_NAME, getTextString(service+".name", lang)));139 tag_service.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(service+".submit", lang)));140 Element param_list = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);138 tag_service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, getTextString(service+".name", lang))); 139 tag_service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(service+".submit", lang))); 140 Element param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 141 141 createParameter(ANNOTATION_TYPE_PARAM, param_list, lang); 142 142 tag_service.appendChild(param_list); … … 153 153 154 154 if (name.equals(ANNOTATION_TYPE_PARAM)) { 155 int len = annotation_types_.length;155 int len = this.annotation_types.length; 156 156 String[] annotation_type_names = new String[len]; 157 157 for (int i = 0; i < len; i++) { 158 annotation_type_names[i] = getTextString("param." + name + "." + annotation_types_[i], lang);158 annotation_type_names[i] = getTextString("param." + name + "." + this.annotation_types[i], lang); 159 159 } 160 160 161 param = GSXML.createParameterDescription( doc_, name, getTextString("param." + name, lang), GSXML.PARAM_TYPE_ENUM_MULTI, annotation_types_[0], annotation_types_, annotation_type_names);161 param = GSXML.createParameterDescription(this.doc, name, getTextString("param." + name, lang), GSXML.PARAM_TYPE_ENUM_MULTI, this.annotation_types[0], this.annotation_types, annotation_type_names); 162 162 param_list.appendChild(param); 163 163 } … … 171 171 172 172 // Create a new (empty) result message 173 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);173 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 174 174 result.setAttribute(GSXML.FROM_ATT, GATE_POS_TAG_SERVICE); 175 175 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); … … 222 222 223 223 annotated_text = "<nodeContent>" + annotated_text + "</nodeContent>"; 224 Element annotated_content = converter_.getDOM(annotated_text).getDocumentElement();224 Element annotated_content = this.converter.getDOM(annotated_text).getDocumentElement(); 225 225 doc_node.replaceChild(doc_node.getOwnerDocument().importNode(annotated_content, true), content); 226 226 } 227 227 228 result.appendChild( doc_.importNode(doc_node_list, true));228 result.appendChild(this.doc.importNode(doc_node_list, true)); 229 229 // System.out.println("GatePOSTag result:\n" + converter_.getPrettyString(result)); 230 230 return result; … … 245 245 246 246 // Add it to the corpus 247 corpus_.clear();248 corpus_.add(doc);247 this.corpus.clear(); 248 this.corpus.add(doc); 249 249 250 250 // Process the corpus 251 application_.execute();251 this.application.execute(); 252 252 253 253 // Extract all the annotations -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
r4903 r5098 67 67 68 68 // the list of the collections - store between some method calls 69 private String[] collection_list _= null;69 private String[] collection_list = null; 70 70 71 71 // set of listeners for any construction commands 72 protected Map listeners _= null;72 protected Map listeners = null; 73 73 74 74 public GS2Construct() { 75 listeners_= Collections.synchronizedMap(new HashMap());75 this.listeners = Collections.synchronizedMap(new HashMap()); 76 76 77 77 } … … 80 80 protected Element getServiceDescription(String service, String lang) { 81 81 82 Element description = doc_.createElement(GSXML.SERVICE_ELEM);82 Element description = this.doc.createElement(GSXML.SERVICE_ELEM); 83 83 description.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 84 84 description.setAttribute(GSXML.NAME_ATT, service); 85 description.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_NAME, getTextString(service+".name", lang)));86 description.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(service+".submit", lang)));87 88 Element param_list = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);85 description.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, getTextString(service+".name", lang))); 86 description.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(service+".submit", lang))); 87 88 Element param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 89 89 description.appendChild(param_list); 90 90 91 91 if (service.equals(NEW_SERVICE)) { 92 92 93 Element param = GSXML.createParameterDescription( doc_, NEW_COL_TITLE_PARAM, getTextString("param."+NEW_COL_TITLE_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null);94 param_list.appendChild(param); 95 param = GSXML.createParameterDescription( doc_, CREATOR_PARAM, getTextString("param."+CREATOR_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null);96 param_list.appendChild(param); 97 param = GSXML.createParameterDescription( doc_, NEW_COL_ABOUT_PARAM, getTextString("param."+NEW_COL_ABOUT_PARAM, lang), GSXML.PARAM_TYPE_TEXT, null, null, null);93 Element param = GSXML.createParameterDescription(this.doc, NEW_COL_TITLE_PARAM, getTextString("param."+NEW_COL_TITLE_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null); 94 param_list.appendChild(param); 95 param = GSXML.createParameterDescription(this.doc, CREATOR_PARAM, getTextString("param."+CREATOR_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null); 96 param_list.appendChild(param); 97 param = GSXML.createParameterDescription(this.doc, NEW_COL_ABOUT_PARAM, getTextString("param."+NEW_COL_ABOUT_PARAM, lang), GSXML.PARAM_TYPE_TEXT, null, null, null); 98 98 param_list.appendChild(param); 99 99 String[] types = {BUILDTYPE_MGPP, BUILDTYPE_MG}; 100 100 String[] type_texts = {getTextString("param."+BUILDTYPE_PARAM+"."+BUILDTYPE_MGPP, lang), getTextString("param."+BUILDTYPE_PARAM+"."+BUILDTYPE_MG, lang)}; 101 101 102 param = GSXML.createParameterDescription( doc_, BUILDTYPE_PARAM, getTextString("param."+BUILDTYPE_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, BUILDTYPE_MGPP, types, type_texts);102 param = GSXML.createParameterDescription(this.doc, BUILDTYPE_PARAM, getTextString("param."+BUILDTYPE_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, BUILDTYPE_MGPP, types, type_texts); 103 103 param_list.appendChild(param); 104 104 return description; … … 108 108 if (service.equals(ACTIVATE_SERVICE) || service.equals(IMPORT_SERVICE) || service.equals(BUILD_SERVICE) || service.equals(RELOAD_SERVICE) || service.equals(DELETE_SERVICE)) { 109 109 110 collection_list_= getCollectionList();111 Element param = GSXML.createParameterDescription( doc_, COL_PARAM, getTextString("param."+COL_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, null, collection_list_, collection_list_);110 this.collection_list = getCollectionList(); 111 Element param = GSXML.createParameterDescription(this.doc, COL_PARAM, getTextString("param."+COL_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, null, this.collection_list, this.collection_list); 112 112 param_list.appendChild(param); 113 113 … … 129 129 // decode the file name, add it to the import directory 130 130 String name = GSPath.getFirstLink(request.getAttribute(GSXML.TO_ATT)); 131 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);131 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 132 132 response.setAttribute(GSXML.FROM_ATT, name); 133 Element status = doc_.createElement(GSXML.STATUS_ELEM);133 Element status = this.doc.createElement(GSXML.STATUS_ELEM); 134 134 response.appendChild(status); 135 135 //String lang = request.getAttribute(GSXML.LANG_ATT); 136 136 //String request_type = request.getAttribute(GSXML.TYPE_ATT); 137 Text t = doc_.createTextNode("AddDocument: not implemented yet");137 Text t = this.doc.createTextNode("AddDocument: not implemented yet"); 138 138 status.appendChild(t); 139 139 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); … … 164 164 } 165 165 String id = status.getAttribute(GSXML.STATUS_PROCESS_ID_ATT); 166 GS2PerlListener listener = (GS2PerlListener) listeners_.get(id);166 GS2PerlListener listener = (GS2PerlListener)this.listeners.get(id); 167 167 if (listener==null) { 168 168 System.err.println("somethings gone wrong, couldn't find the listener"); … … 181 181 182 182 // add the rest of the messages to the status node 183 Text t = doc_.createTextNode("\n"+listener.getUpdate());183 Text t = this.doc.createTextNode("\n"+listener.getUpdate()); 184 184 status.appendChild(t); 185 185 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(listener.getStatus())); … … 188 188 } 189 189 190 t = doc_.createTextNode("\n");190 t = this.doc.createTextNode("\n"); 191 191 status.appendChild(t); 192 192 // once have got here, we assume … … 200 200 // the response to send back 201 201 String name = GSPath.getFirstLink(request.getAttribute(GSXML.TO_ATT)); 202 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);202 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 203 203 response.setAttribute(GSXML.FROM_ATT, name); 204 Element status = doc_.createElement(GSXML.STATUS_ELEM);204 Element status = this.doc.createElement(GSXML.STATUS_ELEM); 205 205 response.appendChild(status); 206 206 Text t = null; // the text node for the error/success message … … 225 225 String coll_name = (String)params.get(COL_PARAM); 226 226 String[] args={coll_name}; 227 File coll_dir = new File(GSFile.collectionBaseDir( site_home_, coll_name));227 File coll_dir = new File(GSFile.collectionBaseDir(this.site_home, coll_name)); 228 228 // check that the coll is there in the first place 229 229 if (!coll_dir.exists()) { 230 t = doc_.createTextNode(getTextString("delete.exists_error", args, lang));230 t = this.doc.createTextNode(getTextString("delete.exists_error", args, lang)); 231 231 status.appendChild(t); 232 232 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); … … 236 236 // try to delete the directory 237 237 if (!GSFile.deleteFile(coll_dir)) { 238 t = doc_.createTextNode(getTextString("delete.delete_error", args, lang));238 t = this.doc.createTextNode(getTextString("delete.delete_error", args, lang)); 239 239 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 240 240 status.appendChild(t); … … 249 249 // the response to send back 250 250 String name = GSPath.getFirstLink(request.getAttribute(GSXML.TO_ATT)); 251 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);251 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 252 252 response.setAttribute(GSXML.FROM_ATT, name); 253 Element status = doc_.createElement(GSXML.STATUS_ELEM);253 Element status = this.doc.createElement(GSXML.STATUS_ELEM); 254 254 response.appendChild(status); 255 255 Text t = null; // the text node for the error/success message … … 287 287 288 288 // send the request to the MR 289 Element message = doc_.createElement(GSXML.MESSAGE_ELEM);290 Element request = doc_.createElement(GSXML.REQUEST_ELEM);289 Element message = this.doc.createElement(GSXML.MESSAGE_ELEM); 290 Element request = this.doc.createElement(GSXML.REQUEST_ELEM); 291 291 request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_CONFIGURE); 292 292 request.setAttribute(GSXML.TO_ATT, ""); 293 293 message.appendChild(request); 294 Element command = doc_.createElement(GSXML.CONFIGURE_ELEM);294 Element command = this.doc.createElement(GSXML.CONFIGURE_ELEM); 295 295 command.setAttribute(GSXML.TYPE_ATT, GSXML.COLLECTION_ELEM); 296 296 command.setAttribute(GSXML.NAME_ATT, coll_name); … … 304 304 } 305 305 request.appendChild(command); 306 Element response = router_.process(message); // at the moment, get no info in response so ignore it306 Element response = this.router.process(message); // at the moment, get no info in response so ignore it 307 307 Text t; 308 308 String[] args={coll_name}; 309 309 310 310 if (response == null) { 311 t = doc_.createTextNode(getTextString(action_name+".configure_error", args , lang));311 t = this.doc.createTextNode(getTextString(action_name+".configure_error", args , lang)); 312 312 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 313 313 status.appendChild(t); … … 316 316 317 317 // if we got here, we have succeeded! 318 t = doc_.createTextNode(getTextString(action_name+".success", args, lang));318 t = this.doc.createTextNode(getTextString(action_name+".success", args, lang)); 319 319 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.SUCCESS)); 320 320 status.appendChild(t); … … 333 333 // set up short_service_info_ - for now just has name and type 334 334 335 e = doc_.createElement(GSXML.SERVICE_ELEM);335 e = this.doc.createElement(GSXML.SERVICE_ELEM); 336 336 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 337 337 e.setAttribute(GSXML.NAME_ATT, NEW_SERVICE); 338 short_service_info_.appendChild(e);339 340 e = doc_.createElement(GSXML.SERVICE_ELEM);338 this.short_service_info.appendChild(e); 339 340 e = this.doc.createElement(GSXML.SERVICE_ELEM); 341 341 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 342 342 e.setAttribute(GSXML.NAME_ATT, IMPORT_SERVICE); 343 short_service_info_.appendChild(e);344 345 e = doc_.createElement(GSXML.SERVICE_ELEM);343 this.short_service_info.appendChild(e); 344 345 e = this.doc.createElement(GSXML.SERVICE_ELEM); 346 346 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 347 347 e.setAttribute(GSXML.NAME_ATT, BUILD_SERVICE); 348 short_service_info_.appendChild(e);349 350 e = doc_.createElement(GSXML.SERVICE_ELEM);348 this.short_service_info.appendChild(e); 349 350 e = this.doc.createElement(GSXML.SERVICE_ELEM); 351 351 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 352 352 e.setAttribute(GSXML.NAME_ATT, ACTIVATE_SERVICE); 353 short_service_info_.appendChild(e);354 355 e = doc_.createElement(GSXML.SERVICE_ELEM);353 this.short_service_info.appendChild(e); 354 355 e = this.doc.createElement(GSXML.SERVICE_ELEM); 356 356 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 357 357 e.setAttribute(GSXML.NAME_ATT, DELETE_SERVICE); 358 short_service_info_.appendChild(e);359 360 e = doc_.createElement(GSXML.SERVICE_ELEM);358 this.short_service_info.appendChild(e); 359 360 e = this.doc.createElement(GSXML.SERVICE_ELEM); 361 361 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 362 362 e.setAttribute(GSXML.NAME_ATT, RELOAD_SERVICE); 363 short_service_info_.appendChild(e);364 365 //e = doc_.createElement(GSXML.SERVICE_ELEM);363 this.short_service_info.appendChild(e); 364 365 //e = this.doc.createElement(GSXML.SERVICE_ELEM); 366 366 //e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS); 367 367 //e.setAttribute(GSXML.NAME_ATT, ADD_DOC_SERVICE); 368 // short_service_info_.appendChild(e);368 //this.short_service_info.appendChild(e); 369 369 370 370 … … 377 377 // the response to send back 378 378 String name = GSPath.getFirstLink(request.getAttribute(GSXML.TO_ATT)); 379 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);379 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 380 380 response.setAttribute(GSXML.FROM_ATT, name); 381 Element status = doc_.createElement(GSXML.STATUS_ELEM);381 Element status = this.doc.createElement(GSXML.STATUS_ELEM); 382 382 response.appendChild(status); 383 383 … … 397 397 String id = (String)params.get(PROCESS_ID_PARAM); 398 398 status.setAttribute(GSXML.STATUS_PROCESS_ID_ATT, id); 399 GS2PerlListener listener = (GS2PerlListener) listeners_.get(id);399 GS2PerlListener listener = (GS2PerlListener)this.listeners.get(id); 400 400 if (listener==null) { 401 Text t = doc_.createTextNode(getTextString("general.process_id_error", lang));401 Text t = this.doc.createTextNode(getTextString("general.process_id_error", lang)); 402 402 status.appendChild(t); 403 403 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 404 404 } else { 405 Text t = doc_.createTextNode(listener.getUpdate());405 Text t = this.doc.createTextNode(listener.getUpdate()); 406 406 status.appendChild(t); 407 407 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(listener.getStatus())); 408 408 // check that we actually should be removing the listener here 409 409 if (listener.isFinished()) { // remove this listener - its job is done 410 listeners_.remove(id); // not working410 this.listeners.remove(id); // not working 411 411 } 412 412 } … … 431 431 GS2PerlConstructor constructor = new GS2PerlConstructor("perl_build"); 432 432 if (!constructor.configure()) { 433 Text t = doc_.createTextNode(getTextString("general.configure_constructor_error", lang));433 Text t = this.doc.createTextNode(getTextString("general.configure_constructor_error", lang)); 434 434 status.appendChild(t); 435 435 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); … … 437 437 } 438 438 439 constructor.setSiteHome( site_home_);439 constructor.setSiteHome(this.site_home); 440 440 constructor.setCollectionName(coll_name); 441 441 constructor.setActionType(type); … … 447 447 448 448 String id = newID(); 449 listeners_.put(id, listener);449 this.listeners.put(id, listener); 450 450 451 451 status.setAttribute(GSXML.STATUS_PROCESS_ID_ATT, id); 452 452 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ACCEPTED)); 453 Text t = doc_.createTextNode(getTextString("general.process_start", lang));453 Text t = this.doc.createTextNode(getTextString("general.process_start", lang)); 454 454 status.appendChild(t); 455 455 return response; … … 465 465 protected String[] getCollectionList() { 466 466 467 File collectDir = new File(GSFile.collectDir( site_home_));467 File collectDir = new File(GSFile.collectDir(this.site_home)); 468 468 if (!collectDir.exists()) { 469 469 System.err.println("couldn't find collect dir: "+collectDir.toString()); … … 513 513 base_name = coll_title.substring(0,6); 514 514 } 515 File coll_dir = new File(GSFile.collectionBaseDir( site_home_, base_name));515 File coll_dir = new File(GSFile.collectionBaseDir(this.site_home, base_name)); 516 516 if (!coll_dir.exists()) { // this name is ok - not used yet 517 517 return base_name; … … 523 523 while(coll_dir.exists()) { 524 524 i++; 525 coll_dir = new File(GSFile.collectionBaseDir( site_home_, base_name+Integer.toString(i)));525 coll_dir = new File(GSFile.collectionBaseDir(this.site_home, base_name+Integer.toString(i))); 526 526 } 527 527 return base_name+Integer.toString(i); … … 534 534 protected Element extractOtherParams(HashMap params, int type) { 535 535 536 Element param_list = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);536 Element param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 537 537 if (type == GS2PerlConstructor.NEW) { 538 Element param = doc_.createElement(GSXML.PARAM_ELEM);538 Element param = this.doc.createElement(GSXML.PARAM_ELEM); 539 539 param.setAttribute(GSXML.NAME_ATT, "creator"); 540 540 param.setAttribute(GSXML.VALUE_ATT, (String)params.get(CREATOR_PARAM)); 541 541 542 542 param_list.appendChild(param); 543 param = doc_.createElement(GSXML.PARAM_ELEM);543 param = this.doc.createElement(GSXML.PARAM_ELEM); 544 544 param.setAttribute(GSXML.NAME_ATT, "about"); 545 545 param.setAttribute(GSXML.VALUE_ATT, (String)params.get(NEW_COL_ABOUT_PARAM)); 546 546 param_list.appendChild(param); 547 param = doc_.createElement(GSXML.PARAM_ELEM);547 param = this.doc.createElement(GSXML.PARAM_ELEM); 548 548 param.setAttribute(GSXML.NAME_ATT, "title"); 549 549 param.setAttribute(GSXML.VALUE_ATT, (String)params.get(NEW_COL_TITLE_PARAM)); 550 550 param_list.appendChild(param); 551 param = doc_.createElement(GSXML.PARAM_ELEM);551 param = this.doc.createElement(GSXML.PARAM_ELEM); 552 552 param.setAttribute(GSXML.NAME_ATT, "buildtype"); 553 553 param.setAttribute(GSXML.VALUE_ATT, (String)params.get(BUILDTYPE_PARAM)); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGPPRetrieve.java
r4222 r5098 47 47 private static final String DEFAULT_LEVEL_ELEM = "defaultLevel"; 48 48 49 private MGPPWrapper mgpp_src _= null;49 private MGPPWrapper mgpp_src = null; 50 50 51 private String default_level _= null;51 private String default_level = null; 52 52 53 53 … … 55 55 public GS2MGPPRetrieve() 56 56 { 57 mgpp_src_= new MGPPWrapper();57 this.mgpp_src = new MGPPWrapper(); 58 58 } 59 59 … … 68 68 Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_LEVEL_ELEM); 69 69 if (def != null) { 70 default_level_= def.getAttribute(GSXML.NAME_ATT);70 this.default_level = def.getAttribute(GSXML.NAME_ATT); 71 71 } 72 if ( default_level_ == null || default_level_.equals("")) {72 if (this.default_level == null || this.default_level.equals("")) { 73 73 System.err.println("Error: default level not specified!"); 74 74 return false; … … 85 85 { 86 86 // Create a new (empty) result message 87 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);87 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 88 88 result.setAttribute(GSXML.FROM_ATT,DOCUMENT_CONTENT_RETRIEVE_SERVICE ); 89 89 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); … … 99 99 } 100 100 101 Element doc_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);101 Element doc_list = this.doc.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 102 102 result.appendChild(doc_list); 103 103 104 104 // The location of the MGPP text files 105 String textdir = GSFile.collectionBaseDir( site_home_, cluster_name_) +106 File.separatorChar + GSFile.collectionTextPath( cluster_name_);105 String textdir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + 106 File.separatorChar + GSFile.collectionTextPath(this.cluster_name); 107 107 108 108 // Get the documents … … 113 113 114 114 if (OID.needsTranslating(doc_id)) { 115 doc_id = gdbm_src_.translateOID(doc_id);115 doc_id = this.gdbm_src.translateOID(doc_id); 116 116 } 117 117 118 long doc_num = gdbm_src_.oid2Docnum(doc_id);119 String doc_content = mgpp_src_.getDocument(textdir, default_level_, doc_num);118 long doc_num = this.gdbm_src.oid2Docnum(doc_id); 119 String doc_content = this.mgpp_src.getDocument(textdir, this.default_level, doc_num); 120 120 doc_content = resolveImages(doc_content, doc_id); 121 121 122 122 // For now, stick it in a text node - eventually should be parsed as xml?? 123 123 124 Element doc = doc_.createElement(GSXML.DOC_NODE_ELEM);124 Element doc = this.doc.createElement(GSXML.DOC_NODE_ELEM); 125 125 doc.setAttribute(GSXML.NODE_ID_ATT, doc_id); 126 GSXML.addDocText( doc_, doc, doc_content);126 GSXML.addDocText(this.doc, doc, doc_content); 127 127 doc_list.appendChild(doc); 128 128 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGPPSearch.java
r4903 r5098 76 76 77 77 protected static final String FIELD_ATT = "field"; 78 private MGPPWrapper mgpp_src _=null;78 private MGPPWrapper mgpp_src=null; 79 79 80 80 // the default level for retrieval - and we'll use it for searching too 81 private String default_level _=null;81 private String default_level=null; 82 82 83 83 /** constructor */ 84 84 public GS2MGPPSearch() 85 85 { 86 mgpp_src_= new MGPPWrapper();86 this.mgpp_src = new MGPPWrapper(); 87 87 } 88 88 … … 101 101 Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_LEVEL_ELEM); 102 102 if (def != null) { 103 default_level_= def.getAttribute(GSXML.NAME_ATT);104 } 105 if ( default_level_ == null || default_level_.equals("")) {103 this.default_level = def.getAttribute(GSXML.NAME_ATT); 104 } 105 if (this.default_level == null || this.default_level.equals("")) { 106 106 System.err.println("Error: default level not specified!"); 107 107 return false; … … 110 110 // the default level is also the level which gdbm is expecting 111 111 // this must not be overwritten 112 mgpp_src_.setReturnLevel(default_level_);112 this.mgpp_src.setReturnLevel(this.default_level); 113 113 // return term info 114 mgpp_src_.setReturnTerms(true);114 this.mgpp_src.setReturnTerms(true); 115 115 // set the default - this may be overwritten by query params 116 mgpp_src_.setQueryLevel(default_level_);116 this.mgpp_src.setQueryLevel(this.default_level); 117 117 118 118 // set up the extra services which are available for this collection … … 127 127 128 128 // set up short_service_info_ - for now just has id and type - name will be added in on teh fly 129 Element fq_service = doc_.createElement(GSXML.SERVICE_ELEM);129 Element fq_service = this.doc.createElement(GSXML.SERVICE_ELEM); 130 130 fq_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_QUERY); 131 131 fq_service.setAttribute(GSXML.NAME_ATT, FIELD_QUERY_SERVICE); 132 short_service_info_.appendChild(fq_service);133 134 Element afq_service = doc_.createElement(GSXML.SERVICE_ELEM);132 this.short_service_info.appendChild(fq_service); 133 134 Element afq_service = this.doc.createElement(GSXML.SERVICE_ELEM); 135 135 afq_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_QUERY); 136 136 afq_service.setAttribute(GSXML.NAME_ATT, ADVANCED_FIELD_QUERY_SERVICE); 137 short_service_info_.appendChild(afq_service);137 this.short_service_info.appendChild(afq_service); 138 138 139 139 140 140 //set up format info - the info is the same as that for text query 141 Element format_info = (Element)format_info_map _.get(TEXT_QUERY_SERVICE);141 Element format_info = (Element)format_info_map.get(TEXT_QUERY_SERVICE); 142 142 if (format_info != null) { 143 format_info_map_.put(FIELD_QUERY_SERVICE, format_info);144 format_info_map_.put(ADVANCED_FIELD_QUERY_SERVICE, format_info);143 this.format_info_map.put(FIELD_QUERY_SERVICE, format_info); 144 this.format_info_map.put(ADVANCED_FIELD_QUERY_SERVICE, format_info); 145 145 } 146 146 return true; … … 153 153 } 154 154 155 Element service = doc_.createElement(GSXML.SERVICE_ELEM);155 Element service = this.doc.createElement(GSXML.SERVICE_ELEM); 156 156 service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_QUERY); 157 157 service.setAttribute(GSXML.NAME_ATT, service_id); 158 service.appendChild(GSXML.createDisplayTextElement(doc_, GSXML.DISPLAY_TEXT_NAME, getTextString(service_id+".name", lang))); 159 service.appendChild(GSXML.createDisplayTextElement(doc_, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(service_id+".submit", lang))); 160 Element param_list = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 158 service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, getTextString(service_id+".name", lang))); 159 service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(service_id+".submit", lang))); 160 service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_DESCRIPTION, getTextString(service_id+".description", lang))); 161 Element param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 161 162 service.appendChild(param_list); 162 163 if (service_id.equals(FIELD_QUERY_SERVICE)) { … … 176 177 if (id.equals(LEVEL_PARAM)) { 177 178 // the level info - read from config file 178 Element level_list = (Element)GSXML.getChildByTagName( config_info_, LEVEL_ELEM+GSXML.LIST_MODIFIER);179 Element level_list = (Element)GSXML.getChildByTagName(this.config_info, LEVEL_ELEM+GSXML.LIST_MODIFIER); 179 180 NodeList levels = level_list.getElementsByTagName(LEVEL_ELEM); 180 181 int len = levels.getLength(); … … 188 189 } 189 190 // the first one is the default 190 param = GSXML.createParameterDescription( doc_, LEVEL_PARAM, getTextString("param."+LEVEL_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, levs[0], levs, lev_names);191 param = GSXML.createParameterDescription(this.doc, LEVEL_PARAM, getTextString("param."+LEVEL_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, levs[0], levs, lev_names); 191 192 192 193 } … … 195 196 String [] vals1_texts = { getTextString("param."+RANK_PARAM+"."+RANK_PARAM_RANK, lang), getTextString("param."+RANK_PARAM+"."+RANK_PARAM_NONE, lang)}; 196 197 197 param = GSXML.createParameterDescription( doc_, RANK_PARAM, getTextString("param."+RANK_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, RANK_PARAM_RANK, vals1, vals1_texts );198 param = GSXML.createParameterDescription(this.doc, RANK_PARAM, getTextString("param."+RANK_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, RANK_PARAM_RANK, vals1, vals1_texts ); 198 199 199 200 } else if (id.equals(FIELD_QUERY_PARAM)) { 200 param = GSXML.createParameterDescription( doc_, FIELD_QUERY_PARAM, getTextString("param."+FIELD_QUERY_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null);201 param = GSXML.createParameterDescription(this.doc, FIELD_QUERY_PARAM, getTextString("param."+FIELD_QUERY_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null); 201 202 202 203 … … 204 205 String[] bool_ops = {"0", "1"}; 205 206 String[] bool_texts = {getTextString("param.boolean.off", lang),getTextString("param.boolean.on", lang)}; 206 param = GSXML.createParameterDescription( doc_, id, getTextString("param."+id, lang), GSXML.PARAM_TYPE_BOOLEAN, BOOLEAN_PARAM_ON, bool_ops, bool_texts);207 param = GSXML.createParameterDescription(this.doc, id, getTextString("param."+id, lang), GSXML.PARAM_TYPE_BOOLEAN, BOOLEAN_PARAM_ON, bool_ops, bool_texts); 207 208 208 209 } else if (id.equals(FIELD_FIELD_PARAM) || id.equals(INDEX_FIELD_PARAM)) { 209 210 210 211 // the field list - read from config file 211 Element field_list = (Element)GSXML.getChildByTagName( config_info_, GSXML.FIELD_ELEM+GSXML.LIST_MODIFIER);212 Element field_list = (Element)GSXML.getChildByTagName(this.config_info, GSXML.FIELD_ELEM+GSXML.LIST_MODIFIER); 212 213 NodeList fields = field_list.getElementsByTagName(GSXML.FIELD_ELEM); 213 214 int len = fields.getLength(); … … 222 223 223 224 } 224 param = GSXML.createParameterDescription( doc_, id, getTextString("param."+id, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, f_names[0], f_names, f_texts );225 param = GSXML.createParameterDescription(this.doc, id, getTextString("param."+id, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, f_names[0], f_names, f_texts ); 225 226 226 227 } else if (id.equals(FIELD_COMBINE_PARAM)) { … … 230 231 231 232 232 param = GSXML.createParameterDescription( doc_, FIELD_COMBINE_PARAM, "", GSXML.PARAM_TYPE_ENUM_SINGLE, FIELD_COMBINE_PARAM_AND, vals, val_texts);233 param = GSXML.createParameterDescription(this.doc, FIELD_COMBINE_PARAM, "", GSXML.PARAM_TYPE_ENUM_SINGLE, FIELD_COMBINE_PARAM_AND, vals, val_texts); 233 234 param.setAttribute(GSXML.PARAM_IGNORE_POS_ATT, "0"); 234 235 … … 291 292 Element multiparam = null; 292 293 Element param=null; 293 multiparam = GSXML.createParameterDescription( doc_, SIMPLE_FIELD_PARAM, "", GSXML.PARAM_TYPE_MULTI, null, null, null);294 multiparam = GSXML.createParameterDescription(this.doc, SIMPLE_FIELD_PARAM, "", GSXML.PARAM_TYPE_MULTI, null, null, null); 294 295 multiparam.setAttribute("occurs", "4"); 295 296 param_list.appendChild(multiparam); … … 318 319 Element param=null; 319 320 320 multiparam = GSXML.createParameterDescription( doc_, ADVANCED_FIELD_PARAM, "", GSXML.PARAM_TYPE_MULTI, null, null, null);321 multiparam = GSXML.createParameterDescription(this.doc, ADVANCED_FIELD_PARAM, "", GSXML.PARAM_TYPE_MULTI, null, null, null); 321 322 multiparam.setAttribute("occurs", "4"); 322 323 param_list.appendChild(multiparam); … … 376 377 377 378 // Create a new (empty) result message 378 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);379 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 379 380 result.setAttribute(GSXML.FROM_ATT, service_name); 380 381 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); … … 403 404 404 405 // set up mgpp_src 405 String indexdir = GSFile.collectionBaseDir( site_home_, cluster_name_) +406 File.separatorChar + GSFile.collectionIndexPath( cluster_name_, default_index_);407 mgpp_src_.loadIndexData(indexdir);406 String indexdir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + 407 File.separatorChar + GSFile.collectionIndexPath(this.cluster_name, this.default_index); 408 this.mgpp_src.loadIndexData(indexdir); 408 409 setStandardQueryParams(params); 409 410 … … 421 422 } 422 423 // run the query 423 mgpp_src_.runQuery(query);424 MGPPQueryResult mqr= mgpp_src_.getQueryResult();424 this.mgpp_src.runQuery(query); 425 MGPPQueryResult mqr= this.mgpp_src.getQueryResult(); 425 426 426 427 // build up the response … … 428 429 // Create a metadata list to store information about the query results 429 430 // should we be using metadataList? or something else? 430 Element metadata_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);431 Element metadata_list = this.doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 431 432 result.appendChild(metadata_list); 432 433 433 434 // Add a metadata element specifying the number of matching documents 434 435 long totalDocs = mqr.getTotalDocs(); 435 Element num_matches_elem = doc_.createElement(GSXML.METADATA_ELEM);436 Element num_matches_elem = this.doc.createElement(GSXML.METADATA_ELEM); 436 437 num_matches_elem.setAttribute(GSXML.NAME_ATT, "numDocsMatched"); 437 438 num_matches_elem.setAttribute(GSXML.VALUE_ATT, "" + totalDocs); … … 440 441 // Create a document list to store the matching documents, and add them 441 442 Vector docs = mqr.getDocs(); 442 Element document_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);443 Element document_list = this.doc.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 443 444 result.appendChild(document_list); 444 445 for (int d = 0; d < docs.size(); d++) { 445 446 long docnum = ((MGPPDocInfo) docs.elementAt(d)).num_; 446 String doc_id = gdbm_src_.docnum2Oid(docnum);447 String doc_id = this.gdbm_src.docnum2Oid(docnum); 447 448 Element doc_node = createDocumentNodeElement(doc_id); 448 449 document_list.appendChild(doc_node); … … 451 452 // Create a term list to store the term information, and add it 452 453 String query_level = (String)params.get(LEVEL_PARAM); // the current query level 453 Element term_list = doc_.createElement(GSXML.TERM_ELEM+GSXML.LIST_MODIFIER);454 Element term_list = this.doc.createElement(GSXML.TERM_ELEM+GSXML.LIST_MODIFIER); 454 455 result.appendChild(term_list); 455 456 Vector terms = mqr.getTerms(); … … 457 458 MGPPTermInfo term_info = (MGPPTermInfo) terms.get(t); 458 459 459 Element term_elem = doc_.createElement(GSXML.TERM_ELEM);460 Element term_elem = this.doc.createElement(GSXML.TERM_ELEM); 460 461 term_elem.setAttribute(GSXML.NAME_ATT, term_info.term_); 461 462 term_elem.setAttribute(STEM_ATT, "" + term_info.stem_method_); … … 470 471 471 472 Vector equiv_terms = term_info.equiv_terms_; 472 Element equiv_term_list = doc_.createElement(EQUIV_TERM_ELEM+GSXML.LIST_MODIFIER);473 Element equiv_term_list = this.doc.createElement(EQUIV_TERM_ELEM+GSXML.LIST_MODIFIER); 473 474 term_elem.appendChild(equiv_term_list); 474 475 … … 476 477 String equiv_term = (String) equiv_terms.get(et); 477 478 478 Element equiv_term_elem = doc_.createElement(GSXML.TERM_ELEM);479 Element equiv_term_elem = this.doc.createElement(GSXML.TERM_ELEM); 479 480 equiv_term_elem.setAttribute(GSXML.NAME_ATT, equiv_term); 480 481 equiv_term_elem.setAttribute(NUM_DOCS_MATCH_ATT, ""); … … 501 502 if (name.equals(CASE_PARAM)) { 502 503 boolean val = (value.equals(BOOLEAN_PARAM_ON)?true:false); 503 mgpp_src_.setCase(val);504 this.mgpp_src.setCase(val); 504 505 } else if (name.equals(STEM_PARAM)) { 505 506 boolean val = (value.equals(BOOLEAN_PARAM_ON)?true:false); 506 mgpp_src_.setStem(val);507 this.mgpp_src.setStem(val); 507 508 } else if (name.equals(MAXDOCS_PARAM)&& !value.equals("")) { 508 509 int docs = Integer.parseInt(value); 509 mgpp_src_.setMaxDocs(docs);510 this.mgpp_src.setMaxDocs(docs); 510 511 } else if (name.equals(LEVEL_PARAM)) { 511 mgpp_src_.setQueryLevel(value);512 this.mgpp_src.setQueryLevel(value); 512 513 } else if (name.equals(MATCH_PARAM)) { 513 514 int mode; 514 515 if (value.equals(MATCH_PARAM_ALL)) mode=1; 515 516 else mode=0; 516 mgpp_src_.setMatchMode(mode);517 this.mgpp_src.setMatchMode(mode); 517 518 } else if (name.equals(RANK_PARAM)) { 518 519 if (value.equals(RANK_PARAM_RANK)) { 519 mgpp_src_.setSortByRank(true);520 this.mgpp_src.setSortByRank(true); 520 521 } else if (value.equals(RANK_PARAM_NONE)) { 521 mgpp_src_.setSortByRank(false);522 this.mgpp_src.setSortByRank(false); 522 523 } 523 524 } // ignore any others -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java
r4062 r5098 46 46 private static final String DEFAULT_INDEX_ELEM = "defaultIndex"; 47 47 48 private MGWrapper mg_src _= null;48 private MGWrapper mg_src = null; 49 49 50 private String default_index _= null;50 private String default_index = null; 51 51 52 52 … … 54 54 public GS2MGRetrieve() 55 55 { 56 mg_src_= new MGWrapper();56 this.mg_src = new MGWrapper(); 57 57 } 58 58 … … 69 69 Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_ELEM); 70 70 if (def != null) { 71 default_index_= def.getAttribute(GSXML.NAME_ATT);71 this.default_index = def.getAttribute(GSXML.NAME_ATT); 72 72 } 73 if ( default_index_ == null || default_index_.equals("")) {73 if (this.default_index == null || this.default_index.equals("")) { 74 74 System.err.println("Error: default index not specified!"); 75 75 return false; 76 76 } 77 // System.out.println("Default index: " + default_index_);77 // System.out.println("Default index: " + this.default_index); 78 78 79 79 // Do generic configuration … … 86 86 { 87 87 // Create a new (empty) result message 88 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);88 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 89 89 result.setAttribute(GSXML.FROM_ATT, DOCUMENT_CONTENT_RETRIEVE_SERVICE); 90 90 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); … … 101 101 } 102 102 103 Element doc_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);103 Element doc_list = this.doc.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 104 104 result.appendChild(doc_list); 105 105 106 106 // The location of the MG index and text files 107 String basedir = GSFile.collectionBaseDir( site_home_, cluster_name_)107 String basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) 108 108 + File.separatorChar; // Needed by MG 109 String textdir = GSFile.collectionTextPath( cluster_name_);109 String textdir = GSFile.collectionTextPath(this.cluster_name); 110 110 // index is only needed to start up MG, not used so just use the default index 111 String indexpath = GSFile.collectionIndexPath( cluster_name_, default_index_);112 mg_src_.setIndex(indexpath);111 String indexpath = GSFile.collectionIndexPath(this.cluster_name, this.default_index); 112 this.mg_src.setIndex(indexpath); 113 113 114 114 // Get the documents … … 118 118 String doc_id = doc_ids[i]; 119 119 if (OID.needsTranslating(doc_id)) { 120 doc_id = gdbm_src_.translateOID(doc_id);120 doc_id = this.gdbm_src.translateOID(doc_id); 121 121 } 122 long doc_num = gdbm_src_.oid2Docnum(doc_id);123 String doc_content = mg_src_.getDocument(basedir, textdir, doc_num);122 long doc_num = this.gdbm_src.oid2Docnum(doc_id); 123 String doc_content = this.mg_src.getDocument(basedir, textdir, doc_num); 124 124 // remove any ctrl-c or ctrl-b (I hope these are the right codes) 125 125 doc_content = doc_content.replaceAll("\u0002|\u0003", ""); … … 127 127 doc_content = resolveImages(doc_content, doc_id); 128 128 // Stick it in a text node 129 Element doc = doc_.createElement(GSXML.DOC_NODE_ELEM);129 Element doc = this.doc.createElement(GSXML.DOC_NODE_ELEM); 130 130 doc.setAttribute(GSXML.NODE_ID_ATT, doc_id); 131 GSXML.addDocText( doc_, doc, doc_content);131 GSXML.addDocText(this.doc, doc, doc_content); 132 132 doc_list.appendChild(doc); 133 133 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGSearch.java
r4903 r5098 48 48 49 49 50 private MGWrapper mg_src _= null;50 private MGWrapper mg_src = null; 51 51 52 52 … … 54 54 public GS2MGSearch() 55 55 { 56 mg_src_= new MGWrapper();56 this.mg_src = new MGWrapper(); 57 57 } 58 58 … … 82 82 { 83 83 // Create a new (empty) result message 84 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);84 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 85 85 result.setAttribute(GSXML.FROM_ATT, TEXT_QUERY_SERVICE); 86 86 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); … … 105 105 String index = (String) params.get(INDEX_PARAM); 106 106 if (index == null) { 107 index = default_index_;107 index = this.default_index; 108 108 } 109 109 110 110 // The location of the MG index and text files 111 String basedir = GSFile.collectionBaseDir( site_home_, cluster_name_) +111 String basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + 112 112 File.separatorChar; // Needed for MG 113 String textdir = GSFile.collectionTextPath( cluster_name_);114 String indexpath = GSFile.collectionIndexPath( cluster_name_, index);115 mg_src_.setIndex(indexpath);113 String textdir = GSFile.collectionTextPath(this.cluster_name); 114 String indexpath = GSFile.collectionIndexPath(this.cluster_name, index); 115 this.mg_src.setIndex(indexpath); 116 116 117 117 // set the mg query parameters to the values the user has specified 118 118 setStandardQueryParams(params); 119 mg_src_.runQuery(basedir, textdir, query);120 MGQueryResult mqr = mg_src_.getQueryResult();119 this.mg_src.runQuery(basedir, textdir, query); 120 MGQueryResult mqr = this.mg_src.getQueryResult(); 121 121 long totalDocs = mqr.getTotalDocs(); 122 122 … … 128 128 129 129 // Create a metadata list to store information about the query results 130 Element metadata_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);130 Element metadata_list = this.doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 131 131 result.appendChild(metadata_list); 132 132 133 133 // Add a metadata element specifying the number of matching documents 134 Element num_matches_elem = doc_.createElement(GSXML.METADATA_ELEM);134 Element num_matches_elem = this.doc.createElement(GSXML.METADATA_ELEM); 135 135 num_matches_elem.setAttribute(GSXML.NAME_ATT, "numDocsMatched"); 136 136 num_matches_elem.setAttribute(GSXML.VALUE_ATT, "" + totalDocs); … … 138 138 139 139 // Create a document list to store the matching documents, and add them 140 Element document_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);140 Element document_list = this.doc.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 141 141 result.appendChild(document_list); 142 142 for (int d = 0; d < docs.size(); d++) { 143 143 long docnum = ((MGDocInfo) docs.elementAt(d)).num_; 144 String doc_id = gdbm_src_.docnum2Oid(docnum);144 String doc_id = this.gdbm_src.docnum2Oid(docnum); 145 145 Element doc_node = createDocumentNodeElement(doc_id); 146 146 document_list.appendChild(doc_node); … … 148 148 149 149 // Create a term list to store the term information, and add it 150 Element term_list = doc_.createElement(GSXML.TERM_ELEM+GSXML.LIST_MODIFIER);150 Element term_list = this.doc.createElement(GSXML.TERM_ELEM+GSXML.LIST_MODIFIER); 151 151 result.appendChild(term_list); 152 152 Vector terms = mqr.getTerms(); … … 158 158 Vector equiv_terms = term_info.equiv_terms_; 159 159 160 Element term_elem = doc_.createElement(GSXML.TERM_ELEM);160 Element term_elem = this.doc.createElement(GSXML.TERM_ELEM); 161 161 term_elem.setAttribute(GSXML.NAME_ATT, term); 162 162 term_elem.setAttribute(STEM_ATT, "" + stem_method); 163 163 164 Element equiv_term_list = doc_.createElement(EQUIV_TERM_ELEM+GSXML.LIST_MODIFIER);164 Element equiv_term_list = this.doc.createElement(EQUIV_TERM_ELEM+GSXML.LIST_MODIFIER); 165 165 term_elem.appendChild(equiv_term_list); 166 166 … … 169 169 MGEquivTermInfo equiv_term_info = (MGEquivTermInfo) equiv_terms.get(et); 170 170 171 Element equiv_term_elem = doc_.createElement(GSXML.TERM_ELEM);171 Element equiv_term_elem = this.doc.createElement(GSXML.TERM_ELEM); 172 172 equiv_term_elem.setAttribute(GSXML.NAME_ATT, equiv_term_info.term_); 173 173 equiv_term_elem.setAttribute(NUM_DOCS_MATCH_ATT, "" + equiv_term_info.match_docs_); … … 190 190 { 191 191 // set the default ones 192 mg_src_.setReturnTerms(true);192 this.mg_src.setReturnTerms(true); 193 193 Set entries = params.entrySet(); 194 194 Iterator i = entries.iterator(); … … 200 200 if (name.equals(CASE_PARAM)) { 201 201 boolean val = (value.equals(BOOLEAN_PARAM_ON) ? true : false); 202 mg_src_.setCase(val);202 this.mg_src.setCase(val); 203 203 } 204 204 else if (name.equals(STEM_PARAM)) { 205 205 boolean val = (value.equals(BOOLEAN_PARAM_ON) ? true : false); 206 mg_src_.setStem(val);206 this.mg_src.setStem(val); 207 207 } 208 208 else if (name.equals(MATCH_PARAM)) { 209 209 int mode = (value.equals(MATCH_PARAM_ALL) ? 1 : 0); 210 mg_src_.setMatchMode(mode);210 this.mg_src.setMatchMode(mode); 211 211 } 212 212 else if (name.equals(MAXDOCS_PARAM)) { 213 213 int docs = Integer.parseInt(value); 214 mg_src_.setMaxDocs(docs);214 this.mg_src.setMaxDocs(docs); 215 215 } // ignore any others 216 216 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Retrieve.java
r4903 r5098 74 74 protected static final int CLASSIFIER=2; 75 75 76 protected GDBMWrapper gdbm_src _= null;77 protected Element config_info _= null; // the xml from the config file76 protected GDBMWrapper gdbm_src = null; 77 protected Element config_info = null; // the xml from the config file 78 78 79 79 /** constructor */ 80 80 protected GS2Retrieve() 81 81 { 82 gdbm_src_= new GDBMWrapper();82 this.gdbm_src = new GDBMWrapper(); 83 83 } 84 84 … … 88 88 { 89 89 System.out.println("Configuring GS2Retrieve..."); 90 config_info_= info;90 this.config_info = info; 91 91 92 92 // set up short_service_info_ - for now just has name and type 93 Element dsr_service = doc_.createElement(GSXML.SERVICE_ELEM);93 Element dsr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 94 94 dsr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 95 95 dsr_service.setAttribute(GSXML.NAME_ATT, DOCUMENT_STRUCTURE_RETRIEVE_SERVICE); 96 short_service_info_.appendChild(dsr_service);97 98 Element dmr_service = doc_.createElement(GSXML.SERVICE_ELEM);96 this.short_service_info.appendChild(dsr_service); 97 98 Element dmr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 99 99 dmr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 100 100 dmr_service.setAttribute(GSXML.NAME_ATT, DOCUMENT_METADATA_RETRIEVE_SERVICE); 101 short_service_info_.appendChild(dmr_service);102 103 Element dcr_service = doc_.createElement(GSXML.SERVICE_ELEM);101 this.short_service_info.appendChild(dmr_service); 102 103 Element dcr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 104 104 dcr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 105 105 dcr_service.setAttribute(GSXML.NAME_ATT, DOCUMENT_CONTENT_RETRIEVE_SERVICE); 106 short_service_info_.appendChild(dcr_service);106 this.short_service_info.appendChild(dcr_service); 107 107 108 108 // Open GDBM database for querying 109 String gdbm_db_file = GSFile.GDBMDatabaseFile( site_home_, cluster_name_);110 if (! gdbm_src_.openDatabase(gdbm_db_file, GDBMWrapper.READER)) {109 String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name); 110 if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) { 111 111 System.err.println("Error: Could not open GDBM database!"); 112 112 return false; … … 125 125 // the classifiers 126 126 extractExtraClassifierInfo(info, extra_info); 127 config_info_= info;127 this.config_info = info; 128 128 129 129 // short_service_info_ - the browse one 130 Element cb_service = doc_.createElement(GSXML.SERVICE_ELEM);130 Element cb_service = this.doc.createElement(GSXML.SERVICE_ELEM); 131 131 cb_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_BROWSE); 132 132 cb_service.setAttribute(GSXML.NAME_ATT, CLASSIFIER_SERVICE); 133 short_service_info_.appendChild(cb_service);133 this.short_service_info.appendChild(cb_service); 134 134 135 135 // metadata retrieval for the browsing 136 Element cbmr_service = doc_.createElement(GSXML.SERVICE_ELEM);136 Element cbmr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 137 137 cbmr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 138 138 cbmr_service.setAttribute(GSXML.NAME_ATT, CLASSIFIER_METADATA_SERVICE); 139 short_service_info_.appendChild(cbmr_service);139 this.short_service_info.appendChild(cbmr_service); 140 140 141 141 // the format info 142 Element cb_format_info = doc_.createElement(GSXML.FORMAT_ELEM);142 Element cb_format_info = this.doc.createElement(GSXML.FORMAT_ELEM); 143 143 boolean format_found = false; 144 144 // add in to the description a simplified list of classifiers … … 146 146 for(int i=0; i<classifiers.getLength(); i++) { 147 147 Element cl = (Element)classifiers.item(i); 148 Element new_cl = (Element) doc_.importNode(cl, false); // just import this node, not the children148 Element new_cl = (Element)this.doc.importNode(cl, false); // just import this node, not the children 149 149 150 150 // get the format info out, and put inside a classifier element … … 156 156 NodeList elems = format.getChildNodes(); 157 157 for (int j=0; j<elems.getLength();j++) { 158 format_cl.appendChild( doc_.importNode(elems.item(j), true));158 format_cl.appendChild(this.doc.importNode(elems.item(j), true)); 159 159 } 160 160 cb_format_info.appendChild(format_cl); … … 166 166 167 167 if (format_found) { 168 format_info_map_.put(CLASSIFIER_SERVICE, cb_format_info);168 this.format_info_map.put(CLASSIFIER_SERVICE, cb_format_info); 169 169 } 170 170 … … 174 174 if (display_format != null) { 175 175 System.out.println("display format not null!"); 176 format_info_map_.put(DOCUMENT_METADATA_RETRIEVE_SERVICE, doc_.importNode(display_format, true));176 this.format_info_map.put(DOCUMENT_METADATA_RETRIEVE_SERVICE, this.doc.importNode(display_format, true)); 177 177 // shoudl we make a copy? 178 178 } … … 184 184 if (service_id.equals(CLASSIFIER_SERVICE)) { 185 185 186 Element class_list = (Element)GSXML.getChildByTagName( config_info_, GSXML.CLASSIFIER_ELEM+GSXML.LIST_MODIFIER);186 Element class_list = (Element)GSXML.getChildByTagName(this.config_info, GSXML.CLASSIFIER_ELEM+GSXML.LIST_MODIFIER); 187 187 if (class_list == null) { 188 188 // no classifiers specified … … 190 190 } 191 191 192 Element cb_service = doc_.createElement(GSXML.SERVICE_ELEM);192 Element cb_service = this.doc.createElement(GSXML.SERVICE_ELEM); 193 193 cb_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_BROWSE); 194 194 cb_service.setAttribute(GSXML.NAME_ATT, CLASSIFIER_SERVICE); 195 cb_service.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_NAME, getTextString(CLASSIFIER_SERVICE+".name", lang)));196 197 Element cl_list = doc_.createElement(GSXML.CLASSIFIER_ELEM+GSXML.LIST_MODIFIER);195 cb_service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, getTextString(CLASSIFIER_SERVICE+".name", lang))); 196 197 Element cl_list = this.doc.createElement(GSXML.CLASSIFIER_ELEM+GSXML.LIST_MODIFIER); 198 198 cb_service.appendChild(cl_list); 199 199 NodeList classifiers = class_list.getElementsByTagName(GSXML.CLASSIFIER_ELEM); 200 200 for(int i=0; i<classifiers.getLength(); i++) { 201 201 Element cl = (Element)classifiers.item(i); 202 Element new_cl = (Element) doc_.importNode(cl, false); // just import this node, not the children202 Element new_cl = (Element)this.doc.importNode(cl, false); // just import this node, not the children 203 203 204 204 cl_list.appendChild(new_cl); … … 213 213 } 214 214 215 Element cl_name = GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_NAME, text);215 Element cl_name = GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, text); 216 216 new_cl.appendChild(cl_name); 217 217 … … 224 224 if (service_id.equals(CLASSIFIER_METADATA_SERVICE)) { 225 225 226 Element cbmr_service = doc_.createElement(GSXML.SERVICE_ELEM);226 Element cbmr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 227 227 cbmr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 228 228 cbmr_service.setAttribute(GSXML.NAME_ATT, CLASSIFIER_METADATA_SERVICE); … … 231 231 232 232 if (service_id.equals(DOCUMENT_STRUCTURE_RETRIEVE_SERVICE)) { 233 Element dsr_service = doc_.createElement(GSXML.SERVICE_ELEM);233 Element dsr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 234 234 dsr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 235 235 dsr_service.setAttribute(GSXML.NAME_ATT, DOCUMENT_STRUCTURE_RETRIEVE_SERVICE); … … 237 237 } 238 238 if (service_id.equals(DOCUMENT_METADATA_RETRIEVE_SERVICE)) { 239 Element dmr_service = doc_.createElement(GSXML.SERVICE_ELEM);239 Element dmr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 240 240 dmr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 241 241 dmr_service.setAttribute(GSXML.NAME_ATT, DOCUMENT_METADATA_RETRIEVE_SERVICE); … … 244 244 245 245 if (service_id.equals(DOCUMENT_CONTENT_RETRIEVE_SERVICE)) { 246 Element dcr_service = doc_.createElement(GSXML.SERVICE_ELEM);246 Element dcr_service = this.doc.createElement(GSXML.SERVICE_ELEM); 247 247 dcr_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE); 248 248 dcr_service.setAttribute(GSXML.NAME_ATT, DOCUMENT_CONTENT_RETRIEVE_SERVICE); … … 307 307 308 308 // create this here or pass it in? 309 DBInfo info = gdbm_src_.getInfo(node_id);309 DBInfo info = this.gdbm_src.getInfo(node_id); 310 310 Element node; 311 311 if (isClassifier(node_id)) { 312 node = doc_.createElement(GSXML.CLASS_NODE_ELEM);312 node = this.doc.createElement(GSXML.CLASS_NODE_ELEM); 313 313 //String childtype = info.getInfo("childtype"); 314 314 //String orientation=""; … … 321 321 } else { 322 322 323 node = doc_.createElement(GSXML.DOC_NODE_ELEM);323 node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 324 324 325 325 String top_id = OID.getTop(node_id); … … 345 345 346 346 if (!is_top) { // we need to look at the top info 347 info = gdbm_src_.getInfo(top_id);347 info = this.gdbm_src.getInfo(top_id); 348 348 } 349 349 … … 377 377 boolean recursive) 378 378 { 379 DBInfo info = gdbm_src_.getInfo(doc_id);379 DBInfo info = this.gdbm_src.getInfo(doc_id); 380 380 String contains = info.getInfo("contains"); 381 381 … … 421 421 protected boolean isLeafNode(String oid) 422 422 { 423 DBInfo info = gdbm_src_.getInfo(oid);423 DBInfo info = this.gdbm_src.getInfo(oid); 424 424 String children = info.getInfo("contains"); 425 425 return (children.equals("")); … … 447 447 { 448 448 // Create a new (empty) result message 449 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);449 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 450 450 451 451 String node_name; … … 524 524 } 525 525 526 Element doc_list = doc_.createElement(node_name+GSXML.LIST_MODIFIER);526 Element doc_list = this.doc.createElement(node_name+GSXML.LIST_MODIFIER); 527 527 result.appendChild(doc_list); 528 528 … … 535 535 System.out.println("doc_id = "+doc_id); 536 536 if (OID.needsTranslating(doc_id)) { 537 doc_id = gdbm_src_.translateOID(doc_id);537 doc_id = this.gdbm_src.translateOID(doc_id); 538 538 System.out.println("translated doc_id = "+doc_id); 539 539 } 540 540 541 541 // Add the document to the list 542 Element doc = doc_.createElement(node_name);542 Element doc = this.doc.createElement(node_name); 543 543 doc_list.appendChild(doc); 544 544 doc.setAttribute(GSXML.NODE_ID_ATT, doc_id); … … 547 547 if (want_info) { 548 548 549 Element info_elem = doc_.createElement("nodeStructureInfo");549 Element info_elem = this.doc.createElement("nodeStructureInfo"); 550 550 doc.appendChild(info_elem); 551 551 … … 560 560 if (want_structure) { 561 561 // all structure info goes into a nodeStructure elem 562 Element structure_elem = doc_.createElement(GSXML.NODE_STRUCTURE_ELEM);562 Element structure_elem = this.doc.createElement(GSXML.NODE_STRUCTURE_ELEM); 563 563 doc.appendChild(structure_elem); 564 564 … … 627 627 { 628 628 // Create a new (empty) result message 629 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);629 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 630 630 631 631 String node_name; … … 667 667 } 668 668 669 Element node_list = doc_.createElement(node_name+GSXML.LIST_MODIFIER);669 Element node_list = this.doc.createElement(node_name+GSXML.LIST_MODIFIER); 670 670 result.appendChild(node_list); 671 671 … … 683 683 684 684 if (OID.needsTranslating(node_id)) { 685 node_id = gdbm_src_.translateOID(node_id);685 node_id = this.gdbm_src.translateOID(node_id); 686 686 } 687 687 688 688 // Add the document to the list 689 Element new_node = (Element) doc_.importNode(request_node, false);689 Element new_node = (Element)this.doc.importNode(request_node, false); 690 690 node_list.appendChild(new_node); 691 691 692 692 // Add the requested metadata information 693 Element node_meta_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);693 Element node_meta_list = this.doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 694 694 new_node.appendChild(node_meta_list); 695 DBInfo info = gdbm_src_.getInfo(node_id);695 DBInfo info = this.gdbm_src.getInfo(node_id); 696 696 if (info == null) {// I have had a case where it is null! 697 697 continue; … … 707 707 System.out.println("getting metadata "+key); 708 708 String value = info.getInfo(key); 709 GSXML.addMetadata( doc_, node_meta_list, key, value);709 GSXML.addMetadata(this.doc, node_meta_list, key, value); 710 710 } 711 711 } else { // just get the selected ones … … 714 714 String metadata = (String) metadata_list.get(m); 715 715 String value = getMetadata(node_id, info, metadata); 716 GSXML.addMetadata( doc_, node_meta_list, metadata, value);716 GSXML.addMetadata(this.doc, node_meta_list, metadata, value); 717 717 } 718 718 } … … 743 743 return ""; 744 744 } 745 DBInfo parent_info = gdbm_src_.getInfo(parent_id);745 DBInfo parent_info = this.gdbm_src.getInfo(parent_id); 746 746 if (parent_info == null) return ""; 747 747 String new_meta = metadata.substring(pos+1); … … 763 763 parent_id = OID.getParent(current_id); 764 764 while (!parent_id.equals(current_id)) { 765 parent_info = gdbm_src_.getInfo(parent_id);765 parent_info = this.gdbm_src.getInfo(parent_id); 766 766 if (parent_info == null) return value.toString(); 767 767 value.insert(0, separator); … … 788 788 { 789 789 String top_doc_id = OID.getTop(doc_id); 790 DBInfo info = gdbm_src_.getInfo(top_doc_id);790 DBInfo info = this.gdbm_src.getInfo(top_doc_id); 791 791 String archivedir = info.getInfo("archivedir"); 792 String image_dir = site_http_address_ + "/collect/"+cluster_name_+"/index/assoc/"+archivedir;792 String image_dir = this.site_http_address + "/collect/"+this.cluster_name+"/index/assoc/"+archivedir; 793 793 794 794 // Resolve all "_httpdocimg_"s … … 814 814 value="-1"; 815 815 } else { 816 DBInfo info = gdbm_src_.getInfo(parent_id);816 DBInfo info = this.gdbm_src.getInfo(parent_id); 817 817 String contains = info.getInfo("contains"); 818 818 contains = contains.replaceAll("\"", parent_id); … … 830 830 return null; 831 831 } 832 Element info_elem = doc_.createElement("info");832 Element info_elem = this.doc.createElement("info"); 833 833 info_elem.setAttribute(GSXML.NAME_ATT, info_type); 834 834 info_elem.setAttribute(GSXML.VALUE_ATT, value); … … 837 837 838 838 protected int getNumChildren(String doc_id) { 839 DBInfo info = gdbm_src_.getInfo(doc_id);839 DBInfo info = this.gdbm_src.getInfo(doc_id); 840 840 String contains = info.getInfo("contains"); 841 841 if (contains.equals("")) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Search.java
r4903 r5098 67 67 protected static final String LEVEL_ELEM = "level"; 68 68 69 protected GDBMWrapper gdbm_src _= null;70 71 protected Element config_info _= null;69 protected GDBMWrapper gdbm_src = null; 70 71 protected Element config_info = null; 72 72 73 73 /** the default index */ 74 protected String default_index _= null;74 protected String default_index = null; 75 75 76 76 … … 78 78 public GS2Search() 79 79 { 80 gdbm_src_= new GDBMWrapper();80 this.gdbm_src = new GDBMWrapper(); 81 81 } 82 82 … … 87 87 System.out.println("Configuring GS2Search..."); 88 88 addExtraQueryInfo(info, extra_info); 89 config_info_= info;89 this.config_info = info; 90 90 91 91 // Get the default index out of <defaultIndex> (buildConfig.xml) 92 92 Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_ELEM); 93 93 if (def != null) { 94 default_index_= def.getAttribute(GSXML.NAME_ATT);95 } 96 if ( default_index_ == null || default_index_.equals("")) {94 this.default_index = def.getAttribute(GSXML.NAME_ATT); 95 } 96 if (this.default_index == null || this.default_index.equals("")) { 97 97 System.err.println("Error: default index not specified!"); 98 98 return false; … … 101 101 // these entries should reflect the build config file - some services may not be available depending on how the collection was built. 102 102 // set up short_service_info_ - for now just has id and type. the name (lang dependent) will be added in if the list is requested. 103 Element tq_service = doc_.createElement(GSXML.SERVICE_ELEM);103 Element tq_service = this.doc.createElement(GSXML.SERVICE_ELEM); 104 104 tq_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_QUERY); 105 105 tq_service.setAttribute(GSXML.NAME_ATT, TEXT_QUERY_SERVICE); 106 short_service_info_.appendChild(tq_service);106 this.short_service_info.appendChild(tq_service); 107 107 108 108 109 109 // Open GDBM database for querying 110 String gdbm_db_file = GSFile.GDBMDatabaseFile( site_home_, cluster_name_);111 if (! gdbm_src_.openDatabase(gdbm_db_file, GDBMWrapper.READER)) {110 String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name); 111 if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) { 112 112 System.err.println("Error: Could not open GDBM database!"); 113 113 return false; … … 117 117 Element format = (Element) GSXML.getChildByTagName(info, GSXML.FORMAT_ELEM); 118 118 if (format != null) { 119 format_info_map_.put(TEXT_QUERY_SERVICE, doc_.importNode(format, true));119 this.format_info_map.put(TEXT_QUERY_SERVICE, this.doc.importNode(format, true)); 120 120 } 121 121 … … 128 128 return null; 129 129 } 130 Element tq_service = doc_.createElement(GSXML.SERVICE_ELEM);130 Element tq_service = this.doc.createElement(GSXML.SERVICE_ELEM); 131 131 tq_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_QUERY); 132 132 tq_service.setAttribute(GSXML.NAME_ATT, TEXT_QUERY_SERVICE); 133 tq_service.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_NAME, getTextString(TEXT_QUERY_SERVICE+".name", lang)));134 tq_service.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(TEXT_QUERY_SERVICE+".submit", lang)));135 Element param_list = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);133 tq_service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, getTextString(TEXT_QUERY_SERVICE+".name", lang))); 134 tq_service.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_SUBMIT, getTextString(TEXT_QUERY_SERVICE+".submit", lang))); 135 Element param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 136 136 createTextQueryParamList(param_list, lang); 137 137 tq_service.appendChild(param_list); … … 191 191 if (name.equals(INDEX_PARAM)) { 192 192 // the index info - read from config file 193 Element index_list = (Element)GSXML.getChildByTagName( config_info_, INDEX_ELEM+GSXML.LIST_MODIFIER);193 Element index_list = (Element)GSXML.getChildByTagName(this.config_info, INDEX_ELEM+GSXML.LIST_MODIFIER); 194 194 NodeList indexes = index_list.getElementsByTagName(INDEX_ELEM); 195 195 int len = indexes.getLength(); … … 203 203 204 204 } 205 param = GSXML.createParameterDescription( doc_, INDEX_PARAM, getTextString("param."+INDEX_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, default_index_, inds, ind_names);205 param = GSXML.createParameterDescription(this.doc, INDEX_PARAM, getTextString("param."+INDEX_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, this.default_index, inds, ind_names); 206 206 207 207 } … … 209 209 String[] bool_ops = {"0", "1"}; 210 210 String[] bool_texts = {getTextString("param.boolean.off", lang),getTextString("param.boolean.on", lang)}; 211 param = GSXML.createParameterDescription( doc_, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_BOOLEAN, BOOLEAN_PARAM_ON, bool_ops, bool_texts);211 param = GSXML.createParameterDescription(this.doc, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_BOOLEAN, BOOLEAN_PARAM_ON, bool_ops, bool_texts); 212 212 } 213 213 else if (name.equals(MATCH_PARAM)) { 214 214 String[] vals = {MATCH_PARAM_ALL, MATCH_PARAM_SOME}; 215 215 String[] val_texts = {getTextString("param."+MATCH_PARAM+"."+MATCH_PARAM_ALL, lang),getTextString("param."+MATCH_PARAM+"."+MATCH_PARAM_SOME, lang)}; 216 param = GSXML.createParameterDescription( doc_, MATCH_PARAM, getTextString("param."+MATCH_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, MATCH_PARAM_ALL, vals, val_texts);216 param = GSXML.createParameterDescription(this.doc, MATCH_PARAM, getTextString("param."+MATCH_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, MATCH_PARAM_ALL, vals, val_texts); 217 217 218 218 } 219 219 else if (name.equals(MAXDOCS_PARAM)) { 220 param = GSXML.createParameterDescription( doc_, MAXDOCS_PARAM, getTextString("param."+MAXDOCS_PARAM, lang), GSXML.PARAM_TYPE_INTEGER, "10", null, null);220 param = GSXML.createParameterDescription(this.doc, MAXDOCS_PARAM, getTextString("param."+MAXDOCS_PARAM, lang), GSXML.PARAM_TYPE_INTEGER, "10", null, null); 221 221 222 222 } 223 223 else if (name.equals(QUERY_PARAM)) { 224 param = GSXML.createParameterDescription( doc_, QUERY_PARAM, getTextString("param."+QUERY_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null);224 param = GSXML.createParameterDescription(this.doc, QUERY_PARAM, getTextString("param."+QUERY_PARAM, lang), GSXML.PARAM_TYPE_STRING, null, null, null); 225 225 226 226 } … … 244 244 protected Element createDocumentNodeElement(String node_id) 245 245 { 246 Element doc_node = doc_.createElement(GSXML.DOC_NODE_ELEM);246 Element doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 247 247 doc_node.setAttribute(GSXML.NODE_ID_ATT, node_id); 248 248 … … 250 250 boolean is_top = (top_id.equals(node_id) ? true : false); 251 251 252 DBInfo info = gdbm_src_.getInfo(node_id);252 DBInfo info = this.gdbm_src.getInfo(node_id); 253 253 if (info == null) { // make it up - cant query the gdbm db 254 254 doc_node.setAttribute(GSXML.DOC_TYPE_ATT, "simple"); … … 273 273 274 274 if (!is_top) { // we need to look at the top info 275 info = gdbm_src_.getInfo(top_id);275 info = this.gdbm_src.getInfo(top_id); 276 276 } 277 277 … … 289 289 290 290 String doc_id = OID.getTop(node_id); 291 DBInfo info = gdbm_src_.getInfo(doc_id);291 DBInfo info = this.gdbm_src.getInfo(doc_id); 292 292 String child_type = info.getInfo("childtype"); 293 293 if (child_type.equals("Paged")) { … … 302 302 protected boolean isLeafNode(String oid) 303 303 { 304 DBInfo info = gdbm_src_.getInfo(oid);304 DBInfo info = this.gdbm_src.getInfo(oid); 305 305 String children = info.getInfo("contains"); 306 306 return (children.equals("")); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java
r4903 r5098 42 42 private static final String PHIND_SERVICE = "PhindApplet"; 43 43 44 private MGPPWrapper mgpp_src _=null;45 private String basepath _= null;44 private MGPPWrapper mgpp_src=null; 45 private String basepath = null; 46 46 47 47 private Element applet_description = null; 48 48 49 49 public PhindPhraseBrowse() { 50 mgpp_src_= new MGPPWrapper();50 this.mgpp_src = new MGPPWrapper(); 51 51 // set up the default params 52 mgpp_src_.setQueryLevel("Document");53 mgpp_src_.setReturnLevel("Document");54 mgpp_src_.setMaxDocs(5);55 mgpp_src_.setStem(false);56 mgpp_src_.setCase(true);52 this.mgpp_src.setQueryLevel("Document"); 53 this.mgpp_src.setReturnLevel("Document"); 54 this.mgpp_src.setMaxDocs(5); 55 this.mgpp_src.setStem(false); 56 this.mgpp_src.setCase(true); 57 57 } 58 58 /** configure the service module … … 66 66 67 67 // set up short_service_info_ - for now just has name and type 68 Element e = doc_.createElement(GSXML.SERVICE_ELEM);68 Element e = this.doc.createElement(GSXML.SERVICE_ELEM); 69 69 e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_APPLET); 70 70 e.setAttribute(GSXML.NAME_ATT, PHIND_SERVICE); 71 short_service_info_.appendChild(e);71 this.short_service_info.appendChild(e); 72 72 73 73 // set up the static applet description 74 74 75 applet_description = doc_.createElement(GSXML.SERVICE_ELEM);75 applet_description = this.doc.createElement(GSXML.SERVICE_ELEM); 76 76 applet_description.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_APPLET); 77 77 applet_description.setAttribute(GSXML.NAME_ATT, PHIND_SERVICE); … … 85 85 app_info += GSCGI.ACTION_ARG +"=a&"+GSCGI.REQUEST_TYPE_ARG +"=r&"+GSCGI.SERVICE_ARG+"="+PHIND_SERVICE+"&"+GSCGI.OUTPUT_ARG+"=xml&"+GSCGI.RESPONSE_ONLY_ARG+"=1'/>"; 86 86 app_info +="<PARAM NAME='collection' VALUE='"; 87 app_info += cluster_name_;87 app_info += this.cluster_name; 88 88 app_info += "'/> <PARAM NAME='classifier' VALUE='1'/> <PARAM NAME='orientation' VALUE='vertical'/> <PARAM NAME='depth' VALUE='2'/> <PARAM NAME='resultorder' VALUE='L,l,E,e,D,d'/> <PARAM NAME='backdrop' VALUE='interfaces/default/images/phindbg1.jpg'/><PARAM NAME='fontsize' VALUE='10'/> <PARAM NAME='blocksize' VALUE='10'/>The Phind java applet.</"+GSXML.APPLET_ELEM+">"; 89 89 90 Document dom = converter_.getDOM(app_info);90 Document dom = this.converter.getDOM(app_info); 91 91 Element app_elem = dom.getDocumentElement(); 92 applet_description.appendChild( doc_.importNode(app_elem, true));92 applet_description.appendChild(this.doc.importNode(app_elem, true)); 93 93 94 94 return true; … … 100 100 } 101 101 Element describe = (Element) applet_description.cloneNode(true); 102 describe.appendChild(GSXML.createDisplayTextElement( doc_, GSXML.DISPLAY_TEXT_NAME, getTextString(PHIND_SERVICE+".name", lang)));102 describe.appendChild(GSXML.createDisplayTextElement(this.doc, GSXML.DISPLAY_TEXT_NAME, getTextString(PHIND_SERVICE+".name", lang))); 103 103 return describe; 104 104 } … … 126 126 String phind_index = (String)params.get("pc"); 127 127 // the location of the mgpp database files 128 basepath_ = GSFile.phindBaseDir(site_home_, cluster_name_, phind_index);128 this.basepath = GSFile.phindBaseDir(this.site_home, this.cluster_name, phind_index); 129 129 130 130 // the result element 131 Element result = doc_.createElement(GSXML.RESPONSE_ELEM);131 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 132 132 result.setAttribute(GSXML.FROM_ATT, PHIND_SERVICE); 133 133 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 134 134 135 135 // applet result info must be in appletInfo element 136 Element applet_data = doc_.createElement(GSXML.APPLET_DATA_ELEM);136 Element applet_data = this.doc.createElement(GSXML.APPLET_DATA_ELEM); 137 137 result.appendChild(applet_data); 138 Element phind_data = doc_.createElement("phindData");138 Element phind_data = this.doc.createElement("phindData"); 139 139 applet_data.appendChild(phind_data); 140 140 … … 168 168 169 169 // set the mgpp index data - we are looking up pword 170 mgpp_src_.loadIndexData(basepath_+File.separatorChar+"pword");171 172 mgpp_src_.runQuery(word);173 174 MGPPQueryResult res = mgpp_src_.getQueryResult();170 this.mgpp_src.loadIndexData(this.basepath+File.separatorChar+"pword"); 171 172 this.mgpp_src.runQuery(word); 173 174 MGPPQueryResult res = this.mgpp_src.getQueryResult(); 175 175 Vector docs = res.getDocs(); 176 176 if (docs.size()==0) { … … 187 187 long last_d) { 188 188 189 String record = mgpp_src_.getDocument(basepath_+File.separatorChar+"pdata", "Document",189 String record = this.mgpp_src.getDocument(this.basepath+File.separatorChar+"pdata", "Document", 190 190 phrase); 191 191 if (record.equals("")) { … … 229 229 phind_data.setAttribute("lf", lf); 230 230 phind_data.setAttribute("tf", tf); 231 GSXML.createTextElement( doc_, "phrase", word);231 GSXML.createTextElement(this.doc, "phrase", word); 232 232 233 233 addExpansionList(phind_data, expansions, word, ef, first_e, last_e); … … 244 244 long first, long last) { 245 245 246 Element expansion_list = doc_.createElement("expansionList");246 Element expansion_list = this.doc.createElement("expansionList"); 247 247 phind_data.appendChild(expansion_list); 248 248 expansion_list.setAttribute("length", freq); … … 267 267 268 268 // look up the phrase in the pdata thingy 269 String record = mgpp_src_.getDocument(basepath_+File.separatorChar+"pdata", "Document",269 String record = this.mgpp_src.getDocument(this.basepath+File.separatorChar+"pdata", "Document", 270 270 phrase_num); 271 271 … … 281 281 String df = fields[3]; 282 282 283 Element expansion = doc_.createElement("expansion");283 Element expansion = this.doc.createElement("expansion"); 284 284 expansion.setAttribute("tf", tf); 285 285 expansion.setAttribute("df", df); … … 289 289 String [] ends = splitPhraseOnWord(phrase, orig_phrase); 290 290 if (!ends[0].equals("")) { 291 expansion.appendChild(GSXML.createTextElement( doc_, "prefix", ends[0]));291 expansion.appendChild(GSXML.createTextElement(this.doc, "prefix", ends[0])); 292 292 } 293 293 if (!ends[1].equals("")) { 294 expansion.appendChild(GSXML.createTextElement( doc_, "suffix", ends[1]));294 expansion.appendChild(GSXML.createTextElement(this.doc, "suffix", ends[1])); 295 295 } 296 296 … … 304 304 long first, long last) { 305 305 306 Element document_list = doc_.createElement("documentList");306 Element document_list = this.doc.createElement("documentList"); 307 307 phind_data.appendChild(document_list); 308 308 document_list.setAttribute("length", freq); … … 341 341 342 342 // look up the phrase in the docs thingy 343 String record = mgpp_src_.getDocument(basepath_+File.separatorChar+"docs", "Document",343 String record = this.mgpp_src.getDocument(this.basepath+File.separatorChar+"docs", "Document", 344 344 doc_num); 345 345 … … 353 353 String title = fields[1]; 354 354 355 Element d = doc_.createElement("document");355 Element d = this.doc.createElement("document"); 356 356 d.setAttribute("hash", hash); 357 d.appendChild(GSXML.createTextElement( doc_, "title", title));357 d.appendChild(GSXML.createTextElement(this.doc, "title", title)); 358 358 359 359 return d; … … 366 366 367 367 368 Element thesaurus_list = doc_.createElement("thesaurusList");368 Element thesaurus_list = this.doc.createElement("thesaurusList"); 369 369 phind_data.appendChild(thesaurus_list); 370 370 thesaurus_list.setAttribute("length", freq); … … 397 397 398 398 // look up the phrase in the pdata thingy 399 String record = mgpp_src_.getDocument(basepath_+File.separatorChar+"pdata", "Document",399 String record = this.mgpp_src.getDocument(this.basepath+File.separatorChar+"pdata", "Document", 400 400 phrase_num); 401 401 … … 411 411 String df = fields[3]; 412 412 413 Element thesaurus = doc_.createElement("thesaurus");413 Element thesaurus = this.doc.createElement("thesaurus"); 414 414 thesaurus.setAttribute("tf", tf); 415 415 thesaurus.setAttribute("df", df); 416 416 thesaurus.setAttribute("id", Long.toString(phrase_num)); 417 thesaurus.appendChild(GSXML.createTextElement( doc_, "phrase", phrase));417 thesaurus.appendChild(GSXML.createTextElement(this.doc, "phrase", phrase)); 418 418 return thesaurus; 419 419 … … 435 435 436 436 protected Element phindError(String message) { 437 Element e = doc_.createElement("phindError");438 Text t = doc_.createTextNode(message);437 Element e = this.doc.createElement("phindError"); 438 Text t = this.doc.createTextNode(message); 439 439 e.appendChild(t); 440 440 return e; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java
r4903 r5098 59 59 60 60 /** the absolute address of the site home */ 61 protected String site_home _=null;61 protected String site_home =null; 62 62 /** the http address of the site home */ 63 protected String site_http_address _=null;63 protected String site_http_address =null; 64 64 65 65 /** the name of the cluster (or collection) that this service 66 66 belongs to - if any */ 67 protected String cluster_name _= null;67 protected String cluster_name = null; 68 68 69 69 /** some services can talk back to the message router */ 70 protected ModuleInterface router _= null;70 protected ModuleInterface router = null; 71 71 72 72 /** a converter class to create Documents etc */ 73 protected XMLConverter converter _= null;73 protected XMLConverter converter = null; 74 74 75 75 /** the original config info - if need to store it */ 76 protected Element config_info _= null;76 protected Element config_info = null; 77 77 78 78 /** XML element for describe requests - the container doc */ 79 protected Document doc _= null;79 protected Document doc = null; 80 80 81 81 /** XML element for describe requests - list of supported services 82 82 - this is static */ 83 protected Element short_service_info _= null;83 protected Element short_service_info = null; 84 84 85 85 /** XML element for stylesheet requests - map of service name to format 86 86 elem */ 87 protected HashMap format_info_map _= null;87 protected HashMap format_info_map = null; 88 88 89 89 /** sets the cluster name */ 90 90 public void setClusterName(String cluster_name) { 91 cluster_name_= cluster_name;91 this.cluster_name = cluster_name; 92 92 } 93 93 /** sets the collect name */ … … 98 98 /** sets the site home */ 99 99 public void setSiteHome(String site_home) { 100 site_home_= site_home;100 this.site_home = site_home; 101 101 } 102 102 /** sets the site http address */ 103 103 public void setSiteAddress(String site_address) { 104 site_http_address_= site_address;104 this.site_http_address = site_address; 105 105 } 106 106 107 107 /** sets the message router */ 108 108 public void setMessageRouter(ModuleInterface m) { 109 router_= m;109 this.router = m; 110 110 } 111 111 112 112 /** the no-args constructor */ 113 113 public ServiceRack() { 114 converter_= new XMLConverter();115 doc_ = converter_.newDOM();116 short_service_info_ = doc_.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER);117 format_info_map_= new HashMap();114 this.converter = new XMLConverter(); 115 this.doc = this.converter.newDOM(); 116 this.short_service_info = this.doc.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER); 117 this.format_info_map = new HashMap(); 118 118 } 119 119 … … 143 143 public String process(String xml_in) { 144 144 145 Document doc = converter_.getDOM(xml_in);145 Document doc = this.converter.getDOM(xml_in); 146 146 147 147 Element res = process(doc.getDocumentElement()); 148 return converter_.getString(res);148 return this.converter.getString(res); 149 149 150 150 } … … 161 161 NodeList requests = message.getElementsByTagName(GSXML.REQUEST_ELEM); 162 162 Document mess_doc = message.getOwnerDocument(); 163 Element mainResult = doc_.createElement(GSXML.MESSAGE_ELEM);163 Element mainResult = this.doc.createElement(GSXML.MESSAGE_ELEM); 164 164 if (requests.getLength()==0) { 165 165 // no requests … … 174 174 Element response = processDescribe(request); 175 175 if (response !=null) { 176 mainResult.appendChild( doc_.importNode(response, true));176 mainResult.appendChild(this.doc.importNode(response, true)); 177 177 } 178 178 179 179 } else if (type.equals(GSXML.REQUEST_TYPE_FORMAT)) { 180 180 Element response = processFormat(request); 181 mainResult.appendChild( doc_.importNode(response, true));181 mainResult.appendChild(this.doc.importNode(response, true)); 182 182 183 183 … … 220 220 } 221 221 if (response !=null) { 222 mainResult.appendChild( doc_.importNode(response, true));222 mainResult.appendChild(this.doc.importNode(response, true)); 223 223 } 224 224 … … 240 240 protected Element processDescribe(Element request) { 241 241 242 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);242 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 243 243 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 244 244 … … 264 264 */ 265 265 protected Element processFormat(Element request) { 266 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);266 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 267 267 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT); 268 268 … … 275 275 276 276 // describe a particular service 277 if ( format_info_map_.containsKey(to)) {277 if (this.format_info_map.containsKey(to)) { 278 278 response.appendChild(getServiceFormat(to)); 279 279 response.setAttribute(GSXML.FROM_ATT, to); … … 288 288 protected Element getServiceList(String lang) { 289 289 // for now, it is static and has no language stuff 290 return (Element) short_service_info_.cloneNode(true);290 return (Element) this.short_service_info.cloneNode(true); 291 291 } 292 292 … … 295 295 296 296 protected Element getServiceFormat(String service) { 297 Element format = (Element)((Element) format_info_map_.get(service)).cloneNode(true);297 Element format = (Element)((Element)this.format_info_map.get(service)).cloneNode(true); 298 298 return format; 299 299 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/XSLTServices.java
r4903 r5098 104 104 105 105 System.out.println("configuring XSLTServices"); 106 config_info_= info;106 this.config_info = info; 107 107 try { 108 108 System.out.println("XSLTService::configure() called with:"); … … 137 137 } 138 138 // create the response so we can report the error 139 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);140 String from = GSPath.appendLink( cluster_name_, RESOURCE_RETRIEVE_SERVICE);139 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 140 String from = GSPath.appendLink(this.cluster_name, RESOURCE_RETRIEVE_SERVICE); 141 141 response.setAttribute(GSXML.FROM_ATT, from); 142 142 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 143 143 144 144 System.err.println("XSLTServices:should never get here. service type wrong:"+service); 145 GSXML.addError( doc_, response,"XSLTServices:should never get here. service type wrong:"+service);145 GSXML.addError(this.doc, response,"XSLTServices:should never get here. service type wrong:"+service); 146 146 return response; 147 147 } … … 151 151 152 152 // create the result and set the path so we know where we are 153 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);154 String from = GSPath.appendLink( cluster_name_, RESOURCE_RETRIEVE_SERVICE);153 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 154 String from = GSPath.appendLink(this.cluster_name, RESOURCE_RETRIEVE_SERVICE); 155 155 response.setAttribute(GSXML.FROM_ATT, from); 156 156 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); … … 170 170 if (param_elem==null) { 171 171 System.err.println("bad query request"); 172 GSXML.addError( doc_, response,"bad query request in XSLTServices");172 GSXML.addError(this.doc, response,"bad query request in XSLTServices"); 173 173 return response; 174 174 } … … 186 186 } 187 187 // something funny with the doc - 188 Element new_doc = doc_.createElement(GSXML.DOCUMENT_ELEM);188 Element new_doc = this.doc.createElement(GSXML.DOCUMENT_ELEM); 189 189 new_doc.setAttribute(GSXML.NAME_ATT, ids[j]); //GSXML.createDocumentElement(doc_, ids[j]); 190 GSXML.addDocText( doc_, new_doc, document);190 GSXML.addDocText(this.doc, new_doc, document); 191 191 response.appendChild(new_doc); 192 192 } … … 199 199 200 200 // create the result and set the path so we know where we are 201 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);202 String from = GSPath.appendLink( cluster_name_, XSLT_QUERY_SERVICE);201 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 202 String from = GSPath.appendLink(this.cluster_name, XSLT_QUERY_SERVICE); 203 203 response.setAttribute(GSXML.FROM_ATT, from); 204 204 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); … … 226 226 } else { 227 227 System.err.println("XSLTServices: bad alphabet name : "+ alphabet); 228 GSXML.addError( doc_, response,"XSLTServices: bad alphabet name : "+ alphabet);228 GSXML.addError(this.doc, response,"XSLTServices: bad alphabet name : "+ alphabet); 229 229 stream = new GeneratedDocumentStream(); 230 230 } 231 231 232 Element resource_list = doc_.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER);232 Element resource_list = this.doc.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER); 233 233 response.appendChild(resource_list); 234 234 … … 247 247 transformer.transform(source,result); 248 248 String id = writer.toString(); 249 Element e = doc_.createElement(GSXML.DOCUMENT_ELEM);249 Element e = this.doc.createElement(GSXML.DOCUMENT_ELEM); 250 250 e.setAttribute(GSXML.NAME_ATT, id); 251 251 //Node no = GSXML.createDocumentElement(doc_, id); 252 252 resource_list.appendChild(e); 253 253 } catch (Throwable t) { 254 GSXML.addError( doc_, response, "Error in XSLTServices finding results:" + t.toString());254 GSXML.addError(this.doc, response, "Error in XSLTServices finding results:" + t.toString()); 255 255 } 256 256 }
Note:
See TracChangeset
for help on using the changeset viewer.