Skip to content

Commit 58ef32e

Browse files
committed
Override methods of base class in JdbcJobRepositoryFactoryBean
1 parent d7f1c1d commit 58ef32e

File tree

1 file changed

+151
-0
lines changed

1 file changed

+151
-0
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JdbcJobRepositoryFactoryBean.java

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,23 @@
1515
*/
1616
package org.springframework.batch.core.repository.support;
1717

18+
import org.springframework.batch.core.JobKeyGenerator;
19+
import org.springframework.batch.core.repository.ExecutionContextSerializer;
20+
import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao;
21+
import org.springframework.batch.core.repository.dao.DefaultExecutionContextSerializer;
22+
import org.springframework.batch.core.repository.dao.JdbcExecutionContextDao;
23+
import org.springframework.batch.core.repository.dao.JdbcJobExecutionDao;
24+
import org.springframework.batch.core.repository.dao.JdbcStepExecutionDao;
25+
import org.springframework.batch.item.database.support.DataFieldMaxValueIncrementerFactory;
26+
import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory;
1827
import org.springframework.beans.factory.FactoryBean;
28+
import org.springframework.core.convert.support.ConfigurableConversionService;
29+
import org.springframework.jdbc.core.JdbcOperations;
30+
import org.springframework.jdbc.core.JdbcTemplate;
31+
import org.springframework.lang.NonNull;
32+
33+
import javax.sql.DataSource;
34+
import java.nio.charset.Charset;
1935

2036
/**
2137
* A {@link FactoryBean} that automates the creation of a {@link SimpleJobRepository}
@@ -31,4 +47,139 @@
3147
*/
3248
public class JdbcJobRepositoryFactoryBean extends JobRepositoryFactoryBean {
3349

50+
/**
51+
* @param type a value from the {@link java.sql.Types} class to indicate the type to
52+
* use for a CLOB
53+
*/
54+
public void setClobType(int type) {
55+
super.setClobType(type);
56+
}
57+
58+
/**
59+
* A custom implementation of the {@link ExecutionContextSerializer}. The default, if
60+
* not injected, is the {@link DefaultExecutionContextSerializer}.
61+
* @param serializer used to serialize/deserialize
62+
* {@link org.springframework.batch.item.ExecutionContext}
63+
* @see ExecutionContextSerializer
64+
*/
65+
public void setSerializer(ExecutionContextSerializer serializer) {
66+
super.setSerializer(serializer);
67+
}
68+
69+
/**
70+
* Public setter for the length of long string columns in database. Do not set this if
71+
* you haven't modified the schema. Note this value will be used for the exit message
72+
* in both {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao} and also the
73+
* short version of the execution context in {@link JdbcExecutionContextDao} . If you
74+
* want to use separate values for exit message and short context, then use
75+
* {@link #setMaxVarCharLengthForExitMessage(int)} and
76+
* {@link #setMaxVarCharLengthForShortContext(int)}. For databases with multi-byte
77+
* character sets this number can be smaller (by up to a factor of 2 for 2-byte
78+
* characters) than the declaration of the column length in the DDL for the tables.
79+
* @param maxVarCharLength the exitMessageLength to set
80+
*/
81+
public void setMaxVarCharLength(int maxVarCharLength) {
82+
super.setMaxVarCharLength(maxVarCharLength);
83+
}
84+
85+
/**
86+
* Public setter for the length of short context string column in database. Do not set
87+
* this if you haven't modified the schema. For databases with multi-byte character
88+
* sets this number can be smaller (by up to a factor of 2 for 2-byte characters) than
89+
* the declaration of the column length in the DDL for the tables. Defaults to
90+
* {@link AbstractJdbcBatchMetadataDao#DEFAULT_SHORT_CONTEXT_LENGTH}
91+
* @param maxVarCharLengthForShortContext the short context length to set
92+
* @since 5.1
93+
*/
94+
public void setMaxVarCharLengthForShortContext(int maxVarCharLengthForShortContext) {
95+
super.setMaxVarCharLengthForShortContext(maxVarCharLengthForShortContext);
96+
}
97+
98+
/**
99+
* Public setter for the length of the exit message in both
100+
* {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao}. Do not set this if
101+
* you haven't modified the schema. For databases with multi-byte character sets this
102+
* number can be smaller (by up to a factor of 2 for 2-byte characters) than the
103+
* declaration of the column length in the DDL for the tables. Defaults to
104+
* {@link AbstractJdbcBatchMetadataDao#DEFAULT_EXIT_MESSAGE_LENGTH}.
105+
* @param maxVarCharLengthForExitMessage the exitMessageLength to set
106+
* @since 5.1
107+
*/
108+
public void setMaxVarCharLengthForExitMessage(int maxVarCharLengthForExitMessage) {
109+
super.setMaxVarCharLengthForExitMessage(maxVarCharLengthForExitMessage);
110+
}
111+
112+
/**
113+
* Public setter for the {@link DataSource}.
114+
* @param dataSource a {@link DataSource}
115+
*/
116+
public void setDataSource(DataSource dataSource) {
117+
super.setDataSource(dataSource);
118+
}
119+
120+
/**
121+
* Public setter for the {@link JdbcOperations}. If this property is not set
122+
* explicitly, a new {@link JdbcTemplate} will be created for the configured
123+
* DataSource by default.
124+
* @param jdbcOperations a {@link JdbcOperations}
125+
*/
126+
public void setJdbcOperations(JdbcOperations jdbcOperations) {
127+
super.setJdbcOperations(jdbcOperations);
128+
}
129+
130+
/**
131+
* Sets the database type.
132+
* @param dbType as specified by {@link DefaultDataFieldMaxValueIncrementerFactory}
133+
*/
134+
public void setDatabaseType(String dbType) {
135+
super.setDatabaseType(dbType);
136+
}
137+
138+
/**
139+
* Sets the table prefix for all the batch meta-data tables.
140+
* @param tablePrefix prefix prepended to batch meta-data tables
141+
*/
142+
public void setTablePrefix(String tablePrefix) {
143+
super.setTablePrefix(tablePrefix);
144+
}
145+
146+
public void setIncrementerFactory(DataFieldMaxValueIncrementerFactory incrementerFactory) {
147+
super.setIncrementerFactory(incrementerFactory);
148+
}
149+
150+
/**
151+
* * Sets the generator for creating the key used in identifying unique {link
152+
* JobInstance} objects
153+
* @param jobKeyGenerator a {@link JobKeyGenerator}
154+
* @since 5.1
155+
*/
156+
public void setJobKeyGenerator(JobKeyGenerator jobKeyGenerator) {
157+
super.setJobKeyGenerator(jobKeyGenerator);
158+
}
159+
160+
/**
161+
* Set the {@link Charset} to use when serializing/deserializing the execution
162+
* context. Defaults to "UTF-8". Must not be {@code null}.
163+
* @param charset to use when serializing/deserializing the execution context.
164+
* @see JdbcExecutionContextDao#setCharset(Charset)
165+
* @since 5.0
166+
*/
167+
public void setCharset(@NonNull Charset charset) {
168+
super.setCharset(charset);
169+
}
170+
171+
/**
172+
* Set the conversion service to use in the job repository. This service is used to
173+
* convert job parameters from String literal to typed values and vice versa.
174+
* @param conversionService the conversion service to use
175+
* @since 5.0
176+
*/
177+
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
178+
super.setConversionService(conversionService);
179+
}
180+
181+
@Override
182+
public void afterPropertiesSet() throws Exception {
183+
super.afterPropertiesSet();
184+
}
34185
}

0 commit comments

Comments
 (0)