List of usage examples for org.springframework.batch.core.job AbstractJob getStepNames
@Override public abstract Collection<String> getStepNames();
From source file:de.codecentric.batch.listener.AddListenerToJobService.java
public void addListenerToJob(AbstractJob job) { if (addProtocolListener) { job.registerJobExecutionListener(protocolListener); }/*w w w . ja va2 s. c om*/ job.registerJobExecutionListener(runningExecutionTrackerListener); if (addLoggingListener) { job.registerJobExecutionListener(loggingListener); job.registerJobExecutionListener(loggingAfterJobListener); for (String stepName : job.getStepNames()) { AbstractStep step = (AbstractStep) job.getStep(stepName); step.registerStepExecutionListener(loggingListener); } } if (listenerProviders != null) { for (ListenerProvider listenerProvider : listenerProviders) { for (JobExecutionListener jobExecutionListener : listenerProvider.jobExecutionListeners()) { job.registerJobExecutionListener(jobExecutionListener); } for (StepExecutionListener stepExecutionListener : listenerProvider.stepExecutionListeners()) { for (String stepName : job.getStepNames()) { AbstractStep step = (AbstractStep) job.getStep(stepName); step.registerStepExecutionListener(stepExecutionListener); } } } } }
From source file:org.geoserver.backuprestore.Backup.java
@Override public void setApplicationContext(ApplicationContext context) throws BeansException { Backup.context = context;/* w ww . j a v a 2 s . c om*/ try { AbstractJob backupJob = (AbstractJob) context.getBean(BACKUP_JOB_NAME); if (backupJob != null) { this.setTotalNumberOfBackupSteps(backupJob.getStepNames().size()); } AbstractJob restoreJob = (AbstractJob) context.getBean(BACKUP_JOB_NAME); if (restoreJob != null) { this.setTotalNumberOfRestoreSteps(restoreJob.getStepNames().size()); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Could not fully configure the Backup Facade!", e); } }