From: Marcus <the...@us...> - 2004-03-27 20:45:37
|
Update of /cvsroot/junk/junk/WEB-INF/classes/junk/plugin/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6753 Modified Files: ConnectionProvider.java DatabasePlugin.java Log Message: minor changes Index: ConnectionProvider.java =================================================================== RCS file: /cvsroot/junk/junk/WEB-INF/classes/junk/plugin/database/ConnectionProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ConnectionProvider.java 24 Mar 2004 15:56:41 -0000 1.1 --- ConnectionProvider.java 27 Mar 2004 20:34:26 -0000 1.2 *************** *** 31,44 **** /** ! * interface to retrieve a database connection ! * @author flow */ public interface ConnectionProvider { /** ! * should return a connection to the configured database ! * the remarkable feature of this file is, that the comments are way larger ! * than the code itself. I love such stuff. ! * @throws SQLException might be thrown if the instatiaton of the connection ! * fails * @return a connection to the configured database */ --- 31,40 ---- /** ! * interface to retrieve a database connection. */ public interface ConnectionProvider { /** ! * should return a connection to the configured database. ! * @throws SQLException * @return a connection to the configured database */ Index: DatabasePlugin.java =================================================================== RCS file: /cvsroot/junk/junk/WEB-INF/classes/junk/plugin/database/DatabasePlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DatabasePlugin.java 24 Mar 2004 15:57:14 -0000 1.1 --- DatabasePlugin.java 27 Mar 2004 20:34:26 -0000 1.2 *************** *** 59,65 **** public static final String KEY_DATABASE_CON = "database-provider"; - /** the actionservlet of the struts application */ - private ActionServlet actionServlet = null; - /** * plugin configuration --- 59,62 ---- *************** *** 112,121 **** */ public void init(ActionServlet a, ModuleConfig m) ! throws ServletException { ! this.actionServlet = a; this.conf = PluginTools.getPluginConfig(DatabasePlugin.class, m); if (this.conf == null) { log.fatal("No database configuration found."); } --- 109,120 ---- */ public void init(ActionServlet a, ModuleConfig m) ! throws ServletException ! { this.conf = PluginTools.getPluginConfig(DatabasePlugin.class, m); if (this.conf == null) { log.fatal("No database configuration found."); + + return; } *************** *** 137,140 **** --- 136,145 ---- Connection con = DriverManager.getConnection(url, user, pass); con.close(); + a.getServletContext().setAttribute(KEY_DATABASE_CON, + (ConnectionProvider) this); + log.info("DatabasePlugin loaded ( [" + driver + "][" + url + "][" + + user + "] )"); + + return; } catch (SQLException e1) { log.fatal("Error while connecting to data source.", e1); *************** *** 146,154 **** log.fatal("Illegal access while instatiating JDBC driver.", e4); } - - this.actionServlet.getServletContext().setAttribute(DatabasePlugin.KEY_DATABASE_CON, - (ConnectionProvider) this); - log.info("DatabasePlugin loaded ( [" + driver + "][" + url + "][" - + user + "] )"); } } --- 151,154 ---- |