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 2002/11/29 14:16:05 UTC

cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/manager AbstractBaseManager.java CacheListener.java MethodCacheKey.java MethodResultCache.java

mpoeschl    2002/11/29 05:16:05

  Modified:    src/java/org/apache/torque/manager AbstractBaseManager.java
                        CacheListener.java MethodCacheKey.java
                        MethodResultCache.java
  Log:
  o checkstyle fixes
  
  Revision  Changes    Path
  1.11      +28 -11    jakarta-turbine-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java
  
  Index: AbstractBaseManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractBaseManager.java	17 Aug 2002 00:06:45 -0000	1.10
  +++ AbstractBaseManager.java	29 Nov 2002 13:16:05 -0000	1.11
  @@ -85,11 +85,12 @@
   public abstract class AbstractBaseManager
       implements Serializable
   {
  +    /** the log */
       protected static final Category category =
           Category.getInstance(AbstractBaseManager.class.getName());
   
       /** used to cache the om objects. cache is set by the region property */
  -    transient protected GroupCacheAccess cache;
  +    protected transient GroupCacheAccess cache;
   
       /** method results cache */
       protected MethodResultCache mrCache;
  @@ -110,6 +111,8 @@
   
       /**
        * Get the Class instance
  +     *
  +     * @return the om class
        */
       protected Class getOMClass()
       {
  @@ -118,6 +121,8 @@
   
       /**
        * Set the Class that will be instantiated by this manager
  +     *
  +     * @param omClass the om class
        */
       protected void setOMClass(Class omClass)
       {
  @@ -126,6 +131,10 @@
   
       /**
        * Get a fresh instance of an om
  +     *
  +     * @return an instance of the om class
  +     * @throws InstantiationException
  +     * @throws IllegalAccessException
        */
       protected Persistent getOMInstance()
           throws InstantiationException, IllegalAccessException
  @@ -145,6 +154,7 @@
       /**
        * Set the classname to instantiate for getInstance()
        * @param v  Value to assign to className.
  +     * @throws TorqueException
        */
       public void setClassName(String  v)
           throws TorqueException
  @@ -164,6 +174,9 @@
   
       /**
        * Return an instance of an om based on the id
  +     *
  +     * @param id
  +     * @throws TorqueException
        */
       protected Persistent getOMInstance(ObjectKey id)
           throws TorqueException
  @@ -173,6 +186,8 @@
   
       /**
        * Return an instance of an om based on the id
  +     *
  +     * @throws TorqueException
        */
       protected Persistent getOMInstance(ObjectKey key, boolean fromCache)
           throws TorqueException
  @@ -284,8 +299,8 @@
           if (getOMClass() != null && !getOMClass().isInstance(om))
           {
               throw new TorqueException(om + "; class=" + om.getClass().getName()
  -                + "; id=" + om.getPrimaryKey() + " cannot be cached with " +
  -                getOMClass().getName() + " objects");
  +                + "; id=" + om.getPrimaryKey() + " cannot be cached with "
  +                + getOMClass().getName() + " objects");
           }
   
           Persistent oldOm = null;
  @@ -358,7 +373,7 @@
           throws TorqueException
       {
           List oms = null;
  -        if ( ids != null && ids.size() > 0 )
  +        if (ids != null && ids.size() > 0)
           {
               // start a new list where we will replace the id's with om's
               oms = new ArrayList(ids);
  @@ -381,14 +396,14 @@
                   }
               }
   
  -            if ( newIds.size() > 0 )
  +            if (newIds.size() > 0)
               {
                   List newOms = retrieveStoredOMs(newIds);
                   for (int i = 0; i < oms.size(); i++)
                   {
                       if (oms.get(i) instanceof ObjectKey)
                       {
  -                        for (int j=newOms.size() - 1; j >= 0; j--)
  +                        for (int j = newOms.size() - 1; j >= 0; j--)
                           {
                               Persistent om = (Persistent) newOms.get(j);
                               if (om.getPrimaryKey().equals(oms.get(i)))
  @@ -425,7 +440,9 @@
   
       /**
        * Set the value of region.
  +     *
        * @param v  Value to assign to region.
  +     * @throws TorqueException
        */
       public void setRegion(String v)
           throws TorqueException
  @@ -433,12 +450,12 @@
           this.region = v;
           try
           {
  -            if (Torque.getConfiguration().getBoolean(Torque.CACHE_KEY)) 
  +            if (Torque.getConfiguration().getBoolean(Torque.CACHE_KEY))
               {
                   cache = JCS.getInstance(getRegion());
  -                mrCache = new MethodResultCache(cache);              
  +                mrCache = new MethodResultCache(cache);
               }
  -            else 
  +            else
               {
                   mrCache = new NoOpMethodResultCache(cache);
               }
  @@ -521,7 +538,7 @@
           }
       }
   
  -    synchronized private List createSubsetList(String key)
  +    private synchronized List createSubsetList(String key)
       {
           FastArrayList list = null;
           if (listenersMap.containsKey(key))
  
  
  
  1.2       +4 -4      jakarta-turbine-torque/src/java/org/apache/torque/manager/CacheListener.java
  
  Index: CacheListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/CacheListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CacheListener.java	13 Mar 2002 21:31:23 -0000	1.1
  +++ CacheListener.java	29 Nov 2002 13:16:05 -0000	1.2
  @@ -65,8 +65,8 @@
    */
   public interface CacheListener
   {
  -    public void addedObject(Persistent om);
  -    public void refreshedObject(Persistent om);
  +    void addedObject(Persistent om);
  +    void refreshedObject(Persistent om);
       //public void removedObject(Persistent om);
  -    public List getInterestedFields();
  +    List getInterestedFields();
   }
  
  
  
  1.8       +4 -5      jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodCacheKey.java
  
  Index: MethodCacheKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodCacheKey.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MethodCacheKey.java	16 Jul 2002 14:57:28 -0000	1.7
  +++ MethodCacheKey.java	29 Nov 2002 13:16:05 -0000	1.8
  @@ -1,6 +1,5 @@
   package org.apache.torque.manager;
   
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -180,7 +179,7 @@
       /**
        * Initialize key for method with more than two arguments.
        *
  -     * @param Serializable[] where
  +     * @param keys Serializable[] where
        * [0]=>the Object on which the method is invoked
        * if the method is static, a String representing the class name is used.
        * [1]=>the method name
  @@ -264,8 +263,8 @@
                       {
                           for (int i = 5; i < n + 2; i++)
                           {
  -                            h+= (moreThanThree[i] == null ?
  -                                 0 : moreThanThree[i].hashCode());
  +                            h += (moreThanThree[i] == null ? 0
  +                                    : moreThanThree[i].hashCode());
                           }
                       }
                   }
  @@ -325,7 +324,7 @@
           public void passivateObject(Object obj)
               throws Exception
           {
  -            MethodCacheKey key = (MethodCacheKey)obj;
  +            MethodCacheKey key = (MethodCacheKey) obj;
               if (key.instanceOrClass == null && key.method == null)
               {
                   throw new TorqueException(
  
  
  
  1.13      +18 -33    jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodResultCache.java
  
  Index: MethodResultCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodResultCache.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- MethodResultCache.java	7 Aug 2002 06:34:03 -0000	1.12
  +++ MethodResultCache.java	29 Nov 2002 13:16:05 -0000	1.13
  @@ -73,6 +73,7 @@
    */
   public class MethodResultCache
   {
  +    /** the log */
       private static final Category log =
           Category.getInstance("org.apache.torque");
   
  @@ -228,8 +229,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method);
                   result = getImpl(key);
                   try
  @@ -258,8 +258,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method, arg1);
                   result = getImpl(key);
                   try
  @@ -288,8 +287,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method, arg1, arg2);
                   result = getImpl(key);
                   try
  @@ -319,8 +317,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method, arg1, arg2, arg3);
                   result = getImpl(key);
                   try
  @@ -348,8 +345,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(keys);
                   result = getImpl(key);
                   try
  @@ -374,8 +370,7 @@
       {
           try
           {
  -            MethodCacheKey key =
  -                (MethodCacheKey)pool.borrowObject();
  +            MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
               key.init(instanceOrClass, method);
               putImpl(key, value);
           }
  @@ -390,8 +385,7 @@
       {
           try
           {
  -            MethodCacheKey key =
  -                (MethodCacheKey)pool.borrowObject();
  +            MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
               key.init(instanceOrClass, method, arg1);
               putImpl(key, value);
           }
  @@ -406,8 +400,7 @@
       {
           try
           {
  -            MethodCacheKey key =
  -                (MethodCacheKey)pool.borrowObject();
  +            MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
               key.init(instanceOrClass, method, arg1, arg2);
               putImpl(key, value);
           }
  @@ -422,8 +415,7 @@
       {
           try
           {
  -            MethodCacheKey key =
  -                (MethodCacheKey)pool.borrowObject();
  +            MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
               key.init(instanceOrClass, method, arg1, arg2, arg3);
               putImpl(key, value);
           }
  @@ -437,8 +429,7 @@
       {
           try
           {
  -            MethodCacheKey key =
  -                (MethodCacheKey)pool.borrowObject();
  +            MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
               key.init(keys);
               putImpl(key, value);
           }
  @@ -455,8 +446,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method);
                   String groupName = key.getGroupKey();
                   jcsCache.invalidateGroup(groupName);
  @@ -486,8 +476,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method);
                   result = removeImpl(key);
                   try
  @@ -516,8 +505,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method, arg1);
                   result = removeImpl(key);
                   try
  @@ -546,8 +534,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method, arg1, arg2);
                   result = removeImpl(key);
                   try
  @@ -577,8 +564,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(instanceOrClass, method, arg1, arg2, arg3);
                   result = removeImpl(key);
                   try
  @@ -606,8 +592,7 @@
           {
               try
               {
  -                MethodCacheKey key =
  -                    (MethodCacheKey)pool.borrowObject();
  +                MethodCacheKey key = (MethodCacheKey) pool.borrowObject();
                   key.init(keys);
                   result = removeImpl(key);
                   try