jmcnally    2002/06/22 09:54:05

  Modified:    .        project.xml
               src/java/org/apache/fulcrum/db DatabaseService.java
                        TurbineDB.java TurbineDatabaseService.java
               src/java/org/apache/fulcrum/security/impl/db/entity
                        TurbineGroupPeer.java TurbinePermissionPeer.java
                        TurbineRolePeer.java TurbineUserPeer.java
  Log:
  updated the security code to use the latest torque.  Also updated the db
  service, though this service should eventually be scrapped.
  
  Revision  Changes    Path
  1.37      +1 -3      jakarta-turbine-fulcrum/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/project.xml,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- project.xml       6 Jun 2002 17:39:22 -0000       1.36
  +++ project.xml       22 Jun 2002 16:54:04 -0000      1.37
  @@ -81,7 +81,6 @@
         <organization>Zenplex</organization>
       </developer>
     </developers>
  -
     <dependencies>
       <dependency>
         <id>bsf</id>
  @@ -156,7 +155,7 @@
       </dependency>
       <dependency>
         <id>torque</id>
  -      <version>3.0-b2</version>
  +      <version>3.0-b3-dev</version>
         <url>http://jakarta.apache.org/turbine/torque</url>
       </dependency>
       <dependency>
  @@ -192,7 +191,6 @@
         <version>2.1.0</version>
       </dependency>
     </dependencies>
  -
     <build>
       <nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress>
       <sourceDirectory>src/java</sourceDirectory>
  
  
  
  1.2       +10 -51    
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/db/DatabaseService.java
  
  Index: DatabaseService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/db/DatabaseService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DatabaseService.java      30 May 2002 02:27:11 -0000      1.1
  +++ DatabaseService.java      22 Jun 2002 16:54:05 -0000      1.2
  @@ -54,9 +54,9 @@
    * <http://www.apache.org/>.
    */
   
  +import java.sql.Connection;
   import org.apache.fulcrum.Service;
   import org.apache.torque.map.DatabaseMap;
  -import org.apache.torque.pool.DBConnection;
   import org.apache.torque.adapter.DB;
   
   /**
  @@ -73,11 +73,11 @@
    * {@link #registerPool(String,String,String,String,String)} method.
    *
    * <p> You can use {@link #getConnection(String)} to acquire a
  - * {@link org.apache.torque.pool.DBConnection} object, which in
  + * {@link java.sql.Connection} object, which in
    * turn can be used to create <code>java.sql.Statement</code> objects.
    *
  - * <p>When you are done using the <code>DBConnection</code> you 
<strong>must</strong>
  - * return it to the pool using {@link #releaseConnection(DBConnection)} method.
  + * <p>When you are done using the <code>Connection</code> you <strong>must</strong>
  + * return it to the pool using {@link #releaseConnection(Connection)} method.
    * This method call is often placed in <code>finally</code> clause of a <code>try /
    * catch</code> statement, to ensure that the connection is always returned
    * to the pool.<br>
  @@ -114,17 +114,17 @@
           throws Exception;
   
       /**
  -     * This method returns a DBConnection from the default pool.
  +     * This method returns a Connection from the default pool.
        *
        * @return The requested connection.
        * @throws Exception Any exceptions caught during processing will be
        *         rethrown wrapped into a Exception.
        */
  -    public DBConnection getConnection()
  +    public Connection getConnection()
           throws Exception;
   
       /**
  -     * This method returns a DBConnection from the pool with the
  +     * This method returns a Connection from the pool with the
        * specified name.  The pool must either have been registered
        * with the {@link #registerPool(String,String,String,String,String)}
        * method, or be specified in the property file using the
  @@ -142,29 +142,7 @@
        * @throws Exception Any exceptions caught during processing will be
        *         rethrown wrapped into a Exception.
        */
  -    public DBConnection getConnection(String name)
  -        throws Exception;
  -
  -
  -    /**
  -     * This method returns a DBConnecton using the given parameters.
  -     *
  -     * @param driver The fully-qualified name of the JDBC driver to use.
  -     * @param url The URL of the database from which the connection is
  -     * desired.
  -     * @param username The name of the database user.
  -     * @param password The password of the database user.
  -     * @return A DBConnection.
  -     * @throws Exception Any exceptions caught during processing will be
  -     *         rethrown wrapped into a Exception.
  -     *
  -     * @deprecated Database parameters should not be specified each
  -     * time a DBConnection is fetched from the service.
  -     */
  -    public DBConnection getConnection(String driver,
  -                                      String url,
  -                                      String username,
  -                                      String password)
  +    public Connection getConnection(String name)
           throws Exception;
   
       /**
  @@ -174,26 +152,7 @@
        *         rethrown wrapped into a Exception.
        * @exception Exception A generic exception.
        */
  -    public void releaseConnection(DBConnection dbconn)
  -        throws Exception;
  -
  -    /**
  -     * 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 Exception Any exceptions caught during processing will be
  -     *         rethrown wrapped into a Exception.
  -     */
  -    public void registerPool( String name,
  -                              String driver,
  -                              String url,
  -                              String username,
  -                              String password )
  +    public void releaseConnection(Connection dbconn)
           throws Exception;
   
   
  
  
  
  1.2       +8 -54     
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/db/TurbineDB.java
  
  Index: TurbineDB.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/db/TurbineDB.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TurbineDB.java    30 May 2002 02:27:12 -0000      1.1
  +++ TurbineDB.java    22 Jun 2002 16:54:05 -0000      1.2
  @@ -54,11 +54,11 @@
    * <http://www.apache.org/>.
    */
   
  +import java.sql.Connection;
   import org.apache.fulcrum.ServiceException;
   import org.apache.fulcrum.TurbineServices;
   import org.apache.torque.adapter.DB;
   import org.apache.torque.map.DatabaseMap;
  -import org.apache.torque.pool.DBConnection;
   
   /**
    * This class provides a common front end to the DatabaseService in Turbine.
  @@ -69,7 +69,7 @@
    * sample code below demonstrates the right way to get and release a database
    * connection (exception handling is application dependent):
    * <blockquote><code><pre>
  - * DBConnection dbConn = null;
  + * Connection dbConn = null;
    * try
    * {
    *     dbConn = TurbineDB.getConnection();
  @@ -169,20 +169,20 @@
       }
   
       /**
  -     * This method returns a DBConnection from the default pool.
  +     * This method returns a Connection from the default pool.
        *
        * @return The requested connection.
        * @throws ServiceException Any exceptions caught during processing will be
        *         rethrown wrapped into a ServiceException.
        */
  -    public static DBConnection getConnection()
  +    public static Connection getConnection()
           throws Exception
       {
           return getService().getConnection();
       }
   
       /**
  -     * This method returns a DBConnection from the pool with the
  +     * This method returns a Connection from the pool with the
        * specified name.  The pool must either have been registered
        * with the {@link #registerPool(String,String,String,String,String)}
        * method, or be specified in the property file using the
  @@ -200,7 +200,7 @@
        * @throws ServiceException Any exceptions caught during processing will be
        *         rethrown wrapped into a ServiceException.
        */
  -    public static DBConnection getConnection(String name)
  +    public static Connection getConnection(String name)
           throws Exception
       {
           return getService().getConnection(name);
  @@ -208,62 +208,16 @@
   
   
       /**
  -     * This method returns a DBConnecton using the given parameters.
  -     *
  -     * @param driver The fully-qualified name of the JDBC driver to use.
  -     * @param url The URL of the database from which the connection is
  -     * desired.
  -     * @param username The name of the database user.
  -     * @param password The password of the database user.
  -     * @return A DBConnection.
  -     * @throws ServiceException Any exceptions caught during processing will be
  -     *         rethrown wrapped into a ServiceException.
  -     *
  -     * @deprecated Database parameters should not be specified each
  -     * time a DBConnection is fetched from the service.
  -     */
  -    public static DBConnection getConnection(String driver,
  -                                      String url,
  -                                      String username,
  -                                      String password)
  -        throws Exception
  -    {
  -        return getService().getConnection(driver, url, username, password);
  -    }
  -
  -    /**
        * Release a connection back to the database pool.
        *
        * @throws ServiceException Any exceptions caught during processing will be
        *         rethrown wrapped into a ServiceException.
        * @exception Exception A generic exception.
        */
  -    public static void releaseConnection(DBConnection dbconn)
  +    public static void releaseConnection(Connection dbconn)
           throws Exception
       {
           getService().releaseConnection(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 ServiceException Any exceptions caught during processing will be
  -     *         rethrown wrapped into a ServiceException.
  -     */
  -    public static void registerPool( String name,
  -                              String driver,
  -                              String url,
  -                              String username,
  -                              String password )
  -        throws Exception
  -    {
  -        getService().registerPool(name, driver, url, username, password);
       }
   
       ///////////////////////////////////////////////////////////////////////////
  
  
  
  1.2       +10 -79    
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/db/TurbineDatabaseService.java
  
  Index: TurbineDatabaseService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/db/TurbineDatabaseService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TurbineDatabaseService.java       30 May 2002 02:27:12 -0000      1.1
  +++ TurbineDatabaseService.java       22 Jun 2002 16:54:05 -0000      1.2
  @@ -54,6 +54,7 @@
    * <http://www.apache.org/>.
    */
   
  +import java.sql.Connection;
   import org.apache.log4j.Category;
   import org.apache.fulcrum.BaseService;
   import org.apache.fulcrum.InitializationException;
  @@ -62,7 +63,7 @@
   import org.apache.torque.TorqueException;
   import org.apache.torque.adapter.DB;
   import org.apache.torque.map.DatabaseMap;
  -import org.apache.torque.pool.DBConnection;
  +import org.apache.torque.util.BasePeer;
   
   /**
    * Turbine's default implementation of {@link DatabaseService}.
  @@ -145,20 +146,20 @@
       }
   
       /**
  -     * This method returns a DBConnection from the default pool.
  +     * This method returns a Connection from the default pool.
        *
        * @return The requested connection.
        * @throws ServiceException Any exceptions caught during processing will be
        *         rethrown wrapped into a ServiceException.
        */
  -    public DBConnection getConnection()
  +    public Connection getConnection()
           throws Exception
       {
           return Torque.getConnection();
       }
   
       /**
  -     * This method returns a DBConnection from the pool with the
  +     * This method returns a Connection from the pool with the
        * specified name.  The pool must either have been registered
        * with the {@link #registerPool(String,String,String,String,String)}
        * method, or be specified in the property file using the
  @@ -176,7 +177,7 @@
        * @throws ServiceException Any exceptions caught during processing will be
        *         rethrown wrapped into a ServiceException.
        */
  -    public DBConnection getConnection(String name)
  +    public Connection getConnection(String name)
           throws Exception
       {
           // The getPool method ensures the validity of the returned pool.
  @@ -184,30 +185,6 @@
       }
   
       /**
  -     * This method returns a DBConnecton using the given parameters.
  -     *
  -     * @param driver The fully-qualified name of the JDBC driver to use.
  -     * @param url The URL of the database from which the connection is
  -     * desired.
  -     * @param username The name of the database user.
  -     * @param password The password of the database user.
  -     * @return A DBConnection.
  -     * @throws ServiceException Any exceptions caught during processing will be
  -     *         rethrown wrapped into a ServiceException.
  -     *
  -     * @deprecated Database parameters should not be specified each
  -     * time a DBConnection is fetched from the service.
  -     */
  -    public DBConnection getConnection(String driver,
  -                                      String url,
  -                                      String username,
  -                                      String password)
  -        throws Exception
  -    {
  -        return Torque.getConnection(driver, url, username, password);
  -    }
  -
  -    /**
        * Release a connection back to the database pool.  <code>null</code>
        * references are ignored.
        *
  @@ -215,58 +192,12 @@
        *         rethrown wrapped into a ServiceException.
        * @exception Exception A generic exception.
        */
  -    public void releaseConnection(DBConnection dbconn)
  -        throws Exception
  -    {
  -        Torque.releaseConnection(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 Exception Any exceptions caught during processing will be
  -     *         rethrown wrapped into a ServiceException.
  -     */
  -    public void registerPool( String name,
  -                              String driver,
  -                              String url,
  -                              String username,
  -                              String password )
  +    public void releaseConnection(Connection dbconn)
           throws Exception
       {
  -        Torque.registerPool(name,driver,url,username,password);
  +        BasePeer.closeConnection(dbconn);
       }
   
  -    /**
  -     * This thread-safe 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.
  -     * @exception Exception A generic exception.
  -     */
  -    public void registerPool( String name,
  -                              String driver,
  -                              String url,
  -                              String username,
  -                              String password,
  -                              int maxCons,
  -                              long expiryTime,
  -                              long maxConnectionAttempts,
  -                              long connectionWaitTimeout)
  -        throws Exception
  -    {
  -        Torque.registerPool(name,driver,url,username,password,maxCons,expiryTime,
  -            maxConnectionAttempts, connectionWaitTimeout);
  -    }
   
       /**
        * Returns the database adapter for the default connection pool.
  @@ -278,7 +209,7 @@
       public DB getDB()
           throws Exception
       {
  -        return Torque.getDB();
  +        return Torque.getDB(getDefaultDB());
       }
   
       /**
  
  
  
  1.2       +1 -2      
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbineGroupPeer.java
  
  Index: TurbineGroupPeer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbineGroupPeer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TurbineGroupPeer.java     30 May 2002 02:27:33 -0000      1.1
  +++ TurbineGroupPeer.java     22 Jun 2002 16:54:05 -0000      1.2
  @@ -58,7 +58,6 @@
   import java.util.List;
   import org.apache.fulcrum.security.impl.db.entity.map.TurbineGroupMapBuilder;
   import org.apache.torque.util.BasePeer;
  -import org.apache.torque.pool.DBConnection;
   import org.apache.torque.util.Criteria;
   import org.apache.fulcrum.security.entity.Group;
   import org.apache.fulcrum.security.entity.SecurityEntity;
  
  
  
  1.2       +1 -2      
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbinePermissionPeer.java
  
  Index: TurbinePermissionPeer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbinePermissionPeer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TurbinePermissionPeer.java        30 May 2002 02:27:33 -0000      1.1
  +++ TurbinePermissionPeer.java        22 Jun 2002 16:54:05 -0000      1.2
  @@ -60,7 +60,6 @@
   import org.apache.fulcrum.security.impl.db.entity.map.TurbinePermissionMapBuilder;
   import org.apache.torque.om.BaseObject;
   import org.apache.torque.util.BasePeer;
  -import org.apache.torque.pool.DBConnection;
   import org.apache.torque.util.Criteria;
   import org.apache.fulcrum.security.entity.Permission;
   import org.apache.fulcrum.security.entity.Role;
  
  
  
  1.2       +1 -2      
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbineRolePeer.java
  
  Index: TurbineRolePeer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbineRolePeer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TurbineRolePeer.java      30 May 2002 02:27:34 -0000      1.1
  +++ TurbineRolePeer.java      22 Jun 2002 16:54:05 -0000      1.2
  @@ -59,7 +59,6 @@
   import org.apache.fulcrum.security.impl.db.entity.UserPeer;
   import org.apache.torque.om.Persistent;
   import org.apache.torque.util.BasePeer;
  -import org.apache.torque.pool.DBConnection;
   import org.apache.torque.util.Criteria;
   import org.apache.fulcrum.security.TurbineSecurity;
   import org.apache.fulcrum.security.entity.Group;
  
  
  
  1.2       +1 -2      
jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbineUserPeer.java
  
  Index: TurbineUserPeer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/src/java/org/apache/fulcrum/security/impl/db/entity/TurbineUserPeer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TurbineUserPeer.java      30 May 2002 02:27:34 -0000      1.1
  +++ TurbineUserPeer.java      22 Jun 2002 16:54:05 -0000      1.2
  @@ -57,7 +57,6 @@
   import java.util.List;
   import org.apache.torque.TorqueException;
   import org.apache.torque.util.BasePeer;
  -import org.apache.torque.pool.DBConnection;
   import org.apache.torque.util.Criteria;
   import org.apache.fulcrum.security.TurbineSecurity;
   import org.apache.fulcrum.security.entity.User;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to