Changeset 24427 for main/trunk/greenstone3
- Timestamp:
- 2011-08-19T10:58:29+12:00 (13 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java
r24393 r24427 421 421 response.setAttribute(GSXML.TYPE_ATT, type); 422 422 423 logger.error("Collection received a message, attempting to process");424 425 423 if (type.equals(GSXML.REQUEST_TYPE_FORMAT_STRING)) 426 424 { 427 logger.error("Received format string request");428 429 425 String subaction = request.getAttribute("subaction"); 430 logger.error("Subaction is " + subaction);431 432 426 String service = request.getAttribute("service"); 433 logger.error("Service is " + service);434 427 435 428 String classifier = null; … … 437 430 { 438 431 classifier = request.getAttribute("classifier"); 439 logger.error("Classifier is " + classifier); 440 } 441 442 //logger.error("Format string: " + format_string); 443 logger.error("Config file location = " + GSFile.collectionConfigFile(this.site_home, this.cluster_name)); 444 432 } 433 445 434 // check for version file 446 447 435 String directory = new File(GSFile.collectionConfigFile(this.site_home, this.cluster_name)).getParent() + File.separator; 448 logger.error("Directory is " + directory);449 436 450 437 String version_filename = ""; … … 455 442 456 443 File version_file = new File(version_filename); 457 logger.error("Version filename is " + version_filename);458 444 459 445 if (subaction.equals("update")) … … 495 481 format_statement_filename = directory + "query_format_statement_v" + version_number + ".txt"; 496 482 497 logger.error("Format statement filename is " + format_statement_filename);498 499 483 // Write format statement 500 484 String format_string = this.converter.getString(format_statement); //GSXML.xmlNodeToString(format_statement); … … 523 507 Element display_format = (Element) format_element.getFirstChild(); 524 508 525 logger.error("I have received a save document request");526 509 String format_string = GSXML.xmlNodeToString(display_format); 527 logger.error("Param=" + format_string);528 510 String collection_config = directory + "collectionConfig.xml"; 529 511 Document config = this.converter.getDOM(new File(collection_config), "UTF-8"); … … 534 516 if (GSXML.getChildByTagName(current_node, "display") == null) 535 517 { 536 logger.error("ERROR: does not have a display child");537 518 // well then create a format tag 538 519 Element display_tag = config.createElement("display"); 539 520 current_node = (Node) current_node.appendChild(display_tag); 540 //current_node = (Node) format_tag; 541 } 542 521 } 543 522 else 544 523 { … … 548 527 if (GSXML.getChildByTagName(current_node, "format") == null) 549 528 { 550 logger.error("ERROR: does not have a format child");551 529 // well then create a format tag 552 530 Element format_tag = config.createElement("format"); 553 531 current_node.appendChild(format_tag); 554 //current_node = (Node) format_tag;555 532 } 556 533 557 534 current_node.replaceChild(config.importNode(display_format, true), GSXML.getChildByTagName(current_node, "format")); 558 535 559 logger.error(GSXML.xmlNodeToString(current_node));560 561 logger.error("Convert config to string");562 536 String new_config = this.converter.getString(config); 563 537 … … 572 546 writer.write(new_config); 573 547 writer.close(); 574 logger.error("All is happy with collection saveDocument");575 548 } 576 549 catch (IOException e) … … 582 555 if (subaction.equals("save")) 583 556 { 584 logger.error("SAVE format statement");585 586 557 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 587 //String format_string = GSXML.getNodeText(format_element);588 558 Element format_statement = (Element) format_element.getFirstChild(); 589 559 590 560 try 591 561 { 592 593 562 // open collectionConfig.xml and read in to w3 Document 594 563 String collection_config = directory + "collectionConfig.xml"; … … 604 573 NodeList current_node_list; 605 574 606 logger.error("Service is " + service);607 608 575 if (service.equals("ClassifierBrowse")) 609 576 { … … 612 579 // default is <browse><format> 613 580 614 logger.error("Looking for browse");615 581 current_node = GSXML.getChildByTagName(current_node, "browse"); 616 582 … … 618 584 if (classifier != null) 619 585 { 620 logger.error("Classifier is not null");621 logger.error("Classifier is " + classifier);622 586 current_node_list = GSXML.getChildrenByTagName(current_node, "classifier"); 623 587 index = Integer.parseInt(classifier.substring(2)) - 1; 624 logger.error("classifier index is " + index); 588 625 589 // index should be given by X-1 626 590 current_node = current_node_list.item(index); … … 628 592 if (GSXML.getChildByTagName(current_node, "format") == null) 629 593 { 630 logger.error("ERROR: valid classifier but does not have a format child");631 594 // well then create a format tag 632 595 Element format_tag = config.createElement("format"); 633 596 current_node.appendChild(format_tag); 634 //current_node = (Node) format_tag;635 597 } 636 598 } 637 599 else 638 600 { 639 logger.error("Classifier is null");640 601 // To support all classifiers, set classifier to null? There is the chance here that the format tag does not exist 641 602 if (GSXML.getChildByTagName(current_node, "format") == null) 642 603 { 643 logger.error("ERROR: classifier does not have a format child");644 604 // well then create a format tag 645 605 Element format_tag = config.createElement("format"); 646 606 current_node.appendChild(format_tag); 647 //current_node = (Node) format_tag;648 607 } 649 608 } … … 651 610 else if (service.equals("AllClassifierBrowse")) 652 611 { 653 logger.error("Looking for browse");654 612 current_node = GSXML.getChildByTagName(current_node, "browse"); 655 613 if (GSXML.getChildByTagName(current_node, "format") == null) 656 614 { 657 logger.error("ERROR AllClassifierBrowse: all classifiers do not have a format child");658 615 // well then create a format tag 659 616 Element format_tag = config.createElement("format"); 660 617 current_node.appendChild(format_tag); 661 //current_node = (Node) format_tag;662 618 } 663 619 } … … 665 621 { 666 622 // look in <format> with no attributes 667 logger.error("I presume this is search");668 669 623 current_node_list = GSXML.getChildrenByTagName(current_node, "search"); 670 624 for (k = 0; k < current_node_list.getLength(); k++) … … 681 635 682 636 // Now convert config document to string for writing to file 683 logger.error("Convert config to string");684 637 String new_config = this.converter.getString(config); 685 638 … … 692 645 writer.write(new_config); 693 646 writer.close(); 694 logger.error("All is happy with collection");695 647 696 648 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java
r24393 r24427 55 55 protected static final String DOCUMENT_GET_INFORMATION = "DocumentGetInformation"; 56 56 57 //Metadata services58 protected static final String DOCUMENT_GET_METADATA = "DocumentGetMetadata";59 protected static final String DOCUMENT_ADD_METADATA = "DocumentAddMetadata";60 protected static final String DOCUMENT_DELETE_METADATA = "DocumentDeleteMetadata";61 62 //Document text services63 protected static final String DOCUMENT_GET_TEXT = "DocumentGetText";64 protected static final String DOCUMENT_SET_TEXT = "DocumentSetText";65 66 57 //Other services 67 58 protected static final String DOCUMENT_EXECUTE_TRANSACTION = "DocumentExecuteTransaction"; 68 59 /***************************************************/ 69 60 70 String[] services = { DOCUMENT_CREATE, DOCUMENT_DELETE, DOCUMENT_DUPLICATE, DOCUMENT_GET_INFORMATION, DOCUMENT_MOVE, DOCUMENT_MERGE, DOCUMENT_SPLIT, DOCUMENT_ GET_METADATA, DOCUMENT_ADD_METADATA, DOCUMENT_DELETE_METADATA, DOCUMENT_GET_TEXT, DOCUMENT_SET_TEXT, DOCUMENT_EXECUTE_TRANSACTION };61 String[] services = { DOCUMENT_CREATE, DOCUMENT_DELETE, DOCUMENT_DUPLICATE, DOCUMENT_GET_INFORMATION, DOCUMENT_MOVE, DOCUMENT_MERGE, DOCUMENT_SPLIT, DOCUMENT_EXECUTE_TRANSACTION }; 71 62 72 63 /** configure this service */ … … 360 351 return null; 361 352 } 362 363 353 }
Note:
See TracChangeset
for help on using the changeset viewer.