BATCH-63: added table-prefix and isolation-level-for-create for job-repository to xsd and parser
This commit is contained in:
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package org.springframework.batch.core.configuration.xml;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -33,8 +32,6 @@ import org.w3c.dom.Element;
|
||||
*/
|
||||
public class JobRepositoryParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
protected String getBeanClassName(Element element) {
|
||||
return "org.springframework.batch.core.repository.support.JobRepositoryFactoryBean";
|
||||
}
|
||||
@@ -49,15 +46,20 @@ public class JobRepositoryParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
String transactionManager = element.getAttribute("transaction-manager");
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Using data-source: " + dataSource);
|
||||
logger.debug("Using transaction-manager: " + transactionManager);
|
||||
}
|
||||
|
||||
String isolationLevelForCreate = element.getAttribute("isolation-level-for-create");
|
||||
|
||||
String tablePrefix = element.getAttribute("table-prefix");
|
||||
|
||||
RuntimeBeanReference ds = new RuntimeBeanReference(dataSource);
|
||||
builder.addPropertyValue("dataSource", ds);
|
||||
RuntimeBeanReference tx = new RuntimeBeanReference(transactionManager);
|
||||
builder.addPropertyValue("transactionManager", tx);
|
||||
if (StringUtils.hasText(isolationLevelForCreate)) {
|
||||
builder.addPropertyValue("isolationLevelForCreate", isolationLevelForCreate);
|
||||
}
|
||||
if (StringUtils.hasText(tablePrefix)) {
|
||||
builder.addPropertyValue("tablePrefix", tablePrefix);
|
||||
}
|
||||
|
||||
builder.setRole(BeanDefinition.ROLE_SUPPORT);
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ The decider is a reference to a JobExecutionDecider that can produce a status to
|
||||
<xsd:extension base="beans:identifiedType">
|
||||
<xsd:attribute name="data-source" type="xsd:string" default="dataSource">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.PlatformTransactionManager"><![CDATA[
|
||||
<xsd:documentation source="java:javax.sql.DataSource"><![CDATA[
|
||||
The bean name of the DataSource that is to be used. This attribute
|
||||
is not required, and only needs to be specified explicitly
|
||||
if the bean name of the desired DataSource is not 'dataSource'.
|
||||
@@ -214,6 +214,24 @@ The decider is a reference to a JobExecutionDecider that can produce a status to
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="isolation-level-for-create" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The isolation level to use for creation of job execution entities.
|
||||
The default is ISOLATION_SERIALIZABLE, which prevents accidental
|
||||
concurrent execution of the same job (ISOLATION_REPEATABLE_READ
|
||||
would work as well).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="table-prefix" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The the table prefix to use for all the batch meta-data tables.
|
||||
Defaults to "BATCH_".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
<beans:property name="dataSource" ref="dataSource"/>
|
||||
</beans:bean>
|
||||
|
||||
<job-repository id="jobRepo1"/>
|
||||
<job-repository id="jobRepo1"/>
|
||||
|
||||
</beans:beans>
|
||||
Reference in New Issue
Block a user