remm 02/02/22 12:11:51 Modified: catalina/src/share/org/apache/naming/factory Tag: tomcat_40_branch TyrexDataSourceFactory.java TyrexTransactionFactory.java Log: - Port patch. - Improve error logging for the Tyrex data sources. - Always return a ServerDataSource (EnabledDataSource is not as useful by itself). Revision Changes Path No revision No revision 1.3.2.1 +30 -20 jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexDataSourceFactory.java Index: TyrexDataSourceFactory.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexDataSourceFactory.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- TyrexDataSourceFactory.java 12 Jul 2001 08:07:27 -0000 1.3 +++ TyrexDataSourceFactory.java 22 Feb 2002 20:11:50 -0000 1.3.2.1 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexDataSourceFactory.java,v 1.3 2001/07/12 08:07:27 remm Exp $ - * $Revision: 1.3 $ - * $Date: 2001/07/12 08:07:27 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexDataSourceFactory.java,v 1.3.2.1 2002/02/22 20:11:50 remm Exp $ + * $Revision: 1.3.2.1 $ + * $Date: 2002/02/22 20:11:50 $ * * ==================================================================== * @@ -102,7 +102,7 @@ * </ul> * * @author Remy Maucherat - * @version $Revision: 1.3 $ $Date: 2001/07/12 08:07:27 $ + * @version $Revision: 1.3.2.1 $ $Date: 2002/02/22 20:11:50 $ */ public class TyrexDataSourceFactory @@ -211,26 +211,21 @@ Driver databaseDriver = (Driver) driverClass.newInstance(); DriverManager.registerDriver(databaseDriver); - if (ref.getClassName().equals - ("tyrex.jdbc.ServerDataSource")) { - - ServerDataSource sds = - new ServerDataSource((javax.sql.XADataSource) ds); - - currentRefAddr = ref.get(DESCRIPTION); - if (currentRefAddr != null) - sds.setDescription - (currentRefAddr.getContent().toString()); - - return sds; - + ServerDataSource sds = + new ServerDataSource((javax.sql.XADataSource) ds); + + currentRefAddr = ref.get(DESCRIPTION); + if (currentRefAddr != null) { + sds.setDescription + (currentRefAddr.getContent().toString()); } - return ds; + return sds; } catch (Throwable t) { - // Another factory could handle this, so just give up - return null; + log("Cannot create DataSource, Exception", t); + throw new NamingException + ("Exception creating DataSource: " + t.getMessage()); } } else { @@ -241,6 +236,21 @@ return null; } + } + + + // -------------------------------------------------------- Private Methods + + + private void log(String message) { + System.out.print("TyrexDataSourceFactory: "); + System.out.println(message); + } + + + private void log(String message, Throwable exception) { + log(message); + exception.printStackTrace(System.out); } 1.2.4.1 +22 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexTransactionFactory.java Index: TyrexTransactionFactory.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexTransactionFactory.java,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -r1.2 -r1.2.4.1 --- TyrexTransactionFactory.java 4 Nov 2000 22:27:07 -0000 1.2 +++ TyrexTransactionFactory.java 22 Feb 2002 20:11:50 -0000 1.2.4.1 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexTransactionFactory.java,v 1.2 2000/11/04 22:27:07 remm Exp $ - * $Revision: 1.2 $ - * $Date: 2000/11/04 22:27:07 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexTransactionFactory.java,v 1.2.4.1 2002/02/22 20:11:50 remm Exp $ + * $Revision: 1.2.4.1 $ + * $Date: 2002/02/22 20:11:50 $ * * ==================================================================== * @@ -81,7 +81,7 @@ * for more details about Tyrex and downloads. * * @author Remy Maucherat - * @version $Revision: 1.2 $ $Date: 2000/11/04 22:27:07 $ + * @version $Revision: 1.2.4.1 $ $Date: 2002/02/22 20:11:50 $ */ public class TyrexTransactionFactory @@ -122,11 +122,9 @@ return Tyrex.getUserTransaction(); } catch (Throwable t) { - // TEMP - t.printStackTrace(); - // END TEMP - // Another factory could handle this, so just give up - return null; + log("Cannot create Transaction, Exception", t); + throw new NamingException + ("Exception creating Transaction: " + t.getMessage()); } } @@ -135,6 +133,21 @@ return null; + } + + + // -------------------------------------------------------- Private Methods + + + private void log(String message) { + System.out.print("TyrexTransactionFactory: "); + System.out.println(message); + } + + + private void log(String message, Throwable exception) { + log(message); + exception.printStackTrace(System.out); }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>