1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.batch.core.repository.dao;
18
19 import java.sql.Types;
20
21 import org.springframework.beans.factory.InitializingBean;
22 import org.springframework.jdbc.core.JdbcOperations;
23 import org.springframework.util.Assert;
24 import org.springframework.util.StringUtils;
25
26
27
28
29
30
31
32 public abstract class AbstractJdbcBatchMetadataDao implements InitializingBean {
33
34
35
36
37 public static final String DEFAULT_TABLE_PREFIX = "BATCH_";
38
39 public static final int DEFAULT_EXIT_MESSAGE_LENGTH = 2500;
40
41 private String tablePrefix = DEFAULT_TABLE_PREFIX;
42
43 private int clobTypeToUse = Types.CLOB;
44
45 private JdbcOperations jdbcTemplate;
46
47 protected String getQuery(String base) {
48 return StringUtils.replace(base, "%PREFIX%", tablePrefix);
49 }
50
51 protected String getTablePrefix() {
52 return tablePrefix;
53 }
54
55
56
57
58
59
60
61
62 public void setTablePrefix(String tablePrefix) {
63 this.tablePrefix = tablePrefix;
64 }
65
66 public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
67 this.jdbcTemplate = jdbcTemplate;
68 }
69
70 protected JdbcOperations getJdbcTemplate() {
71 return jdbcTemplate;
72 }
73
74 public int getClobTypeToUse() {
75 return clobTypeToUse;
76 }
77
78 public void setClobTypeToUse(int clobTypeToUse) {
79 this.clobTypeToUse = clobTypeToUse;
80 }
81
82 @Override
83 public void afterPropertiesSet() throws Exception {
84 Assert.notNull(jdbcTemplate);
85 }
86
87 }