Changeset 24888 for main/trunk/greenstone3/src/java
- Timestamp:
- 2011-12-13T10:00:19+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
r24855 r24888 167 167 protected Element processActivateCollection(Element request) 168 168 { 169 Element response = runCommand(request, GS2PerlConstructor.ACTIVATE);170 169 // this activates the collection on disk. but now we need to tell 171 170 // the MR about it. but we have to wait until the process is finished. 172 Element status = (Element) GSXML.getChildByTagName(response, GSXML.STATUS_ELEM);173 171 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 174 172 HashMap params = GSXML.extractParams(param_list, false); 175 173 String coll_name = (String) params.get(COL_PARAM); 176 174 String lang = request.getAttribute(GSXML.LANG_ATT); 175 176 systemRequest("delete", coll_name, null, lang); 177 178 Element response = runCommand(request, GS2PerlConstructor.ACTIVATE); 179 Element status = (Element) GSXML.getChildByTagName(response, GSXML.STATUS_ELEM); 180 181 String request_type = request.getAttribute(GSXML.TYPE_ATT); 182 if (request_type.equals(GSXML.REQUEST_TYPE_STATUS)) 183 { 184 return response; 185 } 186 177 187 // check for finished 178 188 int status_code = Integer.parseInt(status.getAttribute(GSXML.STATUS_ERROR_CODE_ATT)); … … 320 330 protected void systemRequest(String action_name, String coll_name, Element status, String lang) 321 331 { 322 323 332 // send the request to the MR 324 333 Element message = this.doc.createElement(GSXML.MESSAGE_ELEM); … … 348 357 String[] args = { coll_name }; 349 358 350 if (response == null) 351 { 352 t = this.doc.createTextNode(getTextString(action_name + ".configure_error", lang, args)); 353 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 359 if (status != null) 360 { 361 if (response == null) 362 { 363 t = this.doc.createTextNode(getTextString(action_name + ".configure_error", lang, args)); 364 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 365 status.appendChild(t); 366 return; 367 } 368 369 // if we got here, we have succeeded! 370 t = this.doc.createTextNode(getTextString(action_name + ".success", lang, args)); 371 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.SUCCESS)); 354 372 status.appendChild(t); 355 return; 356 } 357 358 // if we got here, we have succeeded! 359 t = this.doc.createTextNode(getTextString(action_name + ".success", lang, args)); 360 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.SUCCESS)); 361 status.appendChild(t); 373 } 362 374 } 363 375 … … 421 433 protected Element runCommand(Element request, int type) 422 434 { 423 424 435 // the response to send back 425 436 String name = GSPath.getFirstLink(request.getAttribute(GSXML.TO_ATT)); … … 430 441 431 442 String lang = request.getAttribute(GSXML.LANG_ATT); 443 String uid = request.getAttribute(GSXML.USER_ID_ATT); 432 444 String request_type = request.getAttribute(GSXML.TYPE_ATT); 433 445 … … 479 491 coll_name = (String) params.get(COL_PARAM); 480 492 } 481 logger. error("Coll name = " + coll_name);493 logger.info("Coll name = " + coll_name); 482 494 // makes a paramList of the relevant params 483 495 Element other_params = extractOtherParams(params, type); 484 496 485 497 //create the constructor to do the work 486 487 498 GS2PerlConstructor constructor = new GS2PerlConstructor("perl_build"); 488 499 if (!constructor.configure()) … … 494 505 } 495 506 507 GS2PerlListener listener = new GS2PerlListener(); 496 508 constructor.setSiteHome(this.site_home); 497 509 constructor.setCollectionName(coll_name); 498 510 constructor.setActionType(type); 499 511 constructor.setProcessParams(other_params); 500 // the listener 501 GS2PerlListener listener = new GS2PerlListener(); 512 502 513 constructor.addListener(listener); 503 514 constructor.start(); … … 511 522 status.appendChild(t); 512 523 return response; 513 514 524 } 515 525
Note:
See TracChangeset
for help on using the changeset viewer.