EMMA Coverage Report (generated Fri Aug 21 15:59:46 BST 2009)
[all classes][org.springframework.batch.core.repository.dao]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractJdbcBatchMetadataDao.java]

nameclass, %method, %block, %line, %
AbstractJdbcBatchMetadataDao.java100% (1/1)89%  (8/9)92%  (37/40)93%  (14/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractJdbcBatchMetadataDao100% (1/1)89%  (8/9)92%  (37/40)93%  (14/15)
getTablePrefix (): String 0%   (0/1)0%   (0/3)0%   (0/1)
AbstractJdbcBatchMetadataDao (): void 100% (1/1)100% (9/9)100% (3/3)
afterPropertiesSet (): void 100% (1/1)100% (4/4)100% (2/2)
getClobTypeToUse (): int 100% (1/1)100% (3/3)100% (1/1)
getJdbcTemplate (): SimpleJdbcOperations 100% (1/1)100% (3/3)100% (1/1)
getQuery (String): String 100% (1/1)100% (6/6)100% (1/1)
setClobTypeToUse (int): void 100% (1/1)100% (4/4)100% (2/2)
setJdbcTemplate (SimpleJdbcOperations): void 100% (1/1)100% (4/4)100% (2/2)
setTablePrefix (String): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 * Copyright 2006-2007 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17package org.springframework.batch.core.repository.dao;
18 
19import java.sql.Types;
20 
21import org.springframework.beans.factory.InitializingBean;
22import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
23import org.springframework.util.Assert;
24import org.springframework.util.StringUtils;
25 
26/**
27 * Encapsulates common functionality needed by JDBC batch metadata DAOs -
28 * provides jdbcTemplate for subclasses and handles table prefixes.
29 * 
30 * @author Robert Kasanicky
31 */
32public abstract class AbstractJdbcBatchMetadataDao implements InitializingBean {
33 
34        /**
35         * Default value for the table prefix property.
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 SimpleJdbcOperations 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         * Public setter for the table prefix property. This will be prefixed to all
57         * the table names before queries are executed. Defaults to
58         * {@link #DEFAULT_TABLE_PREFIX}.
59         * 
60         * @param tablePrefix the tablePrefix to set
61         */
62        public void setTablePrefix(String tablePrefix) {
63                this.tablePrefix = tablePrefix;
64        }
65 
66        public void setJdbcTemplate(SimpleJdbcOperations jdbcTemplate) {
67                this.jdbcTemplate = jdbcTemplate;
68        }
69 
70        protected SimpleJdbcOperations 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        public void afterPropertiesSet() throws Exception {
83                Assert.notNull(jdbcTemplate);
84        }
85 
86}

[all classes][org.springframework.batch.core.repository.dao]
EMMA 2.0.5312 (C) Vladimir Roubtsov