Example usage for org.springframework.batch.item.database.support DefaultDataFieldMaxValueIncrementerFactory DefaultDataFieldMaxValueIncrementerFactory

List of usage examples for org.springframework.batch.item.database.support DefaultDataFieldMaxValueIncrementerFactory DefaultDataFieldMaxValueIncrementerFactory

Introduction

In this page you can find the example usage for org.springframework.batch.item.database.support DefaultDataFieldMaxValueIncrementerFactory DefaultDataFieldMaxValueIncrementerFactory.

Prototype

public DefaultDataFieldMaxValueIncrementerFactory(DataSource dataSource) 

Source Link

Usage

From source file:com.xchanging.support.batch.admin.service.SimpleJobServiceFactoryBean.java

public void afterPropertiesSet() throws Exception {

    Assert.notNull(dataSource, "DataSource must not be null.");
    Assert.notNull(jobRepository, "JobRepository must not be null.");
    Assert.notNull(jobLocator, "JobLocator must not be null.");
    Assert.notNull(jobLauncher, "JobLauncher must not be null.");

    jdbcTemplate = new SimpleJdbcTemplate(dataSource);

    if (incrementerFactory == null) {
        incrementerFactory = new DefaultDataFieldMaxValueIncrementerFactory(dataSource);
    }//from  w w  w. j  av a 2  s. c om

    if (databaseType == null) {
        databaseType = DatabaseType.fromMetaData(dataSource).name();
        logger.info("No database type set, using meta data indicating: " + databaseType);
    }

    if (lobHandler == null) {
        lobHandler = new DefaultLobHandler();
    }

    Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType), "'" + databaseType
            + "' is an unsupported database type.  The supported database types are "
            + StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes()));

}

From source file:admin.service.SimpleJobServiceFactoryBean.java

public void afterPropertiesSet() throws Exception {

    Assert.notNull(dataSource, "DataSource must not be null.");
    Assert.notNull(jobRepository, "JobRepository must not be null.");
    Assert.notNull(jobLocator, "JobLocator must not be null.");
    Assert.notNull(jobLauncher, "JobLauncher must not be null.");

    jdbcTemplate = new JdbcTemplate(dataSource);

    if (incrementerFactory == null) {
        incrementerFactory = new DefaultDataFieldMaxValueIncrementerFactory(dataSource);
    }/*from  w ww. j a  va  2s . c  o  m*/

    if (databaseType == null) {
        databaseType = DatabaseType.fromMetaData(dataSource).name();
        logger.info("No database type set, using meta data indicating: " + databaseType);
    }

    if (lobHandler == null) {
        lobHandler = new DefaultLobHandler();
    }

    if (serializer == null) {
        XStreamExecutionContextStringSerializer defaultSerializer = new XStreamExecutionContextStringSerializer();
        defaultSerializer.afterPropertiesSet();

        serializer = defaultSerializer;
    }

    Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType), "'" + databaseType
            + "' is an unsupported database type.  The supported database types are "
            + StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes()));

}

From source file:org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.java

@Override
public void afterPropertiesSet() throws Exception {

    Assert.notNull(dataSource, "DataSource must not be null.");

    if (jdbcOperations == null) {
        jdbcOperations = new JdbcTemplate(dataSource);
    }/*  ww  w . ja v a 2s.  c o m*/

    if (incrementerFactory == null) {
        incrementerFactory = new DefaultDataFieldMaxValueIncrementerFactory(dataSource);
    }

    if (databaseType == null) {
        databaseType = DatabaseType.fromMetaData(dataSource).name();
        logger.info("No database type set, using meta data indicating: " + databaseType);
    }

    if (lobHandler == null && databaseType.equalsIgnoreCase(DatabaseType.ORACLE.toString())) {
        lobHandler = new DefaultLobHandler();
    }

    if (serializer == null) {
        Jackson2ExecutionContextStringSerializer defaultSerializer = new Jackson2ExecutionContextStringSerializer();

        serializer = defaultSerializer;
    }

    Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType), "'" + databaseType
            + "' is an unsupported database type.  The supported database types are "
            + StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes()));

    if (lobType != null) {
        Assert.isTrue(isValidTypes(lobType), "lobType must be a value from the java.sql.Types class");
    }

    super.afterPropertiesSet();
}

From source file:org.springframework.cloud.dataflow.server.batch.SimpleJobServiceFactoryBean.java

@Override
public void afterPropertiesSet() throws Exception {

    Assert.notNull(dataSource, "DataSource must not be null.");
    Assert.notNull(jobRepository, "JobRepository must not be null.");
    Assert.notNull(jobLocator, "JobLocator must not be null.");
    Assert.notNull(jobLauncher, "JobLauncher must not be null.");
    Assert.notNull(jobExplorer, "JobExplorer must not be null.");

    jdbcTemplate = new JdbcTemplate(dataSource);

    if (incrementerFactory == null) {
        incrementerFactory = new DefaultDataFieldMaxValueIncrementerFactory(dataSource);
    }/*from   w w w  . ja  v  a2  s  .  c om*/

    if (databaseType == null) {
        databaseType = DatabaseType.fromMetaData(dataSource).name();
        logger.info("No database type set, using meta data indicating: " + databaseType);
    }

    if (lobHandler == null) {
        lobHandler = new DefaultLobHandler();
    }

    if (serializer == null) {
        this.serializer = new Jackson2ExecutionContextStringSerializer();
    }

    Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType), "'" + databaseType
            + "' is an unsupported database type.  The supported database types are "
            + StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes()));

}