public DispatcherResult killDispatcherExecution(final String execId) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); params.put("id", execId); params.put("xmlreq", "true"); // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(RUNDECK_KILL_JOB_PATH, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } final Envelope envelope = validateResponse(response); final boolean result = envelope.isSuccessResult(); final StringBuffer sb = envelope.successMessages(); return new DispatcherResult() { public boolean isSuccessful() { return result; } public String getMessage() { return sb.toString(); } }; }
public DispatcherResult killDispatcherExecution(final String execId) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); final String rundeckApiKillJobPath = substitutePathVariable(RUNDECK_API_KILL_JOB_PATH, "id", execId); // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(rundeckApiKillJobPath, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } final Envelope envelope = validateResponse(response); final Node result1 = envelope.doc.selectSingleNode("result"); final String abortStatus = result1.selectSingleNode("abort/@status").getStringValue(); final boolean result = !"failed".equals(abortStatus); final StringBuffer sb = envelope.successMessages(); return new DispatcherResult() { public boolean isSuccessful() { return result; } public String getMessage() { return sb.toString(); } }; }