Changeset 27705 for main/trunk/greenstone3/src/java/org
- Timestamp:
- 2013-06-26T15:31:58+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java
r26446 r27705 36 36 import org.greenstone.gsdl3.util.GSXML; 37 37 import org.greenstone.gsdl3.util.OAIXML; 38 import org.greenstone.gsdl3.util.SimpleMacroResolver;39 38 import org.greenstone.gsdl3.util.UserContext; 40 39 import org.greenstone.gsdl3.util.XMLTransformer; … … 56 55 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.collection.Collection.class.getName()); 57 56 58 /** is this collection being tidied and therefore can support realistic book view? */57 /** is this collection being tidied and therefore can support realistic book view? */ 59 58 protected boolean useBook = false; 60 /** is this collection public or private - public collections will 61 appear on the home page, whereas private collections won't*/ 59 /** 60 * is this collection public or private - public collections will 61 * appear on the home page, whereas private collections won't 62 */ 62 63 protected boolean is_public = true; 63 64 /** collection type : mg, mgpp or lucene */ … … 81 82 protected ArrayList<HashMap<String, ArrayList<String>>> _securityExceptions = new ArrayList<HashMap<String, ArrayList<String>>>(); 82 83 83 84 84 protected XMLTransformer transformer = null; 85 85 … … 113 113 return false; 114 114 } 115 115 116 116 macro_resolver.addMacro("_httpcollection_", this.site_http_address + "/collect/" + this.cluster_name); 117 117 … … 143 143 this.description.setAttribute(GSXML.TYPE_ATT, col_type); 144 144 this.description.setAttribute(GSXML.DB_TYPE_ATT, db_type); 145 145 146 146 _globalFormat = (Element) GSXML.getChildByTagName(coll_config_xml, GSXML.FORMAT_ELEM); 147 147 // process the metadata and display items and default library params … … 391 391 Element service_list = (Element) GSXML.getChildByTagName(build_config_xml, GSXML.SERVICE_CLASS_ELEM + GSXML.LIST_MODIFIER); 392 392 Element oai_service_rack = null; 393 if (service_list != null) { 394 configureServiceRackList(service_list, coll_config_xml); 395 oai_service_rack = GSXML.getNamedElement(service_list, GSXML.SERVICE_CLASS_ELEM, OAIXML.NAME, OAIXML.OAIPMH); 393 if (service_list != null) 394 { 395 configureServiceRackList(service_list, coll_config_xml); 396 oai_service_rack = GSXML.getNamedElement(service_list, GSXML.SERVICE_CLASS_ELEM, OAIXML.NAME, OAIXML.OAIPMH); 396 397 } 397 398 // collection Config may also contain manually added service racks … … 399 400 if (service_list != null) 400 401 { 401 402 403 402 configureServiceRackList(service_list, build_config_xml); 403 // this oai used in preference to one in buildConfig.xml 404 oai_service_rack = GSXML.getNamedElement(service_list, GSXML.SERVICE_CLASS_ELEM, OAIXML.NAME, OAIXML.OAIPMH); 404 405 } 405 406 // Check for oai 406 407 407 408 if (oai_service_rack != null) 408 409 410 logger.info(this.cluster_name +" has OAI services");411 412 413 414 415 416 NodeList children = metadata_list.getElementsByTagName(GSXML.METADATA_ELEM);417 // can't do getChildNodes(), because whitespace, such as newlines, creates Text nodes418 for (int i = 0; i < children.getLength(); i++)419 420 421 422 423 String earliestDatestampStr = GSXML.getValue(metadata);424 if (!earliestDatestampStr.equals(""))425 426 427 428 break; // found a metadata element with name=earliestDatestamp in buildconfig429 430 431 432 433 434 435 436 437 409 { 410 has_oai = true; 411 logger.info(this.cluster_name + " has OAI services"); 412 // extract earliestDatestamp from the buildconfig.xml for OAI 413 Element metadata_list = (Element) GSXML.getChildByTagName(build_config_xml, GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER); 414 415 if (metadata_list != null) 416 { 417 NodeList children = metadata_list.getElementsByTagName(GSXML.METADATA_ELEM); 418 // can't do getChildNodes(), because whitespace, such as newlines, creates Text nodes 419 for (int i = 0; i < children.getLength(); i++) 420 { 421 Element metadata = (Element) children.item(i); 422 if (metadata.getAttribute(GSXML.NAME_ATT).equals(OAIXML.EARLIEST_DATESTAMP)) 423 { 424 String earliestDatestampStr = GSXML.getValue(metadata); 425 if (!earliestDatestampStr.equals("")) 426 { 427 earliestDatestamp = Long.parseLong(earliestDatestampStr); 428 } 429 break; // found a metadata element with name=earliestDatestamp in buildconfig 430 } 431 } 432 } 433 434 // If at the end of this, there is no value for earliestDatestamp, print out a warning 435 logger.warn("No earliestDatestamp in buildConfig.xml for collection: " + this.cluster_name + ". Defaulting to 0."); 436 437 } // if oai_service_rack != null 438 438 439 return true; 439 440 } 440 441 441 442 442 /** … … 462 462 if (subset.equals(GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER) || subset.equals(GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER) || subset.equals("libraryParamList")) 463 463 { 464 465 464 configureLocalData(coll_config_elem); 465 configureLocalData(build_config_elem); 466 466 return findAndLoadInfo(coll_config_elem, build_config_elem); 467 467 … … 481 481 protected Element processMessage(Element request) 482 482 { 483 483 String type = request.getAttribute(GSXML.TYPE_ATT); 484 484 if (type.equals(GSXML.REQUEST_TYPE_FORMAT_STRING)) 485 485 { 486 486 return processFormatStringRequest(request); 487 487 } 488 488 else if (type.equals(GSXML.REQUEST_TYPE_SECURITY)) 489 489 { 490 490 return processSecurityRequest(request); 491 491 } 492 492 else if (type.equals(GSXML.REQUEST_TYPE_FORMAT)) 493 493 { 494 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 495 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 496 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT); 497 if (_globalFormat != null) 498 { 499 response.appendChild(this.doc.importNode(_globalFormat, true)); 500 } 501 return response; 502 } 503 // unknown type 504 return super.processMessage(request); 505 506 } 507 508 protected Element processSecurityRequest(Element request) 509 { 494 510 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 495 511 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 496 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT); 497 if(_globalFormat != null) 498 { 499 response.appendChild(this.doc.importNode(_globalFormat, true)); 500 } 501 return response; 502 } 503 // unknown type 504 return super.processMessage(request); 505 506 } 507 508 protected Element processSecurityRequest(Element request) { 509 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 510 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 511 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_SECURITY); 512 513 String oid = request.getAttribute("oid"); 514 if (oid.contains(".")) 515 { 516 oid = oid.substring(0, oid.indexOf(".")); 517 } 518 519 ArrayList<String> groups = getPermittedGroups(oid); 520 521 Element groupList = this.doc.createElement(GSXML.GROUP_ELEM + GSXML.LIST_MODIFIER); 522 response.appendChild(groupList); 523 524 for (String groupName : groups) 525 { 526 Element group = this.doc.createElement(GSXML.GROUP_ELEM); 527 groupList.appendChild(group); 528 group.setAttribute(GSXML.NAME_ATT, groupName); 529 } 530 return response; 531 } 512 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_SECURITY); 513 514 String oid = request.getAttribute("oid"); 515 if (oid.contains(".")) 516 { 517 oid = oid.substring(0, oid.indexOf(".")); 518 } 519 520 ArrayList<String> groups = getPermittedGroups(oid); 521 522 Element groupList = this.doc.createElement(GSXML.GROUP_ELEM + GSXML.LIST_MODIFIER); 523 response.appendChild(groupList); 524 525 for (String groupName : groups) 526 { 527 Element group = this.doc.createElement(GSXML.GROUP_ELEM); 528 groupList.appendChild(group); 529 group.setAttribute(GSXML.NAME_ATT, groupName); 530 } 531 return response; 532 } 532 533 533 534 protected ArrayList<String> getPermittedGroups(String oid) … … 681 682 } 682 683 683 protected Element processFormatStringRequest(Element request) { 684 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 685 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT_STRING); 686 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 687 688 String subaction = request.getAttribute("subaction"); 689 String service = request.getAttribute("service"); 690 691 String classifier = null; 692 if (service.equals("ClassifierBrowse")) 693 { 694 classifier = request.getAttribute("classifier"); 695 } 696 697 // check for version file 698 String directory = new File(GSFile.collectionConfigFile(this.site_home, this.cluster_name)).getParent() + File.separator; 699 700 String version_filename = ""; 701 if (service.equals("ClassifierBrowse")) 702 version_filename = directory + "browse_" + classifier + "_format_statement_version.txt"; 703 else 704 version_filename = directory + "query_format_statement_version.txt"; 705 706 File version_file = new File(version_filename); 707 708 if (subaction.equals("update")) 709 { 710 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 711 //String format_string = GSXML.getNodeText(format_element); 712 Element format_statement = (Element) format_element.getFirstChild(); 713 714 String version_number = "1"; 715 BufferedWriter writer; 716 717 try 718 { 719 720 if (version_file.exists()) 721 { 722 // Read version 723 BufferedReader reader = new BufferedReader(new FileReader(version_filename)); 724 version_number = reader.readLine(); 725 int aInt = Integer.parseInt(version_number) + 1; 726 version_number = Integer.toString(aInt); 727 reader.close(); 728 } 729 else 730 { 731 // Create 732 version_file.createNewFile(); 733 writer = new BufferedWriter(new FileWriter(version_filename)); 734 writer.write(version_number); 735 writer.close(); 736 } 737 738 // Write version file 739 String format_statement_filename = ""; 740 741 if (service.equals("ClassifierBrowse")) 742 format_statement_filename = directory + "browse_" + classifier + "_format_statement_v" + version_number + ".txt"; 743 else 744 format_statement_filename = directory + "query_format_statement_v" + version_number + ".txt"; 745 746 // Write format statement 747 String format_string = this.converter.getString(format_statement); //GSXML.xmlNodeToString(format_statement); 748 writer = new BufferedWriter(new FileWriter(format_statement_filename)); 749 writer.write(format_string); 750 writer.close(); 751 752 // Update version number 753 writer = new BufferedWriter(new FileWriter(version_filename)); 754 writer.write(version_number); 755 writer.close(); 756 757 } 758 catch (IOException e) 759 { 760 logger.error("IO Exception " + e); 761 } 762 } 763 764 if (subaction.equals("saveDocument")) 765 { 766 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 767 //String format_string = GSXML.getNodeText(format_element); 768 // Get display tag 769 Element display_format = (Element) format_element.getFirstChild(); 770 771 String collection_config = directory + "collectionConfig.xml"; 772 Document config = this.converter.getDOM(new File(collection_config), "UTF-8"); 773 774 Node current_node = GSXML.getChildByTagName(config, "CollectionConfig"); 775 776 // Get display child 777 if (GSXML.getChildByTagName(current_node, "display") == null) 778 { 779 // well then create a format tag 780 Element display_tag = config.createElement("display"); 781 current_node = (Node) current_node.appendChild(display_tag); 782 } 783 else 784 { 785 current_node = GSXML.getChildByTagName(current_node, "display"); 786 } 787 788 if (GSXML.getChildByTagName(current_node, "format") == null) 789 { 790 // well then create a format tag 791 Element format_tag = config.createElement("format"); 792 current_node.appendChild(format_tag); 793 } 794 795 current_node.replaceChild(config.importNode(display_format, true), GSXML.getChildByTagName(current_node, "format")); 796 797 String new_config = this.converter.getString(config); 798 799 new_config = StringUtils.replace(new_config, "<", "<"); 800 new_config = StringUtils.replace(new_config, ">", ">"); 801 new_config = StringUtils.replace(new_config, """, "\""); 802 803 try 804 { 805 // Write to file (not original! for now) 806 BufferedWriter writer = new BufferedWriter(new FileWriter(collection_config + ".new")); 807 writer.write(new_config); 808 writer.close(); 809 } 810 catch (IOException e) 811 { 812 logger.error("IO Exception " + e); 813 } 814 } 815 816 if (subaction.equals("save")) 817 { 818 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 819 Element format_statement = (Element) format_element.getFirstChild(); 820 821 try 822 { 823 // open collectionConfig.xml and read in to w3 Document 824 String collection_config = directory + "collectionConfig.xml"; 825 Document config = this.converter.getDOM(new File(collection_config), "UTF-8"); 826 827 //String tag_name = ""; 828 int k; 829 int index; 830 Element elem; 831 // Try importing entire tree to this.doc so we can add and remove children at ease 832 //Node current_node = this.doc.importNode(GSXML.getChildByTagName(config, "CollectionConfig"),true); 833 Node current_node = GSXML.getChildByTagName(config, "CollectionConfig"); 834 NodeList current_node_list; 835 836 if (service.equals("ClassifierBrowse")) 837 { 838 //tag_name = "browse"; 839 // if CLX then need to look in <classifier> X then <format> 840 // default is <browse><format> 841 842 current_node = GSXML.getChildByTagName(current_node, "browse"); 843 844 // find CLX 845 if (classifier != null) 846 { 847 current_node_list = GSXML.getChildrenByTagName(current_node, "classifier"); 848 index = Integer.parseInt(classifier.substring(2)) - 1; 849 850 // index should be given by X-1 851 current_node = current_node_list.item(index); 852 // what if classifier does not have a format tag? 853 if (GSXML.getChildByTagName(current_node, "format") == null) 854 { 855 // well then create a format tag 856 Element format_tag = config.createElement("format"); 857 current_node.appendChild(format_tag); 858 } 859 } 684 protected Element processFormatStringRequest(Element request) 685 { 686 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 687 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT_STRING); 688 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 689 690 String subaction = request.getAttribute("subaction"); 691 String service = request.getAttribute("service"); 692 693 String classifier = null; 694 if (service.equals("ClassifierBrowse")) 695 { 696 classifier = request.getAttribute("classifier"); 697 } 698 699 // check for version file 700 String directory = new File(GSFile.collectionConfigFile(this.site_home, this.cluster_name)).getParent() + File.separator; 701 702 String version_filename = ""; 703 if (service.equals("ClassifierBrowse")) 704 version_filename = directory + "browse_" + classifier + "_format_statement_version.txt"; 860 705 else 861 { 862 // To support all classifiers, set classifier to null? There is the chance here that the format tag does not exist 863 if (GSXML.getChildByTagName(current_node, "format") == null) 864 { 865 // well then create a format tag 866 Element format_tag = config.createElement("format"); 867 current_node.appendChild(format_tag); 868 } 869 } 870 } 871 else if (service.equals("AllClassifierBrowse")) 872 { 873 current_node = GSXML.getChildByTagName(current_node, "browse"); 874 if (GSXML.getChildByTagName(current_node, "format") == null) 875 { 876 // well then create a format tag 877 Element format_tag = config.createElement("format"); 878 current_node.appendChild(format_tag); 879 } 880 } 881 else 882 { 883 // look in <format> with no attributes 884 current_node_list = GSXML.getChildrenByTagName(current_node, "search"); 885 for (k = 0; k < current_node_list.getLength(); k++) 886 { 887 current_node = current_node_list.item(k); 888 // if current_node has no attributes then break 889 elem = (Element) current_node; 890 if (elem.hasAttribute("name") == false) 891 break; 892 } 893 } 894 895 current_node.replaceChild(config.importNode(format_statement, true), GSXML.getChildByTagName(current_node, "format")); 896 897 // Now convert config document to string for writing to file 898 String new_config = this.converter.getString(config); 899 900 new_config = StringUtils.replace(new_config, "<", "<"); 901 new_config = StringUtils.replace(new_config, ">", ">"); 902 new_config = StringUtils.replace(new_config, """, "\""); 903 904 // Write to file (not original! for now) 905 BufferedWriter writer = new BufferedWriter(new FileWriter(collection_config + ".new")); 906 writer.write(new_config); 907 writer.close(); 908 909 } 910 catch (Exception ex) 911 { 912 logger.error("There was an exception " + ex); 913 914 StringWriter sw = new StringWriter(); 915 PrintWriter pw = new PrintWriter(sw, true); 916 ex.printStackTrace(pw); 917 pw.flush(); 918 sw.flush(); 919 logger.error(sw.toString()); 920 } 921 922 } 923 924 return response; 925 } 706 version_filename = directory + "query_format_statement_version.txt"; 707 708 File version_file = new File(version_filename); 709 710 if (subaction.equals("update")) 711 { 712 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 713 //String format_string = GSXML.getNodeText(format_element); 714 Element format_statement = (Element) format_element.getFirstChild(); 715 716 String version_number = "1"; 717 BufferedWriter writer; 718 719 try 720 { 721 722 if (version_file.exists()) 723 { 724 // Read version 725 BufferedReader reader = new BufferedReader(new FileReader(version_filename)); 726 version_number = reader.readLine(); 727 int aInt = Integer.parseInt(version_number) + 1; 728 version_number = Integer.toString(aInt); 729 reader.close(); 730 } 731 else 732 { 733 // Create 734 version_file.createNewFile(); 735 writer = new BufferedWriter(new FileWriter(version_filename)); 736 writer.write(version_number); 737 writer.close(); 738 } 739 740 // Write version file 741 String format_statement_filename = ""; 742 743 if (service.equals("ClassifierBrowse")) 744 format_statement_filename = directory + "browse_" + classifier + "_format_statement_v" + version_number + ".txt"; 745 else 746 format_statement_filename = directory + "query_format_statement_v" + version_number + ".txt"; 747 748 // Write format statement 749 String format_string = this.converter.getString(format_statement); //GSXML.xmlNodeToString(format_statement); 750 writer = new BufferedWriter(new FileWriter(format_statement_filename)); 751 writer.write(format_string); 752 writer.close(); 753 754 // Update version number 755 writer = new BufferedWriter(new FileWriter(version_filename)); 756 writer.write(version_number); 757 writer.close(); 758 759 } 760 catch (IOException e) 761 { 762 logger.error("IO Exception " + e); 763 } 764 } 765 766 if (subaction.equals("saveDocument")) 767 { 768 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 769 //String format_string = GSXML.getNodeText(format_element); 770 // Get display tag 771 Element display_format = (Element) format_element.getFirstChild(); 772 773 String collection_config = directory + "collectionConfig.xml"; 774 Document config = this.converter.getDOM(new File(collection_config), "UTF-8"); 775 776 Node current_node = GSXML.getChildByTagName(config, "CollectionConfig"); 777 778 // Get display child 779 if (GSXML.getChildByTagName(current_node, "display") == null) 780 { 781 // well then create a format tag 782 Element display_tag = config.createElement("display"); 783 current_node = (Node) current_node.appendChild(display_tag); 784 } 785 else 786 { 787 current_node = GSXML.getChildByTagName(current_node, "display"); 788 } 789 790 if (GSXML.getChildByTagName(current_node, "format") == null) 791 { 792 // well then create a format tag 793 Element format_tag = config.createElement("format"); 794 current_node.appendChild(format_tag); 795 } 796 797 current_node.replaceChild(config.importNode(display_format, true), GSXML.getChildByTagName(current_node, "format")); 798 799 String new_config = this.converter.getString(config); 800 801 new_config = StringUtils.replace(new_config, "<", "<"); 802 new_config = StringUtils.replace(new_config, ">", ">"); 803 new_config = StringUtils.replace(new_config, """, "\""); 804 805 try 806 { 807 // Write to file (not original! for now) 808 BufferedWriter writer = new BufferedWriter(new FileWriter(collection_config + ".new")); 809 writer.write(new_config); 810 writer.close(); 811 } 812 catch (IOException e) 813 { 814 logger.error("IO Exception " + e); 815 } 816 } 817 818 if (subaction.equals("save")) 819 { 820 Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM); 821 Element format_statement = (Element) format_element.getFirstChild(); 822 823 try 824 { 825 // open collectionConfig.xml and read in to w3 Document 826 String collection_config = directory + "collectionConfig.xml"; 827 Document config = this.converter.getDOM(new File(collection_config), "UTF-8"); 828 829 //String tag_name = ""; 830 int k; 831 int index; 832 Element elem; 833 // Try importing entire tree to this.doc so we can add and remove children at ease 834 //Node current_node = this.doc.importNode(GSXML.getChildByTagName(config, "CollectionConfig"),true); 835 Node current_node = GSXML.getChildByTagName(config, "CollectionConfig"); 836 NodeList current_node_list; 837 838 if (service.equals("ClassifierBrowse")) 839 { 840 //tag_name = "browse"; 841 // if CLX then need to look in <classifier> X then <format> 842 // default is <browse><format> 843 844 current_node = GSXML.getChildByTagName(current_node, "browse"); 845 846 // find CLX 847 if (classifier != null) 848 { 849 current_node_list = GSXML.getChildrenByTagName(current_node, "classifier"); 850 index = Integer.parseInt(classifier.substring(2)) - 1; 851 852 // index should be given by X-1 853 current_node = current_node_list.item(index); 854 // what if classifier does not have a format tag? 855 if (GSXML.getChildByTagName(current_node, "format") == null) 856 { 857 // well then create a format tag 858 Element format_tag = config.createElement("format"); 859 current_node.appendChild(format_tag); 860 } 861 } 862 else 863 { 864 // To support all classifiers, set classifier to null? There is the chance here that the format tag does not exist 865 if (GSXML.getChildByTagName(current_node, "format") == null) 866 { 867 // well then create a format tag 868 Element format_tag = config.createElement("format"); 869 current_node.appendChild(format_tag); 870 } 871 } 872 } 873 else if (service.equals("AllClassifierBrowse")) 874 { 875 current_node = GSXML.getChildByTagName(current_node, "browse"); 876 if (GSXML.getChildByTagName(current_node, "format") == null) 877 { 878 // well then create a format tag 879 Element format_tag = config.createElement("format"); 880 current_node.appendChild(format_tag); 881 } 882 } 883 else 884 { 885 // look in <format> with no attributes 886 current_node_list = GSXML.getChildrenByTagName(current_node, "search"); 887 for (k = 0; k < current_node_list.getLength(); k++) 888 { 889 current_node = current_node_list.item(k); 890 // if current_node has no attributes then break 891 elem = (Element) current_node; 892 if (elem.hasAttribute("name") == false) 893 break; 894 } 895 } 896 897 current_node.replaceChild(config.importNode(format_statement, true), GSXML.getChildByTagName(current_node, "format")); 898 899 // Now convert config document to string for writing to file 900 String new_config = this.converter.getString(config); 901 902 new_config = StringUtils.replace(new_config, "<", "<"); 903 new_config = StringUtils.replace(new_config, ">", ">"); 904 new_config = StringUtils.replace(new_config, """, "\""); 905 906 // Write to file (not original! for now) 907 BufferedWriter writer = new BufferedWriter(new FileWriter(collection_config + ".new")); 908 writer.write(new_config); 909 writer.close(); 910 911 } 912 catch (Exception ex) 913 { 914 logger.error("There was an exception " + ex); 915 916 StringWriter sw = new StringWriter(); 917 PrintWriter pw = new PrintWriter(sw, true); 918 ex.printStackTrace(pw); 919 pw.flush(); 920 sw.flush(); 921 logger.error(sw.toString()); 922 } 923 924 } 925 926 return response; 927 } 926 928 }
Note:
See TracChangeset
for help on using the changeset viewer.