Changeset 9798 for branches/ant-install-branch/gsdl3
- Timestamp:
- 2005-05-03T09:50:12+12:00 (19 years ago)
- Location:
- branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java
r8832 r9798 52 52 public String process(String xml_in) { 53 53 54 Element message = this.converter.getDOM(xml_in).getDocumentElement(); 55 56 Element result = process(message); 54 Document message_doc = this.converter.getDOM(xml_in); 55 if (message_doc == null) { 56 System.err.println("Action.process(String) Error: Couldn't parse request"); 57 System.err.println(xml_in); 58 return null; 59 } 60 Element result = process(message_doc.getDocumentElement()); 57 61 return this.converter.getString(result); 58 62 } -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java
r5403 r9798 101 101 } 102 102 // get the xml for both files 103 Element coll_config_elem = this.converter.getDOM(coll_config_file, CONFIG_ENCODING).getDocumentElement(); 103 Document coll_config_doc = this.converter.getDOM(coll_config_file, CONFIG_ENCODING); 104 Element coll_config_elem = null; 105 if (coll_config_doc != null) { 106 coll_config_elem = coll_config_doc.getDocumentElement(); 107 } 104 108 return coll_config_elem; 105 109 … … 116 120 return null; 117 121 } 118 Element build_config_elem = this.converter.getDOM(build_config_file, CONFIG_ENCODING).getDocumentElement(); 119 122 Document build_config_doc = this.converter.getDOM(build_config_file, CONFIG_ENCODING); 123 Element build_config_elem = null; 124 if (build_config_doc != null) { 125 build_config_elem = build_config_doc.getDocumentElement(); 126 } 120 127 return build_config_elem; 121 128 } -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java
r9433 r9798 139 139 140 140 Document doc = this.converter.getDOM(config_file, CONFIG_ENCODING); 141 if (doc == null) { 142 System.err.println("ServiceCluster: couldn't parse config file "+config_file.getPath()); 143 return false; 144 } 141 145 142 146 // get the appropriate service cluster element … … 147 151 return this.configure(sc); 148 152 } 149 153 150 154 151 155 public boolean configure(Element service_cluster_info) { … … 159 163 } 160 164 } 161 165 162 166 // get the display info 163 167 Element display_list = (Element) GSXML.getChildByTagName(service_cluster_info, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER); … … 528 532 } 529 533 530 Element site_config_elem = this.converter.getDOM(configFile).getDocumentElement(); 534 Document site_config_doc = this.converter.getDOM(configFile); 535 if (site_config_doc == null) { 536 System.err.println("ServiceCluster: could not read in site config file: "+configFile.getPath()); 537 return false; 538 } 539 540 Element site_config_elem = site_config_doc.getDocumentElement(); 531 541 Element cluster_config_elem = GSXML.getNamedElement((Element)GSXML.getChildByTagName(site_config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER), GSXML.CLUSTER_ELEM, GSXML.NAME_ATT, this.cluster_name); 532 542 if (cluster_config_elem == null) { -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r9276 r9798 133 133 this.module_map = new HashMap(); 134 134 135 Element config = this.converter.getDOM(configFile).getDocumentElement(); 136 137 Element local_site_name = (Element)GSXML.getChildByTagName(config, GSXML.SITE_NAME_ELEM); 135 Document config_doc = this.converter.getDOM(configFile); 136 if (config_doc == null) { 137 System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath()); 138 return false; 139 } 140 Element config_elem = config_doc.getDocumentElement(); 141 142 Element local_site_name = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_NAME_ELEM); 138 143 if (local_site_name == null) { 139 144 System.err.println("MessageRouter configure error:no site name in config file"); … … 143 148 } 144 149 145 Element http_address = (Element)GSXML.getChildByTagName(config , GSXML.SITE_HTTP_ADDRESS_ELEM);150 Element http_address = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_HTTP_ADDRESS_ELEM); 146 151 if (http_address == null) { 147 152 System.err.println("MessageRouter configure error: no http address in config file"); … … 151 156 } 152 157 153 Element proxy = (Element)GSXML.getChildByTagName(config , "proxy");158 Element proxy = (Element)GSXML.getChildByTagName(config_elem, "proxy"); 154 159 if (proxy != null) { 155 160 String host = proxy.getAttribute("host"); … … 180 185 181 186 // load up the services 182 Element service_rack_list = (Element)GSXML.getChildByTagName(config , GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);187 Element service_rack_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER); 183 188 configureServices(service_rack_list); 184 189 185 190 // load up the service clusters 186 Element cluster_list = (Element)GSXML.getChildByTagName(config , GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER);191 Element cluster_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER); 187 192 configureClusters(cluster_list); 188 193 … … 191 196 192 197 // load up the external sites - this also adds their services/clusters/collections to the other lists - so must be done last 193 Element site_list = (Element)GSXML.getChildByTagName(config , GSXML.SITE_ELEM+GSXML.LIST_MODIFIER);198 Element site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 194 199 configureSites(site_list); 195 200 … … 603 608 continue; 604 609 } 605 site_config_elem = this.converter.getDOM(configFile).getDocumentElement(); 610 Document site_config_doc = this.converter.getDOM(configFile); 611 if (site_config_doc == null) { 612 System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath()); 613 continue; 614 } 615 site_config_elem = site_config_doc.getDocumentElement(); 606 616 } 607 617 if (subset.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) { … … 684 694 File init_file = new File(GSFile.collectionInitFile(this.site_home, col_name)); 685 695 if (init_file.exists()) { 686 Element init_elem = this.converter.getDOM(init_file).getDocumentElement(); 687 String coll_class_name = init_elem.getAttribute("class"); 688 if (coll_class_name.equals("")) { 689 c = new Collection(); 690 } else { 691 try { 692 c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance(); 693 } catch (Exception e) { 694 System.out.println("MessageRouter: couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection"); 695 c = new Collection(); 696 } 697 } 698 } else { 699 // use the defualt collection 696 Document init_doc = this.converter.getDOM(init_file); 697 if (init_doc != null) { 698 Element init_elem = init_doc.getDocumentElement(); 699 if (init_elem != null) { 700 String coll_class_name = init_elem.getAttribute("class"); 701 if (!coll_class_name.equals("")) { 702 try { 703 c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance(); 704 } catch (Exception e) { 705 System.out.println("MessageRouter: couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection"); 706 } 707 } 708 } 709 } 710 } 711 if (c==null) { // we haven't found anpther classname to use 700 712 c = new Collection(); 701 713 } 714 702 715 c.setCollectionName(col_name); 703 716 c.setSiteHome(this.site_home); … … 720 733 721 734 } 722 735 723 736 protected boolean activateSite(String site_name) { 724 737 System.out.println("MessageRouter:Activating site: "+site_name+"."); … … 732 745 return false; 733 746 } 734 Element config = this.converter.getDOM(configFile).getDocumentElement(); 735 736 Element site_list = (Element)GSXML.getChildByTagName(config, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 747 Document config_doc = this.converter.getDOM(configFile); 748 if (config_doc == null) { 749 System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath()); 750 return false; 751 } 752 Element config_elem = config_doc.getDocumentElement(); 753 754 Element site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 737 755 if (site_list ==null ) { 738 756 System.err.println("MessageRouter:activateSite, no sites found"); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java
r8921 r9798 81 81 } 82 82 83 Element config_doc = this.converter.getDOM(interface_config_file).getDocumentElement(); 84 String base_interface = config_doc.getAttribute("baseInterface"); 83 Document config_doc = this.converter.getDOM(interface_config_file); 84 if (config_doc == null) { 85 System.err.println("Receptionist: could not parse interface config file: "+interface_config_file.getPath()); 86 return false; 87 } 88 Element config_elem = config_doc.getDocumentElement(); 89 String base_interface = config_elem.getAttribute("baseInterface"); 85 90 setUpBaseInterface(base_interface); 86 setUpInterfaceOptions(config_ doc);91 setUpInterfaceOptions(config_elem); 87 92 88 93 // load up the actions 89 Element action_list = (Element)GSXML.getChildByTagName(config_ doc, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);94 Element action_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER); 90 95 NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM); 91 96 … … 109 114 } 110 115 111 this.language_list = (Element)GSXML.getChildByTagName(config_ doc, "languageList");116 this.language_list = (Element)GSXML.getChildByTagName(config_elem, "languageList"); 112 117 if (language_list == null) { 113 118 System.err.println("Receptionist: didn't find a language list in the config file!!"); … … 229 234 base_interfaces.add(base_interface); 230 235 // now see if this has a base interface 231 Element config_doc = this.converter.getDOM(base_interface_config_file).getDocumentElement(); 232 base_interface = config_doc.getAttribute("baseInterface"); 236 Document config_doc = this.converter.getDOM(base_interface_config_file); 237 if (config_doc == null) { 238 System.err.println("Receptionist: could not parse base interface config file: "+base_interface_config_file.getPath()); 239 return false; 240 } 241 Element config_elem = config_doc.getDocumentElement(); 242 base_interface = config_elem.getAttribute("baseInterface"); 233 243 } 234 244 return true; 235 245 } 236 246 237 protected boolean setUpInterfaceOptions(Element config_ doc) {238 Element option_list = (Element)GSXML.getChildByTagName(config_ doc, "optionList");247 protected boolean setUpInterfaceOptions(Element config_elem) { 248 Element option_list = (Element)GSXML.getChildByTagName(config_elem, "optionList"); 239 249 if (option_list != null) { 240 250 System.err.println("found an option list"); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r9405 r9798 52 52 return false; 53 53 } 54 55 Element config_doc = this.converter.getDOM(interface_config_file, "utf-8").getDocumentElement(); 56 String base_interface = config_doc.getAttribute("baseInterface"); 54 Document config_doc = this.converter.getDOM(interface_config_file, "utf-8"); 55 if (config_doc == null) { 56 System.err.println("TransformingReceptionist: could not parse interface config file: "+interface_config_file.getPath()); 57 return false; 58 } 59 Element config_elem = config_doc.getDocumentElement(); 60 String base_interface = config_elem.getAttribute("baseInterface"); 57 61 setUpBaseInterface(base_interface); 58 setUpInterfaceOptions(config_ doc);59 60 Element action_list = (Element)GSXML.getChildByTagName(config_ doc, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);62 setUpInterfaceOptions(config_elem); 63 64 Element action_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER); 61 65 NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM); 62 66 … … 97 101 98 102 } 99 Element lang_list = (Element)GSXML.getChildByTagName(config_ doc, "languageList");103 Element lang_list = (Element)GSXML.getChildByTagName(config_elem, "languageList"); 100 104 if (lang_list == null) { 101 105 System.err.println("TransformingReceptionist: didn't find a language list in the config file!!"); … … 157 161 } 158 162 Document style_doc = this.converter.getDOM(new File(xslt_file), "UTF-8"); 163 if (style_doc == null) { 164 System.err.println("TransformingReceptionist: cant parse the xslt file needed, so returning the original page!"); 165 return page; 166 167 } 159 168 160 169 // look for the format element in the page response … … 166 175 // need to transform the format info 167 176 String stylesheet_file = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, "config_format.xsl"); 168 Document stylesheet = this.converter.getDOM(new File(stylesheet_file)); 169 Document format_doc = this.converter.newDOM(); 170 format_doc.appendChild(format_doc.importNode(format_elem, true)); 171 Element new_format = (Element)this.transformer.transform(stylesheet, format_doc); 177 Document stylesheet_doc = this.converter.getDOM(new File(stylesheet_file)); 178 if (stylesheet_doc != null) { 179 Document format_doc = this.converter.newDOM(); 180 format_doc.appendChild(format_doc.importNode(format_elem, true)); 181 Element new_format = (Element)this.transformer.transform(stylesheet_doc, format_doc); 172 182 ///ystem.err.println("new format elem="+this.converter.getPrettyString(new_format)); 173 183 174 184 // add it in to the main stylesheet 175 GSXSLT.mergeStylesheets(style_doc, new_format); 185 GSXSLT.mergeStylesheets(style_doc, new_format); 186 } else { 187 System.err.println("TransformingReceptionist: couldn't parse the config_format stylesheet, adding the format info as is"); 188 GSXSLT.mergeStylesheets(style_doc, format_elem); 189 } 176 190 ///ystem.out.println("the converted stylesheet is:"); 177 191 ///ystem.out.println(this.converter.getPrettyString(style_doc.getDocumentElement())); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java.tmp
r6501 r9798 226 226 227 227 annotated_text = "<nodeContent>" + annotated_text + "</nodeContent>"; 228 Element annotated_content = this.converter.getDOM(annotated_text).getDocumentElement(); 229 doc_node.replaceChild(doc_node.getOwnerDocument().importNode(annotated_content, true), content); 230 } 228 Document annotated_content_doc = this.converter.getDOM(annotated_text); 229 if (annotated_content_doc != null) { 230 Element annotated_content = annotated_content_doc.getDocumentElement(); 231 doc_node.replaceChild(doc_node.getOwnerDocument().importNode(annotated_content, true), content); 232 } else { 233 System.err.println("GATEServices.processGatePOSTag Error: Couldn't parse annotated text for doc node "+i); 234 } 235 } 231 236 232 237 result.appendChild(this.doc.importNode(doc_node_list, true)); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaProxy.java
r9529 r9798 405 405 doc_node.setAttribute(GSXML.NODE_ID_ATT, doc_id); 406 406 407 Element content_element = this.converter.getDOM(processed_content.toString()).getDocumentElement(); 408 doc_node.appendChild(this.doc.importNode(content_element, true)); 409 407 Document content_doc = this.converter.getDOM(processed_content.toString()); 408 if (content_doc != null) { 409 Element content_element = content_doc.getDocumentElement(); 410 doc_node.appendChild(this.doc.importNode(content_element, true)); 411 } else { 412 System.err.println("IViaProxy.getDocument Error: Couldn't parse the node content"); 413 } 410 414 return doc_node; 411 415 -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaRetrieve.java
r9529 r9798 98 98 processed_content.append("</nodeContent>"); 99 99 100 Element content_element = this.converter.getDOM(processed_content.toString()).getDocumentElement(); 100 Document content_doc = this.converter.getDOM(processed_content.toString()); 101 if (content_doc == null) { 102 System.err.println("IViaRetrieve.getNodeContent Error: Couldn't parse node content"); 103 System.err.println(processed_content.toString()); 104 return null; 105 } 106 107 Element content_element = content_doc.getDocumentElement(); 101 108 102 109 return (Element)this.doc.importNode(content_element,true); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java
r6490 r9798 89 89 90 90 Document dom = this.converter.getDOM(app_info); 91 if (dom==null) { 92 System.err.println("PhindPhraseBrowse.configure Error: Couldn't parse applet info"); 93 return false; 94 } 91 95 Element app_elem = dom.getDocumentElement(); 92 96 applet_description.appendChild(this.doc.importNode(app_elem, true)); 93 97 94 98 return true; 95 99 } -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java
r9426 r9798 144 144 145 145 Document doc = this.converter.getDOM(xml_in); 146 146 if (doc == null) { 147 System.err.println("ServiceRack.process(String) Error: Couldn't parse request"); 148 System.err.println(xml_in); 149 return null; 150 } 147 151 Element res = process(doc.getDocumentElement()); 148 152 return this.converter.getString(res); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/Visualizer.java
r8347 r9798 75 75 76 76 Document dom = converter.getDOM(app_info); 77 if (dom == null) { 78 System.err.println("Visualizer.configure Error: Couldn't parse applet info"); 79 return false; 80 } 77 81 Element app_elem = dom.getDocumentElement(); 78 82 applet_description.appendChild(this.doc.importNode(app_elem, true));
Note:
See TracChangeset
for help on using the changeset viewer.