From dc656d248dfc18c27e94e6a1235353edb57ad27b Mon Sep 17 00:00:00 2001 From: nebhale Date: Wed, 27 Feb 2008 15:43:24 +0000 Subject: [PATCH] [BATCH-63] Refactoring to accomodate the new element --- spring-batch-execution/.springBeans | 42 +-- .../configuration/AbstractStepEntry.java | 45 --- .../configuration/BatchNamespaceHandler.java | 15 +- .../configuration/ChunkStepEntry.java | 41 --- .../ConfigBeanDefinitionParser.java | 333 ++++++++++++++++++ .../JobBeanDefinitionParser.java | 205 ----------- .../execution/configuration/JobEntry.java | 42 --- .../JobRepositoryBeanDefinitionParser.java | 169 --------- .../configuration/TaskletStepEntry.java | 41 --- .../configuration/spring-batch-1.0.xsd | 92 ++--- ...tchNamespaceHandlerJobRepositoryTests.java | 62 ---- ...obRepositoryBeanDefinitionParserTests.java | 63 ++++ ...ava => StepBeanDefinitionParserTests.java} | 43 ++- ...TaskletStepBeanDefinitionParserTests.java} | 12 +- .../BatchNamespaceHandlerJobRepositoryDb2.xml | 13 - ...BatchNamespaceHandlerJobRepositoryHsql.xml | 13 - ...eHandlerJobRepositoryMissingDataSource.xml | 10 - ...atchNamespaceHandlerJobRepositoryMySql.xml | 13 - .../BatchNamespaceHandlerJobRepositoryOk.xml | 13 - ...tchNamespaceHandlerJobRepositoryOracle.xml | 13 - ...hNamespaceHandlerJobRepositoryPostgres.xml | 13 - ...eHandlerStepSpecificTransactionManager.xml | 26 -- ...skletStepRerunNever.xml => JobRepoDb2.xml} | 16 +- .../execution/configuration/JobRepoDerby.xml | 22 ++ .../execution/configuration/JobRepoHsql.xml | 22 ++ ...Derby.xml => JobRepoMissingDataSource.xml} | 12 +- .../execution/configuration/JobRepoMySql.xml | 22 ++ ...HandlerTaskletStepOk.xml => JobRepoOk.xml} | 16 +- .../execution/configuration/JobRepoOracle.xml | 22 ++ .../configuration/JobRepoPostgres.xml | 22 ++ ...emReader.xml => StepMissingItemReader.xml} | 10 +- ...emWriter.xml => StepMissingItemWriter.xml} | 10 +- ....xml => StepMissingTransactionManager.xml} | 10 +- ...dlerStepRerunIncomplete.xml => StepOk.xml} | 10 +- ...eHandlerStepOk.xml => StepRerunAlways.xml} | 10 +- .../configuration/StepRerunIncomplete.xml | 28 ++ ...StepRerunAlways.xml => StepRerunNever.xml} | 10 +- ...xml => StepSpecificTransactionManager.xml} | 10 +- ...klet.xml => TaskletStepMissingTasklet.xml} | 10 +- ...pRerunIncomplete.xml => TaskletStepOk.xml} | 10 +- ...nAlways.xml => TaskletStepRerunAlways.xml} | 10 +- .../TaskletStepRerunIncomplete.xml | 22 ++ .../configuration/TaskletStepRerunNever.xml | 23 ++ 43 files changed, 772 insertions(+), 874 deletions(-) delete mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/AbstractStepEntry.java delete mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ChunkStepEntry.java create mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java delete mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobBeanDefinitionParser.java delete mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobEntry.java delete mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParser.java delete mode 100644 spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/TaskletStepEntry.java delete mode 100644 spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryTests.java create mode 100644 spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java rename spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepTests.java => StepBeanDefinitionParserTests.java} (72%) rename spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerTaskletStepTests.java => TaskletStepBeanDefinitionParserTests.java} (82%) delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDb2.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryHsql.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMissingDataSource.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMySql.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOk.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOracle.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryPostgres.xml delete mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepSpecificTransactionManager.xml rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerTaskletStepRerunNever.xml => JobRepoDb2.xml} (79%) create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerJobRepositoryDerby.xml => JobRepoMissingDataSource.xml} (61%) create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerTaskletStepOk.xml => JobRepoOk.xml} (79%) create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepMissingItemReader.xml => StepMissingItemReader.xml} (80%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepMissingItemWriter.xml => StepMissingItemWriter.xml} (80%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepMissingTransactionManager.xml => StepMissingTransactionManager.xml} (77%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepRerunIncomplete.xml => StepOk.xml} (81%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepOk.xml => StepRerunAlways.xml} (80%) create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepRerunAlways.xml => StepRerunNever.xml} (80%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerStepRerunNever.xml => StepSpecificTransactionManager.xml} (81%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerTaskletStepMissingTasklet.xml => TaskletStepMissingTasklet.xml} (77%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerTaskletStepRerunIncomplete.xml => TaskletStepOk.xml} (79%) rename spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/{BatchNamespaceHandlerTaskletStepRerunAlways.xml => TaskletStepRerunAlways.xml} (78%) create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml create mode 100644 spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml diff --git a/spring-batch-execution/.springBeans b/spring-batch-execution/.springBeans index 5f9c3db13..c12f307ee 100644 --- a/spring-batch-execution/.springBeans +++ b/spring-batch-execution/.springBeans @@ -16,27 +16,27 @@ src/test/resources/beanRefContext.xml src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml src/test/resources/org/springframework/batch/execution/bootstrap/support/test-environment.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDb2.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDerby.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryHsql.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMissingDataSource.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMySql.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOk.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOracle.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryPostgres.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepMissingTasklet.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepOk.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunAlways.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunIncomplete.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunNever.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepOk.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemReader.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemWriter.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingTransactionManager.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunAlways.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunIncomplete.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunNever.xml - src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepSpecificTransactionManager.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml + src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml + src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml + src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml + src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml + src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml + src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml + src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml + src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml + src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml + src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml + src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml + src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml + src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml + src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/AbstractStepEntry.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/AbstractStepEntry.java deleted file mode 100644 index 906e5c50b..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/AbstractStepEntry.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import org.springframework.beans.factory.parsing.ParseState; - -/** - * {@link ParseState} entry representing a step. This is an abstract class intended to be overriden with given step - * types. - * - * @author Ben Hale - */ -abstract class AbstractStepEntry implements ParseState.Entry { - - private final String name; - - /** - * Creates a new instance of the {@link AbstractStepEntry} class. - * - * @param name the bean name of the job - */ - AbstractStepEntry(String name) { - this.name = name; - } - - abstract String getType(); - - public String toString() { - return "Step '" + name + "', Type'" + getType() + "'"; - } -} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java index b1df581c7..698963345 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java @@ -20,25 +20,18 @@ import org.springframework.beans.factory.xml.BeanDefinitionParser; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** - * NamespaceHandler for the batch-execution namespace. + * NamespaceHandler for the batch namespace. * *

- * Provides a {@link BeanDefinitionParser} for the <batch:job> tag. A job tag can - * include nested chunked-step and tasklet-step tags. - * - *

- * Provides a {@link BeanDefinitionParser} for the <batch:job-repository> tag. + * Provides a {@link BeanDefinitionParser} for the <batch:config> tag. A config tag + * must include nested job-repository and job tags. * * @author Ben Hale */ public class BatchNamespaceHandler extends NamespaceHandlerSupport { - /** - * Register the {@link BeanDefinitionParser BeanDefinitionParser} for the 'job', tag. - */ public void init() { - registerBeanDefinitionParser("job", new JobBeanDefinitionParser()); - registerBeanDefinitionParser("job-repository", new JobRepositoryBeanDefinitionParser()); + registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser()); } } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ChunkStepEntry.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ChunkStepEntry.java deleted file mode 100644 index 048f9c5eb..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ChunkStepEntry.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import org.springframework.beans.factory.parsing.ParseState; - -/** - * {@link ParseState} entry representing a {@link ChunkStep}. - * - * @author Ben Hale - */ -public class ChunkStepEntry extends AbstractStepEntry { - - /** - * Creates a new instance of the {@link ChunkStepEntry} class. - * - * @param name the bean name of the job - */ - ChunkStepEntry(String name) { - super(name); - } - - String getType() { - return "chunk"; - } - -} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java new file mode 100644 index 000000000..5429eef3e --- /dev/null +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java @@ -0,0 +1,333 @@ +/* + * Copyright 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.execution.configuration; + +import org.springframework.batch.execution.repository.SimpleJobRepository; +import org.springframework.batch.execution.repository.dao.JdbcJobExecutionDao; +import org.springframework.batch.execution.repository.dao.JdbcJobInstanceDao; +import org.springframework.batch.execution.repository.dao.JdbcStepExecutionDao; +import org.springframework.batch.execution.step.ItemOrientedStep; +import org.springframework.batch.execution.step.TaskletStep; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConstructorArgumentValues; +import org.springframework.beans.factory.config.RuntimeBeanReference; +import org.springframework.beans.factory.parsing.BeanComponentDefinition; +import org.springframework.beans.factory.parsing.CompositeComponentDefinition; +import org.springframework.beans.factory.support.AbstractBeanDefinition; +import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.beans.factory.xml.BeanDefinitionParser; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.incrementer.DB2SequenceMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer; +import org.springframework.util.StringUtils; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * @author Ben Hale + */ +public class ConfigBeanDefinitionParser implements BeanDefinitionParser { + + private static final String JOB_REPOSITORY_ELEMENT = "job-repository"; + + private static final String JOB_REPOSITORY_BEAN_NAME = "_jobRepository"; + + private static final String DATA_SOURCE_ATT = "data-source"; + + private static final String DB_TYPE_ATT = "db-type"; + + private static final String DB_TYPE_DB2 = "db2"; + + private static final String DB_TYPE_DERBY = "derby"; + + private static final String DB_TYPE_HSQL = "hsql"; + + private static final String DB_TYPE_MYSQL = "mysql"; + + private static final String DB_TYPE_ORACLE = "oracle"; + + private static final String DB_TYPE_POSTGRES = "postgres"; + + private static final String JOB_ELEMENT = "job"; + + private static final String ID_ATT = "id"; + + private static final String RERUN_ATT = "rerun"; + + private static final String RERUN_ALWAYS = "always"; + + private static final String RERUN_NEVER = "never"; + + private static final String RERUN_INCOMPLETE = "incomplete"; + + private static final String STEP_ELEMENT = "step"; + + private static final String SIZE_ATT = "size"; + + private static final String TRANSACTION_MANAGER_ATT = "transaction-manager"; + + private static final String ITEM_READER_ATT = "item-reader"; + + private static final String ITEM_WRITER_ATT = "item-writer"; + + private static final String INPUT_SKIP_LIMIT_ATT = "input-skip-limit"; + + private static final String OUTPUT_SKIP_LIMIT_ATT = "output-skip-limit"; + + private static final String TASKLET_STEP_ELEMENT = "tasklet-step"; + + private static final String TASKLET_ATT = "tasklet"; + + public BeanDefinition parse(Element element, ParserContext parserContext) { + CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), + parserContext.extractSource(element)); + parserContext.pushContainingComponent(compositeDef); + + NodeList childNodes = element.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node child = childNodes.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + String localName = child.getLocalName(); + if (JOB_REPOSITORY_ELEMENT.equals(localName)) { + parseJobRepository((Element) child, parserContext); + } else if (JOB_ELEMENT.equals(localName)) { + parseJob((Element) child, parserContext); + } + } + } + + parserContext.popAndRegisterContainingComponent(); + return null; + } + + private void parseJobRepository(Element jobRepoEle, ParserContext parserContext) { + RootBeanDefinition jobRepoDef = new RootBeanDefinition(SimpleJobRepository.class); + jobRepoDef.setSource(parserContext.extractSource(jobRepoEle)); + + String dataSourceId = jobRepoEle.getAttribute(DATA_SOURCE_ATT); + if (!StringUtils.hasText(dataSourceId)) { + parserContext.getReaderContext().error("'data-source' attribute contains empty value", jobRepoEle); + } else { + String dbType = jobRepoEle.getAttribute(DB_TYPE_ATT); + ConstructorArgumentValues constructorArgumentValues = jobRepoDef.getConstructorArgumentValues(); + String templateId = createJdbcTemplateDefinition(dataSourceId, parserContext); + constructorArgumentValues.addGenericArgumentValue(createJobInstanceDao(templateId, dataSourceId, dbType, + parserContext)); + constructorArgumentValues.addGenericArgumentValue(createJobExecutionDao(templateId, dataSourceId, dbType, + parserContext)); + constructorArgumentValues.addGenericArgumentValue(createStepExecutionDao(templateId, dataSourceId, dbType, + parserContext)); + } + + parserContext.registerBeanComponent(new BeanComponentDefinition(jobRepoDef, JOB_REPOSITORY_BEAN_NAME)); + } + + private String createJdbcTemplateDefinition(String dataSourceId, ParserContext parserContext) { + RootBeanDefinition templateDef = new RootBeanDefinition(JdbcTemplate.class); + templateDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(dataSourceId)); + return parserContext.getReaderContext().registerWithGeneratedName(templateDef); + } + + private BeanDefinition createJobInstanceDao(String templateId, String dataSourceId, String dbType, + ParserContext parserContext) { + RootBeanDefinition daoDef = new RootBeanDefinition(JdbcJobInstanceDao.class); + MutablePropertyValues propertyValues = daoDef.getPropertyValues(); + propertyValues.addPropertyValue("jdbcTemplate", new RuntimeBeanReference(templateId)); + propertyValues.addPropertyValue("jobIncrementer", getIncrementer(dbType, dataSourceId, "BATCH_JOB_SEQ")); + return daoDef; + } + + private BeanDefinition createJobExecutionDao(String templateId, String dataSourceId, String dbType, + ParserContext parserContext) { + RootBeanDefinition daoDef = new RootBeanDefinition(JdbcJobExecutionDao.class); + MutablePropertyValues propertyValues = daoDef.getPropertyValues(); + propertyValues.addPropertyValue("jdbcTemplate", new RuntimeBeanReference(templateId)); + propertyValues.addPropertyValue("jobExecutionIncrementer", getIncrementer(dbType, dataSourceId, + "BATCH_JOB_EXECUTION_SEQ")); + return daoDef; + } + + private BeanDefinition createStepExecutionDao(String templateId, String dataSourceId, String dbType, + ParserContext parserContext) { + RootBeanDefinition daoDef = new RootBeanDefinition(JdbcStepExecutionDao.class); + MutablePropertyValues propertyValues = daoDef.getPropertyValues(); + propertyValues.addPropertyValue("jdbcTemplate", new RuntimeBeanReference(templateId)); + propertyValues.addPropertyValue("stepExecutionIncrementer", getIncrementer(dbType, dataSourceId, + "BATCH_STEP_EXECUTION_SEQ")); + return daoDef; + } + + private BeanDefinition getIncrementer(String dbType, String dataSourceId, String incrementerName) { + RootBeanDefinition incrementerDef = new RootBeanDefinition(); + + if (DB_TYPE_DB2.equals(dbType)) { + incrementerDef.setBeanClass(DB2SequenceMaxValueIncrementer.class); + addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); + } else if (DB_TYPE_DERBY.equals(dbType)) { + incrementerDef.setBeanClass(DerbyMaxValueIncrementer.class); + addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); + } else if (DB_TYPE_HSQL.equals(dbType)) { + incrementerDef.setBeanClass(HsqlMaxValueIncrementer.class); + addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); + } else if (DB_TYPE_MYSQL.equals(dbType)) { + incrementerDef.setBeanClass(MySQLMaxValueIncrementer.class); + addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); + } else if (DB_TYPE_ORACLE.equals(dbType)) { + incrementerDef.setBeanClass(OracleSequenceMaxValueIncrementer.class); + addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); + } else if (DB_TYPE_POSTGRES.equals(dbType)) { + incrementerDef.setBeanClass(PostgreSQLSequenceMaxValueIncrementer.class); + addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); + } + + return incrementerDef; + } + + private void addSequenceIncrementer(String dataSourceId, String incrementerName, + ConstructorArgumentValues constructorArgumentValues) { + constructorArgumentValues.addGenericArgumentValue(new RuntimeBeanReference(dataSourceId)); + constructorArgumentValues.addGenericArgumentValue(incrementerName); + } + + private void addTableIncrementer(String dataSourceId, String incrementerName, + ConstructorArgumentValues constructorArgumentValues) { + constructorArgumentValues.addGenericArgumentValue(new RuntimeBeanReference(dataSourceId)); + constructorArgumentValues.addGenericArgumentValue(incrementerName); + constructorArgumentValues.addGenericArgumentValue("id"); + } + + private void parseJob(Element jobEle, ParserContext parserContext) { + NodeList childNodes = jobEle.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node child = childNodes.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + String localName = child.getLocalName(); + if (STEP_ELEMENT.equals(localName)) { + parseStep((Element) child, parserContext); + } else if (TASKLET_STEP_ELEMENT.equals(localName)) { + parseTaskletStep((Element) child, parserContext); + } + } + } + } + + private void parseStep(Element stepEle, ParserContext parserContext) { + AbstractBeanDefinition stepDef = createStepBeanDefinition(stepEle, parserContext); + String id = stepEle.getAttribute(ID_ATT); + + if (StringUtils.hasText(id)) { + parserContext.getRegistry().registerBeanDefinition(id, stepDef); + } else { + parserContext.getReaderContext().registerWithGeneratedName(stepDef); + } + } + + private AbstractBeanDefinition createStepBeanDefinition(Element stepElement, ParserContext parserContext) { + RootBeanDefinition stepDef = new RootBeanDefinition(ItemOrientedStep.class); + stepDef.setSource(parserContext.extractSource(stepElement)); + MutablePropertyValues propertyValues = stepDef.getPropertyValues(); + + String size = stepElement.getAttribute(SIZE_ATT); + propertyValues.addPropertyValue("commitInterval", Integer.valueOf(size)); + String transactionManager = stepElement.getAttribute(TRANSACTION_MANAGER_ATT); + if (!StringUtils.hasText(transactionManager)) { + parserContext.getReaderContext().error("'transaction-manager' attribute contains empty value", stepElement); + } else { + propertyValues.addPropertyValue("transactionManager", new RuntimeBeanReference(transactionManager)); + } + + String itemReader = stepElement.getAttribute(ITEM_READER_ATT); + if (!StringUtils.hasText(itemReader)) { + parserContext.getReaderContext().error("'item-reader' attribute contains empty value", stepElement); + } else { + propertyValues.addPropertyValue("itemReader", new RuntimeBeanReference(itemReader)); + } + String itemWriter = stepElement.getAttribute(ITEM_WRITER_ATT); + if (!StringUtils.hasText(itemWriter)) { + parserContext.getReaderContext().error("'item-writer' attribute contains empty value", stepElement); + } else { + propertyValues.addPropertyValue("itemWriter", new RuntimeBeanReference(itemWriter)); + } + + if (stepElement.hasAttribute(INPUT_SKIP_LIMIT_ATT)) { + String inputSkipLimit = stepElement.getAttribute(INPUT_SKIP_LIMIT_ATT); + propertyValues.addPropertyValue("skipLimit", Integer.valueOf(inputSkipLimit)); + } + + // TODO: Create difference between input skip limit and output skip limit + // if (stepElement.hasAttribute(ATT_OUTPUT_SKIP_LIMIT)) { + // String outputSkipLimit = stepElement.getAttribute(ATT_OUTPUT_SKIP_LIMIT); + // propertyValues.addPropertyValue(PROP_OUTPUT_SKIP_LIMIT, Integer.valueOf(outputSkipLimit)); + // } + + String rerun = stepElement.getAttribute(RERUN_ATT); + setPropertiesForRerun(rerun, propertyValues); + propertyValues.addPropertyValue("jobRepository", new RuntimeBeanReference(JOB_REPOSITORY_BEAN_NAME)); + return stepDef; + } + + private void parseTaskletStep(Element taskletStepEle, ParserContext parserContext) { + AbstractBeanDefinition stepDef = createTaskletStepBeanDefinition(taskletStepEle, parserContext); + + String id = taskletStepEle.getAttribute(ID_ATT); + + if (StringUtils.hasText(id)) { + parserContext.getRegistry().registerBeanDefinition(id, stepDef); + } else { + parserContext.getReaderContext().registerWithGeneratedName(stepDef); + } + } + + private AbstractBeanDefinition createTaskletStepBeanDefinition(Element taskletElement, ParserContext parserContext) { + RootBeanDefinition stepDef = new RootBeanDefinition(TaskletStep.class); + stepDef.setSource(parserContext.extractSource(taskletElement)); + MutablePropertyValues propertyValues = stepDef.getPropertyValues(); + + String tasklet = taskletElement.getAttribute(TASKLET_ATT); + if (!StringUtils.hasText(tasklet)) { + parserContext.getReaderContext().error("'tasklet' attribute contains empty value", taskletElement); + } else { + propertyValues.addPropertyValue("tasklet", new RuntimeBeanReference(tasklet)); + } + + String rerun = taskletElement.getAttribute(RERUN_ATT); + setPropertiesForRerun(rerun, propertyValues); + propertyValues.addPropertyValue("jobRepository", new RuntimeBeanReference(JOB_REPOSITORY_BEAN_NAME)); + + return stepDef; + } + + private void setPropertiesForRerun(String rerun, MutablePropertyValues propertyValues) { + if (RERUN_ALWAYS.equals(rerun)) { + propertyValues.addPropertyValue("allowStartIfComplete", Boolean.TRUE); + propertyValues.addPropertyValue("startLimit", new Integer(Integer.MAX_VALUE)); + } else if (RERUN_NEVER.equals(rerun)) { + propertyValues.addPropertyValue("allowStartIfComplete", Boolean.FALSE); + propertyValues.addPropertyValue("startLimit", Integer.valueOf(1)); + } else if (RERUN_INCOMPLETE.equals(rerun)) { + propertyValues.addPropertyValue("allowStartIfComplete", Boolean.FALSE); + propertyValues.addPropertyValue("startLimit", new Integer(Integer.MAX_VALUE)); + } + } +} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobBeanDefinitionParser.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobBeanDefinitionParser.java deleted file mode 100644 index 8cf559382..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobBeanDefinitionParser.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import org.springframework.batch.execution.step.ItemOrientedStep; -import org.springframework.batch.execution.step.TaskletStep; -import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.RuntimeBeanReference; -import org.springframework.beans.factory.support.AbstractBeanDefinition; -import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.util.StringUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * - * @author Ben Hale - */ -class JobBeanDefinitionParser implements BeanDefinitionParser { - - private static final String TAG_JOB = "job"; - - private static final String TAG_STEP = "step"; - - private static final String TAG_TASKLET_STEP = "tasklet-step"; - - private static final String ATT_ID = "id"; - - private static final String ATT_TASKLET = "tasklet"; - - private static final String ATT_RERUN = "rerun"; - - private static final String PROP_TASKLET = "tasklet"; - - private static final String ENUM_ALWAYS = "always"; - - private static final String ENUM_NEVER = "never"; - - private static final String ENUM_INCOMPLETE = "incomplete"; - - private static final String PROP_ALLOW_START_IF_COMPLETE = "allowStartIfComplete"; - - private static final String PROP_JOB_REPOSITORY = "jobRepository"; - - private static final String PROP_START_LIMIT = "startLimit"; - - private static final String REPOSITORY_BEAN_NAME = "_jobRepository"; - - private static final String ATT_SIZE = "size"; - - private static final String PROP_COMMIT_INTERVAL = "commitInterval"; - - private static final String ATT_TRANSACTION_MANAGER = "transaction-manager"; - - private static final String PROP_TRANSACTION_MANAGER = "transactionManager"; - - private static final String ATT_ITEM_READER = "item-reader"; - - private static final String PROP_ITEM_READER = "itemReader"; - - private static final String ATT_ITEM_WRITER = "item-writer"; - - private static final String PROP_ITEM_WRITER = "itemWriter"; - - private static final String ATT_INPUT_SKIP_LIMIT = "input-skip-limit"; - - // TODO: Create difference between input skip limit and output skip limit - private static final String PROP_INPUT_SKIP_LIMIT = "skipLimit"; - - private static final String ATT_OUTPUT_SKIP_LIMIT = "output-skip-limit"; - - private static final String PROP_OUTPUT_SKIP_LIMIT = "outputSkipLimit"; - - public BeanDefinition parse(Element element, ParserContext parserContext) { - NodeList childNodes = element.getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node node = childNodes.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - String localName = node.getLocalName(); - if (TAG_STEP.equals(localName)) { - parseStep((Element) node, parserContext); - } else if (TAG_TASKLET_STEP.equals(localName)) { - parseTaskletStep((Element) node, parserContext); - } - } - } - return null; - } - - private void parseStep(Element stepElement, ParserContext parserContext) { - AbstractBeanDefinition stepDef = createStepBeanDefinition(stepElement, parserContext); - String id = stepElement.getAttribute(ATT_ID); - - if (StringUtils.hasText(id)) { - parserContext.getRegistry().registerBeanDefinition(id, stepDef); - } else { - parserContext.getReaderContext().registerWithGeneratedName(stepDef); - } - } - - private AbstractBeanDefinition createStepBeanDefinition(Element stepElement, ParserContext parserContext) { - RootBeanDefinition stepDef = new RootBeanDefinition(ItemOrientedStep.class); - stepDef.setSource(parserContext.extractSource(stepElement)); - MutablePropertyValues propertyValues = stepDef.getPropertyValues(); - - String size = stepElement.getAttribute(ATT_SIZE); - propertyValues.addPropertyValue(PROP_COMMIT_INTERVAL, Integer.valueOf(size)); - String transactionManager = stepElement.getAttribute(ATT_TRANSACTION_MANAGER); - if (!StringUtils.hasText(transactionManager)) { - parserContext.getReaderContext().error("'transaction-manager' attribute contains empty value", stepElement); - } else { - propertyValues.addPropertyValue(PROP_TRANSACTION_MANAGER, new RuntimeBeanReference(transactionManager)); - } - - String itemReader = stepElement.getAttribute(ATT_ITEM_READER); - if (!StringUtils.hasText(itemReader)) { - parserContext.getReaderContext().error("'item-reader' attribute contains empty value", stepElement); - } else { - propertyValues.addPropertyValue(PROP_ITEM_READER, new RuntimeBeanReference(itemReader)); - } - String itemWriter = stepElement.getAttribute(ATT_ITEM_WRITER); - if (!StringUtils.hasText(itemWriter)) { - parserContext.getReaderContext().error("'item-writer' attribute contains empty value", stepElement); - } else { - propertyValues.addPropertyValue(PROP_ITEM_WRITER, new RuntimeBeanReference(itemWriter)); - } - - if (stepElement.hasAttribute(ATT_INPUT_SKIP_LIMIT)) { - String inputSkipLimit = stepElement.getAttribute(ATT_INPUT_SKIP_LIMIT); - propertyValues.addPropertyValue(PROP_INPUT_SKIP_LIMIT, Integer.valueOf(inputSkipLimit)); - } - - // TODO: Create difference between input skip limit and output skip limit - // if (stepElement.hasAttribute(ATT_OUTPUT_SKIP_LIMIT)) { - // String outputSkipLimit = stepElement.getAttribute(ATT_OUTPUT_SKIP_LIMIT); - // propertyValues.addPropertyValue(PROP_OUTPUT_SKIP_LIMIT, Integer.valueOf(outputSkipLimit)); - // } - - String rerun = stepElement.getAttribute(ATT_RERUN); - setPropertiesForRerun(rerun, propertyValues); - propertyValues.addPropertyValue(PROP_JOB_REPOSITORY, new RuntimeBeanReference(REPOSITORY_BEAN_NAME)); - return stepDef; - } - - private void parseTaskletStep(Element taskletElement, ParserContext parserContext) { - AbstractBeanDefinition stepDef = createTaskletStepBeanDefinition(taskletElement, parserContext); - String id = taskletElement.getAttribute(ATT_ID); - - if (StringUtils.hasText(id)) { - parserContext.getRegistry().registerBeanDefinition(id, stepDef); - } else { - parserContext.getReaderContext().registerWithGeneratedName(stepDef); - } - } - - private AbstractBeanDefinition createTaskletStepBeanDefinition(Element taskletElement, ParserContext parserContext) { - RootBeanDefinition stepDef = new RootBeanDefinition(TaskletStep.class); - stepDef.setSource(parserContext.extractSource(taskletElement)); - MutablePropertyValues propertyValues = stepDef.getPropertyValues(); - - String tasklet = taskletElement.getAttribute(ATT_TASKLET); - if (!StringUtils.hasText(tasklet)) { - parserContext.getReaderContext().error("'tasklet' attribute contains empty value", taskletElement); - } else { - propertyValues.addPropertyValue(PROP_TASKLET, new RuntimeBeanReference(tasklet)); - } - - String rerun = taskletElement.getAttribute(ATT_RERUN); - setPropertiesForRerun(rerun, propertyValues); - propertyValues.addPropertyValue(PROP_JOB_REPOSITORY, new RuntimeBeanReference(REPOSITORY_BEAN_NAME)); - - return stepDef; - } - - private void setPropertiesForRerun(String rerun, MutablePropertyValues propertyValues) { - if (ENUM_ALWAYS.equals(rerun)) { - propertyValues.addPropertyValue(PROP_ALLOW_START_IF_COMPLETE, Boolean.TRUE); - propertyValues.addPropertyValue(PROP_START_LIMIT, new Integer(Integer.MAX_VALUE)); - } else if (ENUM_NEVER.equals(rerun)) { - propertyValues.addPropertyValue(PROP_ALLOW_START_IF_COMPLETE, Boolean.FALSE); - propertyValues.addPropertyValue(PROP_START_LIMIT, Integer.valueOf(1)); - } else if (ENUM_INCOMPLETE.equals(rerun)) { - propertyValues.addPropertyValue(PROP_ALLOW_START_IF_COMPLETE, Boolean.FALSE); - propertyValues.addPropertyValue(PROP_START_LIMIT, new Integer(Integer.MAX_VALUE)); - } - } -} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobEntry.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobEntry.java deleted file mode 100644 index 4aa503471..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import org.springframework.beans.factory.parsing.ParseState; - -/** - * {@link ParseState} entry representing a job. - * - * @author Ben Hale - */ -class JobEntry implements ParseState.Entry { - - private final String name; - - /** - * Creates a new instance of the {@link JobEntry} class. - * - * @param name the bean name of the job - */ - JobEntry(String name) { - this.name = name; - } - - public String toString() { - return "Job '" + name + "'"; - } -} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParser.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParser.java deleted file mode 100644 index bafaebef8..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParser.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import org.springframework.batch.execution.repository.SimpleJobRepository; -import org.springframework.batch.execution.repository.dao.JdbcJobExecutionDao; -import org.springframework.batch.execution.repository.dao.JdbcJobInstanceDao; -import org.springframework.batch.execution.repository.dao.JdbcStepExecutionDao; -import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConstructorArgumentValues; -import org.springframework.beans.factory.config.RuntimeBeanReference; -import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.support.incrementer.DB2SequenceMaxValueIncrementer; -import org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer; -import org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer; -import org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer; -import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer; -import org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer; -import org.springframework.util.StringUtils; -import org.w3c.dom.Element; - -/** - * Creates a {@link BeanDefinitionParser} for the <job-repository> tag. - * - * @author Ben Hale - */ -class JobRepositoryBeanDefinitionParser implements BeanDefinitionParser { - - private static final String ATT_DATA_SOURCE = "data-source"; - - private static final String ATT_DB_TYPE = "db-type"; - - private static final String ENUM_DB2 = "db2"; - - private static final String ENUM_DERBY = "derby"; - - private static final String ENUM_HSQL = "hsql"; - - private static final String ENUM_MYSQL = "mysql"; - - private static final String ENUM_ORACLE = "oracle"; - - private static final String ENUM_POSTGRES = "postgres"; - - private static final String PROP_JDBC_TEMPLATE = "jdbcTemplate"; - - private static final String PROP_JOB_INCREMENTER = "jobIncrementer"; - - private static final String PROP_JOB_EXECUTION_INCREMENTER = "jobExecutionIncrementer"; - - private static final String PROP_STEP_EXECUTION_INCREMENTER = "stepExecutionIncrementer"; - - private static final String REPOSITORY_BEAN_NAME = "_jobRepository"; - - public BeanDefinition parse(Element element, ParserContext parserContext) { - RootBeanDefinition repositoryDef = new RootBeanDefinition(SimpleJobRepository.class); - - String dbType = element.getAttribute(ATT_DB_TYPE); - String dataSourceId = element.getAttribute(ATT_DATA_SOURCE); - if (!StringUtils.hasText(dataSourceId)) { - parserContext.getReaderContext().error("'data-source' attribute contains empty value", element); - } else { - ConstructorArgumentValues constructorArgumentValues = repositoryDef.getConstructorArgumentValues(); - String templateId = createJdbcTemplateDefinition(dataSourceId, parserContext); - constructorArgumentValues.addGenericArgumentValue(createJobInstanceDao(templateId, dataSourceId, dbType, - parserContext)); - constructorArgumentValues.addGenericArgumentValue(createJobExecutionDao(templateId, dataSourceId, dbType, - parserContext)); - constructorArgumentValues.addGenericArgumentValue(createStepExecutionDao(templateId, dataSourceId, dbType, - parserContext)); - } - - parserContext.getRegistry().registerBeanDefinition(REPOSITORY_BEAN_NAME, repositoryDef); - return null; - } - - private String createJdbcTemplateDefinition(String dataSourceId, ParserContext parserContext) { - RootBeanDefinition templateDef = new RootBeanDefinition(JdbcTemplate.class); - templateDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(dataSourceId)); - return parserContext.getReaderContext().registerWithGeneratedName(templateDef); - } - - private BeanDefinition createJobInstanceDao(String templateId, String dataSourceId, String dbType, - ParserContext parserContext) { - RootBeanDefinition daoDef = new RootBeanDefinition(JdbcJobInstanceDao.class); - MutablePropertyValues propertyValues = daoDef.getPropertyValues(); - propertyValues.addPropertyValue(PROP_JDBC_TEMPLATE, new RuntimeBeanReference(templateId)); - propertyValues.addPropertyValue(PROP_JOB_INCREMENTER, getIncrementer(dbType, dataSourceId, "BATCH_JOB_SEQ")); - return daoDef; - } - - private BeanDefinition createJobExecutionDao(String templateId, String dataSourceId, String dbType, - ParserContext parserContext) { - RootBeanDefinition daoDef = new RootBeanDefinition(JdbcJobExecutionDao.class); - MutablePropertyValues propertyValues = daoDef.getPropertyValues(); - propertyValues.addPropertyValue(PROP_JDBC_TEMPLATE, new RuntimeBeanReference(templateId)); - propertyValues.addPropertyValue(PROP_JOB_EXECUTION_INCREMENTER, getIncrementer(dbType, dataSourceId, - "BATCH_JOB_EXECUTION_SEQ")); - return daoDef; - } - - private BeanDefinition createStepExecutionDao(String templateId, String dataSourceId, String dbType, - ParserContext parserContext) { - RootBeanDefinition daoDef = new RootBeanDefinition(JdbcStepExecutionDao.class); - MutablePropertyValues propertyValues = daoDef.getPropertyValues(); - propertyValues.addPropertyValue(PROP_JDBC_TEMPLATE, new RuntimeBeanReference(templateId)); - propertyValues.addPropertyValue(PROP_STEP_EXECUTION_INCREMENTER, getIncrementer(dbType, dataSourceId, - "BATCH_STEP_EXECUTION_SEQ")); - return daoDef; - } - - private BeanDefinition getIncrementer(String dbType, String dataSourceId, String incrementerName) { - RootBeanDefinition incrementerDef = new RootBeanDefinition(); - - if (ENUM_DB2.equals(dbType)) { - incrementerDef.setBeanClass(DB2SequenceMaxValueIncrementer.class); - addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); - } else if (ENUM_DERBY.equals(dbType)) { - incrementerDef.setBeanClass(DerbyMaxValueIncrementer.class); - addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); - } else if (ENUM_HSQL.equals(dbType)) { - incrementerDef.setBeanClass(HsqlMaxValueIncrementer.class); - addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); - } else if (ENUM_MYSQL.equals(dbType)) { - incrementerDef.setBeanClass(MySQLMaxValueIncrementer.class); - addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); - } else if (ENUM_ORACLE.equals(dbType)) { - incrementerDef.setBeanClass(OracleSequenceMaxValueIncrementer.class); - addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); - } else if (ENUM_POSTGRES.equals(dbType)) { - incrementerDef.setBeanClass(PostgreSQLSequenceMaxValueIncrementer.class); - addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues()); - } - - return incrementerDef; - } - - private void addSequenceIncrementer(String dataSourceId, String incrementerName, - ConstructorArgumentValues constructorArgumentValues) { - constructorArgumentValues.addGenericArgumentValue(new RuntimeBeanReference(dataSourceId)); - constructorArgumentValues.addGenericArgumentValue(incrementerName); - } - - private void addTableIncrementer(String dataSourceId, String incrementerName, - ConstructorArgumentValues constructorArgumentValues) { - constructorArgumentValues.addGenericArgumentValue(new RuntimeBeanReference(dataSourceId)); - constructorArgumentValues.addGenericArgumentValue(incrementerName); - constructorArgumentValues.addGenericArgumentValue("id"); - } - -} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/TaskletStepEntry.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/TaskletStepEntry.java deleted file mode 100644 index 245f3b203..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/TaskletStepEntry.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import org.springframework.beans.factory.parsing.ParseState; - -/** - * {@link ParseState} entry representing a {@link TaskletStep}. - * - * @author Ben Hale - */ -public class TaskletStepEntry extends AbstractStepEntry { - - /** - * Creates a new instance of the {@link TaskletStepEntry} class. - * - * @param name the bean name of the job - */ - TaskletStepEntry(String name) { - super(name); - } - - String getType() { - return "tasklet"; - } - -} diff --git a/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd b/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd index 23bbefbc3..0a4c8d04b 100644 --- a/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd +++ b/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd @@ -4,60 +4,70 @@ targetNamespace="http://www.springframework.org/schema/batch" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryTests.java deleted file mode 100644 index 4053a825d..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryTests.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.execution.configuration; - -import junit.framework.TestCase; - -import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class BatchNamespaceHandlerJobRepositoryTests extends TestCase { - - private static final String PACKAGE = "org/springframework/batch/execution/configuration/"; - - public void testRepositoryOk() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryOk.xml"); - } - - public void testRepositoryMissingDataSource() { - try { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryMissingDataSource.xml"); - fail("Expected BeanDefinitionParsingException"); - } catch (BeanDefinitionParsingException e) { } - } - - public void testRepositoryDb2() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryDb2.xml"); - } - - public void testRepositoryDerby() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryDerby.xml"); - } - - public void testRepositoryHsql() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryHsql.xml"); - } - - public void testRepositoryMySql() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryMySql.xml"); - } - - public void testRepositoryOracle() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryOracle.xml"); - } - - public void testRepositoryPostgres() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryPostgres.xml"); - } -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java new file mode 100644 index 000000000..c21122b8c --- /dev/null +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java @@ -0,0 +1,63 @@ +/* + * Copyright 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.execution.configuration; + +import junit.framework.TestCase; + +import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class JobRepositoryBeanDefinitionParserTests extends TestCase { + + private static final String PACKAGE = "org/springframework/batch/execution/configuration/"; + + public void testJobRepoOk() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoOk.xml"); + } + + public void testJobRepoMissingDataSource() { + try { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoMissingDataSource.xml"); + fail("Expected BeanDefinitionParsingException"); + } catch (BeanDefinitionParsingException e) { + } + } + + public void testJobRepoDb2() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoDb2.xml"); + } + + public void testJobRepoDerby() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoDerby.xml"); + } + + public void testJobRepoHsql() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoHsql.xml"); + } + + public void testJobRepoMySql() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoMySql.xml"); + } + + public void testJobRepoOracle() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoOracle.xml"); + } + + public void testJobRepoPostgres() { + new ClassPathXmlApplicationContext(PACKAGE + "JobRepoPostgres.xml"); + } +} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StepBeanDefinitionParserTests.java similarity index 72% rename from spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepTests.java rename to spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StepBeanDefinitionParserTests.java index 22a13e209..606783aeb 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StepBeanDefinitionParserTests.java @@ -23,55 +23,60 @@ import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class BatchNamespaceHandlerStepTests extends TestCase { +public class StepBeanDefinitionParserTests extends TestCase { private static final String PACKAGE = "org/springframework/batch/execution/configuration/"; public void testStepOk() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepOk.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "StepOk.xml"); } - + public void testStepMissingIteamReader() { try { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepMissingItemReader.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "StepMissingItemReader.xml"); fail("Expected BeanDefinitionParsingException"); - } catch (BeanDefinitionParsingException e) { } + } catch (BeanDefinitionParsingException e) { + } } - + public void testStepMissingItemWriter() { try { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepMissingItemWriter.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "StepMissingItemWriter.xml"); fail("Expected BeanDefinitionParsingException"); - } catch (BeanDefinitionParsingException e) { } + } catch (BeanDefinitionParsingException e) { + } } - + public void testStepMissingTransactionManager() { try { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepMissingTransactionManager.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "StepMissingTransactionManager.xml"); fail("Expected BeanDefinitionParsingException"); - } catch (BeanDefinitionParsingException e) { } + } catch (BeanDefinitionParsingException e) { + } } - + public void testStepSpecificTransactionManager() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepSpecificTransactionManager.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "StepSpecificTransactionManager.xml"); } - + public void testStepRerunAlways() { - ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepRerunAlways.xml"); + ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + + "StepRerunAlways.xml"); ItemOrientedStep step = (ItemOrientedStep) ctx.getBean("process"); assertEquals(Integer.MAX_VALUE, step.getStartLimit()); assertTrue(step.isAllowStartIfComplete()); } - + public void testStepRerunNever() { - ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepRerunNever.xml"); + ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "StepRerunNever.xml"); ItemOrientedStep step = (ItemOrientedStep) ctx.getBean("process"); assertEquals(1, step.getStartLimit()); assertFalse(step.isAllowStartIfComplete()); } - + public void testStepRerunIncomplete() { - ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerStepRerunIncomplete.xml"); + ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + + "StepRerunIncomplete.xml"); ItemOrientedStep step = (ItemOrientedStep) ctx.getBean("process"); assertEquals(Integer.MAX_VALUE, step.getStartLimit()); assertFalse(step.isAllowStartIfComplete()); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletStepBeanDefinitionParserTests.java similarity index 82% rename from spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepTests.java rename to spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletStepBeanDefinitionParserTests.java index 6f8c634cc..df0aec212 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletStepBeanDefinitionParserTests.java @@ -23,37 +23,37 @@ import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class BatchNamespaceHandlerTaskletStepTests extends TestCase { +public class TaskletStepBeanDefinitionParserTests extends TestCase { private static final String PACKAGE = "org/springframework/batch/execution/configuration/"; public void testTaskletStepOk() { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepOk.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepOk.xml"); } public void testTaskletStepMissingTasklet() { try { - new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepMissingTasklet.xml"); + new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepMissingTasklet.xml"); fail("Expected BeanDefinitionParsingException"); } catch (BeanDefinitionParsingException e) { } } public void testTaskletStepRerunAlways() { - ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepRerunAlways.xml"); + ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepRerunAlways.xml"); TaskletStep step = (TaskletStep) ctx.getBean("process"); assertEquals(Integer.MAX_VALUE, step.getStartLimit()); assertTrue(step.isAllowStartIfComplete()); } public void testTaskletStepRerunNever() { - ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepRerunNever.xml"); + ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepRerunNever.xml"); TaskletStep step = (TaskletStep) ctx.getBean("process"); assertEquals(1, step.getStartLimit()); assertFalse(step.isAllowStartIfComplete()); } public void testTaskletStepRerunIncomplete() { - ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepRerunIncomplete.xml"); + ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepRerunIncomplete.xml"); TaskletStep step = (TaskletStep) ctx.getBean("process"); assertEquals(Integer.MAX_VALUE, step.getStartLimit()); assertFalse(step.isAllowStartIfComplete()); diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDb2.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDb2.xml deleted file mode 100644 index a31526f83..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDb2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryHsql.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryHsql.xml deleted file mode 100644 index 7720d4647..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryHsql.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMissingDataSource.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMissingDataSource.xml deleted file mode 100644 index 015b888e5..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMissingDataSource.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMySql.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMySql.xml deleted file mode 100644 index 063ea5f60..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMySql.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOk.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOk.xml deleted file mode 100644 index a31526f83..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOk.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOracle.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOracle.xml deleted file mode 100644 index 27dc75469..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOracle.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryPostgres.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryPostgres.xml deleted file mode 100644 index 84015ea32..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryPostgres.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepSpecificTransactionManager.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepSpecificTransactionManager.xml deleted file mode 100644 index 126ba537b..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepSpecificTransactionManager.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunNever.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml similarity index 79% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunNever.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml index 9c1945172..2a29711b4 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunNever.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml @@ -5,16 +5,18 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - - - + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml new file mode 100644 index 000000000..9bc7748dc --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml new file mode 100644 index 000000000..dafa5127e --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDerby.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml similarity index 61% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDerby.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml index 9184a38c5..f40efa5eb 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDerby.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml @@ -5,9 +5,15 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml new file mode 100644 index 000000000..2c4fb2f71 --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepOk.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml similarity index 79% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepOk.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml index 87d6d5fac..2a29711b4 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepOk.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml @@ -5,16 +5,18 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - - - + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml new file mode 100644 index 000000000..4ccd4aea4 --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml new file mode 100644 index 000000000..6447b5ded --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemReader.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml similarity index 80% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemReader.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml index ecd00a3a0..491fb560e 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemReader.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemWriter.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml similarity index 80% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemWriter.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml index 78f537aaf..a93f658ee 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingItemWriter.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingTransactionManager.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml similarity index 77% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingTransactionManager.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml index ce68b5235..0456f7fbf 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepMissingTransactionManager.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunIncomplete.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml similarity index 81% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunIncomplete.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml index d66d497bb..83f6e98a4 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunIncomplete.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepOk.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml similarity index 80% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepOk.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml index 126ba537b..e2772305e 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepOk.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml new file mode 100644 index 000000000..0264fed64 --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunAlways.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml similarity index 80% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunAlways.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml index 522ccd9ba..41f367d1f 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunAlways.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunNever.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml similarity index 81% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunNever.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml index 81fcb3fb8..83f6e98a4 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerStepRerunNever.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepMissingTasklet.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml similarity index 77% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepMissingTasklet.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml index ad416e6bc..2a34ec9e7 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepMissingTasklet.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunIncomplete.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml similarity index 79% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunIncomplete.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml index c29e12a7b..56a9b6e65 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunIncomplete.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunAlways.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml similarity index 78% rename from spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunAlways.xml rename to spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml index 867002cba..830326e6e 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunAlways.xml +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml @@ -5,11 +5,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd"> - + + - - - + + + + diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml new file mode 100644 index 000000000..47f5ad4a7 --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml new file mode 100644 index 000000000..10cfa3fb7 --- /dev/null +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file