001    /*
002    @license.text@
003     */
004    package biz.hammurapi.sql.hypersonic;
005    
006    import java.io.IOException;
007    import java.io.Reader;
008    import java.sql.SQLException;
009    
010    import biz.hammurapi.config.Context;
011    import biz.hammurapi.sql.ConnectionPerThreadDataSource;
012    import biz.hammurapi.sql.SQLProcessor;
013    import biz.hammurapi.sql.Transaction;
014    
015    
016    
017    /**
018     * Base class for HyperSonic data sources
019     * @author Pavel Vlasov 
020     * @version $Revision: 1.4 $
021     */
022    public class HypersonicDataSource extends ConnectionPerThreadDataSource {
023    
024            public HypersonicDataSource(
025                            String dbURL, 
026                            String user, 
027                            String password, 
028                            Transaction initConnectionTransaction) throws ClassNotFoundException {
029                    super("org.hsqldb.jdbcDriver", dbURL, user, password, initConnectionTransaction);
030            }
031    
032            /**
033             * @param scriptName Fully qualified name of a script to execute. E.g. org/hammurapi/results/persistent/jdbc/Hammurapi.Hypersonic.sql
034             * @throws SQLException
035             * @throws IOException
036             */
037            public void initDB(Reader scriptReader, Context nameMap) throws SQLException, IOException {
038                    new SQLProcessor(this, nameMap).executeScript(scriptReader);
039            }
040    }