Package org.springframework.batch.core.job

Examples of org.springframework.batch.core.job.AbstractJob


   @Override
   public void beforeStep(StepExecution se) {
      logger.info("step started: " + se.getStepName());
      JobExecution je = se.getJobExecution();
      AbstractJob job = null;
      try {
         job =
               (AbstractJob) jobRegistry.getJob(je.getJobInstance()
                     .getJobName());
      } catch (NoSuchJobException ex) {
         throw BddException.INTERNAL(ex, "Illegal state.");
      }

      Collection<String> stepNames = job.getStepNames();

      int steps = stepNames.size();
      double done = 0;
      for (String stepName : stepNames) {
         ExecutionContext jec = se.getJobExecution().getExecutionContext();
View Full Code Here


  protected void enhance(Job target) {

    if (target instanceof AbstractJob) {

      AbstractJob job = (AbstractJob) target;
      job.setJobRepository(properties.getJobRepository());

      JobParametersIncrementer jobParametersIncrementer = properties.getJobParametersIncrementer();
      if (jobParametersIncrementer != null) {
        job.setJobParametersIncrementer(jobParametersIncrementer);
      }
      JobParametersValidator jobParametersValidator = properties.getJobParametersValidator();
      if (jobParametersValidator != null) {
        job.setJobParametersValidator(jobParametersValidator);
      }

      Boolean restartable = properties.getRestartable();
      if (restartable != null) {
        job.setRestartable(restartable);
      }

      List<JobExecutionListener> listeners = properties.getJobExecutionListeners();
      if (!listeners.isEmpty()) {
        job.setJobExecutionListeners(listeners.toArray(new JobExecutionListener[0]));
      }

    }

  }
View Full Code Here

      return processor;
    }

    @Bean
    public Job discreteJob() {
      AbstractJob job = new AbstractJob("discreteRegisteredJob") {

        @Override
        public Collection<String> getStepNames() {
          return Collections.emptySet();
        }

        @Override
        public Step getStep(String stepName) {
          return null;
        }

        @Override
        protected void doExecute(JobExecution execution)
            throws JobExecutionException {
          execution.setStatus(BatchStatus.COMPLETED);
        }
      };
      job.setJobRepository(this.jobRepository);
      return job;
    }
View Full Code Here

    @Autowired
    private JobRepository jobRepository;

    @Bean
    public Job discreteJob() {
      AbstractJob job = new AbstractJob("discreteLocalJob") {

        @Override
        public Collection<String> getStepNames() {
          return Collections.emptySet();
        }

        @Override
        public Step getStep(String stepName) {
          return null;
        }

        @Override
        protected void doExecute(JobExecution execution)
            throws JobExecutionException {
          execution.setStatus(BatchStatus.COMPLETED);
        }
      };
      job.setJobRepository(this.jobRepository);
      return job;
    }
View Full Code Here

    @Autowired
    private JobRepository jobRepository;

    @Bean
    public Job job() {
      AbstractJob job = new AbstractJob() {

        @Override
        public Collection<String> getStepNames() {
          return Collections.emptySet();
        }

        @Override
        public Step getStep(String stepName) {
          return null;
        }

        @Override
        protected void doExecute(JobExecution execution)
            throws JobExecutionException {
          execution.setStatus(BatchStatus.COMPLETED);
        }
      };
      job.setJobRepository(this.jobRepository);
      return job;
    }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.job.AbstractJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.