private static String getResponseFaultReason(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return XMLUtils.parseXml(response, FAULT_REASON_XPATH); }
private static String getResponseFaultDetail(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return XMLUtils.parseXml(response, FAULT_DETAIL_XPATH); }
private static String getResponseFaultDetail(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return XMLUtils.parseXml(response, FAULT_DETAIL_XPATH); }
public static String getScriptExitCode(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return XMLUtils.parseXml(response, SCRIPT_EXIT_CODE_XPATH); }
private static String getResponseFaultReason(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return XMLUtils.parseXml(response, FAULT_REASON_XPATH); }
public static String getScriptExitCode(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return XMLUtils.parseXml(response, SCRIPT_EXIT_CODE_XPATH); }
public static int countStreamElements(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return Integer.parseInt(XMLUtils.parseXml(response, COUNT_STREAMS_XPATH)); }
public static int countStreamElements(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return Integer.parseInt(XMLUtils.parseXml(response, COUNT_STREAMS_XPATH)); }
public static boolean commandExecutionIsDone(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return StringUtils.containsIgnoreCase(XMLUtils.parseXml(response, COMMAND_STATE_XPATH), DONE_COMMAND_STATE_ACTION); }
public static boolean isSpecificResponseAction(String response, String responseType) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return StringUtils.isNotEmpty(response) && StringUtils.containsIgnoreCase(XMLUtils.parseXml(response, HEADER_XPATH), responseType); }
public static boolean isSpecificResponseAction(String response, String responseType) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return StringUtils.isNotEmpty(response) && StringUtils.containsIgnoreCase(XMLUtils.parseXml(response, HEADER_XPATH), responseType); }
public static boolean commandExecutionIsDone(String response) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { return StringUtils.containsIgnoreCase(XMLUtils.parseXml(response, COMMAND_STATE_XPATH), DONE_COMMAND_STATE_ACTION); }
/** * Constructs the executed command response from multiple streams of data containing the encoded result of the execution. * * @param response * @param outputStream * @return the decoded result of the command in a string. * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException * @throws IOException */ private String buildResultFromResponseStreams(String response, OutputStream outputStream) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { StringBuilder commandResult = new StringBuilder(); int noOfStreams = WSManUtils.countStreamElements(response); for (int streamNo = 0; streamNo < noOfStreams; streamNo++) { String stream = XMLUtils.parseXml(response, String.format(RECEIVE_RESPONSE_XPATH, outputStream.getValue(), streamNo)); if (!"DQo=".equals(stream)) { commandResult.append(EncoderDecoder.decodeBase64String(stream)); } } return commandResult.toString(); }
/** * Constructs the executed command response from multiple streams of data containing the encoded result of the execution. * * @param response * @param outputStream * @return the decoded result of the command in a string. * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException * @throws IOException */ private String buildResultFromResponseStreams(String response, OutputStream outputStream) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { StringBuilder commandResult = new StringBuilder(); int noOfStreams = WSManUtils.countStreamElements(response); for (int streamNo = 0; streamNo < noOfStreams; streamNo++) { String stream = XMLUtils.parseXml(response, String.format(RECEIVE_RESPONSE_XPATH, outputStream.getValue(), streamNo)); if (!"DQo=".equals(stream)) { commandResult.append(EncoderDecoder.decodeBase64String(stream)); } } return commandResult.toString(); }
/** * This method retrieves the resource id from the create resource request response and throws the appropriate exceptions in case of failure. * * @param response * @param resourceResponseAction * @param resourceIdXpath * @param resourceIdExceptionMessage * @return * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException * @throws IOException */ private String getResourceId(String response, String resourceResponseAction, String resourceIdXpath, String resourceIdExceptionMessage) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { if (WSManUtils.isSpecificResponseAction(response, resourceResponseAction)) { String shellId = XMLUtils.parseXml(response, resourceIdXpath); if (StringUtils.isNotBlank(shellId)) { return shellId; } else { throw new RuntimeException(resourceIdExceptionMessage); } } else if (WSManUtils.isFaultResponse(response)) { throw new RuntimeException(WSManUtils.getResponseFault(response)); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + response); } }
/** * This method retrieves the resource id from the create resource request response and throws the appropriate exceptions in case of failure. * * @param response * @param resourceResponseAction * @param resourceIdXpath * @param resourceIdExceptionMessage * @return * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException * @throws IOException */ private String getResourceId(String response, String resourceResponseAction, String resourceIdXpath, String resourceIdExceptionMessage) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { if (WSManUtils.isSpecificResponseAction(response, resourceResponseAction)) { String shellId = XMLUtils.parseXml(response, resourceIdXpath); if (StringUtils.isNotBlank(shellId)) { return shellId; } else { throw new RuntimeException(resourceIdExceptionMessage); } } else if (WSManUtils.isFaultResponse(response)) { throw new RuntimeException(WSManUtils.getResponseFault(response)); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + response); } }