Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 88   Methods: 7
NCLOC: 49   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
JdbcDriverType.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * Joey and its relative products are published under the terms
 3   
  * of the Apache Software License.
 4   
  */
 5   
 /*
 6   
  * Created on 2004/02/22
 7   
  */
 8   
 package org.asyrinx.brownie.jdbc.util;
 9   
 
 10   
 import java.sql.Connection;
 11   
 import java.sql.DatabaseMetaData;
 12   
 import java.sql.SQLException;
 13   
 import java.util.HashMap;
 14   
 import java.util.Map;
 15   
 
 16   
 /**
 17   
  * @author akima
 18   
  */
 19   
 public class JdbcDriverType {
 20   
 
 21   
     /**
 22   
      *  
 23   
      */
 24  0
     protected JdbcDriverType(String productName, String innerName) {
 25  0
         super();
 26  0
         this.productName = productName;
 27  0
         this.innerName = innerName;
 28  0
         productMap.put(productName, this);
 29   
     }
 30   
 
 31   
     private static final Map productMap = new HashMap();
 32   
 
 33   
     private final String productName;
 34   
 
 35   
     private final String innerName;
 36   
 
 37   
     /**
 38   
      * @return
 39   
      */
 40  0
     public String getInnerName() {
 41  0
         return innerName;
 42   
     }
 43   
 
 44   
     /**
 45   
      * @return
 46   
      */
 47  0
     public String getProductName() {
 48  0
         return productName;
 49   
     }
 50   
 
 51   
     /**
 52   
      * @see java.lang.Object#toString()
 53   
      */
 54  0
     public String toString() {
 55  0
         return productName;
 56   
     }
 57   
 
 58  0
     public static JdbcDriverType get(String databaseProductName)
 59   
             throws SQLException {
 60  0
         final JdbcDriverType result = (JdbcDriverType) productMap
 61   
                 .get(databaseProductName);
 62  0
         if (result == null)
 63  0
             throw new SQLException("unknown kind of connection. ["
 64   
                     + databaseProductName
 65   
                     + "]. Now you can use these database."
 66   
                     + productMap.keySet());
 67  0
         return result;
 68   
     }
 69   
 
 70  0
     public static JdbcDriverType get(DatabaseMetaData metaData)
 71   
             throws SQLException {
 72  0
         return get(metaData.getDatabaseProductName());
 73   
     }
 74   
 
 75  0
     public static JdbcDriverType get(Connection connection) throws SQLException {
 76  0
         return get(connection.getMetaData());
 77   
     }
 78   
 
 79   
     public static final JdbcDriverType POSTGRESQL = new JdbcDriverType(
 80   
             "PostgreSQL", "postgresql");
 81   
 
 82   
     public static final JdbcDriverType HSQL = new JdbcDriverType(
 83   
             "HSQL Database Engine", "hsql");
 84   
 
 85   
     public static final JdbcDriverType MYSQL = new JdbcDriverType("MySQL",
 86   
             "mysql");
 87   
 
 88   
 }