Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 74   Methods: 5
NCLOC: 44   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JDBCCacheLoaderConfig.java 100% 100% 100% 100%
coverage
 1    package org.jboss.cache.loader;
 2   
 3    import org.apache.commons.logging.Log;
 4    import org.apache.commons.logging.LogFactory;
 5    import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 6   
 7    import java.util.Properties;
 8   
 9    /**
 10    * Builds the different SQLs needed by <tt>JDBCCacheLoader</tt>.
 11    *
 12    * @author Mircea.Markus@iquestint.com
 13    * @version 1.0
 14    */
 15    public class JDBCCacheLoaderConfig extends AdjListJDBCCacheLoaderConfig
 16    {
 17   
 18    private static final long serialVersionUID = -8371846151643130271L;
 19   
 20    private static final Log log = LogFactory.getLog(JDBCCacheLoaderConfig.class);
 21   
 22    private String deleteNode;
 23    private String recursiveChildren;
 24    private String nodeCountSql;
 25   
 26   
 27  253 public JDBCCacheLoaderConfig(IndividualCacheLoaderConfig base)
 28    {
 29  253 super(base);
 30  253 setClassName(JDBCCacheLoader.class.getName());
 31    }
 32   
 33   
 34  253 public void setProperties(Properties props)
 35    {
 36  253 super.setProperties(props);
 37  253 String sqlConcat = props.getProperty("cache.jdbc.sql-concat");
 38  253 if (sqlConcat == null) {
 39  7 log.info("Missiing JDBCCacheLoader config 'cache.jdbc.sql-concat', using default value:'concat(1,2)'");
 40  7 sqlConcat = "concat(1,2)";
 41    }
 42  253 String startingWith = sqlConcat.replace('1', '?').replace("2", "'%'"); //concat(?, '%')
 43  253 String appendSepparator = sqlConcat.replace("1", fqnColumn).replace("2", "'/'"); //concat(fqnColumn, '/')
 44  253 deleteNode = "delete from " + table + " where " + appendSepparator + " like " + startingWith;
 45  253 recursiveChildren = "select " + fqnColumn + "," + nodeColumn + " from " + table + " where " + appendSepparator + " like " + startingWith;
 46  253 nodeCountSql = "select count(*) from " + table;
 47    }
 48   
 49   
 50    /**
 51    * Returns the sql string for removing a node and all its children.
 52    */
 53  6636 public String getDeleteNodeSql()
 54    {
 55  6636 return deleteNode;
 56    }
 57   
 58    /**
 59    * Returns an sql that will return a node and all its children.
 60    */
 61  16 public String getRecursiveChildrenSql()
 62    {
 63  16 return recursiveChildren;
 64    }
 65   
 66   
 67    /**
 68    * Returns an sql that will count all the persisted node.
 69    */
 70  246 public String getNodeCountSql()
 71    {
 72  246 return nodeCountSql;
 73    }
 74    }