You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by mp...@apache.org on 2003/05/18 14:27:25 UTC

cvs commit: db-torque/src/java/org/apache/torque/manager AbstractBaseManager.java CacheListener.java

mpoeschl    2003/05/18 05:27:24

  Modified:    src/java/org/apache/torque/util Transaction.java
               src/java/org/apache/torque/om NumberKey.java
               src/java/org/apache/torque/manager AbstractBaseManager.java
                        CacheListener.java
  Log:
  checkstyle and javadoc fixes
  
  Revision  Changes    Path
  1.8       +15 -11    db-torque/src/java/org/apache/torque/util/Transaction.java
  
  Index: Transaction.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/Transaction.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Transaction.java	14 May 2003 19:38:02 -0000	1.7
  +++ Transaction.java	18 May 2003 12:27:24 -0000	1.8
  @@ -69,13 +69,13 @@
    *
    * <p>
    * This can be used to handle cases where transaction support is optional.
  - * The second parameter of beginOptionalTransaction will determine with a transaction
  - * is used or not. If a transaction is not used, the commit and rollback methods
  + * The second parameter of beginOptionalTransaction will determine with a 
  + * transaction is used or not. 
  + * If a transaction is not used, the commit and rollback methods
    * do not have any effect. Instead it simply makes the logic easier to follow
    * by cutting down on the if statements based solely on whether a transaction
    * is needed or not.
    *
  - *
    * @author <a href="mailto:stephenh@chase3000.com">Stephen Haberman</a>
    * @version $Id$
    */
  @@ -92,7 +92,8 @@
        *
        * @param dbName Name of database.
        * @return The Connection for the transaction.
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       public static Connection begin(String dbName) throws TorqueException
       {
  @@ -107,7 +108,8 @@
        * @param dbName Name of database.
        * @param useTransaction If false, a transaction won't be used.
        * @return The Connection for the transaction.
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       public static Connection beginOptional(String dbName,
                                              boolean useTransaction)
  @@ -134,16 +136,17 @@
        * transactions, it only returns the connection.
        *
        * @param con The Connection for the transaction.
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       public static void commit(Connection con) throws TorqueException
       {
           if (con == null)
           {
               throw new NullPointerException("Connection object was null. "
  -                                           + "This could be due to a misconfiguration of the "
  -                                           + "DataSourceFactory. Check the logs and Torque.properties "
  -                                           + "to better determine the cause.");
  +                    + "This could be due to a misconfiguration of the "
  +                    + "DataSourceFactory. Check the logs and Torque.properties "
  +                    + "to better determine the cause.");
           }
   
           try
  @@ -172,7 +175,8 @@
        * connection.
        *
        * @param con The Connection for the transaction.
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       public static void rollback(Connection con) throws TorqueException
       {
  
  
  
  1.18      +3 -9      db-torque/src/java/org/apache/torque/om/NumberKey.java
  
  Index: NumberKey.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/om/NumberKey.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- NumberKey.java	30 Apr 2003 17:42:07 -0000	1.17
  +++ NumberKey.java	18 May 2003 12:27:24 -0000	1.18
  @@ -125,6 +125,8 @@
   
       /**
        * Creates a NumberKey equivalent to <code>key</code>.
  +     *
  +     * @param key the key value
        */
       public NumberKey(double key)
       {
  @@ -259,8 +261,6 @@
       /**
        * @param o the comparison value
        * @return a numeric comparison of the two values
  -     * @throws NullPointerException when the value of the NumberKey or the
  -     *         comparison value is null
        */
       public int compareTo(Object o)
       {
  @@ -288,7 +288,6 @@
        * {@link java.math.BigDecimal.byteValue()}
        *
        * @return the NumberKey converted to a byte
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public byte byteValue()
       {
  @@ -306,7 +305,6 @@
        * opposite sign.
        *
        * @return the NumberKey converted to an int
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public int intValue()
       {
  @@ -323,7 +321,6 @@
        * precision of the NumberKey value as well as return a result with the
        * opposite sign.
        *
  -     * @throws NullPointerException when the value of the NumberKey is null
        * @return the NumberKey converted to a short
        */
       public short shortValue()
  @@ -337,7 +334,6 @@
        * {@link java.math.BigDecimal.intValue()}
        *
        * @return the NumberKey converted to a long
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public long longValue()
       {
  @@ -353,7 +349,6 @@
        * or Float.POSITIVE_INFINITY as appropriate.
        *
        * @return the NumberKey converted to a float
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public float floatValue()
       {
  @@ -369,7 +364,6 @@
        * or Double.POSITIVE_INFINITY as appropriate.
        *
        * @return the NumberKey converted to a double
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public double doubleValue()
       {
  
  
  
  1.14      +87 -16    db-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java
  
  Index: AbstractBaseManager.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractBaseManager.java	14 May 2003 19:38:05 -0000	1.13
  +++ AbstractBaseManager.java	18 May 2003 12:27:24 -0000	1.14
  @@ -88,8 +88,7 @@
       implements Serializable
   {
       /** the log */
  -    protected static final Log log 
  -            = LogFactory.getLog(AbstractBaseManager.class);
  +    protected static Log log = LogFactory.getLog(AbstractBaseManager.class);
   
       /** used to cache the om objects. cache is set by the region property */
       protected transient GroupCacheAccess cache;
  @@ -156,7 +155,8 @@
       /**
        * Set the classname to instantiate for getInstance()
        * @param v  Value to assign to className.
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       public void setClassName(String  v)
           throws TorqueException
  @@ -178,7 +178,8 @@
        * Return an instance of an om based on the id
        *
        * @param id
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       protected Persistent getOMInstance(ObjectKey id)
           throws TorqueException
  @@ -189,7 +190,8 @@
       /**
        * Return an instance of an om based on the id
        *
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       protected Persistent getOMInstance(ObjectKey key, boolean fromCache)
           throws TorqueException
  @@ -234,6 +236,11 @@
           return om;
       }
   
  +    /**
  +     * 
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
  +     */
       protected void clearImpl()
           throws TorqueException
       {
  @@ -251,7 +258,13 @@
           }
       }
   
  -
  +    /**
  +     * 
  +     * @param key
  +     * @return
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
  +     */
       protected Persistent removeInstanceImpl(Serializable key)
           throws TorqueException
       {
  @@ -286,7 +299,13 @@
           return oldOm;
       }
   
  -
  +    /**
  +     * 
  +     * @param om
  +     * @return
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
  +     */
       protected Persistent putInstanceImpl(Persistent om)
           throws TorqueException
       {
  @@ -294,7 +313,14 @@
           return putInstanceImpl(key, om);
       }
   
  -
  +    /**
  +     * 
  +     * @param key
  +     * @param om
  +     * @return
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
  +     */
       protected Persistent putInstanceImpl(Serializable key, Persistent om)
           throws TorqueException
       {
  @@ -335,6 +361,13 @@
           return oldOm;
       }
   
  +    /**
  +     * 
  +     * @param id
  +     * @return
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
  +     */
       protected abstract Persistent retrieveStoredOM(ObjectKey id)
           throws TorqueException;
   
  @@ -343,7 +376,8 @@
        *
        * @param ids a <code>ObjectKey[]</code> value
        * @return a <code>List</code> value
  -     * @exception TorqueException if an error occurs
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       protected List getOMs(ObjectKey[] ids)
           throws TorqueException
  @@ -356,7 +390,8 @@
        *
        * @param ids a <code>List</code> of <code>ObjectKey</code>'s
        * @return a <code>List</code> value
  -     * @exception TorqueException if an error occurs
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       protected List getOMs(List ids)
           throws TorqueException
  @@ -369,7 +404,8 @@
        *
        * @param ids a <code>List</code> of <code>ObjectKey</code>'s
        * @return a <code>List</code> value
  -     * @exception TorqueException if an error occurs
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       protected List getOMs(List ids, boolean fromCache)
           throws TorqueException
  @@ -428,11 +464,19 @@
           return oms;
       }
   
  +    /**
  +     * 
  +     * @param ids
  +     * @return
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
  +     */
       protected abstract List retrieveStoredOMs(List ids)
           throws TorqueException;
   
       /**
        * Get the value of region.
  +     * 
        * @return value of region.
        */
       public String getRegion()
  @@ -444,7 +488,8 @@
        * Set the value of region.
        *
        * @param v  Value to assign to region.
  -     * @throws TorqueException
  +     * @throws TorqueException Any exceptions caught during processing will be
  +     *         rethrown wrapped into a TorqueException.
        */
       public void setRegion(String v)
           throws TorqueException
  @@ -496,7 +541,10 @@
       {
       }
   
  -
  +    /**
  +     * 
  +     * @param listener
  +     */
       public void addCacheListenerImpl(CacheListener listener)
       {
           List keys = listener.getInterestedFields();
  @@ -540,6 +588,11 @@
           }
       }
   
  +    /**
  +     * 
  +     * @param key
  +     * @return
  +     */
       private synchronized List createSubsetList(String key)
       {
           FastArrayList list = null;
  @@ -556,7 +609,12 @@
           return list;
       }
   
  -
  +    /**
  +     * 
  +     * @param listeners
  +     * @param oldOm
  +     * @param om
  +     */
       protected void notifyListeners(List listeners,
                                      Persistent oldOm, Persistent om)
       {
  @@ -592,13 +650,26 @@
           }
       }
   
  -    // helper methods for the Serializable interface
  +
  +    /**
  +     * helper methods for the Serializable interface
  +     * 
  +     * @param out
  +     * @throws IOException
  +     */
       private void writeObject(java.io.ObjectOutputStream out)
           throws IOException
       {
           out.defaultWriteObject();
       }
   
  +    /**
  +     * helper methods for the Serializable interface
  +     * 
  +     * @param in
  +     * @throws IOException
  +     * @throws ClassNotFoundException
  +     */
       private void readObject(java.io.ObjectInputStream in)
           throws IOException, ClassNotFoundException
       {
  
  
  
  1.3       +16 -2     db-torque/src/java/org/apache/torque/manager/CacheListener.java
  
  Index: CacheListener.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/manager/CacheListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CacheListener.java	29 Nov 2002 13:16:05 -0000	1.2
  +++ CacheListener.java	18 May 2003 12:27:24 -0000	1.3
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -65,8 +65,22 @@
    */
   public interface CacheListener
   {
  +    /**
  +     * 
  +     * @param om
  +     */
       void addedObject(Persistent om);
  +    
  +    /**
  +     * 
  +     * @param om
  +     */
       void refreshedObject(Persistent om);
  +    
       //public void removedObject(Persistent om);
  +    
  +    /**
  +     * 
  +     */
       List getInterestedFields();
   }