Example usage for org.springframework.batch.core.repository.dao Jackson2ExecutionContextStringSerializer Jackson2ExecutionContextStringSerializer

List of usage examples for org.springframework.batch.core.repository.dao Jackson2ExecutionContextStringSerializer Jackson2ExecutionContextStringSerializer

Introduction

In this page you can find the example usage for org.springframework.batch.core.repository.dao Jackson2ExecutionContextStringSerializer Jackson2ExecutionContextStringSerializer.

Prototype

public Jackson2ExecutionContextStringSerializer() 

Source Link

Usage

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);
    }// w  w w. j  a  va 2  s .c om

    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);
    }/* w  w w .  ja v  a 2 s.  co 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) {
        this.serializer = new Jackson2ExecutionContextStringSerializer();
    }

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

}