Search in sources :

Example 1 with GetNodeSummariesJSONWork

use of org.apache.hyracks.control.cc.work.GetNodeSummariesJSONWork in project asterixdb by apache.

the class NodesRESTAPIFunction method invoke.

@Override
public ObjectNode invoke(String host, String servletPath, String[] arguments) throws Exception {
    ObjectMapper om = new ObjectMapper();
    ObjectNode result = om.createObjectNode();
    switch(arguments.length) {
        case 1:
            {
                if ("".equals(arguments[0])) {
                    GetNodeSummariesJSONWork gnse = new GetNodeSummariesJSONWork(ccs.getNodeManager());
                    ccs.getWorkQueue().scheduleAndSync(gnse);
                    result.set("result", enhanceSummaries(gnse.getSummaries(), host, servletPath));
                } else {
                    String nodeId = arguments[0];
                    GetNodeDetailsJSONWork gnde = new GetNodeDetailsJSONWork(ccs.getNodeManager(), ccs.getCCConfig(), nodeId, true, true);
                    ccs.getWorkQueue().scheduleAndSync(gnde);
                    result.set("result", gnde.getDetail());
                }
            }
    }
    return result;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) GetNodeDetailsJSONWork(org.apache.hyracks.control.cc.work.GetNodeDetailsJSONWork) GetNodeSummariesJSONWork(org.apache.hyracks.control.cc.work.GetNodeSummariesJSONWork) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 GetNodeDetailsJSONWork (org.apache.hyracks.control.cc.work.GetNodeDetailsJSONWork)1 GetNodeSummariesJSONWork (org.apache.hyracks.control.cc.work.GetNodeSummariesJSONWork)1