List of usage examples for org.w3c.dom Element getAttributes
public NamedNodeMap getAttributes();
NamedNodeMap
containing the attributes of this node (if it is an Element
) or null
otherwise. From source file:MSUmpire.SearchResultParser.PepXMLParseHandler.java
private void ParseSpectrumNode(Element spectrum) throws XmlPullParserException, IOException { PSM psm = new PSM(); psm.SpecNumber = spectrum.getAttributes().getNamedItem("spectrum").getNodeValue(); psm.ObserPrecursorMass = Float .parseFloat(spectrum.getAttributes().getNamedItem("precursor_neutral_mass").getNodeValue()); psm.Charge = Integer.parseInt(spectrum.getAttributes().getNamedItem("assumed_charge").getNodeValue()); psm.ScanNo = Integer.parseInt(spectrum.getAttributes().getNamedItem("start_scan").getNodeValue()); if (spectrum.getAttributes().getNamedItem("retention_time_sec") != null) { psm.RetentionTime = Float .parseFloat(spectrum.getAttributes().getNamedItem("retention_time_sec").getNodeValue()) / 60f; }// www . j av a2 s. c o m psm.NeighborMaxRetentionTime = psm.RetentionTime; psm.RawDataName = psm.SpecNumber.substring(0, psm.SpecNumber.indexOf(".")); for (int k = 0; k < spectrum.getChildNodes().getLength(); k++) { Node resultNode = spectrum.getChildNodes().item(k); if ("search_result".equals(resultNode.getNodeName())) { for (int l = 0; l < resultNode.getChildNodes().getLength(); l++) { Node hitNode = resultNode.getChildNodes().item(l); if ("search_hit".equals(hitNode.getNodeName()) && "1".equals(hitNode.getAttributes().getNamedItem("hit_rank").getNodeValue())) { psm.NeutralPepMass = Float.parseFloat( hitNode.getAttributes().getNamedItem("calc_neutral_pep_mass").getNodeValue()); float error = Float.parseFloat( hitNode.getAttributes().getNamedItem("massdiff").getNodeValue().replace("+-", "")); float error0 = Math.abs(error); float error1 = Math.abs(error - 1f); float error2 = Math.abs(error - 2f); float error3 = Math.abs(error - 3f); if (error0 < error1 && error0 < error2 && error0 < error3) { psm.MassError = error; } else if (error1 < error0 && error1 < error2 && error1 < error3) { psm.MassError = error - 1f; psm.ObserPrecursorMass -= 1f; } else if (error2 < error0 && error2 < error1 && error2 < error3) { psm.MassError = error - 2f; psm.ObserPrecursorMass -= 2f; } else if (error3 < error0 && error3 < error1 && error3 < error2) { psm.MassError = error - 3f; psm.ObserPrecursorMass -= 3f; } if (hitNode.getAttributes().getNamedItem("peptide_prev_aa") != null) { psm.PreAA = hitNode.getAttributes().getNamedItem("peptide_prev_aa").getNodeValue(); } if (hitNode.getAttributes().getNamedItem("peptide_next_aa") != null) { psm.NextAA = hitNode.getAttributes().getNamedItem("peptide_next_aa").getNodeValue(); } if (hitNode.getAttributes().getNamedItem("num_missed_cleavages") != null) { psm.MissedCleavage = Integer.parseInt( hitNode.getAttributes().getNamedItem("num_missed_cleavages").getNodeValue()); } psm.Sequence = hitNode.getAttributes().getNamedItem("peptide").getNodeValue(); psm.ModSeq = psm.Sequence; psm.TPPModSeq = psm.Sequence; String ProtACC = hitNode.getAttributes().getNamedItem("protein").getNodeValue(); if (!"".equals(ProtACC)) { psm.AddParentProtein(ProtACC); } String altproACC = ""; boolean iprophet = false; for (int m = 0; m < hitNode.getChildNodes().getLength(); m++) { Node hitModNode = hitNode.getChildNodes().item(m); switch (hitModNode.getNodeName()) { case ("modification_info"): { GetModificationInfo(psm, hitModNode); break; } case ("analysis_result"): { switch (hitModNode.getAttributes().getNamedItem("analysis").getNodeValue()) { case "peptideprophet": { if (!iprophet && hitModNode.getChildNodes().item(1).getAttributes() .getNamedItem("probability") != null) { psm.Probability = Float.parseFloat(hitModNode.getChildNodes().item(1) .getAttributes().getNamedItem("probability").getNodeValue()); } break; } case "interprophet": { iprophet = true; if (hitModNode.getChildNodes().item(1).getAttributes() .getNamedItem("probability") != null) { psm.Probability = Float.parseFloat(hitModNode.getChildNodes().item(1) .getAttributes().getNamedItem("probability").getNodeValue()); } break; } case "percolator": { if (hitModNode.getChildNodes().item(1).getAttributes() .getNamedItem("probability") != null) { psm.Probability = Float.parseFloat(hitModNode.getChildNodes().item(1) .getAttributes().getNamedItem("probability").getNodeValue()); } break; } } break; } case ("search_score"): { switch (hitModNode.getAttributes().item(0).getNodeValue()) { case ("hyperscore"): { psm.hyperscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("nextscore"): { psm.nextscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("bscore"): { psm.bscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("yscore"): { psm.yscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("zscore"): { psm.zscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("ascore"): { psm.ascore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("xscore"): { psm.xscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("expect"): { psm.expect = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } case ("XCorr"): { psm.hyperscore = Float .parseFloat(hitModNode.getAttributes().item(1).getNodeValue()); break; } } break; } case ("alternative_protein"): { altproACC = hitModNode.getAttributes().getNamedItem("protein").getNodeValue(); if (!"".equals(altproACC)) { psm.AddParentProtein(altproACC); } break; } } } if (psm.Probability > threshold) { singleLCMSID.AddPSM(psm); } } } } } }
From source file:com.amalto.workbench.actions.XSDPasteConceptAction.java
public Map<String, List<String>> cloneXSDAnnotation(XSDAnnotation oldAnn) { XSDAnnotation xsdannotation = XSDFactory.eINSTANCE.createXSDAnnotation(); Map<String, List<String>> infor = new HashMap<String, List<String>>(); try {//from ww w . ja v a 2 s.c om /* * Element oldAnnElem =oldAnn.getElement(); Element newAnnElem = (Element)oldAnnElem.cloneNode(true); * xsdannotation.setElement(newAnnElem); */ /* * List<Element> listAppInfo = new ArrayList<Element>(); List<Element> listUserInfo = new * ArrayList<Element>(); List<Attr> listAttri = new ArrayList<Attr>(); */ if (oldAnn != null) { for (int i = 0; i < oldAnn.getApplicationInformation().size(); i++) { Element oldElem = oldAnn.getApplicationInformation().get(i); // System.out.println(oldElem.getAttributes().getNamedItem( // "source").getNodeValue()); String type = oldElem.getAttributes().getNamedItem(Messages.XSDPasteConceptAction_Source) .getNodeValue(); /* * Element newElem = (Element) oldElem.cloneNode(true); * listAppInfo.add(oldAnn.getApplicationInformation().get(i)); */ if (!infor.containsKey(type)) { List<String> typeList = new ArrayList<String>(); typeList.add(oldElem.getFirstChild().getNodeValue()); infor.put(type, typeList); } else { infor.get(type).add(oldElem.getFirstChild().getNodeValue()); } } /* * xsdannotation.getApplicationInformation().addAll(listAppInfo); * * for (int i = 0; i < oldAnn.getUserInformation().size(); i++) { Element oldElemUserInfo = * oldAnn.getUserInformation() .get(i); Element newElemUserInfo = (Element) oldElemUserInfo * .cloneNode(true); listUserInfo.add(newElemUserInfo); * * } xsdannotation.getUserInformation().addAll(listUserInfo); * * for (int i = 0; i < oldAnn.getAttributes().size(); i++) { Attr oldAttri = * oldAnn.getAttributes().get(i); Attr newAtri = (Attr) oldAttri.cloneNode(true); * listAttri.add(newAtri); } xsdannotation.getAttributes().addAll(listAttri); */ } } catch (Exception e) { log.error(e.getMessage(), e); MessageDialog.openError(this.page.getSite().getShell(), Messages._Error, Messages.bind(Messages.XSDPasteConceptAction_ErrorMsg2, e.getLocalizedMessage())); } return infor; }
From source file:com.nridge.core.base.io.xml.RelationshipXML.java
/** * Parses an XML DOM element and loads it into a relationship. * * @param anElement DOM element./*www . j av a2s . co m*/ * * @throws java.io.IOException I/O related exception. */ @Override public void load(Element anElement) throws IOException { Node nodeItem; Attr nodeAttr; Element nodeElement; DataBagXML dataBagXML; DocumentXML documentXML; String nodeName, nodeValue; mRelationship.reset(); String attrValue = anElement.getAttribute("type"); if (StringUtils.isEmpty(attrValue)) throw new IOException("Relationship is missing type attribute."); mRelationship.setType(attrValue); NamedNodeMap namedNodeMap = anElement.getAttributes(); int attrCount = namedNodeMap.getLength(); for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) { nodeAttr = (Attr) namedNodeMap.item(attrOffset); nodeName = nodeAttr.getNodeName(); nodeValue = nodeAttr.getNodeValue(); if (StringUtils.isNotEmpty(nodeValue)) { if ((!StringUtils.equalsIgnoreCase(nodeName, "type"))) mRelationship.addFeature(nodeName, nodeValue); } } NodeList nodeList = anElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { nodeItem = nodeList.item(i); if (nodeItem.getNodeType() != Node.ELEMENT_NODE) continue; nodeName = nodeItem.getNodeName(); if (nodeName.equalsIgnoreCase(IO.XML_PROPERTIES_NODE_NAME)) { nodeElement = (Element) nodeItem; dataBagXML = new DataBagXML(); dataBagXML.load(nodeElement); mRelationship.setBag(dataBagXML.getBag()); } else { nodeElement = (Element) nodeItem; documentXML = new DocumentXML(); documentXML.load(nodeElement); mRelationship.add(documentXML.getDocument()); } } }
From source file:com.rest4j.generator.Generator.java
private void cleanupFinal(Element element) { if ("http://www.w3.org/1999/xhtml".equals(element.getNamespaceURI())) { element.getOwnerDocument().renameNode(element, null, element.getLocalName()); }/*from w w w .ja va 2s . c om*/ NamedNodeMap attrs = element.getAttributes(); if (attrs.getNamedItem("xmlns") != null) { attrs.removeNamedItem("xmlns"); } if (attrs.getNamedItem("xmlns:html") != null) { attrs.removeNamedItem("xmlns:html"); } for (Node child : Util.it(element.getChildNodes())) { if (child instanceof Element) { cleanupFinal((Element) child); } } }
From source file:com.bstek.dorado.view.config.XmlDocumentPreprocessor.java
private void gothroughPlaceHolders(Document templateDocument, TemplateContext templateContext) throws Exception { Element templteViewElement = ViewConfigParserUtils.findViewElement(templateDocument.getDocumentElement(), templateContext.getResource()); Document document = templateContext.getSourceDocument(); Element viewElement = ViewConfigParserUtils.findViewElement(document.getDocumentElement(), templateContext.getSourceContext().getResource()); NamedNodeMap attributes = viewElement.getAttributes(); int len = attributes.getLength(); for (int i = 0; i < len; i++) { Node item = attributes.item(i); String nodeName = item.getNodeName(); if (!specialMergeProperties.contains(nodeName)) { templteViewElement.setAttribute(nodeName, item.getNodeValue()); }/* w w w. ja va 2 s. c o m*/ } List<Element> viewProperties = DomUtils.getChildrenByTagName(viewElement, XmlConstants.PROPERTY); for (Element propertyElement : viewProperties) { String propertyName = propertyElement.getAttribute(XmlConstants.ATTRIBUTE_NAME); if (!specialMergeProperties.contains(propertyName)) { Element clonedElement = (Element) templateDocument.importNode(propertyElement, true); templteViewElement.appendChild(clonedElement); } } mergeMetaData(templateDocument, templteViewElement, viewElement); mergeTemplateProperty(templteViewElement, viewElement, ViewXmlConstants.ATTRIBUTE_PACKAGES); mergeTemplateProperty(templteViewElement, viewElement, ViewXmlConstants.ATTRIBUTE_JAVASCRIPT_FILE); mergeTemplateProperty(templteViewElement, viewElement, ViewXmlConstants.ATTRIBUTE_STYLESHEET_FILE); for (Element element : DomUtils.getChildElements(viewElement)) { String nodeName = element.getNodeName(); if (nodeName.equals(XmlConstants.PROPERTY) || nodeName.equals(XmlConstants.GROUP_START) || nodeName.equals(XmlConstants.GROUP_END) || nodeName.equals(XmlConstants.IMPORT) || nodeName.equals(XmlConstants.GROUP_END) || nodeName.equals(XmlConstants.PLACE_HOLDER_START) || nodeName.equals(XmlConstants.PLACE_HOLDER_END)) { continue; } if (componentTypeRegistry.getRegisterInfo(nodeName) == null) { Element clonedElement = (Element) templateDocument.importNode(element, true); templteViewElement.appendChild(clonedElement); } } processPlaceHolders(templteViewElement, templateContext); }
From source file:com.espertech.esper.client.ConfigurationParser.java
private static void handleMethodReference(Configuration configuration, Element element) { String className = getRequiredAttribute(element, "class-name"); ConfigurationMethodRef configMethodRef = new ConfigurationMethodRef(); configuration.addMethodRef(className, configMethodRef); DOMElementIterator nodeIterator = new DOMElementIterator(element.getChildNodes()); while (nodeIterator.hasNext()) { Element subElement = nodeIterator.next(); if (subElement.getNodeName().equals("expiry-time-cache")) { String maxAge = getRequiredAttribute(subElement, "max-age-seconds"); String purgeInterval = getRequiredAttribute(subElement, "purge-interval-seconds"); ConfigurationCacheReferenceType refTypeEnum = ConfigurationCacheReferenceType.getDefault(); if (subElement.getAttributes().getNamedItem("ref-type") != null) { String refType = subElement.getAttributes().getNamedItem("ref-type").getTextContent(); refTypeEnum = ConfigurationCacheReferenceType.valueOf(refType.toUpperCase()); }// w ww. j a va 2 s .c o m configMethodRef.setExpiryTimeCache(Double.parseDouble(maxAge), Double.parseDouble(purgeInterval), refTypeEnum); } else if (subElement.getNodeName().equals("lru-cache")) { String size = getRequiredAttribute(subElement, "size"); configMethodRef.setLRUCache(Integer.parseInt(size)); } } }
From source file:com.box.androidlib.FileTransfer.BoxFileUpload.java
/** * Execute a file upload.//from w w w .ja v a 2 s . co m * * @param action * Set to {@link com.box.androidlib.Box#UPLOAD_ACTION_UPLOAD} or {@link com.box.androidlib.Box#UPLOAD_ACTION_OVERWRITE} or * {@link com.box.androidlib.Box#UPLOAD_ACTION_NEW_COPY} * @param file * A File resource pointing to the file you wish to upload. Make sure File.isFile() and File.canRead() are true for this resource. * @param filename * The desired filename on Box after upload (just the file name, do not include the path) * @param destinationId * If action is {@link com.box.androidlib.Box#UPLOAD_ACTION_UPLOAD}, then this is the folder id where the file will uploaded to. If action is * {@link com.box.androidlib.Box#UPLOAD_ACTION_OVERWRITE} or {@link com.box.androidlib.Box#UPLOAD_ACTION_NEW_COPY}, then this is the file_id that * is being overwritten, or copied. * @return A FileResponseParser with information about the upload. * @throws IOException * Can be thrown if there is no connection, or if some other connection problem exists. * @throws FileNotFoundException * File being uploaded either doesn't exist, is not a file, or cannot be read * @throws MalformedURLException * Make sure you have specified a valid upload action */ public FileResponseParser execute(final String action, final File file, final String filename, final long destinationId) throws IOException, MalformedURLException, FileNotFoundException { if (!file.isFile() || !file.canRead()) { throw new FileNotFoundException("Specified upload file is either not a file, or cannot be read"); } if (!action.equals(Box.UPLOAD_ACTION_UPLOAD) && !action.equals(Box.UPLOAD_ACTION_OVERWRITE) && !action.equals(Box.UPLOAD_ACTION_NEW_COPY)) { throw new MalformedURLException("action must be upload, overwrite or new_copy"); } final Uri.Builder builder = new Uri.Builder(); builder.scheme(BoxConfig.getInstance().getUploadUrlScheme()); builder.authority(BoxConfig.getInstance().getUploadUrlAuthority()); builder.path(BoxConfig.getInstance().getUploadUrlPath()); builder.appendPath(action); builder.appendPath(mAuthToken); builder.appendPath(String.valueOf(destinationId)); builder.appendQueryParameter("file_name", filename); // Set up post body final HttpPost post = new HttpPost(builder.build().toString()); final MultipartEntityWithProgressListener reqEntity = new MultipartEntityWithProgressListener( HttpMultipartMode.BROWSER_COMPATIBLE); if (mListener != null && mHandler != null) { reqEntity.setProgressListener(new MultipartEntityWithProgressListener.ProgressListener() { @Override public void onTransferred(final long bytesTransferredCumulative) { mHandler.post(new Runnable() { @Override public void run() { mListener.onProgress(bytesTransferredCumulative); } }); } }); } reqEntity.addPart(filename, new FileBody(file) { @Override public String getFilename() { return filename; } }); post.setEntity(reqEntity); // Send request final HttpResponse httpResponse; try { httpResponse = (new DefaultHttpClient()).execute(post); } catch (final IOException e) { // Detect if the download was cancelled through thread interrupt. // See CountingOutputStream.write() for when this exception is thrown. if (e.getMessage().equals(FileUploadListener.STATUS_CANCELLED)) { final FileResponseParser handler = new FileResponseParser(); handler.setStatus(FileUploadListener.STATUS_CANCELLED); return handler; } else { throw e; } } String status = null; BoxFile boxFile = null; final InputStream is = httpResponse.getEntity().getContent(); final BufferedReader reader = new BufferedReader(new InputStreamReader(is)); final StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } is.close(); httpResponse.getEntity().consumeContent(); final String xml = sb.toString(); try { final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new ByteArrayInputStream(xml.getBytes())); final Node statusNode = doc.getElementsByTagName("status").item(0); if (statusNode != null) { status = statusNode.getFirstChild().getNodeValue(); } final Element fileEl = (Element) doc.getElementsByTagName("file").item(0); if (fileEl != null) { try { boxFile = Box.getBoxFileClass().newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } for (int i = 0; i < fileEl.getAttributes().getLength(); i++) { boxFile.parseAttribute(fileEl.getAttributes().item(i).getNodeName(), fileEl.getAttributes().item(i).getNodeValue()); } } // errors are NOT returned as properly formatted XML yet so in this // case the raw response is the error status code // see // http://developers.box.net/w/page/12923951/ApiFunction_Upload-and-Download if (status == null) { status = xml; } } catch (final SAXException e) { // errors are NOT returned as properly formatted XML yet so in this // case the raw response is the error status code // see // http://developers.box.net/w/page/12923951/ApiFunction_Upload-and-Download status = xml; } catch (final ParserConfigurationException e) { e.printStackTrace(); } final FileResponseParser handler = new FileResponseParser(); handler.setFile(boxFile); handler.setStatus(status); return handler; }
From source file:com.espertech.esper.client.ConfigurationParser.java
private static void handleVariable(Configuration configuration, Element element) { String variableName = getRequiredAttribute(element, "name"); String type = getRequiredAttribute(element, "type"); Class variableType = JavaClassHelper.getClassForSimpleName(type); if (variableType == null) { throw new ConfigurationException( "Invalid variable type for variable '" + variableName + "', the type is not recognized"); }/*from w ww .ja v a 2s .c om*/ Node initValueNode = element.getAttributes().getNamedItem("initialization-value"); String initValue = null; if (initValueNode != null) { initValue = initValueNode.getTextContent(); } boolean isConstant = false; if (getOptionalAttribute(element, "constant") != null) { isConstant = Boolean.parseBoolean(getOptionalAttribute(element, "constant")); } configuration.addVariable(variableName, variableType, initValue, isConstant); }
From source file:cc.siara.csv_ml.ParsedObject.java
/** * Performas any pending activity against an element to finalize it. In this * case, it adds any pending attributes needing namespace mapping. * /*from ww w. j a va 2 s . c om*/ * Also if the node has a namespace attached, it recreates the node with * specific URI. */ public void finalizeElement() { // Add all remaining attributes for (String col_name : pendingAttributes.keySet()) { String value = pendingAttributes.get(col_name); int cIdx = col_name.indexOf(':'); String ns = col_name.substring(0, cIdx); String nsURI = nsMap.get(ns); if (nsURI == null) nsURI = generalNSURI; Attr attr = doc.createAttributeNS(nsURI, col_name.substring(cIdx + 1)); attr.setPrefix(ns); attr.setValue(value); ((Element) cur_element).setAttributeNodeNS(attr); } // If the element had a namespace prefix, it has to be recreated. if (!currentElementNS.equals("") && !doc.getDocumentElement().equals(cur_element)) { Node parent = cur_element.getParentNode(); Element cur_ele = (Element) parent.removeChild(cur_element); String node_name = cur_ele.getNodeName(); String nsURI = nsMap.get(currentElementNS); if (nsURI == null) nsURI = generalNSURI; Element new_node = doc.createElementNS(nsURI, currentElementNS + ":" + node_name); parent.appendChild(new_node); // Add all attributes NamedNodeMap attrs = cur_ele.getAttributes(); while (attrs.getLength() > 0) { Attr attr = (Attr) attrs.item(0); cur_ele.removeAttributeNode(attr); nsURI = attr.getNamespaceURI(); new_node.setAttributeNodeNS(attr); } // Add all CData sections NodeList childNodes = cur_ele.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (node.getNodeType() == Node.CDATA_SECTION_NODE) new_node.appendChild(node); } cur_element = new_node; } pendingAttributes = new Hashtable<String, String>(); }
From source file:com.espertech.esper.client.ConfigurationParser.java
private static void handleDefaultsThreading(Configuration configuration, Element parentElement) { String engineFairlockStr = getOptionalAttribute(parentElement, "engine-fairlock"); if (engineFairlockStr != null) { boolean isEngineFairlock = Boolean.parseBoolean(engineFairlockStr); configuration.getEngineDefaults().getThreading().setEngineFairlock(isEngineFairlock); }//from w w w. j a va2 s. c o m DOMElementIterator nodeIterator = new DOMElementIterator(parentElement.getChildNodes()); while (nodeIterator.hasNext()) { Element subElement = nodeIterator.next(); if (subElement.getNodeName().equals("listener-dispatch")) { String preserveOrderText = getRequiredAttribute(subElement, "preserve-order"); Boolean preserveOrder = Boolean.parseBoolean(preserveOrderText); configuration.getEngineDefaults().getThreading().setListenerDispatchPreserveOrder(preserveOrder); if (subElement.getAttributes().getNamedItem("timeout-msec") != null) { String timeoutMSecText = subElement.getAttributes().getNamedItem("timeout-msec") .getTextContent(); Long timeoutMSec = Long.parseLong(timeoutMSecText); configuration.getEngineDefaults().getThreading().setListenerDispatchTimeout(timeoutMSec); } if (subElement.getAttributes().getNamedItem("locking") != null) { String value = subElement.getAttributes().getNamedItem("locking").getTextContent(); configuration.getEngineDefaults().getThreading().setListenerDispatchLocking( ConfigurationEngineDefaults.Threading.Locking.valueOf(value.toUpperCase())); } } if (subElement.getNodeName().equals("insert-into-dispatch")) { String preserveOrderText = getRequiredAttribute(subElement, "preserve-order"); Boolean preserveOrder = Boolean.parseBoolean(preserveOrderText); configuration.getEngineDefaults().getThreading().setInsertIntoDispatchPreserveOrder(preserveOrder); if (subElement.getAttributes().getNamedItem("timeout-msec") != null) { String timeoutMSecText = subElement.getAttributes().getNamedItem("timeout-msec") .getTextContent(); Long timeoutMSec = Long.parseLong(timeoutMSecText); configuration.getEngineDefaults().getThreading().setInsertIntoDispatchTimeout(timeoutMSec); } if (subElement.getAttributes().getNamedItem("locking") != null) { String value = subElement.getAttributes().getNamedItem("locking").getTextContent(); configuration.getEngineDefaults().getThreading().setInsertIntoDispatchLocking( ConfigurationEngineDefaults.Threading.Locking.valueOf(value.toUpperCase())); } } if (subElement.getNodeName().equals("internal-timer")) { String enabledText = getRequiredAttribute(subElement, "enabled"); Boolean enabled = Boolean.parseBoolean(enabledText); String msecResolutionText = getRequiredAttribute(subElement, "msec-resolution"); Long msecResolution = Long.parseLong(msecResolutionText); configuration.getEngineDefaults().getThreading().setInternalTimerEnabled(enabled); configuration.getEngineDefaults().getThreading().setInternalTimerMsecResolution(msecResolution); } if (subElement.getNodeName().equals("threadpool-inbound")) { ThreadPoolConfig result = parseThreadPoolConfig(subElement); configuration.getEngineDefaults().getThreading().setThreadPoolInbound(result.isEnabled()); configuration.getEngineDefaults().getThreading() .setThreadPoolInboundNumThreads(result.getNumThreads()); configuration.getEngineDefaults().getThreading().setThreadPoolInboundCapacity(result.getCapacity()); } if (subElement.getNodeName().equals("threadpool-outbound")) { ThreadPoolConfig result = parseThreadPoolConfig(subElement); configuration.getEngineDefaults().getThreading().setThreadPoolOutbound(result.isEnabled()); configuration.getEngineDefaults().getThreading() .setThreadPoolOutboundNumThreads(result.getNumThreads()); configuration.getEngineDefaults().getThreading() .setThreadPoolOutboundCapacity(result.getCapacity()); } if (subElement.getNodeName().equals("threadpool-timerexec")) { ThreadPoolConfig result = parseThreadPoolConfig(subElement); configuration.getEngineDefaults().getThreading().setThreadPoolTimerExec(result.isEnabled()); configuration.getEngineDefaults().getThreading() .setThreadPoolTimerExecNumThreads(result.getNumThreads()); configuration.getEngineDefaults().getThreading() .setThreadPoolTimerExecCapacity(result.getCapacity()); } if (subElement.getNodeName().equals("threadpool-routeexec")) { ThreadPoolConfig result = parseThreadPoolConfig(subElement); configuration.getEngineDefaults().getThreading().setThreadPoolRouteExec(result.isEnabled()); configuration.getEngineDefaults().getThreading() .setThreadPoolRouteExecNumThreads(result.getNumThreads()); configuration.getEngineDefaults().getThreading() .setThreadPoolRouteExecCapacity(result.getCapacity()); } } }