List of usage examples for javax.xml.stream XMLStreamException getMessage
public String getMessage()
From source file:org.wso2.carbon.connector.FileArchives.java
/** * Generate the results/*from ww w . j ava 2 s. c o m*/ * * @param messageContext The message context that is generated for processing the file * @param resultStatus output result (true/false) */ private void generateResults(MessageContext messageContext, boolean resultStatus) { ResultPayloadCreate resultPayload = new ResultPayloadCreate(); String response = FileConstants.START_TAG + resultStatus + FileConstants.END_TAG; try { OMElement element = resultPayload.performSearchMessages(response); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { handleException(e.getMessage(), e, messageContext); } catch (IOException e) { handleException(e.getMessage(), e, messageContext); } catch (JSONException e) { handleException(e.getMessage(), e, messageContext); } }
From source file:org.wso2.carbon.connector.FileCopy.java
/** * Generate the results//from w ww . jav a 2 s . com * * @param messageContext The message context that is processed by a handler in the handle method * @param resultStatus Result of the status (true/false) * @param resultPayload result payload create */ private void generateResults(MessageContext messageContext, boolean resultStatus, ResultPayloadCreate resultPayload) { String response = FileConstants.START_TAG + resultStatus + FileConstants.END_TAG; OMElement element; try { element = resultPayload.performSearchMessages(response); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { log.error(e.getMessage()); handleException(e.getMessage(), e, messageContext); } catch (IOException e) { log.error(e.getMessage()); handleException(e.getMessage(), e, messageContext); } catch (JSONException e) { log.error(e.getMessage()); handleException(e.getMessage(), e, messageContext); } }
From source file:org.wso2.carbon.connector.FileCopyInStream.java
/** * Generate the results//from ww w . j a v a 2s .c om * * @param messageContext * @param resultStatus */ private void generateResults(MessageContext messageContext, boolean resultStatus) { ResultPayloadCreater resultPayload = new ResultPayloadCreater(); String responce = "<result><copylarge>" + resultStatus + "</copylarge></result>"; try { OMElement element = resultPayload.performSearchMessages(responce); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { log.error(e.getMessage()); handleException(e.getMessage(), messageContext); } catch (IOException e) { log.error(e.getMessage()); handleException(e.getMessage(), messageContext); } catch (JSONException e) { log.error(e.getMessage()); handleException(e.getMessage(), messageContext); } }
From source file:org.wso2.carbon.connector.FileCreate.java
/** * Generate the output payload/*from w w w.ja va 2s. com*/ * * @param messageContext The message context that is processed by a handler in the handle method * @param resultStatus Result of the status (true/false) */ private void generateOutput(MessageContext messageContext, boolean resultStatus) { ResultPayloadCreate resultPayload = new ResultPayloadCreate(); String response = FileConstants.START_TAG + resultStatus + FileConstants.END_TAG; try { OMElement element = resultPayload.performSearchMessages(response); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { handleException(e.getMessage(), e, messageContext); } catch (IOException e) { handleException(e.getMessage(), e, messageContext); } catch (JSONException e) { handleException(e.getMessage(), e, messageContext); } }
From source file:org.wso2.carbon.connector.FileExist.java
/** * Generate the result//www .ja va 2 s . c om * * @param messageContext The message context that is generated for processing the file * @param isFileExist Result of the status (true/false) */ private void generateResults(MessageContext messageContext, boolean isFileExist) { ResultPayloadCreate resultPayload = new ResultPayloadCreate(); String response = FileConstants.FILE_EXIST_START_TAG + isFileExist + FileConstants.FILE_EXIST_END_TAG; OMElement element; try { element = resultPayload.performSearchMessages(response); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { handleException(e.getMessage(), e, messageContext); } catch (IOException e) { handleException(e.getMessage(), e, messageContext); } catch (JSONException e) { handleException(e.getMessage(), e, messageContext); } }
From source file:org.wso2.carbon.connector.FileMove.java
/** * Generate the result//from www .ja va2s .c o m * * @param messageContext The message context that is processed by a handler in the handle method * @param resultStatus Result of the status (true/false) */ private void generateResults(MessageContext messageContext, boolean resultStatus) { ResultPayloadCreate resultPayload = new ResultPayloadCreate(); String response = FileConstants.START_TAG + resultStatus + FileConstants.END_TAG; try { OMElement element = resultPayload.performSearchMessages(response); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { handleException(e.getMessage(), messageContext); } catch (IOException e) { handleException(e.getMessage(), messageContext); } catch (JSONException e) { handleException(e.getMessage(), messageContext); } }
From source file:org.wso2.carbon.connector.FileRename.java
/** * Generate the output/*from w ww. j a va2 s . c o m*/ * * @param messageContext * @param resultStatus */ private void generateResult(MessageContext messageContext, boolean resultStatus) { ResultPayloadCreater resultPayload = new ResultPayloadCreater(); String responce = "<result><success>" + resultStatus + "</success></result>"; try { OMElement element = resultPayload.performSearchMessages(responce); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { log.error(e.getMessage()); handleException(e.getMessage(), messageContext); } catch (IOException e) { log.error(e.getMessage()); handleException(e.getMessage(), messageContext); } catch (JSONException e) { log.error(e.getMessage()); handleException(e.getMessage(), messageContext); } }
From source file:org.wso2.carbon.connector.FileUnzip.java
/** * Generate the result/*w w w .j a v a 2 s .c o m*/ * * @param messageContext The message context that is processed by a handler in the handle method * @param resultStatus Result of the status (true/false) */ private void generateResults(MessageContext messageContext, boolean resultStatus) { ResultPayloadCreate resultPayload = new ResultPayloadCreate(); String response = FileConstants.START_TAG + resultStatus + FileConstants.END_TAG; try { OMElement element = resultPayload.performSearchMessages(response); resultPayload.preparePayload(messageContext, element); } catch (XMLStreamException e) { handleException(e.getMessage(), e, messageContext); } catch (IOException e) { handleException(e.getMessage(), e, messageContext); } catch (JSONException e) { handleException(e.getMessage(), e, messageContext); } }
From source file:org.wso2.carbon.core.persistence.PersistenceUtils.java
public static OMElement getResourceDocumentElement(File resourceFile) throws XMLStreamException, IOException { OMElement resourceElement;/* www .j av a 2 s. c o m*/ FileInputStream fis = null; XMLStreamReader reader = null; try { fis = FileUtils.openInputStream(resourceFile); reader = xif.createXMLStreamReader(fis); StAXOMBuilder builder = new StAXOMBuilder(reader); resourceElement = builder.getDocumentElement(); resourceElement.detach(); } catch (XMLStreamException e) { throw new XMLStreamException(e.getMessage(), e); } catch (IOException e) { throw new IOException(e.getMessage(), e); } finally { try { if (fis != null) { fis.close(); } } catch (IOException e) { log.error(e.getMessage(), e); } try { if (reader != null) { reader.close(); } } catch (XMLStreamException e) { log.error(e.getMessage(), e); } } return resourceElement; }
From source file:org.wso2.carbon.core.transports.util.RequestProcessorUtil.java
/** * @param byteArrayOutStream//from ww w. j a v a 2 s.co m * @param out * @param annotatedXsl * @param contextRoot * @param annotation : If annotation is false PI would not be attached. */ public static void writeDocument(ByteArrayOutputStream byteArrayOutStream, OutputStream out, String annotatedXsl, String contextRoot, boolean annotation) { XMLStreamWriter writer; ByteArrayInputStream bais = null; XMLStreamReader reader = null; try { bais = new ByteArrayInputStream(byteArrayOutStream.toByteArray()); reader = XMLInputFactory.newInstance().createXMLStreamReader(bais); StAXOMBuilder builder = new StAXOMBuilder(reader); OMElement docElem = builder.getDocumentElement(); writer = XMLOutputFactory.newInstance().createXMLStreamWriter(out); if (annotatedXsl != null && annotation) { writer.writeProcessingInstruction("xml-stylesheet", " type=\"text/xsl\" href=\"" + (contextRoot.equals("/") ? "" : contextRoot) + "/styles/" + annotatedXsl + "\""); } docElem.serialize(writer); writer.flush(); } catch (XMLStreamException e) { log.error("Error occurred while trying to write processing instruction for attaching " + "annotated style sheet", e); } finally { try { if (bais != null) { bais.close(); } } catch (IOException e) { log.error(e.getMessage(), e); } try { if (reader != null) { reader.close(); } } catch (XMLStreamException e) { log.error(e.getMessage(), e); } } }