Java Code Examples for org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean#afterPropertiesSet()

The following examples show how to use org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean#afterPropertiesSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultSpringBatchLightminBatchConfigurer.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
protected void createMapComponents() throws Exception {
    if (this.transactionManager == null) {
        this.transactionManager = new ResourcelessTransactionManager();
    }
    // jobRepository
    final MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean(
            this.transactionManager);
    jobRepositoryFactory.afterPropertiesSet();
    this.jobRepository = jobRepositoryFactory.getObject();
    // jobExplorer
    final MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(
            jobRepositoryFactory);
    jobExplorerFactory.afterPropertiesSet();
    this.jobExplorer = jobExplorerFactory.getObject();
    // jobExecutionDao
    this.jobExecutionDao = new MapJobExecutionDao();
    // jobInstanceDao
    this.jobInstanceDao = new MapJobInstanceDao();
    // stepExecutionDao
    this.stepExecutionDao = new MapStepExecutionDao();
}
 
Example 2
Source File: SpringBatchConfiguration.java    From spring-cloud with Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void initialize() {
    try {
        if (dataSource == null) {
            log.warn("No datasource was provided...using a Map based JobRepository");

            if (this.transactionManager == null) {
                this.transactionManager = new ResourcelessTransactionManager();
            }

            MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean(
                    this.transactionManager);
            jobRepositoryFactory.afterPropertiesSet();
            this.jobRepository = jobRepositoryFactory.getObject();

            MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(
                    jobRepositoryFactory);
            jobExplorerFactory.afterPropertiesSet();
            this.jobExplorer = jobExplorerFactory.getObject();
        } else {
            this.jobRepository = createJobRepository();

            JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
            jobExplorerFactoryBean.setDataSource(this.dataSource);
            jobExplorerFactoryBean.afterPropertiesSet();
            this.jobExplorer = jobExplorerFactoryBean.getObject();
        }

        this.jobLauncher = createJobLauncher();
    } catch (Exception e) {
        throw new BatchConfigurationException(e);
    }
}
 
Example 3
Source File: TaskExecutorBatchConfiguration.java    From spring-boot-starter-batch-web with Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void initialize() throws Exception {
	if (dataSource == null) {
		LOGGER.warn("No datasource was provided...using a Map based JobRepository");

		if (this.transactionManager == null) {
			this.transactionManager = new ResourcelessTransactionManager();
		}

		MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean(this.transactionManager);
		jobRepositoryFactory.afterPropertiesSet();
		this.jobRepository = jobRepositoryFactory.getObject();

		MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(jobRepositoryFactory);
		jobExplorerFactory.afterPropertiesSet();
		this.jobExplorer = jobExplorerFactory.getObject();
	} else {
		if (this.transactionManager == null) {
			this.transactionManager = new DataSourceTransactionManager(dataSource);
		}

		this.jobRepository = createJobRepository();

		JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
		jobExplorerFactoryBean.setDataSource(this.dataSource);
		jobExplorerFactoryBean.setSerializer(serializer);
		String tablePrefix = batchConfig.getRepository().getTablePrefix();
		if (tablePrefix != null) {
			jobExplorerFactoryBean.setTablePrefix(tablePrefix);
		}
		jobExplorerFactoryBean.afterPropertiesSet();
		this.jobExplorer = jobExplorerFactoryBean.getObject();
	}

	this.jobLauncher = createJobLauncher();
}
 
Example 4
Source File: JpaBatchConfigurer.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void initialize() {
	try {
		if (dataSource == null) {
			logger.warn("No datasource was provided...using a Map based JobRepository");

			if (this.transactionManager == null) {
				this.transactionManager = new ResourcelessTransactionManager();
			}

			MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean(
					this.transactionManager);
			jobRepositoryFactory.afterPropertiesSet();
			this.jobRepository = jobRepositoryFactory.getObject();

			MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(
					jobRepositoryFactory);
			jobExplorerFactory.afterPropertiesSet();
			this.jobExplorer = jobExplorerFactory.getObject();
		} else {
			this.jobRepository = createJobRepository();

			JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
			jobExplorerFactoryBean.setDataSource(this.dataSource);
			jobExplorerFactoryBean.afterPropertiesSet();
			this.jobExplorer = jobExplorerFactoryBean.getObject();
		}

		this.jobLauncher = createJobLauncher();
	} catch (Exception e) {
		throw new BatchConfigurationException(e);
	}
}