Clover coverage report - JFox Service-Oriented Application Framework - 1.0
Coverage timestamp: 星期一 八月 21 2006 22:56:01 CST
file stats: LOC: 242   Methods: 0
NCLOC: 26   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
JdbcService.java - - - -
coverage
 1   
 /**
 2   
  * @(#)JdbcService.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.persistence;
 26   
 
 27   
 import java.sql.Connection;
 28   
 import java.sql.SQLException;
 29   
 
 30   
 import javax.sql.DataSource;
 31   
 
 32   
 import org.apache.commons.dbutils.ResultSetHandler;
 33   
 import org.huihoo.jfox.soaf.exception.DAOException;
 34   
 
 35   
 /**
 36   
  * <p>
 37   
  * JDBC persistence service wrapper.
 38   
  * </p>
 39   
  * 
 40   
  * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
 41   
  * @version $Revision: 1.1 $ $Date: 2006/02/15 08:45:44 $
 42   
  * @version Revision: 1.0
 43   
  */
 44   
 public interface JdbcService {
 45   
 
 46   
     /**
 47   
      * Set DataSource
 48   
      * 
 49   
      * @param dataSource
 50   
      */
 51   
     void setDataSource(DataSource dataSource);
 52   
 
 53   
     /**
 54   
      * Execute an SQL SELECT query with a single replacement parameter. The
 55   
      * caller is responsible for connection cleanup.
 56   
      * 
 57   
      * @param conn
 58   
      *            The connection to execute the query in.
 59   
      * @param sql
 60   
      *            The query to execute.
 61   
      * @param param
 62   
      *            The replacement parameter.
 63   
      * @param rsh
 64   
      *            The handler that converts the results into an object.
 65   
      * @return The object returned by the handler.
 66   
      * @throws SQLException
 67   
      */
 68   
     Object query(Connection conn, String sql, Object param, ResultSetHandler rsh)
 69   
             throws DAOException;
 70   
 
 71   
     /**
 72   
      * Execute an SQL SELECT query with replacement parameters. The caller is
 73   
      * responsible for connection cleanup.
 74   
      * 
 75   
      * @param conn
 76   
      *            The connection to execute the query in.
 77   
      * @param sql
 78   
      *            The query to execute.
 79   
      * @param params
 80   
      *            The replacement parameters.
 81   
      * @param rsh
 82   
      *            The handler that converts the results into an object.
 83   
      * @return The object returned by the handler.
 84   
      * @throws SQLException
 85   
      */
 86   
     Object query(Connection conn, String sql, Object[] params,
 87   
             ResultSetHandler rsh) throws DAOException;
 88   
 
 89   
     /**
 90   
      * Execute an SQL SELECT query without any replacement parameters. The
 91   
      * caller is responsible for connection cleanup.
 92   
      * 
 93   
      * @param conn
 94   
      *            The connection to execute the query in.
 95   
      * @param sql
 96   
      *            The query to execute.
 97   
      * @param rsh
 98   
      *            The handler that converts the results into an object.
 99   
      * @return The object returned by the handler.
 100   
      * @throws SQLException
 101   
      */
 102   
     Object query(Connection conn, String sql, ResultSetHandler rsh)
 103   
             throws DAOException;
 104   
 
 105   
     /**
 106   
      * Executes the given SELECT SQL with a single replacement parameter. The
 107   
      * <code>Connection</code> is retrieved from the <code>DataSource</code>.
 108   
      * 
 109   
      * @param sql
 110   
      *            The SQL statement to execute.
 111   
      * @param param
 112   
      *            The replacement parameter.
 113   
      * @param rsh
 114   
      *            The handler used to create the result object from the
 115   
      *            <code>ResultSet</code>.
 116   
      * 
 117   
      * @return An object generated by the handler.
 118   
      * @throws DAOException
 119   
      */
 120   
     Object query(String sql, Object param, ResultSetHandler rsh)
 121   
             throws DAOException;
 122   
 
 123   
     /**
 124   
      * Executes the given SELECT SQL query and returns a result object. The
 125   
      * <code>Connection</code> is retrieved from the <code>DataSource</code>.
 126   
      * 
 127   
      * @param sql
 128   
      *            The SQL statement to execute.
 129   
      * @param params
 130   
      *            Initialize the PreparedStatement's IN parameters with this
 131   
      *            array.
 132   
      * 
 133   
      * @param rsh
 134   
      *            The handler used to create the result object from the
 135   
      *            <code>ResultSet</code>.
 136   
      * 
 137   
      * @return An object generated by the handler.
 138   
      * @throws DAOException
 139   
      */
 140   
     Object query(String sql, Object[] params, ResultSetHandler rsh)
 141   
             throws DAOException;
 142   
 
 143   
     /**
 144   
      * Executes the given SELECT SQL without any replacement parameters. The
 145   
      * <code>Connection</code> is retrieved from the <code>DataSource</code>
 146   
      * set in the constructor.
 147   
      * 
 148   
      * @param sql
 149   
      *            The SQL statement to execute.
 150   
      * @param rsh
 151   
      *            The handler used to create the result object from the
 152   
      *            <code>ResultSet</code>.
 153   
      * 
 154   
      * @return An object generated by the handler.
 155   
      * @throws DAOException
 156   
      */
 157   
     Object query(String sql, ResultSetHandler rsh) throws DAOException;
 158   
 
 159   
     /**
 160   
      * Execute an SQL INSERT, UPDATE, or DELETE query without replacement
 161   
      * parameters.
 162   
      * 
 163   
      * @param conn
 164   
      *            The connection to use to run the query.
 165   
      * @param sql
 166   
      *            The SQL to execute.
 167   
      * @return The number of rows updated.
 168   
      * @throws SQLException
 169   
      */
 170   
     int update(Connection conn, String sql) throws DAOException;
 171   
 
 172   
     /**
 173   
      * Execute an SQL INSERT, UPDATE, or DELETE query with a single replacement
 174   
      * parameter.
 175   
      * 
 176   
      * @param conn
 177   
      *            The connection to use to run the query.
 178   
      * @param sql
 179   
      *            The SQL to execute.
 180   
      * @param param
 181   
      *            The replacement parameter.
 182   
      * @return The number of rows updated.
 183   
      * @throws SQLException
 184   
      */
 185   
     int update(Connection conn, String sql, Object param) throws DAOException;
 186   
 
 187   
     /**
 188   
      * Execute an SQL INSERT, UPDATE, or DELETE query.
 189   
      * 
 190   
      * @param conn
 191   
      *            The connection to use to run the query.
 192   
      * @param sql
 193   
      *            The SQL to execute.
 194   
      * @param params
 195   
      *            The query replacement parameters.
 196   
      * @return The number of rows updated.
 197   
      * @throws DAOException
 198   
      */
 199   
     int update(Connection conn, String sql, Object[] params)
 200   
             throws DAOException;
 201   
 
 202   
     /**
 203   
      * Executes the given INSERT, UPDATE, or DELETE SQL statement without any
 204   
      * replacement parameters. The <code>Connection</code> is retrieved from
 205   
      * the <code>DataSource</code>.
 206   
      * 
 207   
      * @param sql
 208   
      *            The SQL statement to execute.
 209   
      * @throws DAOException
 210   
      * @return The number of rows updated.
 211   
      */
 212   
     int update(String sql) throws DAOException;
 213   
 
 214   
     /**
 215   
      * Executes the given INSERT, UPDATE, or DELETE SQL statement with a single
 216   
      * replacement parameter. The <code>Connection</code> is retrieved from
 217   
      * the <code>DataSource</code> set in the constructor.
 218   
      * 
 219   
      * @param sql
 220   
      *            The SQL statement to execute.
 221   
      * @param param
 222   
      *            The replacement parameter.
 223   
      * @throws DAOException
 224   
      * @return The number of rows updated.
 225   
      */
 226   
     int update(String sql, Object param) throws DAOException;
 227   
 
 228   
     /**
 229   
      * Executes the given INSERT, UPDATE, or DELETE SQL statement. The
 230   
      * <code>Connection</code> is retrieved from the <code>DataSource</code>
 231   
      * set in the constructor.
 232   
      * 
 233   
      * @param sql
 234   
      *            The SQL statement to execute.
 235   
      * @param params
 236   
      *            Initializes the PreparedStatement's IN (i.e. '?') parameters.
 237   
      * @throws DAOException
 238   
      * @return The number of rows updated.
 239   
      */
 240   
     int update(String sql, Object[] params) throws DAOException;
 241   
 
 242   
 }