@Override public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException { try { int count = jobExplorer.getJobInstanceCount(jobName); if(count <= 0) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } else { return count; } } catch (org.springframework.batch.core.launch.NoSuchJobException e) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } }
@Override public final NoSuchJobException noSuchJobException(final String jobName) { final NoSuchJobException result = new NoSuchJobException(String.format(getLoggingLocale(), noSuchJobException$str(), jobName)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String couldNotFindJobXml = "WFLYBATCH000006: Could not find the job XML file in the deployment: %s";
@Override public List<JobInstance> getJobInstances(String jobName, int start, int count) throws NoSuchJobException, JobSecurityException { List<org.springframework.batch.core.JobInstance> jobInstances = jobExplorer.getJobInstances(jobName, start, count); if(jobInstances == null || jobInstances.size() == 0) { throw new NoSuchJobException("The job was not found"); } return new ArrayList<>(jobInstances); }
@Override public final NoSuchJobException noSuchJobException(final String jobName) { final NoSuchJobException result = new NoSuchJobException(String.format(getLoggingLocale(), noSuchJobException$str(), jobName)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String invalidConfigProperty = "JBERET000633: Invalid JBeret configuration property %s = %s.";
@Override public List<Long> getRunningExecutions(String name) throws NoSuchJobException, JobSecurityException { Set<org.springframework.batch.core.JobExecution> findRunningJobExecutions = jobExplorer.findRunningJobExecutions(name); if(findRunningJobExecutions.isEmpty()) { throw new NoSuchJobException("Job name: " + name + " not found."); } List<Long> results = new ArrayList<>(findRunningJobExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : findRunningJobExecutions) { results.add(jobExecution.getId()); } return results; }
@Override public final NoSuchJobException noSuchJobException(final String jobName) { final NoSuchJobException result = new NoSuchJobException(String.format(getLoggingLocale(), noSuchJobException$str(), jobName)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String couldNotFindJobXml = "WFLYBATCH000006: Could not find the job XML file in the deployment: %s";
@Override public List<StepExecution> getStepExecutions(long executionId) throws NoSuchJobExecutionException, JobSecurityException { org.springframework.batch.core.JobExecution execution = jobExplorer.getJobExecution(executionId); if(execution == null) { throw new NoSuchJobException("JobExecution with the id " + executionId + " was not found"); } Collection<org.springframework.batch.core.StepExecution> executions = execution.getStepExecutions(); List<StepExecution> batchExecutions = new ArrayList<>(); if(executions != null) { for (org.springframework.batch.core.StepExecution stepExecution : executions) { if(!stepExecution.getStepName().contains(":partition")) { batchExecutions.add(new JsrStepExecution(jobExplorer.getStepExecution(executionId, stepExecution.getId()))); } } } return batchExecutions; }
@Override public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException { try { int count = jobExplorer.getJobInstanceCount(jobName); if(count <= 0) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } else { return count; } } catch (org.springframework.batch.core.launch.NoSuchJobException e) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } }
@Override public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException { try { int count = jobExplorer.getJobInstanceCount(jobName); if(count <= 0) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } else { return count; } } catch (org.springframework.batch.core.launch.NoSuchJobException e) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } }
@Override public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException { try { int count = jobExplorer.getJobInstanceCount(jobName); if(count <= 0) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } else { return count; } } catch (org.springframework.batch.core.launch.NoSuchJobException e) { throw new NoSuchJobException("No job instances were found for job name " + jobName); } }
@Override public List<JobInstance> getJobInstances(String jobName, int start, int count) throws NoSuchJobException, JobSecurityException { List<org.springframework.batch.core.JobInstance> jobInstances = jobExplorer.getJobInstances(jobName, start, count); if(jobInstances == null || jobInstances.size() == 0) { throw new NoSuchJobException("The job was not found"); } return new ArrayList<JobInstance>(jobInstances); }
@Override public List<JobInstance> getJobInstances(String jobName, int start, int count) throws NoSuchJobException, JobSecurityException { List<org.springframework.batch.core.JobInstance> jobInstances = jobExplorer.getJobInstances(jobName, start, count); if(jobInstances == null || jobInstances.size() == 0) { throw new NoSuchJobException("The job was not found"); } return new ArrayList<JobInstance>(jobInstances); }
@Override public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException { final int jobInstanceCount = persistenceManagerService.jobOperatorGetJobInstanceCount(jobName); if (jobInstanceCount > 0) { return jobInstanceCount; } throw new NoSuchJobException("Job " + jobName + " not found"); }
@Override public List<JobInstance> getJobInstances(String jobName, int start, int count) throws NoSuchJobException, JobSecurityException { List<org.springframework.batch.core.JobInstance> jobInstances = jobExplorer.getJobInstances(jobName, start, count); if(jobInstances == null || jobInstances.size() == 0) { throw new NoSuchJobException("The job was not found"); } return new ArrayList<JobInstance>(jobInstances); }
@Override public List<Long> getRunningExecutions(String name) throws NoSuchJobException, JobSecurityException { Set<org.springframework.batch.core.JobExecution> findRunningJobExecutions = jobExplorer.findRunningJobExecutions(name); if(findRunningJobExecutions.isEmpty()) { throw new NoSuchJobException("Job name: " + name + " not found."); } List<Long> results = new ArrayList<Long>(findRunningJobExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : findRunningJobExecutions) { results.add(jobExecution.getId()); } return results; }
/** * Throws NoSuchJobException if and only if jobName is not in the Set returned * by getJobNames(). * * Not crazy about having to do this, but the TCK forces us to (unless we want * to go back to all the people who have already dealt with this and argue we * should ignore these tests simply because we're running up against it now * and don't like the behavior). * * Would like to reconsider in 1.1. * * @param jobName * @throws NoSuchJobException */ private void validateJobName(String jobName) throws NoSuchJobException { if (!getJobNames().contains(jobName)) { logger.fine("Job Name " + jobName + " not found"); throw new NoSuchJobException("Job Name " + jobName + " not found"); } }
@Override public List<Long> getRunningExecutions(String name) throws NoSuchJobException, JobSecurityException { Set<org.springframework.batch.core.JobExecution> findRunningJobExecutions = jobExplorer.findRunningJobExecutions(name); if(findRunningJobExecutions.isEmpty()) { throw new NoSuchJobException("Job name: " + name + " not found."); } List<Long> results = new ArrayList<Long>(findRunningJobExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : findRunningJobExecutions) { results.add(jobExecution.getId()); } return results; }
@Override public List<Long> getRunningExecutions(String name) throws NoSuchJobException, JobSecurityException { Set<org.springframework.batch.core.JobExecution> findRunningJobExecutions = jobExplorer.findRunningJobExecutions(name); if(findRunningJobExecutions.isEmpty()) { throw new NoSuchJobException("Job name: " + name + " not found."); } List<Long> results = new ArrayList<Long>(findRunningJobExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : findRunningJobExecutions) { results.add(jobExecution.getId()); } return results; }
@Override public List<JobInstance> getJobInstances(String jobName, int start, int count) throws NoSuchJobException, JobSecurityException { List<JobInstance> jobInstances = new ArrayList<JobInstance>(); if (count == 0) { return new ArrayList<JobInstance>(); } else if (count < 0) { throw new IllegalArgumentException("Count should be a positive integer (or 0, which will return an empty list)"); } final List<Long> instanceIds = persistenceManagerService.jobOperatorGetJobInstanceIds(jobName, start, count); // get the jobinstance ids associated with this job name if (instanceIds.size() > 0) { // for every job instance id for (long id : instanceIds) { // get the job instance obj, add it to the list final JobStatus jobStatus = statusManagerService.getJobStatus(id); final JobInstance jobInstance = jobStatus.getJobInstance(); jobInstances.add(jobInstance); } // send the list of objs back to caller return jobInstances; } throw new NoSuchJobException("Job Name " + jobName + " not found"); }
@Override public List<Long> getRunningExecutions(final String jobName) throws NoSuchJobException, JobSecurityException { final List<Long> jobExecutions = new ArrayList<Long>(); // get the jobexecution ids associated with this job name final Set<Long> executionIds = persistenceManagerService.jobOperatorGetRunningExecutions(jobName); if (executionIds.isEmpty()) { throw new NoSuchJobException("Job Name " + jobName + " not found"); } // for every job instance id for (final long id : executionIds) { try { if (kernelService.isExecutionRunning(id)) { final InternalJobExecution jobEx = kernelService.getJobExecution(id); jobExecutions.add(jobEx.getExecutionId()); } } catch (final NoSuchJobExecutionException e) { throw new IllegalStateException("Just found execution with id = " + id + " in table, but now seeing it as gone", e); } } return jobExecutions; }