db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1379317 - in /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque: manager/ util/
Date Fri, 31 Aug 2012 06:56:48 GMT
Author: tfischer
Date: Fri Aug 31 06:56:48 2012
New Revision: 1379317

URL: http://svn.apache.org/viewvc?rev=1379317&view=rev
Log:
javadoc & checkstyle

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodCacheKey.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
Fri Aug 31 06:56:48 2012
@@ -45,6 +45,7 @@ import org.apache.torque.om.Persistent;
  * This class contains common functionality of a Manager for
  * instantiating OM's.
  *
+ * @param <T> the class of the database object managed by this class.
  * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
  * @version $Id$
  */
@@ -75,8 +76,10 @@ public abstract class AbstractBaseManage
     /** Whether the cache manager has already registered its cache Listeners. */
     private boolean isNew = true;
 
+    /** The fields which are valid fields of interest for a listener. */
     protected Map<String, ?> validFields;
 
+    /** The listeners for this manager. */
     protected Map<String, FastArrayList> listenersMap
         = new HashMap<String, FastArrayList>();
 
@@ -434,7 +437,7 @@ public abstract class AbstractBaseManage
             if (newIds.size() > 0)
             {
                 List<T> newOms = retrieveStoredOMs(newIds);
-                for(T om : newOms)
+                for (T om : newOms)
                 {
                     omsMap.put(om.getPrimaryKey(), om);
                     if (fromCache)
@@ -549,26 +552,27 @@ public abstract class AbstractBaseManage
                     listeners = createSubsetList(key);
                 }
 
-                boolean isNew = true;
+                boolean isListenerNew = true;
                 Iterator<?> j = listeners.iterator();
                 while (j.hasNext())
                 {
                     Object listener2 =
                         ((WeakReference<?>) j.next()).get();
-                    if (listener2 == null)
+//                    if (listener2 == null)
+//                    {
+//                        // do a little cleanup while checking for dupes
+//                        // not thread-safe, not likely to be many nulls
+//                        // but should revisit
+//                        //j.remove();
+//                    }
+//                    else
+                    if (listener2 == listener)
                     {
-                        // do a little cleanup while checking for dupes
-                        // not thread-safe, not likely to be many nulls
-                        // but should revisit
-                        //j.remove();
-                    }
-                    else if (listener2 == listener)
-                    {
-                        isNew = false;
+                        isListenerNew = false;
                         break;
                     }
                 }
-                if (isNew)
+                if (isListenerNew)
                 {
                     listeners.add(new WeakReference<CacheListener<? extends Persistent>>(listener));
                 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
Fri Aug 31 06:56:48 2012
@@ -26,6 +26,7 @@ import org.apache.torque.om.Persistent;
 /**
  * Listener for cache events
  *
+ * @param <T> The database object class for which this instance is a listener.
  * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
  * @version $Id$
  */

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodCacheKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodCacheKey.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodCacheKey.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodCacheKey.java
Fri Aug 31 06:56:48 2012
@@ -25,6 +25,8 @@ import org.apache.commons.lang.builder.E
 import org.apache.commons.lang.builder.HashCodeBuilder;
 
 /**
+ * The key for the MethodResultCache.
+ *
  * @version $Id$
  */
 public class MethodCacheKey implements Serializable
@@ -34,9 +36,19 @@ public class MethodCacheKey implements S
      */
     private static final long serialVersionUID = -1831486431185021200L;
 
+    /**
+     * The Object on which the method is invoked.
+     * If the method is static, a String representing the class name is used.
+     */
     private Serializable instanceOrClass;
+
+    /** The method name. */
     private String method;
+
+    /** Optional arguments for the method. */
     private Serializable[] args;
+
+    /** The cache group key. */
     private String groupKey;
 
     public MethodCacheKey()

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java
Fri Aug 31 06:56:48 2012
@@ -38,7 +38,10 @@ import org.apache.torque.TorqueException
  */
 public class MethodResultCache
 {
+    /** The underlying jcs cache. */
     private GroupCacheAccess jcsCache;
+
+    /** All chache groups which are currently filled. */
     private Map<String, Object> groups;
 
     /** Logging */

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
Fri Aug 31 06:56:48 2012
@@ -24,7 +24,6 @@ import java.sql.Connection;
 import java.util.List;
 
 import org.apache.torque.TorqueException;
-import org.apache.torque.map.TableMap;
 import org.apache.torque.om.ObjectKey;
 import org.apache.torque.om.mapper.RecordMapper;
 
@@ -71,10 +70,10 @@ public abstract class BasePeer implement
         BasePeerImpl<?> peerImplInstance = basePeerImpl;
         if (peerImplInstance == null)
         {
-            peerImplInstance = new BasePeerImpl();
+            peerImplInstance = new BasePeerImpl<T>();
             basePeerImpl = peerImplInstance;
         }
-        return (BasePeerImpl<T>)peerImplInstance;
+        return (BasePeerImpl<T>) peerImplInstance;
     }
 
     /**

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
Fri Aug 31 06:56:48 2012
@@ -1257,9 +1257,9 @@ public class BasePeerImpl<T> implements 
 
         try
         {
-            connection = Transaction.begin((dbName == null) ?
-                    Torque.getDefaultDB() :
-                    dbName);
+            connection = Transaction.begin((dbName == null)
+                    ? Torque.getDefaultDB()
+                    : dbName);
 
             List<TT> result = doSelect(
                     query,

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
Fri Aug 31 06:56:48 2012
@@ -319,17 +319,17 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
-        String databaseName = (c.getDbName() == null) ?
-                Torque.getDefaultDB():
-                c.getDbName();
+        String databaseName = (c.getDbName() == null)
+                ? Torque.getDefaultDB()
+                : c.getDbName();
 
         BasePeerImpl<Integer> peer = new BasePeerImpl<Integer>(
                 new IntegerMapper(),
                 tableMap, databaseName);
 
-        List<Integer> result = (conn == null) ?
-            peer.doSelect(c) :
-            peer.doSelect(c, conn);
+        List<Integer> result = (conn == null)
+            ? peer.doSelect(c)
+            : peer.doSelect(c, conn);
 
         return result.get(0);
     }
@@ -374,17 +374,17 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
-        String databaseName = (c.getDbName() == null) ?
-                Torque.getDefaultDB():
-                c.getDbName();
+        String databaseName = (c.getDbName() == null)
+                ? Torque.getDefaultDB()
+                : c.getDbName();
 
         BasePeerImpl<Integer> peer = new BasePeerImpl<Integer>(
                 new IntegerMapper(),
                 tableMap, databaseName);
 
-        List<Integer> result = (conn == null) ?
-            peer.doSelect(c) :
-            peer.doSelect(c, conn);
+        List<Integer> result = (conn == null)
+            ? peer.doSelect(c)
+            : peer.doSelect(c, conn);
 
         return result.get(0);
     }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java?rev=1379317&r1=1379316&r2=1379317&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
Fri Aug 31 06:56:48 2012
@@ -756,7 +756,7 @@ public class SummaryHelper
         {
             ListOrderedMapCI rec = (ListOrderedMapCI) i.next();
             OrderedMapIterator rI = rec.orderedMapIterator();
-            StringBuilder heading= new StringBuilder();
+            StringBuilder heading = new StringBuilder();
             StringBuilder recString = new StringBuilder();
             while (rI.hasNext())
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message