mpoeschl 2002/12/15 05:06:31
Modified: src/java/org/apache/turbine/services/db TurbineDB.java
conf Fulcrum.properties TurbineResources.properties
conf/master TurbineResources.master meta.properties
Removed: src/java/org/apache/turbine/services/db
MapBrokerService.java PoolBrokerService.java
TurbineMapBrokerService.java
TurbinePoolBrokerService.java
Log:
o remove MapBroker and PoolBroker services
o TurbineDB is left as a facade for Torque
Revision Changes Path
1.6 +36 -102
jakarta-turbine-2/src/java/org/apache/turbine/services/db/TurbineDB.java
Index: TurbineDB.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/db/TurbineDB.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineDB.java 12 Jul 2002 20:46:55 -0000 1.5
+++ TurbineDB.java 15 Dec 2002 13:06:31 -0000 1.6
@@ -55,6 +55,7 @@
*/
import java.sql.Connection;
+import org.apache.torque.Torque;
import org.apache.torque.adapter.DB;
import org.apache.torque.map.DatabaseMap;
import org.apache.turbine.services.TurbineServices;
@@ -81,20 +82,13 @@
* }
* finally
* {
- * try
- * {
- * dbConn.close();
- * }
- * catch (Exception e)
- * {
- * // Error releasing database connection back to pool.
- * }
+ * Torque.closeConnection(dbConn);
* }
* </pre></code></blockquote>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @version $Id$
- * @deprecated use org.apache.torque.Torque
+ * @deprecated As of Turbine 2.2, use org.apache.torque.Torque
*/
public abstract class TurbineDB
{
@@ -115,16 +109,7 @@
// hit of catching the exception will only happen
// once and while running torque from the command
// line it won't incur an unbearable wait.
- try
- {
- return getMapBroker().getDefaultMap();
- }
- catch(Exception e)
- {
- // do nothing
- }
-
- return MapBrokerService.DEFAULT;
+ return Torque.getDefaultDB();
}
/**
@@ -134,10 +119,16 @@
* @throws TurbineException Any exceptions caught during processing will be
* rethrown wrapped into a TurbineException.
*/
- public static DatabaseMap getDatabaseMap()
- throws TurbineException
+ public static DatabaseMap getDatabaseMap() throws TurbineException
{
- return getMapBroker().getDatabaseMap();
+ try
+ {
+ return Torque.getDatabaseMap();
+ }
+ catch (Exception ex)
+ {
+ throw new TurbineException(ex);
+ }
}
/**
@@ -151,9 +142,16 @@
* rethrown wrapped into a TurbineException.
*/
public static DatabaseMap getDatabaseMap(String name)
- throws TurbineException
+ throws TurbineException
{
- return getMapBroker().getDatabaseMap(name);
+ try
+ {
+ return Torque.getDatabaseMap(name);
+ }
+ catch (Exception ex)
+ {
+ throw new TurbineException(ex);
+ }
}
///////////////////////////////////////////////////////////////////////////
@@ -173,16 +171,7 @@
// hit of catching the exception will only happen
// once and while running torque from the command
// line it won't incur an unbearable wait.
- try
- {
- return getPoolBroker().getDefaultDB();
- }
- catch(Exception e)
- {
- // do nothing
- }
-
- return PoolBrokerService.DEFAULT;
+ return Torque.getDefaultDB();
}
/**
@@ -192,10 +181,9 @@
* @throws Exception Any exceptions caught during processing will be
* rethrown wrapped into a TurbineException.
*/
- public static Connection getConnection()
- throws Exception
+ public static Connection getConnection() throws Exception
{
- return getPoolBroker().getConnection();
+ return Torque.getConnection();
}
/**
@@ -217,48 +205,22 @@
* @throws Exception Any exceptions caught during processing will be
* rethrown wrapped into a TurbineException.
*/
- public static Connection getConnection(String name)
- throws Exception
+ public static Connection getConnection(String name) throws Exception
{
- return getPoolBroker().getConnection(name);
+ return Torque.getConnection(name);
}
/**
* Release a connection back to the database pool.
*
- * @throws TurbineException Any exceptions caught during processing will be
- * rethrown wrapped into a TurbineException.
- * @exception Exception A generic exception.
+ * @param dbconn the connection to release
+ * @throws Exception A generic exception.
*/
- public static void releaseConnection(Connection dbconn)
- throws Exception
+ public static void releaseConnection(Connection dbconn) throws Exception
{
- getPoolBroker().releaseConnection(dbconn);
+ Torque.closeConnection(dbconn);
}
- /**
- * This method registers a new pool using the given parameters.
- *
- * @param name The name of the pool to register.
- * @param driver The fully-qualified name of the JDBC driver to use.
- * @param url The URL of the database to use.
- * @param username The name of the database user.
- * @param password The password of the database user.
- *
- * @throws TurbineException Any exceptions caught during processing will be
- * rethrown wrapped into a TurbineException.
- */
-/*
- public static void registerPool( String name,
- String driver,
- String url,
- String username,
- String password )
- throws Exception
- {
- getPoolBroker().registerPool(name, driver, url, username, password);
- }
-*/
///////////////////////////////////////////////////////////////////////////
// DB Adapters
///////////////////////////////////////////////////////////////////////////
@@ -270,10 +232,9 @@
* @throws Exception Any exceptions caught during processing will be
* rethrown wrapped into a TurbineException.
*/
- public static DB getDB()
- throws Exception
+ public static DB getDB() throws Exception
{
- return getPoolBroker().getDB();
+ return Torque.getDB(Torque.getDefaultDB());
}
/**
@@ -284,35 +245,8 @@
* @throws Exception Any exceptions caught during processing will be
* rethrown wrapped into a TurbineException.
*/
- public static DB getDB(String name)
- throws Exception
- {
- return getPoolBroker().getDB(name);
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Service access
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * Returns the system's configured MapBrokerService implementation.
- *
- * @return a MapBrokerService
- */
- private static MapBrokerService getMapBroker()
- {
- return (MapBrokerService)TurbineServices.getInstance().getService(
- MapBrokerService.SERVICE_NAME);
- }
-
- /**
- * Returns the system's configured PoolBrokerService implementation.
- *
- * @return a PoolBrokerService
- */
- private static PoolBrokerService getPoolBroker()
+ public static DB getDB(String name) throws Exception
{
- return (PoolBrokerService)TurbineServices.getInstance().getService(
- PoolBrokerService.SERVICE_NAME);
+ return Torque.getDB(name);
}
}
1.2 +0 -70 jakarta-turbine-2/conf/Fulcrum.properties
Index: Fulcrum.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/conf/Fulcrum.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Fulcrum.properties 15 Mar 2002 16:57:23 -0000 1.1
+++ Fulcrum.properties 15 Dec 2002 13:06:31 -0000 1.2
@@ -21,7 +21,6 @@
services.XmlRpcService.classname=org.apache.fulcrum.xmlrpc.TurbineXmlRpcService
services.UploadService.classname=org.apache.fulcrum.upload.TurbineUploadService
services.SecurityService.classname=org.apache.fulcrum.security.impl.db.DBSecurityService
-#services.DatabaseService.classname=org.apache.fulcrum.db.TurbineDatabaseService
services.XSLTService.classname=org.apache.fulcrum.xslt.TurbineXSLTService
services.BSFService.classname=org.apache.fulcrum.bsf.TurbineBSFService
services.GlobalCacheService.classname=org.apache.fulcrum.cache.TurbineGlobalCacheService
@@ -31,75 +30,6 @@
# Turn on the appropriate template service.
services.VelocityService.classname=org.apache.turbine.services.velocity.TurbineVelocityService
-
-# -------------------------------------------------------------------
-#
-# D A T A B A S E S E R V I C E
-#
-# -------------------------------------------------------------------
-# These are your database settings. Look in the
-# org.apache.turbine.util.db.pool.* packages for more information.
-# The default driver for Turbine is for MySQL.
-#
-# The parameters to connect to the default database. You MUST
-# configure these properly.
-# -------------------------------------------------------------------
-
-services.DatabaseService.database.default=default
-
-services.DatabaseService.database.default.driver=org.gjt.mm.mysql.Driver
-services.DatabaseService.database.default.url=jdbc:mysql://localhost:3306/Turbine
-services.DatabaseService.database.default.username=username
-services.DatabaseService.database.default.password=password
-
-# The number of database connections to cache per ConnectionPool
-# instance (specified per database).
-
-services.DatabaseService.database.default.maxConnections=3
-
-# The amount of time (in milliseconds) that database connections will be
-# cached (specified per database).
-#
-# Default: one hour = 60 * 60 * 1000
-
-services.DatabaseService.database.default.expiryTime=3600000
-
-# The amount of time (in milliseconds) a connection request will have to wait
-# before a time out occurs and an error is thrown.
-#
-# Default: ten seconds = 10 * 1000
-
-services.DatabaseService.database.connectionWaitTimeout=10000
-
-# The interval (in milliseconds) between which the PoolBrokerService logs
-# the status of it's ConnectionPools.
-#
-# Default: No logging = 0 = 0 * 1000
-
-services.DatabaseService.database.logInterval=0
-
-# These are the supported JDBC drivers and their associated Turbine
-# adapter. These properties are used by the DBFactory. You can add
-# all the drivers you want here.
-
-services.DatabaseService.database.adapter=DBMM
-services.DatabaseService.database.adapter.DBMM=org.gjt.mm.mysql.Driver
-
-# Determines if the quantity column of the IDBroker's id_table should
-# be increased automatically if requests for ids reaches a high
-# volume.
-
-services.DatabaseService.idbroker.cleverquantity=true
-
-# Determines if IDBroker should prefetch IDs or not. If set to false
-# this property has the effect of shutting off the housekeeping thread
-# that attempts to prefetch the id's. It also sets the # of id's grabbed
-# per request to 1 regardless of the settings in the database.
-# Default: true
-
-services.DatabaseService.idbroker.prefetch=true
-
-services.DatabaseService.earlyInit = true
# -------------------------------------------------------------------
#
1.19 +1 -14 jakarta-turbine-2/conf/TurbineResources.properties
Index: TurbineResources.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/conf/TurbineResources.properties,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TurbineResources.properties 13 Dec 2002 07:40:53 -0000 1.18
+++ TurbineResources.properties 15 Dec 2002 13:06:31 -0000 1.19
@@ -369,8 +369,6 @@
services.UniqueIdService.classname=org.apache.turbine.services.uniqueid.TurbineUniqueIdService
services.UploadService.classname=org.apache.turbine.services.upload.TurbineUploadService
services.SecurityService.classname=org.apache.turbine.services.security.db.DBSecurityService
-services.PoolBrokerService.classname=org.apache.turbine.services.db.TurbinePoolBrokerService
-services.MapBrokerService.classname=org.apache.turbine.services.db.TurbineMapBrokerService
services.PullService.classname=org.apache.turbine.services.pull.TurbinePullService
#services.IntakeService.classname=org.apache.turbine.services.intake.TurbineIntakeService
services.TemplateService.classname=org.apache.turbine.services.template.TurbineTemplateService
@@ -378,17 +376,6 @@
# Turn on the appropriate template service.
services.VelocityService.classname=org.apache.turbine.services.velocity.TurbineVelocityService
-
-# -------------------------------------------------------------------
-#
-# P O O L / M A P B R O K E R
-#
-# -------------------------------------------------------------------
-# Default value: default
-# -------------------------------------------------------------------
-
-services.PoolBrokerService.defaultPool = default
-services.MapBrokerService.defaultMap = default
# -------------------------------------------------------------------
#
1.18 +1 -14 jakarta-turbine-2/conf/master/TurbineResources.master
Index: TurbineResources.master
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/conf/master/TurbineResources.master,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- TurbineResources.master 13 Dec 2002 07:40:54 -0000 1.17
+++ TurbineResources.master 15 Dec 2002 13:06:31 -0000 1.18
@@ -369,8 +369,6 @@
services.UniqueIdService.classname=org.apache.turbine.services.uniqueid.TurbineUniqueIdService
services.UploadService.classname=org.apache.turbine.services.upload.TurbineUploadService
services.SecurityService.classname=org.apache.turbine.services.security.db.DBSecurityService
-services.PoolBrokerService.classname=org.apache.turbine.services.db.TurbinePoolBrokerService
-services.MapBrokerService.classname=org.apache.turbine.services.db.TurbineMapBrokerService
services.PullService.classname=org.apache.turbine.services.pull.TurbinePullService
#services.IntakeService.classname=org.apache.turbine.services.intake.TurbineIntakeService
services.TemplateService.classname=org.apache.turbine.services.template.TurbineTemplateService
@@ -378,17 +376,6 @@
# Turn on the appropriate template service.
@TEMPLATE_SERVICE@
-
-# -------------------------------------------------------------------
-#
-# P O O L / M A P B R O K E R
-#
-# -------------------------------------------------------------------
-# Default value: default
-# -------------------------------------------------------------------
-
-services.PoolBrokerService.defaultPool = @DATABASE_DEFAULT@
-services.MapBrokerService.defaultMap = @DATABASE_DEFAULT@
# -------------------------------------------------------------------
#
1.3 +0 -6 jakarta-turbine-2/conf/master/meta.properties
Index: meta.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/conf/master/meta.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- meta.properties 13 Dec 2002 07:40:54 -0000 1.2
+++ meta.properties 15 Dec 2002 13:06:31 -0000 1.3
@@ -1,9 +1,3 @@
-# Supported databases types are in the turbine/conf/database directory.
-database.type=mysql
-database.name=Turbine
-database.user=username
-database.password=password
-
view.type=velocity
turbine.log=/logs/turbine.log
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>