1 /*
2 * File: AbstractDataSet.java
3 * Created: 28.4.2007 11:35:44
4 *
5 * Copyright 2007 Michal Burda.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 package net.sf.webmancer.db.sql;
23
24 import javax.sql.DataSource;
25
26 import net.sf.webmancer.db.AbstractDataSet;
27 import net.sf.webmancer.util.ContractChecker;
28
29 import org.springframework.jdbc.core.JdbcTemplate;
30
31 /**
32 * @author Michal Burda
33 *
34 */
35 public abstract class AbstractSqlDataSet extends AbstractDataSet {
36
37 /**
38 *
39 */
40 private JdbcTemplate jdbcTemplate;
41
42 /**
43 * Constructs the AbstractSqlDataSet.
44 *
45 */
46 public AbstractSqlDataSet() {
47 super();
48 }
49
50 /**
51 * @param dataSource
52 */
53 public void setDataSource(DataSource dataSource) {
54 ContractChecker.mustNotBeNull(dataSource, "dataSource");
55 jdbcTemplate = new JdbcTemplate(dataSource);
56 }
57
58 /**
59 * Returns the jdbcTemplate.
60 *
61 * @return the jdbcTemplate
62 */
63 protected JdbcTemplate getJdbcTemplate() {
64 return this.jdbcTemplate;
65 }
66
67 }