|
From: Michael K. <ko...@us...> - 2004-07-05 07:58:58
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23424/db Modified Files: DBAccess.java DBAccessImpl.java Log Message: Moved resource loading to new ResourceUtil class. Index: DBAccessImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccessImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- DBAccessImpl.java 24 Jun 2004 06:55:36 -0000 1.8 +++ DBAccessImpl.java 5 Jul 2004 07:58:01 -0000 1.9 @@ -25,6 +25,7 @@ import org.cobricks.core.CobricksException; import org.cobricks.core.CoreManager; import org.cobricks.core.util.LogUtil; +import org.cobricks.core.util.ResourceUtil; import org.cobricks.user.*; @@ -208,6 +209,7 @@ // for all components check subdirectory db, load the tables.txt file // and then load all files referenced in this file String components = properties.getProperty("components"); + if (components == null) return; StringTokenizer st = new StringTokenizer(components, ","); while (st.hasMoreTokens()) { String compname = st.nextToken(); @@ -218,8 +220,8 @@ } List tables = new ArrayList(); try { - InputStream is = coreManager. - getComponentResourceAsStream(compname, "db/tables.txt"); + InputStream is = + ResourceUtil.getComponentResourceAsStream(compname, "db/tables.txt"); if (is == null) continue; BufferedReader in = new BufferedReader(new InputStreamReader(is)); if (in == null) continue; @@ -258,8 +260,8 @@ tableDescriptors.put(tablename, td); } String resourcename = "/"+compname.replace('.', '/')+"/db/"+tablename+".xml"; - InputStream is = coreManager. - getComponentResourceAsStream(compname, "db/"+tablename+".xml"); + InputStream is = + ResourceUtil.getComponentResourceAsStream(compname, "db/"+tablename+".xml"); if (is == null) return null; td.readFromInputStream(is); return tablename; @@ -1157,6 +1159,12 @@ } } + + public Connection getConnection() + throws SQLException + { + return dataSource.getConnection(); + } } Index: DBAccess.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccess.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- DBAccess.java 24 Jun 2004 06:55:35 -0000 1.5 +++ DBAccess.java 5 Jul 2004 07:58:01 -0000 1.6 @@ -13,7 +13,12 @@ package org.cobricks.core.db; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.sql.Connection; +import java.sql.SQLException; import org.cobricks.core.CobricksException; import org.cobricks.core.CoreManager; @@ -80,4 +85,7 @@ // convert a generic type name to a database specific type name public String getColumnTypeForCreateTable(String coltype); + public Connection getConnection() + throws SQLException; + } |