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>"); } } }); }
public void getSourceRequests(final Request selection) { if (!isServerActive()) { getView().setSourceRequests(selection, null); } ModelNode address = RuntimeBaseAddress.get(); address.add("subsystem", "teiid"); ModelNode operation = new ModelNode(); operation.get(OP).set("list-requests-per-session"); operation.get(ADDRESS).set(address); operation.get("session").set(new ModelNode().set(selection.getSessionId())); operation.get("include-source").set(new ModelNode().set(true)); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.get(RESULT).isDefined()) { List<Request> requests = requestAdaptor.fromDMRList(response.get(RESULT).asList()); getView().setSourceRequests(selection, requests); } else { getView().setSourceRequests(selection, null); } } }); }