Changeset 1236 for MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/SRUProxyAction.java
- Timestamp:
- 04/25/11 21:01:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/SRUProxyAction.java
r1215 r1236 78 78 79 79 private MDRepoProxyAction mdrepoproxyaction; 80 private TermsProxyAction termsproxyaction; 80 81 private InputStream resultStream; 81 82 private HttpServletRequest request; … … 89 90 { 90 91 hash_operations.put("searchRetrieve", "recordset"); 92 hash_operations.put("explain", "model"); /* could be terms*/ 93 hash_operations.put("scan", "values"); 91 94 } 92 95 … … 95 98 { 96 99 operation_code.put("searchRetrieve", OP_SEARCHRETRIEVE); 97 operation_code.put(" searchRetrieve", OP_EXPLAIN);98 operation_code.put("s earchRetrieve", OP_SCAN);100 operation_code.put("explain", OP_EXPLAIN); 101 operation_code.put("scan", OP_SCAN); 99 102 } 100 103 … … 304 307 if ((this.maximumRecords < 0 ) ||((getServletRequest().getParameter("maximumRecords") != null) && (getServletRequest().getParameter("maximumRecords").equals("0")))){ 305 308 this.Diagnostics().Add(new Diagnostic(Diagnostic.UNSUPPORTED_PARAMETERVALUE, 306 "maximumRecords must by gr ater than 0."));309 "maximumRecords must by greater than 0.")); 307 310 } else { 308 311 mdrepoproxyaction.setMaximumItems(Integer.toString(this.getMaximumRecords())); … … 319 322 320 323 } else { 321 if (operation.equals("explain") ){322 324 if (operation.equals("explain") || operation == null){ 325 Admin.notifyUser("explaining", "debug"); 323 326 }else { 324 327 if (operation.equals("scan")){ … … 345 348 } 346 349 } 350 347 351 public void prepare() throws UnsupportedEncodingException{ 348 352 // special handling of parameter setting, x-cmd-... not alowed in java 349 353 this.setX_cmd_repository(getServletRequest().getParameter("x-cmd-repository")); 350 354 this.setX_cmd_collections(getServletRequest().getParameter("x-cmd-collections")); 351 352 353 //version 354 if (this.version == null) { 355 this.Diagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "version"); 355 356 // root call 357 //operation 358 if (operation.equals("explain") || operation == null){ 359 // TODO: version param is mandatory for explain as well, but for root-request not! 360 //explain 361 termsproxyaction = new TermsProxyAction(); 362 termsproxyaction.setDiagnostics(diagnostics); 363 termsproxyaction.setActionkey("terms"); 364 365 termsproxyaction.setQ("all"); 366 termsproxyaction.setFormat("sru-explain"); 367 356 368 //return -1; 357 } else { 358 if (!version.equals("1.2")) { 359 this.Diagnostics().Add(Diagnostic.UNSUPPORTED_VERSION, "Version 1.2 supported."); 369 } else { 370 //version 371 if (this.version == null) { 372 this.Diagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "version"); 360 373 //return -1; 361 } 362 }363 //operation364 if (this.operation == null) {365 this.Diagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "operation");366 //return -1;367 } else {374 } else { 375 if (!version.equals("1.2")) { 376 this.Diagnostics().Add(Diagnostic.UNSUPPORTED_VERSION, "Version 1.2 supported."); 377 //return -1; 378 } 379 } 380 368 381 prepareOperation(); 369 382 } … … 444 457 prepare(); 445 458 if (Diagnostics().Accepted()){ 446 //TODO diagnostic 447 if (this.mdrepoproxyaction.getTargetRequest() == null) { 448 Diagnostics().Add(Diagnostic.QUERYSYNTAXERROR); 449 return ERROR; 450 } 451 if (this.mdrepoproxyaction.execute() == SUCCESS){ 452 resultStream = this.mdrepoproxyaction.getResultStream(); 453 postprocess(); 454 return SUCCESS; 459 // root-explain 460 if (this.termsproxyaction != null) { 461 if (this.termsproxyaction.execute() == SUCCESS){ 462 resultStream = this.termsproxyaction.getResultStream(); 463 return SUCCESS; 464 } 465 } else { 466 //TODO diagnostic 467 if (this.mdrepoproxyaction.getTargetRequest() == null) { 468 Diagnostics().Add(Diagnostic.QUERYSYNTAXERROR); 469 return ERROR; 470 } 471 if (this.mdrepoproxyaction.execute() == SUCCESS){ 472 resultStream = this.mdrepoproxyaction.getResultStream(); 473 postprocess(); 474 return SUCCESS; 475 } 455 476 } 456 477 }
Note: See TracChangeset
for help on using the changeset viewer.