Clover coverage report - JFox Service-Oriented Application Framework - 1.0-M3 Coverage timestamp: 星期日 五月 22 2005 15:41:44 CST FRAMES NO FRAMES |
file stats: | LOC: | 130 |  | Methods: | 10
| NCLOC: | 44 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
AbstractJdbcDAO.java | - | 8.3% | 10% | 9.1% |

1 |  |
     /**
2 |  |
      * @(#)AbstractJdbcDAO.java
3 |  |
      *
4 |  |
      * JFoxSOAF, Service-Oriented Application Framework
5 |  |
      *
6 |  |
      * Copyright(c) JFoxSOAF Team
7 |  |
      *
8 |  |
      * Licensed under the GNU LGPL, Version 2.1 (the "License");
9 |  |
      * you may not use this file except in compliance with the License.
10 |  |
      * You may obtain a copy of the License at
11 |  |
      *
12 |  |
      * http://www.gnu.org/copyleft/lesser.html
13 |  |
      *
14 |  |
      * Unless required by applicable law or agreed to in writing, software
15 |  |
      * distributed under the License is distributed on an "AS IS" BASIS,
16 |  |
      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 |  |
      * See the License for the specific language governing permissions and
18 |  |
      * limitations under the License.
19 |  |
      *
20 |  |
      * For more information, please visit:
21 |  |
      * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22 |  |
      * http://www.huihoo.org/jfox/jfoxsoaf
23 |  |
      */
24 |  |
25 |  |
     package org.huihoo.jfox.soaf.services.dao;
26 |  |
27 |  |
     import java.sql.Connection;
28 |  |
     import java.sql.ResultSet;
29 |  |
     import java.sql.SQLException;
30 |  |
     import java.sql.Statement;
31 |  |
32 |  |
     import org.apache.commons.dbutils.DbUtils;
33 |  |
     import org.huihoo.jfox.soaf.container.ServiceFactory;
34 |  |
     import org.huihoo.jfox.soaf.services.jdbc.DataSourceService;
35 |  |
36 |  |
     /**
37 |  |
      * <p>
38 |  |
      * Abstract JDBC DAO Template.
39 |  |
      * </p>
40 |  |
      *
41 |  |
      * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
42 |  |
      * @version $Revision: 1.1 $ $Date: 2005/05/22 06:49:10 $
43 |  |
      * @version Revision: 1.0
44 |  |
      */
45 |  |
46 |  |
     public abstract class AbstractJdbcDAO extends AbstractDAO {
47 |  |
48 |  |
         private DataSourceService dsService;
49 |  |
50 |  |
         /**
51 |  |
          * Default Constructor
52 |  |
          */
53 | 2 |
         public AbstractJdbcDAO() {
54 | 2 |
             dsService = (DataSourceService) ServiceFactory.getInstance()
55 |  |
                     .getService(DataSourceService.class);
56 |  |
         }
57 |  |
58 |  |
         /**
59 |  |
          * Gets the JDBC Connection from given data source
60 |  |
          *
61 |  |
          * @param dsName datasource name
62 |  |
          * @return A JDBC Connection instance.
63 |  |
          */
64 | 0 |
         protected Connection getConnection(String dsName) throws SQLException {
65 | 0 |
             return dsService.getDataSource(dsName).getConnection();
66 |  |
         }
67 |  |
68 |  |
         /**
69 |  |
          * Close a Connection.
70 |  |
          */
71 | 0 |
         protected void close(Connection conn) throws SQLException {
72 | 0 |
             DbUtils.close(conn);
73 |  |
         }
74 |  |
75 |  |
         /**
76 |  |
          * Close a ResultSet.
77 |  |
          */
78 | 0 |
         protected void close(ResultSet rs) throws SQLException {
79 | 0 |
             DbUtils.close(rs);
80 |  |
         }
81 |  |
82 |  |
         /**
83 |  |
          * Close a Statement.
84 |  |
          */
85 | 0 |
         protected void close(Statement stmt) throws SQLException {
86 | 0 |
             DbUtils.close(stmt);
87 |  |
         }
88 |  |
89 |  |
         /**
90 |  |
          * Close a Connection, avoid closing if null and hide any SQLExceptions that
91 |  |
          * occur.
92 |  |
          */
93 | 0 |
         protected void closeQuietly(Connection conn) {
94 | 0 |
             DbUtils.closeQuietly(conn);
95 |  |
         }
96 |  |
97 |  |
         /**
98 |  |
          * Close a Statement, avoid closing if null and hide any SQLExceptions that
99 |  |
          * occur.
100 |  |
          */
101 | 0 |
         protected void closeQuietly(Statement stmt) {
102 | 0 |
             DbUtils.closeQuietly(stmt);
103 |  |
         }
104 |  |
105 |  |
         /**
106 |  |
          * Close a ResultSet, avoid closing if null and hide any SQLExceptions that
107 |  |
          * occur.
108 |  |
          */
109 | 0 |
         protected void closeQuietly(ResultSet rs) {
110 | 0 |
             DbUtils.closeQuietly(rs);
111 |  |
         }
112 |  |
113 |  |
         /**
114 |  |
          * Close a Connection, Statement and ResultSet.
115 |  |
          */
116 | 0 |
         protected void close(Connection conn, Statement stmt, ResultSet rs)
117 |  |
                 throws SQLException {
118 | 0 |
             DbUtils.close(conn);
119 | 0 |
             DbUtils.close(stmt);
120 | 0 |
             DbUtils.close(rs);
121 |  |
         }
122 |  |
123 |  |
         /**
124 |  |
          * Close a Connection, Statement and ResultSet.
125 |  |
          */
126 | 0 |
         protected void closeQuietly(Connection conn, Statement stmt, ResultSet rs) {
127 | 0 |
             DbUtils.closeQuietly(conn, stmt, rs);
128 |  |
         }
129 |  |
130 |  |
     }