You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2002/03/06 04:48:15 UTC

cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/om AbstractBaseManager.java

jmcnally    02/03/05 19:48:15

  Modified:    src/templates/om BaseManager.vm
               src/java/org/apache/torque/om AbstractBaseManager.java
  Log:
  throw TorqueExceptions
  
  Revision  Changes    Path
  1.2       +28 -19    jakarta-turbine-torque/src/templates/om/BaseManager.vm
  
  Index: BaseManager.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/BaseManager.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseManager.vm	2 Mar 2002 02:23:55 -0000	1.1
  +++ BaseManager.vm	6 Mar 2002 03:48:15 -0000	1.2
  @@ -1,6 +1,6 @@
   #*
    * author <a href="mailto:jmcnally@collab.net">John McNally</a>
  - * version $Id: BaseManager.vm,v 1.1 2002/03/02 02:23:55 jmcnally Exp $
  + * version $Id: BaseManager.vm,v 1.2 2002/03/06 03:48:15 jmcnally Exp $
    *#
   
   #set ($db = $table.Database)
  @@ -55,7 +55,7 @@
        * @exception Exception if an error occurs
        */
       public static ${table.JavaName} getInstance()
  -        throws Exception
  +        throws TorqueException
       {
           return getManager().getInstance();
       }
  @@ -68,7 +68,7 @@
        * @exception Exception if an error occurs
        */
       public static ${table.JavaName} getInstance(ObjectKey id)
  -        throws Exception
  +        throws TorqueException
       {
           return getManager().getInstanceImpl(id);
       }
  @@ -81,7 +81,7 @@
        * @exception Exception if an error occurs
        */
       public static ${table.JavaName} getInstance(ObjectKey id, boolean fromCache)
  -        throws Exception
  +        throws TorqueException
       {
           return getManager().getInstanceImpl(id, fromCache);
       }
  @@ -94,7 +94,7 @@
        * @exception Exception if an error occurs
        */
       public static List getInstances(List ids)
  -        throws Exception
  +        throws TorqueException
       {
           return getManager().getInstancesImpl(ids);
       }
  @@ -107,25 +107,25 @@
        * @exception Exception if an error occurs
        */
       public static List getInstances(List ids, boolean fromCache)
  -        throws Exception
  -    {
  +        throws TorqueException
  +    {    
           return getManager().getInstancesImpl(ids, fromCache);
       }
   
       public static void putInstance(Persistent om)
  -        throws Exception
  +        throws TorqueException
       {
           getManager().putInstanceImpl(om);
       }
   
       public static void clear()
  -        throws Exception
  +        throws TorqueException
       {
           getManager().clearImpl();
       }
   
       public static boolean exists(${table.JavaName} obj)
  -        throws Exception
  +        throws TorqueException
       {
           return getManager().existsImpl(obj);
       }
  @@ -147,9 +147,18 @@
        * Get a fresh instance of a ${table.JavaName}Manager
        */
       protected ${table.JavaName} getInstanceImpl()
  -        throws Exception
  +        throws TorqueException
       {
  -        return (${table.JavaName}) getOMInstance();
  +        ${table.JavaName} obj = null;
  +        try
  +        {
  +            obj = (${table.JavaName}) getOMInstance();
  +        }
  +        catch (Exception e)
  +        {
  +            throw new TorqueException(e);
  +        }
  +        return obj;
       }
   
   
  @@ -159,7 +168,7 @@
        * @param id <code>ObjectKey</code> value
        */
       protected ${table.JavaName} getInstanceImpl(ObjectKey id)
  -        throws Exception
  +        throws TorqueException
       {
           return (${table.JavaName}) getOMInstance(id);
       }
  @@ -172,7 +181,7 @@
        * from storage.
        */
       protected ${table.JavaName} getInstanceImpl(ObjectKey id, boolean fromCache)
  -        throws Exception
  +        throws TorqueException
       {
           return (${table.JavaName}) getOMInstance(id, fromCache);
       }
  @@ -185,7 +194,7 @@
        * @exception Exception if an error occurs
        */
       protected List getInstancesImpl(List ids) 
  -        throws Exception
  +        throws TorqueException
       {
           return getOMs(ids);
       }
  @@ -200,7 +209,7 @@
        * @exception Exception if an error occurs
        */
       protected List getInstancesImpl(List ids, boolean fromCache) 
  -        throws Exception
  +        throws TorqueException
       {
           return getOMs(ids, fromCache);
       }
  @@ -209,7 +218,7 @@
        * check for a duplicate project name
        */
       protected boolean existsImpl(${table.JavaName} om)
  -        throws Exception
  +        throws TorqueException
       {
           Criteria crit = ${table.JavaName}Peer.buildCriteria(om);
           return ${table.JavaName}Peer.doSelect(crit).size() > 0;
  @@ -223,7 +232,7 @@
   
   
       protected Persistent retrieveStoredOM(ObjectKey id)
  -        throws Exception
  +        throws TorqueException
       {
           return ${table.JavaName}Peer.${retrieveMethod}(id);
       }
  @@ -236,7 +245,7 @@
        * @exception Exception if an error occurs
        */
       protected List retrieveStoredOMs(List ids) 
  -        throws Exception
  +        throws TorqueException
       {
           return ${table.JavaName}Peer.${retrieveMethod}s(ids);
       }
  
  
  
  1.2       +8 -8      jakarta-turbine-torque/src/java/org/apache/torque/om/AbstractBaseManager.java
  
  Index: AbstractBaseManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/AbstractBaseManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractBaseManager.java	2 Mar 2002 02:23:55 -0000	1.1
  +++ AbstractBaseManager.java	6 Mar 2002 03:48:15 -0000	1.2
  @@ -64,7 +64,7 @@
    * instantiating OM's.
    *
    * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
  - * @version $Id: AbstractBaseManager.java,v 1.1 2002/03/02 02:23:55 jmcnally Exp $
  + * @version $Id: AbstractBaseManager.java,v 1.2 2002/03/06 03:48:15 jmcnally Exp $
    */
   public abstract class AbstractBaseManager 
   {
  @@ -141,7 +141,7 @@
        * Return an instance of an om based on the id
        */
       protected Persistent getOMInstance(ObjectKey id) 
  -        throws Exception
  +        throws TorqueException
       {
           return getOMInstance(id, true);
       }
  @@ -150,7 +150,7 @@
        * Return an instance of an om based on the id
        */
       protected Persistent getOMInstance(ObjectKey id, boolean fromCache) 
  -        throws Exception
  +        throws TorqueException
       {
           String key = id.toString();
           Persistent om = null;
  @@ -242,7 +242,7 @@
       }
   
       protected abstract Persistent retrieveStoredOM(ObjectKey id)
  -        throws Exception;
  +        throws TorqueException;
   
       /**
        * Gets a list of om's based on id's.
  @@ -252,7 +252,7 @@
        * @exception Exception if an error occurs
        */
       protected List getOMs(ObjectKey[] ids) 
  -        throws Exception
  +        throws TorqueException
       {
           return getOMs(Arrays.asList(ids));
       }
  @@ -265,7 +265,7 @@
        * @exception Exception if an error occurs
        */
       protected List getOMs(List ids) 
  -        throws Exception
  +        throws TorqueException
       {
           return getOMs(ids, true);
       }
  @@ -278,7 +278,7 @@
        * @exception Exception if an error occurs
        */
       protected List getOMs(List ids, boolean fromCache) 
  -        throws Exception
  +        throws TorqueException
       {
           List oms = null;
           if ( ids != null && ids.size() > 0 ) 
  @@ -336,7 +336,7 @@
       }
   
       protected abstract List retrieveStoredOMs(List ids)
  -        throws Exception;
  +        throws TorqueException;
   
       /**
        * Get the value of region.
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>