org.springframework.boot.autoconfigure.batch.BatchProperties#org.springframework.batch.core.configuration.JobRegistry源码实例Demo

下面列出了org.springframework.boot.autoconfigure.batch.BatchProperties#org.springframework.batch.core.configuration.JobRegistry 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-batch-rest   文件: JobBuilder.java
public static Job registerJob(JobRegistry jobRegistry, Job job) {
    jobRegistry.unregister(job.getName());
    try {
        jobRegistry.register(new JobFactory() {
            @Override
            public Job createJob() {
                return job;
            }

            @Override
            public String getJobName() {
                return job.getName();
            }
        });
    } catch (Exception e) {
        throw new RuntimeException("Could not create " + job.getName(), e);
    }
    return job;
}
 
@Bean
public JobCreationListener jobCreationListener(
        final ApplicationContext applicationContext,
        final JobRegistry jobRegistry,
        final AdminService adminService,
        final SchedulerService schedulerService,
        final ListenerService listenerService,
        final JobExecutionListenerRegisterBean jobExecutionListenerRegisterBean) {
    return new JobCreationListener(
            applicationContext,
            jobRegistry,
            adminService,
            schedulerService,
            listenerService,
            jobExecutionListenerRegisterBean);
}
 
@Bean
@ConditionalOnMissingBean(value = {LightminClientRegistratorService.class})
public LightminClientRegistratorService lightminClientRegistratorService(
        final LightminClientProperties lightminClientProperties,
        final LightminClientClassicConfigurationProperties lightminClientClassicConfigurationProperties,
        final JobRegistry jobRegistry,
        final LightminServerLocatorService lightminServerLocatorService,
        @Qualifier("serverRestTemplate") final RestTemplate restTemplate) {

    return new LightminClientRegistratorService(
            lightminClientProperties,
            lightminClientClassicConfigurationProperties,
            restTemplate,
            jobRegistry,
            lightminServerLocatorService);
}
 
public TaskJobLauncherCommandLineRunnerFactoryBean(JobLauncher jobLauncher,
		JobExplorer jobExplorer, List<Job> jobs,
		TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry,
		JobRepository jobRepository, BatchProperties batchProperties) {
	Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null");
	Assert.notNull(batchProperties, "batchProperties must not be null");
	this.jobLauncher = jobLauncher;
	this.jobExplorer = jobExplorer;
	Assert.notEmpty(jobs, "jobs must not be null nor empty");
	this.jobs = jobs;
	this.jobNames = taskBatchProperties.getJobNames();
	this.jobRegistry = jobRegistry;
	this.taskBatchProperties = taskBatchProperties;
	if (StringUtils.hasText(batchProperties.getJob().getNames())) {
		this.jobNames = batchProperties.getJob().getNames();
	}
	else {
		this.jobNames = taskBatchProperties.getJobNames();
	}
	this.order = taskBatchProperties.getCommandLineRunnerOrder();
	this.jobRepository = jobRepository;
}
 
源代码5 项目: spring-batch-rest   文件: AdHocStarter.java
public AdHocStarter(JobLocator jobLocator, JobRepository jobRepository, JobPropertyResolvers jobPropertyResolvers,
                    @Value("${com.github.chrisgleissner.springbatchrest.addUniqueJobParameter:true}") boolean addUniqueJobParameter,
                    JobRegistry jobRegistry) {
    this.jobLocator = jobLocator;
    asyncJobLauncher = jobLauncher(new SimpleAsyncTaskExecutor(), jobRepository);
    syncJobLauncher = jobLauncher(new SyncTaskExecutor(), jobRepository);
    this.jobPropertyResolvers = jobPropertyResolvers;
    this.addUniqueJobParameter = addUniqueJobParameter;
    this.jobRegistry = jobRegistry;
    log.info("Adding unique job parameter: {}", addUniqueJobParameter);
}
 
源代码6 项目: SpringAll   文件: JobConfigure.java
/**
 * 注册JobRegistryBeanPostProcessor bean
 * 用于将任务名称和实际的任务关联起来
 */
@Bean
public JobRegistryBeanPostProcessor processor(JobRegistry jobRegistry, ApplicationContext applicationContext) {
    JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
    postProcessor.setJobRegistry(jobRegistry);
    postProcessor.setBeanFactory(applicationContext.getAutowireCapableBeanFactory());
    return postProcessor;
}
 
public JobCreationListener(final ApplicationContext applicationContext,
                           final JobRegistry jobRegistry,
                           final AdminService adminService,
                           final SchedulerService schedulerService,
                           final ListenerService listenerService,
                           final JobExecutionListenerRegisterBean jobExecutionListenerRegisterBean) {
    this.applicationContext = applicationContext;
    this.jobRegistry = jobRegistry;
    this.adminService = adminService;
    this.schedulerService = schedulerService;
    this.listenerService = listenerService;
    this.jobExecutionListenerRegisterBean = jobExecutionListenerRegisterBean;
}
 
源代码8 项目: spring-batch-lightmin   文件: DefaultJobService.java
public DefaultJobService(final JobOperator jobOperator,
                         final JobRegistry jobRegistry,
                         final JobExplorer jobExplorer,
                         final LightminJobExecutionDao lightminJobExecutionDao) {
    this.jobOperator = jobOperator;
    this.jobRegistry = jobRegistry;
    this.jobExplorer = jobExplorer;
    this.lightminJobExecutionDao = lightminJobExecutionDao;
}
 
源代码9 项目: spring-batch-lightmin   文件: JobLauncherBean.java
public JobLauncherBean(final JobLauncher jobLauncher,
                       final JobRegistry jobRegistry,
                       final SpringBatchLightminCoreConfigurationProperties properties) {
    this.jobLauncher = jobLauncher;
    this.JobRegistry = jobRegistry;
    this.springBatchLightminCoreConfigurationProperties = properties;
}
 
源代码10 项目: spring-batch-lightmin   文件: JobLauncherBean.java
/**
 * Lauches a {@link Job} with the given values of the {@link JobLaunch} parameter
 *
 * @param jobLaunch the launch information for the Job
 */
public void launchJob(final JobLaunch jobLaunch) {
    final Job job;
    try {
        job = this.JobRegistry.getJob(jobLaunch.getJobName());
        final JobParameters jobParameters = ResourceToDomainMapper.map(jobLaunch.getJobParameters());
        final JobExecution jobExecution = this.jobLauncher.run(job, jobParameters);
        final JobExecutionEvent jobExecutionEvent =
                new JobExecutionEvent(jobExecution, this.springBatchLightminCoreConfigurationProperties.getApplicationName());
        this.applicationEventPublisher.publishEvent(jobExecutionEvent);
    } catch (final Exception e) {
        throw new SpringBatchLightminApplicationException(e, e.getMessage());
    }

}
 
public DefaultSchedulerService(final BeanRegistrar beanRegistrar,
                               final JobRepository jobRepository,
                               final JobRegistry jobRegistry) {
    this.beanRegistrar = beanRegistrar;
    this.jobRepository = jobRepository;
    this.jobRegistry = jobRegistry;
}
 
@Bean
@ConditionalOnMissingBean(value = {SchedulerService.class})
public SchedulerService schedulerService(final BeanRegistrar beanRegistrar,
                                         final JobRepository jobRepository,
                                         final JobRegistry jobRegistry) {
    return new DefaultSchedulerService(beanRegistrar, jobRepository, jobRegistry);
}
 
@Bean
@ConditionalOnMissingBean(value = {ListenerService.class})
public ListenerService listenerService(final BeanRegistrar beanRegistrar,
                                       final JobRegistry jobRegistry,
                                       final JobRepository jobRepository) {
    return new DefaultListenerService(beanRegistrar, jobRegistry, jobRepository);
}
 
@Bean
@ConditionalOnMissingBean(value = {JobLauncherBean.class})
public JobLauncherBean jobLauncherBean(
        @Qualifier("defaultAsyncJobLauncher") final JobLauncher defaultAsyncJobLauncher,
        final JobRegistry jobRegistry,
        final SpringBatchLightminCoreConfigurationProperties properties) {

    return new JobLauncherBean(defaultAsyncJobLauncher, jobRegistry, properties);
}
 
@Bean
public JobLauncherBean jobLauncherBean(
        @Qualifier("defaultAsyncJobLauncher") final JobLauncher defaultAsyncJobLauncher,
        final JobRegistry jobRegistry,
        final SpringBatchLightminCoreConfigurationProperties properties) {
    return new JobLauncherBean(defaultAsyncJobLauncher, jobRegistry, properties);
}
 
@Bean
public OnApplicationReadyEventEmbeddedListener onApplicationReadyEventEmbeddedListener(
        final RegistrationBean registrationBean,
        final JobRegistry jobRegistry,
        final LightminClientProperties lightminClientProperties) {
    return new OnApplicationReadyEventEmbeddedListener(registrationBean, jobRegistry, lightminClientProperties);
}
 
public OnApplicationReadyEventEmbeddedListener(final RegistrationBean registrationBean,
                                               final JobRegistry jobRegistry,
                                               final LightminClientProperties lightminClientProperties) {
    this.registrationBean = registrationBean;
    this.jobRegistry = jobRegistry;
    this.lightminClientProperties = lightminClientProperties;
}
 
public LightminClientRegistratorService(
        final LightminClientProperties lightminClientProperties,
        final LightminClientClassicConfigurationProperties lightminClientClassicConfigurationProperties,
        final RestTemplate restTemplate,
        final JobRegistry jobRegistry,
        final LightminServerLocatorService lightminServerLocatorService) {
    this.lightminClientProperties = lightminClientProperties;
    this.lightminClientClassicConfigurationProperties = lightminClientClassicConfigurationProperties;
    this.restTemplate = restTemplate;
    this.jobRegistry = jobRegistry;
    this.lightminServerLocatorService = lightminServerLocatorService;
}
 
@Bean
public TaskJobLauncherCommandLineRunnerFactoryBean jobLauncherCommandLineRunner(
		JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs,
		JobRegistry jobRegistry, JobRepository jobRepository,
		BatchProperties batchProperties) {
	TaskJobLauncherCommandLineRunnerFactoryBean taskJobLauncherCommandLineRunnerFactoryBean;
	taskJobLauncherCommandLineRunnerFactoryBean = new TaskJobLauncherCommandLineRunnerFactoryBean(
			jobLauncher, jobExplorer, jobs, this.properties, jobRegistry,
			jobRepository, batchProperties);

	return taskJobLauncherCommandLineRunnerFactoryBean;
}
 
public JobOperationsController(JobOperator jobOperator, JobExplorer jobExplorer, JobRegistry jobRegistry,
		JobRepository jobRepository, JobLauncher jobLauncher, JsrJobOperator jsrJobOperator) {
	super();
	this.jobOperator = jobOperator;
	this.jobExplorer = jobExplorer;
	this.jobRegistry = jobRegistry;
	this.jobRepository = jobRepository;
	this.jobLauncher = jobLauncher;
	this.jsrJobOperator = jsrJobOperator;
}
 
源代码21 项目: spring-batch-rest   文件: JobService.java
@Autowired
public JobService(JobRegistry jobRegistry) {
    this.jobRegistry = jobRegistry;
}
 
源代码22 项目: spring-batch-rest   文件: Fixtures.java
public static void configureMock(JobRegistry jobRegistry) {
    reset(jobRegistry);
    when(jobRegistry.getJobNames()).thenReturn(JOB_NAMES);
}
 
@Bean
JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor(JobRegistry jobRegistry) {
    JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
    postProcessor.setJobRegistry(jobRegistry);
    return postProcessor;
}
 
源代码24 项目: CogStack-Pipeline   文件: BatchConfigurer.java
@Bean
public JobRegistry jobRegistry(){
    return new MapJobRegistry();
}
 
public DefaultListenerService(final BeanRegistrar beanRegistrar, final JobRegistry jobRegistry, final JobRepository jobRepository) {
    this.beanRegistrar = beanRegistrar;
    this.jobRegistry = jobRegistry;
    this.jobRepository = jobRepository;
}
 
public JobConfigurationRestController(final ServiceEntry serviceEntry, final JobRegistry jobRegistry) {
    this.serviceEntry = serviceEntry;
    this.jobRegistry = jobRegistry;
}
 
@Bean
public JobConfigurationRestController jobConfigurationRestController(final ServiceEntry serviceEntry,
                                                                     final JobRegistry jobRegistry) {
    return new JobConfigurationRestController(serviceEntry, jobRegistry);
}
 
@Bean
@ConditionalOnMissingBean(value = {JobRegistry.class})
public JobRegistry jobRegistry() {
    return new MapJobRegistry();
}
 
public LightminClientApplicationService(final JobRegistry jobRegistry,
                                        final LightminClientProperties lightminClientProperties) {
    this.jobRegistry = jobRegistry;
    this.lightminClientProperties = lightminClientProperties;
}
 
@Bean
public LightminClientApplicationService lightminClientApplicationService(
        final JobRegistry jobRegistry,
        final LightminClientProperties lightminClientProperties) {
    return new LightminClientApplicationService(jobRegistry, lightminClientProperties);
}