public static boolean getComponentTaskResult()

in jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/utils/ManagementSupport.java [337:373]


    public static boolean getComponentTaskResult(String resultMsg, String component, List<Element> results) {
        Element result = null;
        boolean success = true;

        try {
            Document doc = parse(wrap(resultMsg));
            Element wrapper = getElement(doc, WRAPPER);
            result = getChildElement(wrapper, COMPONENT_TASK_RESULT);
            Element e = getChildElement(result, COMPONENT_TASK_RESULT_DETAILS);
            e = getChildElement(e, TASK_RESULT_DETAILS);
            e = getChildElement(e, TASK_RESULT);
            String r = DOMUtil.getElementText(e);
            if (!SUCCESS.equals(r)) {
                success = false;
            }
        } catch (Exception e) {
            // The component did not throw an exception upon deployment, but the
            // result string is not compliant: issue a warning and consider this
            // is a successful deployment
            try {
                if (success) {
                    result = ManagementSupport.createComponentWarning("deploy", component,
                                                                      "Unable to parse result string", e);
                } else {
                    result = ManagementSupport.createComponentFailure("deploy", component,
                                                                      "Unable to parse result string", e);
                }
            } catch (Exception e2) {
                logger.error("", e2);
                result = null;
            }
        }
        if (result != null) {
            results.add(result);
        }
        return success;
    }