Changeset 25260
- Timestamp:
- 2012-03-23T14:21:37+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GeneralAction.java
r25128 r25260 26 26 public Node process(Node message_node) 27 27 { 28 29 28 Element message = this.converter.nodeToElement(message_node); 30 29 … … 48 47 String optionName = (String) params.get("configChangeName"); 49 48 String optionValue = (String) params.get("configChangeValue"); 50 49 51 50 changeConfig(optionName, optionValue); 52 51 } … … 84 83 { 85 84 //do the request 86 87 85 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 88 86 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); … … 104 102 mr_query_request.appendChild(param_list); 105 103 } 104 105 Element userInformation = (Element) GSXML.getChildByTagName(request, GSXML.USER_INFORMATION_ELEM); 106 if (userInformation != null) 107 { 108 mr_query_request.appendChild(this.doc.importNode(userInformation, true)); 109 } 110 mr_query_request.setAttribute("remoteAddress", request.getAttribute("remoteAddress")); 106 111 107 112 Element mr_query_response = (Element) this.mr.process(mr_query_message); … … 144 149 return result; 145 150 } 146 147 protected void changeConfig 151 152 protected void changeConfig(String optionName, String optionValue) 148 153 { 149 if (this.config_params.get(optionName) != null)154 if (this.config_params.get(optionName) != null) 150 155 { 151 156 this.config_params.put(optionName, optionValue); 152 153 File interfaceConfigFile = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), (String) this.config_params.get("interface_name"))));154 157 158 File interfaceConfigFile = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), (String) this.config_params.get("interface_name")))); 159 155 160 Document interfaceXML = null; 156 161 try … … 163 168 164 169 NodeList optionList = optionListElem.getElementsByTagName("option"); 165 166 for (int i = 0; i < optionList.getLength(); i++)170 171 for (int i = 0; i < optionList.getLength(); i++) 167 172 { 168 Element currentOption = (Element) optionList.item(i);169 if (currentOption.getAttribute(GSXML.NAME_ATT) != null && currentOption.getAttribute(GSXML.NAME_ATT).equals(optionName))173 Element currentOption = (Element) optionList.item(i); 174 if (currentOption.getAttribute(GSXML.NAME_ATT) != null && currentOption.getAttribute(GSXML.NAME_ATT).equals(optionName)) 170 175 { 171 176 currentOption.setAttribute(GSXML.VALUE_ATT, optionValue); 172 177 } 173 178 } 174 179 175 180 DOMSource source = new DOMSource(interfaceXML); 176 181 Result xmlresult = new StreamResult(interfaceConfigFile); … … 179 184 transformer.transform(source, xmlresult); 180 185 } 181 catch (Exception ex)186 catch (Exception ex) 182 187 { 183 188 ex.printStackTrace();
Note:
See TracChangeset
for help on using the changeset viewer.