diff --git a/spring-batch-core/src/main/resources/baseContext.xml b/spring-batch-core/src/main/resources/baseContext.xml index 974b7d0cb..e71d499d9 100644 --- a/spring-batch-core/src/main/resources/baseContext.xml +++ b/spring-batch-core/src/main/resources/baseContext.xml @@ -11,7 +11,7 @@ http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> + transaction-manager="transactionManager" table-prefix="${batch.table.prefix}"/> @@ -28,8 +28,7 @@ - + diff --git a/spring-batch-core/src/main/resources/batch-derby.properties b/spring-batch-core/src/main/resources/batch-derby.properties new file mode 100644 index 000000000..00ab554c0 --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-derby.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for Derby: +batch.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +batch.jdbc.url=jdbc:derby:derby-home/test;create=true +batch.jdbc.user=app +batch.jdbc.password= +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer +batch.schema.script=classpath:/org/springframework/batch/core/schema-derby.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-derby.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=true +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-h2.properties b/spring-batch-core/src/main/resources/batch-h2.properties new file mode 100644 index 000000000..53e06737f --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-h2.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for H2: +batch.jdbc.driver=org.h2.Driver +batch.jdbc.url=jdbc:h2:file:build/data/h2 +batch.jdbc.user=sa +batch.jdbc.password= +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.H2SequenceMaxValueIncrementer +batch.schema.script=classpath:/org/springframework/batch/core/schema-h2.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-h2.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=true +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-hsql.properties b/spring-batch-core/src/main/resources/batch-hsql.properties index e654afb96..e830b6bab 100644 --- a/spring-batch-core/src/main/resources/batch-hsql.properties +++ b/spring-batch-core/src/main/resources/batch-hsql.properties @@ -17,3 +17,5 @@ batch.jdbc.validationQuery= # Non-platform dependent settings that you might like to change batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-mysql.properties b/spring-batch-core/src/main/resources/batch-mysql.properties new file mode 100644 index 000000000..953fe1ce1 --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-mysql.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for MySQL: +batch.jdbc.driver=com.mysql.jdbc.Driver +batch.jdbc.url=jdbc:mysql://localhost/test +batch.jdbc.user=test +batch.jdbc.password=test +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer +batch.schema.script=classpath:/org/springframework/batch/core/schema-mysql.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-mysql.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=true +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-oracle.properties b/spring-batch-core/src/main/resources/batch-oracle.properties new file mode 100644 index 000000000..6ea62a158 --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-oracle.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for Oracle: +batch.jdbc.driver=oracle.jdbc.OracleDriver +batch.jdbc.url=jdbc:oracle:thin:@oracle:1521:xe +batch.jdbc.user=spring +batch.jdbc.password=spring +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer +batch.schema.script=classpath:/org/springframework/batch/core/schema-oracle10g.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-oracle10g.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=false +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-postgresql.properties b/spring-batch-core/src/main/resources/batch-postgresql.properties new file mode 100644 index 000000000..6497cb14e --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-postgresql.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for Postgres: +batch.jdbc.driver=org.postgresql.Driver +batch.jdbc.url=jdbc:postgresql://localhost/samples +batch.jdbc.user=postgres +batch.jdbc.password=dba +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer +batch.schema.script=classpath:/org/springframework/batch/core/schema-postgresql.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-postgresql.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=false +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-sqlf.properties b/spring-batch-core/src/main/resources/batch-sqlf.properties new file mode 100644 index 000000000..6284308bb --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-sqlf.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for SQLFire: +batch.jdbc.driver=com.vmware.sqlfire.jdbc.ClientDriver +batch.jdbc.url=jdbc:sqlfire://localhost:1257/;update=true +batch.jdbc.user=SAMPLES +batch.jdbc.password=SAMPLES +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer +batch.schema.script=classpath:/org/springframework/batch/core/schema-sqlf.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-sqlf.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=false +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-sqlserver.properties b/spring-batch-core/src/main/resources/batch-sqlserver.properties new file mode 100644 index 000000000..103948e25 --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-sqlserver.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for MS SQLServer: +batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver +batch.jdbc.url=jdbc:jtds:sqlserver://localhost:1433;instance=SQLEXPRESS +batch.jdbc.user=sa +batch.jdbc.password=sa +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SqlServerMaxValueIncrementer +batch.schema.script=classpath*:/org/springframework/batch/core/schema-sqlserver.sql +batch.drop.script=classpath*:/org/springframework/batch/core/schema-drop-sqlserver.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=false +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-core/src/main/resources/batch-sybase.properties b/spring-batch-core/src/main/resources/batch-sybase.properties new file mode 100644 index 000000000..9b3d7c185 --- /dev/null +++ b/spring-batch-core/src/main/resources/batch-sybase.properties @@ -0,0 +1,18 @@ +# Placeholders batch.* +# for Sybase: +batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver +batch.jdbc.url=jdbc:jtds:sybase://dbhost:5000;databaseName=test +batch.jdbc.user=spring +batch.jdbc.password=spring +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SybaseMaxValueIncrementer +batch.schema.script=classpath*:/org/springframework/batch/core/schema-sybase.sql +batch.drop.script=classpath*:/org/springframework/batch/core/schema-drop-sybase.sql +batch.business.schema.script= +batch.jdbc.testWhileIdle=true +batch.jdbc.validationQuery= + + +# Non-platform dependent settings that you might like to change +batch.data.source.init=true +batch.table.prefix=BATCH_ + diff --git a/spring-batch-samples/src/main/resources/batch-derby.properties b/spring-batch-samples/src/main/resources/batch-derby.properties index 385ec9ca5..2eea26309 100644 --- a/spring-batch-samples/src/main/resources/batch-derby.properties +++ b/spring-batch-samples/src/main/resources/batch-derby.properties @@ -16,3 +16,4 @@ batch.grid.size=2 batch.jdbc.pool.size=6 batch.verify.cursor.position=false batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-h2.properties b/spring-batch-samples/src/main/resources/batch-h2.properties index edfc12008..38c325f4b 100644 --- a/spring-batch-samples/src/main/resources/batch-h2.properties +++ b/spring-batch-samples/src/main/resources/batch-h2.properties @@ -16,3 +16,4 @@ batch.grid.size=2 batch.jdbc.pool.size=6 batch.verify.cursor.position=true batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-hsql.properties b/spring-batch-samples/src/main/resources/batch-hsql.properties index 147da900b..7b6e6846b 100644 --- a/spring-batch-samples/src/main/resources/batch-hsql.properties +++ b/spring-batch-samples/src/main/resources/batch-hsql.properties @@ -20,3 +20,4 @@ batch.grid.size=6 batch.verify.cursor.position=true batch.isolationlevel=ISOLATION_SERIALIZABLE batch.data.source.init=true +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-mysql.properties b/spring-batch-samples/src/main/resources/batch-mysql.properties index 947c24b7b..e1a8c17bc 100644 --- a/spring-batch-samples/src/main/resources/batch-mysql.properties +++ b/spring-batch-samples/src/main/resources/batch-mysql.properties @@ -16,4 +16,5 @@ batch.jdbc.pool.size=6 batch.grid.size=50 batch.verify.cursor.position=true batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-oracle.properties b/spring-batch-samples/src/main/resources/batch-oracle.properties index 22c75d505..f039e2aba 100644 --- a/spring-batch-samples/src/main/resources/batch-oracle.properties +++ b/spring-batch-samples/src/main/resources/batch-oracle.properties @@ -16,4 +16,5 @@ batch.grid.size=2 batch.jdbc.pool.size=6 batch.verify.cursor.position=true batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-postgresql.properties b/spring-batch-samples/src/main/resources/batch-postgresql.properties index bf554dde7..84949d207 100644 --- a/spring-batch-samples/src/main/resources/batch-postgresql.properties +++ b/spring-batch-samples/src/main/resources/batch-postgresql.properties @@ -17,4 +17,5 @@ batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler batch.grid.size=2 batch.jdbc.pool.size=6 batch.verify.cursor.position=false -batch.isolationlevel=ISOLATION_SERIALIZABLE \ No newline at end of file +batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-sqlf.properties b/spring-batch-samples/src/main/resources/batch-sqlf.properties index 532ab10fb..d2a57b94b 100644 --- a/spring-batch-samples/src/main/resources/batch-sqlf.properties +++ b/spring-batch-samples/src/main/resources/batch-sqlf.properties @@ -19,4 +19,5 @@ batch.jdbc.pool.size=6 batch.verify.cursor.position=false #add this for your jobRepository bean p:isolationLevelForCreate = "${batch.isolationlevel}" #see simple-job-launcher-context.xml for example -batch.isolationlevel=ISOLATION_READ_COMMITTED \ No newline at end of file +batch.isolationlevel=ISOLATION_READ_COMMITTED +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-sqlserver.properties b/spring-batch-samples/src/main/resources/batch-sqlserver.properties index f6307adf9..b6d018d84 100644 --- a/spring-batch-samples/src/main/resources/batch-sqlserver.properties +++ b/spring-batch-samples/src/main/resources/batch-sqlserver.properties @@ -16,4 +16,5 @@ batch.grid.size=2 batch.jdbc.pool.size=6 batch.verify.cursor.position=true batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/spring-batch-samples/src/main/resources/batch-sybase.properties b/spring-batch-samples/src/main/resources/batch-sybase.properties index 706bc4c62..041d1b2cb 100644 --- a/spring-batch-samples/src/main/resources/batch-sybase.properties +++ b/spring-batch-samples/src/main/resources/batch-sybase.properties @@ -16,5 +16,6 @@ batch.jdbc.pool.size=6 batch.grid.size=6 batch.verify.cursor.position=true batch.isolationlevel=ISOLATION_SERIALIZABLE +batch.table.prefix=BATCH_ diff --git a/src/site/docbook/reference/jsr-352.xml b/src/site/docbook/reference/jsr-352.xml index 47cd8f443..d8c45d4e4 100644 --- a/src/site/docbook/reference/jsr-352.xml +++ b/src/site/docbook/reference/jsr-352.xml @@ -26,6 +26,162 @@ important to note that batch artifacts that have been developed against the JSR-352 interfaces will not work within a traditional Spring Batch job. + +
+ Setup + + JSR-352 requires a very simple path to executing a batch job. The following code is all that is needed to + execute your first batch job: + + + JobOperator operator = BatchRuntime.getJobOperator(); +jobOperator.start("myJob", new Properties()); + + While that is convenient for developers, the devil is in the details. Spring Batch bootstraps a bit of + infrastructure behind the scenes that a developer may want to override. The following is bootstrapped the + first time BatchRuntime.getJobOperator() is called: + + + + + + + + + Bean Name + + + Default Configuration + + + Notes + + + + + dataSource + + + Apache DBCP BasicDataSource with configured values. + + + By default, HSQLDB is bootstrapped. + + + + + transactionManager + + + org.springframework.jdbc.datasource.DataSourceTransactionManager + + + References the dataSource bean defined above. + + + + + A Datasource initializer + + + + + This is configured to execute the scripts configured via the + batch.drop.script and batch.schema.script properties. By + default, the schema scripts for HSQLDB are executed. This behavior can be disabled via + batch.data.source.init property. + + + + + jobRepository + + + A JDBC based SimpleJobRepository. + + + This JobRepository uses the previously mentioned data source and transaction + manager. The schema's table prefix is configurable (defaults to BATCH_) via the + batch.table.prefix property. + + + + + jobLauncher + + + org.springframework.batch.core.launch.support.SimpleJobLauncher + + + Used to launch jobs. + + + + + batchJobOperator + + + org.springframework.batch.core.launch.support.SimpleJobOperator + + + The JsrJobOperator wraps this to provide most of it's functionality. + + + + + jobExplorer + + + org.springframework.batch.core.explore.support.JobExplorerFactoryBean + + + Used to address lookup functionality provided by the JsrJobOperator. + + + + + jobParametersConverter + + + org.springframework.batch.core.jsr.JsrJobParametersConverter + + + JSR-352 specific implementation of the JobParametersConverter. + + + + + jobRegistry + + + org.springframework.batch.core.configuration.support.MapJobRegistry + + + Used by the SimpleJobOperator. + + + + + placeholderProperties + + + org.springframework.beans.factory.config.PropertyPlaceholderConfigure + + + Loads the properties file batch-${ENVIRONMENT:hsql}.properties to configure + the properties mentioned above. ENVIRONMENT is a System property (defaults to hsql) + that can be used to specify any of the supported databases Spring Batch currently + supports. + + + + + + + None of the above beans are optional for executing JSR-352 based jobs. All may be overriden to + provide customized functionality as needed. + +
Dependency Injection