portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggol...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml JetspeedGroupProfilePeer.java JetspeedRoleProfilePeer.java JetspeedUserProfilePeer.java
Date Thu, 12 Sep 2002 13:38:01 GMT
ggolden     2002/09/12 06:38:00

  Modified:    src/java/org/apache/jetspeed/om/dbpsml
                        JetspeedGroupProfilePeer.java
                        JetspeedRoleProfilePeer.java
                        JetspeedUserProfilePeer.java
  Log:
  The DatabasePsmlManagerService now takes an optional parameter:
  database
  which can name a torque pool to use for all database access in the service.
  If not specified, the default pool is used.
  (Also tuned the logging).
  
  The JetspeedGroup/Role/UserProfilePeer classes were updated to take
  DBConnection parameters - the service gets the connection from the proper
  pool and gives it to the peers to use.
  
  Revision  Changes    Path
  1.7       +23 -16    jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedGroupProfilePeer.java
  
  Index: JetspeedGroupProfilePeer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedGroupProfilePeer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JetspeedGroupProfilePeer.java	26 Jul 2002 01:47:20 -0000	1.6
  +++ JetspeedGroupProfilePeer.java	12 Sep 2002 13:38:00 -0000	1.7
  @@ -10,6 +10,7 @@
   //Torque classes
   import org.apache.torque.util.Criteria;
   import org.apache.torque.util.BasePeer;
  +import org.apache.torque.pool.DBConnection;
   
   // Local classes
   import org.apache.jetspeed.om.dbpsml.map.*;
  @@ -50,24 +51,26 @@
        * Insert a group profile record in the database table.
        *
        * @param profile Profile object that will be inserted in the database
  +     * @param connection A database connection to use
        */
  -    public void insert(Profile profile) throws Exception
  +    public void insert(Profile profile, DBConnection connection) throws Exception
       {
  -        doInsertOrUpdate(profile, INSERT);
  +        doInsertOrUpdate(profile, INSERT, connection);
       }
   
       /**
        * Update group profile record from the database table.
        *
        * @param profile Profile object that will be deleted from the database
  +     * @param connection A database connection to use
        */
  -    public void update(Profile profile) throws Exception
  +    public void update(Profile profile, DBConnection connection) throws Exception
       {
  -        doInsertOrUpdate(profile, UPDATE);
  +        doInsertOrUpdate(profile, UPDATE, connection);
       }
   
   
  -    private void doInsertOrUpdate(Profile profile, int operation)
  +    private void doInsertOrUpdate(Profile profile, int operation, DBConnection connection)
                              throws Exception
       {
           JetspeedGroupProfile groupProfile = new JetspeedGroupProfile();
  @@ -92,14 +95,14 @@
   
           if (operation == INSERT) 
           {
  -            super.doInsert(groupProfile);
  +            super.doInsert(groupProfile, connection);
           }
           else if (operation == UPDATE) 
           {
               Criteria values = buildCriteria(groupProfile);
               Criteria select = buildCriteria(groupProfile);
               select.remove(PROFILE);
  -            BasePeer.doUpdate( select, values );                               
  +            BasePeer.doUpdate( select, values, connection );                          
    
           }
       }
   
  @@ -108,10 +111,11 @@
        * Delete group profile record from the database table.
        *  
        * @param profile Profile object that will be deleted from the database
  +     * @param connection A database connection to use
        */ 
  -    public void delete(ProfileLocator locator) throws Exception
  +    public void delete(ProfileLocator locator, DBConnection connection) throws Exception
       {   
  -        super.doDelete(buildCriteria(locator));
  +        super.doDelete(buildCriteria(locator), connection);
       }
   
       /**
  @@ -120,11 +124,12 @@
        *
        * @param locator ProfileLocator object that will be used to select required
        * profile from the database
  +     * @param connection A database connection to use
        * @return Vector of records that statisfy the given locator criteria.
        */
  -    public Vector select(ProfileLocator locator) throws Exception
  +    public Vector select(ProfileLocator locator, DBConnection connection) throws Exception
       {
  -        return super.doSelect(buildCriteria(locator));
  +        return super.doSelect(buildCriteria(locator), connection);
       }
   
       /**
  @@ -133,9 +138,10 @@
        *
        * @param locator ProfileLocator object that will be used to select required
        * profile from the database
  +     * @param connection A database connection to use
        * @return Vector of records that statisfy the given locator criteria.
        */
  -    public Vector selectOrdered(ProfileLocator locator) throws Exception
  +    public Vector selectOrdered(ProfileLocator locator, DBConnection connection) throws
Exception
       {
           Criteria criteria = buildCriteria(locator);
   
  @@ -145,21 +151,22 @@
           criteria.addAscendingOrderByColumn(COUNTRY);
           criteria.addAscendingOrderByColumn(PAGE);
   
  -        return super.doSelect(criteria);
  +        return super.doSelect(criteria, connection);
       }
   
       /** 
        * Delete all records from the database table for a group.
        *   
        * @param group Group object for which all the records will be deleted from the database
  +     * @param connection A database connection to use
        */  
  -    public void delete(Group group) throws Exception
  +    public void delete(Group group, DBConnection connection) throws Exception
       {   
           Criteria criteria = new Criteria();
    
           criteria.add(GROUP_NAME, group.getName());
   
  -        super.doDelete(criteria);
  +        super.doDelete(criteria, connection);
       }
   
   
  
  
  
  1.7       +25 -18    jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedRoleProfilePeer.java
  
  Index: JetspeedRoleProfilePeer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedRoleProfilePeer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JetspeedRoleProfilePeer.java	26 Jul 2002 01:47:20 -0000	1.6
  +++ JetspeedRoleProfilePeer.java	12 Sep 2002 13:38:00 -0000	1.7
  @@ -11,6 +11,7 @@
   //Torque classes
   import org.apache.torque.util.Criteria;
   import org.apache.torque.util.BasePeer;
  +import org.apache.torque.pool.DBConnection;
   
   // Local classes
   import org.apache.jetspeed.om.dbpsml.map.*;
  @@ -50,25 +51,27 @@
       /** 
        * Insert a role profile record in the database table.
        * 
  -     * @param profile Profile object that will be inserted in the database 
  +     * @param profile Profile object that will be inserted in the database
  +     * @param connection A database connection to use
        */
  -    public void insert(Profile profile) throws Exception
  +    public void insert(Profile profile, DBConnection connection) throws Exception
       {
  -        doInsertOrUpdate(profile, INSERT);
  +        doInsertOrUpdate(profile, INSERT, connection);
       }
   
       /**
        * Update role profile record from the database table.
        *
        * @param profile Profile object that will be deleted from the database
  +     * @param connection A database connection to use
        */
  -    public void update(Profile profile) throws Exception
  +    public void update(Profile profile, DBConnection connection) throws Exception
       {
  -        doInsertOrUpdate(profile, UPDATE);
  +        doInsertOrUpdate(profile, UPDATE, connection);
       }
   
   
  -    private void doInsertOrUpdate(Profile profile, int operation)
  +    private void doInsertOrUpdate(Profile profile, int operation, DBConnection connection)
                              throws Exception
       {
           JetspeedRoleProfile roleProfile = new JetspeedRoleProfile();
  @@ -93,25 +96,26 @@
   
           if (operation == INSERT)
           {
  -            super.doInsert(roleProfile);
  +            super.doInsert(roleProfile, connection);
           }
           else if (operation == UPDATE)
           {
               Criteria values = buildCriteria(roleProfile);
               Criteria select = buildCriteria(roleProfile);
               select.remove(PROFILE);
  -            BasePeer.doUpdate( select, values );                   
  +            BasePeer.doUpdate( select, values, connection );                   
           }
       }   
    
       /** 
        * Delete role profile record from the database table. 
        *   
  -     * @param profile Profile object that will be deleted from the database 
  +     * @param profile Profile object that will be deleted from the database
  +     * @param connection A database connection to use
        */  
  -    public void delete(ProfileLocator locator) throws Exception
  +    public void delete(ProfileLocator locator, DBConnection connection) throws Exception
       {   
  -        super.doDelete(buildCriteria(locator)); 
  +        super.doDelete(buildCriteria(locator), connection); 
       }   
   
       /**
  @@ -120,11 +124,12 @@
        *
        * @param locator ProfileLocator object that will be used to select required
        * profile from the database
  +     * @param connection A database connection to use
        * @return Vector of records that statisfy the given locator criteria.
        */
  -    public Vector select(ProfileLocator locator) throws Exception
  +    public Vector select(ProfileLocator locator, DBConnection connection) throws Exception
       {
  -        return super.doSelect(buildCriteria(locator));
  +        return super.doSelect(buildCriteria(locator), connection);
       }
   
       /**
  @@ -133,9 +138,10 @@
        *
        * @param locator ProfileLocator object that will be used to select required
        * profile from the database
  +     * @param connection A database connection to use
        * @return Vector of records that statisfy the given locator criteria.
        */
  -    public Vector selectOrdered(ProfileLocator locator) throws Exception
  +    public Vector selectOrdered(ProfileLocator locator, DBConnection connection) throws
Exception
       {
           Criteria criteria = buildCriteria(locator);
           
  @@ -145,21 +151,22 @@
           criteria.addAscendingOrderByColumn(COUNTRY);
           criteria.addAscendingOrderByColumn(PAGE);
   
  -        return super.doSelect(criteria);
  +        return super.doSelect(criteria, connection);
       }
   
       /** 
        * Delete all records from the database table for a role.
        *   
        * @param role Role object for which all the records will be deleted from the database
  +     * @param connection A database connection to use
        */  
  -    public void delete(Role role) throws Exception
  +    public void delete(Role role, DBConnection connection) throws Exception
       {   
           Criteria criteria = new Criteria();
    
           criteria.add(ROLE_NAME, role.getName());
   
  -        super.doDelete(criteria);
  +        super.doDelete(criteria, connection);
       }
   
       /*
  
  
  
  1.8       +23 -16    jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedUserProfilePeer.java
  
  Index: JetspeedUserProfilePeer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedUserProfilePeer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JetspeedUserProfilePeer.java	13 Aug 2002 22:12:06 -0000	1.7
  +++ JetspeedUserProfilePeer.java	12 Sep 2002 13:38:00 -0000	1.8
  @@ -15,6 +15,7 @@
   //Torque classes
   import org.apache.torque.util.Criteria;
   import org.apache.torque.util.BasePeer;
  +import org.apache.torque.pool.DBConnection;
   
   import org.apache.turbine.om.NumberKey;
   
  @@ -58,23 +59,25 @@
        * Insert a user profile record in the database table.
        *
        * @param profile Profile object that will be inserted in the database
  +     * @param connection A database connection to use
        */
  -    public void insert(Profile profile) throws Exception
  +    public void insert(Profile profile, DBConnection connection) throws Exception
       {
  -        doInsertOrUpdate(profile, INSERT);
  +        doInsertOrUpdate(profile, INSERT, connection);
       }  
   
       /**
        * Insert a user profile record in the database table.
        *
        * @param profile Profile object that will be inserted in the database
  +     * @param connection A database connection to use
        */
  -    public void update(Profile profile) throws Exception
  +    public void update(Profile profile, DBConnection connection) throws Exception
       {
  -        doInsertOrUpdate(profile, UPDATE);
  +        doInsertOrUpdate(profile, UPDATE, connection);
       }  
   
  -    private void doInsertOrUpdate(Profile profile, int operation) 
  +    private void doInsertOrUpdate(Profile profile, int operation, DBConnection connection)

                            throws Exception 
       {
           JetspeedUserProfile userProfile = new JetspeedUserProfile();
  @@ -100,14 +103,14 @@
                                  
           if (operation == INSERT) 
           {
  -            super.doInsert(userProfile);
  +            super.doInsert(userProfile, connection);
           } 
           else if (operation == UPDATE) 
           {
               Criteria values = buildCriteria(userProfile);
               Criteria select = buildCriteria(userProfile);
               select.remove(PROFILE);
  -            BasePeer.doUpdate( select, values );
  +            BasePeer.doUpdate( select, values, connection );
           }             
       }  
    
  @@ -116,10 +119,11 @@
        * Delete user profile record from the database table.
        *   
        * @param profile Profile object that will be deleted from the database
  +     * @param connection A database connection to use
        */  
  -    public void delete(ProfileLocator locator) throws Exception
  +    public void delete(ProfileLocator locator, DBConnection connection) throws Exception
       {    
  -        super.doDelete(buildCriteria(locator));
  +        super.doDelete(buildCriteria(locator), connection);
       }
   
       /**
  @@ -128,12 +132,13 @@
        *
        * @param locator ProfileLocator object that will be used to select required
        * profile from the database
  +     * @param connection A database connection to use
        * @return Vector of records that statisfy the given locator criteria.
        */
  -    public Vector select(ProfileLocator locator) throws Exception
  +    public Vector select(ProfileLocator locator, DBConnection connection) throws Exception
       {
           Criteria criteria = buildCriteria(locator);
  -        return super.doSelect(criteria); // buildCriteria(locator));        
  +        return super.doSelect(criteria, connection); // buildCriteria(locator));      
 
       }
   
       /**
  @@ -142,9 +147,10 @@
        *
        * @param locator ProfileLocator object that will be used to select required
        * profile from the database
  +     * @param connection A database connection to use
        * @return Vector of records that statisfy the given locator criteria.
        */
  -    public Vector selectOrdered(ProfileLocator locator) throws Exception
  +    public Vector selectOrdered(ProfileLocator locator, DBConnection connection) throws
Exception
       {
           Criteria criteria = buildCriteria(locator);
   
  @@ -154,7 +160,7 @@
           criteria.addAscendingOrderByColumn(COUNTRY);
           criteria.addAscendingOrderByColumn(PAGE);
   
  -        return super.doSelect(criteria);        
  +        return super.doSelect(criteria, connection);        
       }
   
   
  @@ -162,14 +168,15 @@
        * Delete all records from the database table for a user.
        *   
        * @param user User object for which all the records will be deleted from the database
  +     * @param connection A database connection to use
        */  
  -    public void delete(JetspeedUser user) throws Exception
  +    public void delete(JetspeedUser user, DBConnection connection) throws Exception
       {   
           Criteria criteria = new Criteria(); 
   
           criteria.add(USER_NAME, user.getUserName());
    
  -        super.doDelete(criteria);
  +        super.doDelete(criteria, connection);
       }
   
       /*
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message