Search in sources :

Example 1 with XmlMap

use of org.glassfish.admin.rest.utils.xml.XmlMap in project Payara by payara.

the class ActionReportXmlProvider method processReport.

protected XmlObject processReport(ActionReporter ar) {
    XmlMap result = new XmlMap("map");
    result.put("message", (ar instanceof RestActionReporter) ? ((RestActionReporter) ar).getCombinedMessage() : ar.getMessage());
    result.put("command", ar.getActionDescription());
    result.put("exit_code", ar.getActionExitCode().toString());
    Properties properties = ar.getTopMessagePart().getProps();
    if ((properties != null) && (!properties.isEmpty())) {
        result.put("properties", new XmlMap("properties", properties));
    }
    Properties extraProperties = ar.getExtraProperties();
    if ((extraProperties != null) && (!extraProperties.isEmpty())) {
        result.put("extraProperties", getExtraProperties(result, extraProperties));
    }
    List<MessagePart> children = ar.getTopMessagePart().getChildren();
    if ((children != null) && (!children.isEmpty())) {
        result.put("children", processChildren(children));
    }
    List<ActionReporter> subReports = ar.getSubActionsReport();
    if ((subReports != null) && (!subReports.isEmpty())) {
        result.put("subReports", processSubReports(subReports));
    }
    return result;
}
Also used : RestActionReporter(org.glassfish.admin.rest.utils.xml.RestActionReporter) MessagePart(org.glassfish.api.ActionReport.MessagePart) XmlMap(org.glassfish.admin.rest.utils.xml.XmlMap) RestActionReporter(org.glassfish.admin.rest.utils.xml.RestActionReporter) ActionReporter(com.sun.enterprise.v3.common.ActionReporter)

Example 2 with XmlMap

use of org.glassfish.admin.rest.utils.xml.XmlMap in project Payara by payara.

the class ActionReportXmlProvider method getExtraProperties.

protected XmlMap getExtraProperties(XmlObject object, Properties props) {
    XmlMap extraProperties = new XmlMap("extraProperties");
    for (Map.Entry<Object, Object> entry : props.entrySet()) {
        String key = entry.getKey().toString();
        Object value = getXmlObject(entry.getValue());
        if (value != null) {
            extraProperties.put(key, value);
        }
    }
    return extraProperties;
}
Also used : XmlMap(org.glassfish.admin.rest.utils.xml.XmlMap) XmlObject(org.glassfish.admin.rest.utils.xml.XmlObject) XmlMap(org.glassfish.admin.rest.utils.xml.XmlMap)

Example 3 with XmlMap

use of org.glassfish.admin.rest.utils.xml.XmlMap in project Payara by payara.

the class ActionReportXmlProvider method processChildren.

protected XmlArray processChildren(List<MessagePart> parts) {
    XmlArray array = new XmlArray("children");
    for (MessagePart part : parts) {
        XmlMap object = new XmlMap("part");
        object.put("message", part.getMessage());
        object.put("properties", new XmlMap("properties", part.getProps()));
        List<MessagePart> children = part.getChildren();
        if (children.size() > 0) {
            object.put("children", processChildren(part.getChildren()));
        }
        array.put(object);
    }
    return array;
}
Also used : XmlArray(org.glassfish.admin.rest.utils.xml.XmlArray) MessagePart(org.glassfish.api.ActionReport.MessagePart) XmlMap(org.glassfish.admin.rest.utils.xml.XmlMap)

Aggregations

XmlMap (org.glassfish.admin.rest.utils.xml.XmlMap)3 MessagePart (org.glassfish.api.ActionReport.MessagePart)2 ActionReporter (com.sun.enterprise.v3.common.ActionReporter)1 RestActionReporter (org.glassfish.admin.rest.utils.xml.RestActionReporter)1 XmlArray (org.glassfish.admin.rest.utils.xml.XmlArray)1 XmlObject (org.glassfish.admin.rest.utils.xml.XmlObject)1