001 /* 002 @license.text@ 003 */ 004 package biz.hammurapi.sql.hypersonic; 005 006 import java.io.IOException; 007 import java.sql.SQLException; 008 009 import biz.hammurapi.config.ConfigurationException; 010 011 public class HypersonicTmpDataSourceComponent extends HypersonicDataSourceComponent { 012 013 private HypersonicTmpDataSource master; 014 015 public HypersonicTmpDataSourceComponent() { 016 super(); 017 } 018 019 public Object getMaster() { 020 if (master==null) { 021 throw new IllegalStateException("Not yet started"); 022 } 023 return master; 024 } 025 026 public void start() throws ConfigurationException { 027 try { 028 master=new HypersonicTmpDataSource(getReader()); 029 } catch (ClassNotFoundException e) { 030 throw new ConfigurationException("Driver class not found", e); 031 } catch (IOException e) { 032 throw new ConfigurationException("Could not initialize database: "+e, e); 033 } catch (SQLException e) { 034 throw new ConfigurationException("Could not initialize database: "+e, e); 035 } 036 } 037 038 public void stop() throws ConfigurationException { 039 if (master!=null) { 040 master.shutdown(); 041 } 042 } 043 }