@Override public List<com.enioka.jqm.api.Queue> getQueues() { try { return target.path("q").request().get(new GenericType<List<Queue>>() { }); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public List<JobDef> getJobDefinitions(String application) { try { return target.path("jd/" + application).request().get(new GenericType<List<JobDef>>() { }); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public List<com.enioka.jqm.api.JobInstance> getActiveJobs() { try { return target.path("ji/active").request().get(new GenericType<List<JobInstance>>() { }); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public List<JobDef> getJobDefinitions() { try { return target.path("jd").request().get(new GenericType<List<JobDef>>() { }); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public List<com.enioka.jqm.api.JobInstance> getJobs() { try { return target.path("ji").request().get(new GenericType<List<JobInstance>>() { }); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public JobDef getJobDefinition(String name) { try { return target.path("jd/name/" + name).request().get(new GenericType<JobDef>() { }); } catch (Exception e) { throw new JqmClientException(e); } } }
@Override public InputStream getDeliverableContent(com.enioka.jqm.api.Deliverable d) { try { return target.path("ji/files").request().post(Entity.entity(d, MediaType.APPLICATION_XML), InputStream.class); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void setScheduleRecurrence(int scheduleId, String cronExpression) { try { target.path("schedule/" + scheduleId + "/cron/" + cronExpression).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void setSchedulePriority(int scheduleId, int priority) { try { target.path("schedule/" + scheduleId + "/priority/" + priority).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public InputStream getJobLogStdErr(int jobId) { try { return target.path("ji/" + jobId + "/stderr").request().get(InputStream.class); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void setJobRunAfter(int jobId, Calendar whenToRun) { try { target.path("ji/" + jobId + "/delay/" + whenToRun.getTimeInMillis()).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void killJob(int idJob) { try { target.path("ji/killed/" + idJob).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void pauseRunningJob(int jobId) { try { target.path("ji/running/paused/" + jobId).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void setJobQueuePosition(int idJob, int position) { try { target.path("ji/" + idJob + "/position/" + position).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public com.enioka.jqm.api.JobInstance getJob(int idJob) { try { return target.path("ji/" + idJob).request().get(JobInstance.class); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException("An internal JQM error occured", e); } }
@Override public void cancelJob(int idJob) { try { target.path("ji/cancelled/" + idJob).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void pauseQueuedJob(int idJob) { try { target.path("ji/paused/" + idJob).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void setScheduleQueue(int scheduleId, int queueId) { try { target.path("schedule/" + scheduleId + "/queue/" + queueId).request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public InputStream getDeliverableContent(int d) { try { return target.path("ji/files/" + d).request().get(InputStream.class); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
private InputStream getJobLog(int jobId, String extension, String param) { // 1: retrieve node to address String uriStart = getHostForLaunch(jobId); // 2: build URL URL url = null; try { url = new URL(uriStart + "/ws/simple/" + param + "?id=" + jobId); jqmlogger.trace("URL: " + url.toString()); } catch (MalformedURLException e) { throw new JqmClientException("URL is not valid " + url, e); } return getFile(url.toString()); }