public void cancelRequest(final Request request) { if (!isServerActive()) { getView().cancelSubmitted(request); } ModelNode address = RuntimeBaseAddress.get(); address.add("subsystem", "teiid"); ModelNode operation = new ModelNode(); operation.get(OP).set("cancel-request"); operation.get(ADDRESS).set(address); operation.get("session").set(new ModelNode().set(request.getSessionId())); operation.get("execution-id").set(new ModelNode().set(request.getExecutionId())); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.get(RESULT).isDefined()) { getView().cancelSubmitted(request); Console.info( "Query Cancel Submitted. Session Id:" + request.getSessionId() + ", Execution Id:" + request.getExecutionId()); } else { getView().cancelSubmitted(null); } } }); }
public void getQueryPlan(Request request) { if (!isServerActive()) { getView().setQueryPlan("No Server Found"); } ModelNode address = RuntimeBaseAddress.get(); address.add("subsystem", "teiid"); ModelNode operation = new ModelNode(); operation.get(OP).set("get-query-plan"); operation.get(ADDRESS).set(address); operation.get("session").set(new ModelNode().set(request.getSessionId())); operation.get("execution-id").set(new ModelNode().set(request.getExecutionId())); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); String plan = null; if (response.get(RESULT).isDefined()) { plan = response.get(RESULT).asString(); } if (plan != null && !plan.trim().isEmpty()) { getView().setQueryPlan(plan); } else { getView() .setQueryPlan( "<node name=\"query\"><property name=\"noplan\">No Plan found, query might have finished executing!</property></node>"); } } }); }