@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 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 int enqueue(JobRequest jd) { try { return target.path("ji").request().post(Entity.entity(jd, MediaType.APPLICATION_XML), JobInstance.class).getId(); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public int getQueueEnabledCapacity(Queue q) { try { return target.path("q/" + q.getId() + "/enabled-capacity").request().get().readEntity(Integer.class); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void clearQueue(Queue q) { try { target.path("q/" + q.getId() + "/clear").request().post(null); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
private InputStream getDeliverableContent(Deliverable deliverable) { URL url = null; try { String uriStart = getHostForLaunch(deliverable.getJobId()); url = new URL(uriStart + "/ws/simple/file?id=" + deliverable.getRandomId()); jqmlogger.trace("URL: " + url.toString()); } catch (MalformedURLException e) { throw new JqmClientException("URL is not valid " + url, e); } return getFile(url.toString()); }
public int restartCrashedJob(int idJob) { try { return target.path("ji/crashed/" + idJob).request().delete(JobInstance.class).getId(); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }
@Override public void resumeQueue(Queue q) { try { target.path("q/" + q.getId() + "/pause").request().delete(); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } }