[cvs] expresso commit by lhamel: cosmetic formatting only

JCorporate Ltd jcorp at jcorporate.com
Sun Feb 20 22:10:57 UTC 2005


Log Message:
-----------
cosmetic formatting only

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj:
        CacheUtils.java

Revision Data
-------------
Index: CacheUtils.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java -u -r1.12 -r1.13
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java
@@ -98,8 +98,7 @@
      * @param theDBObj the object to add to the cache.
      * @throws DBException upon add error (either Cache related or dbobject related)
      */
-    public void addModifiedToCache(DBObject theDBObj) throws DBException
-    {
+    public void addModifiedToCache(DBObject theDBObj) throws DBException {
         JDBCObjectMetaData metadata = theDBObj.getJDBCMetaData();
         String theClassName = theDBObj.getClass().getName();
 
@@ -123,26 +122,82 @@
             return;
         }
         try {
-            prepareCache(cs,cacheSize,theClassName);
-			DBObject newObj = null;
+            prepareCache(cs, cacheSize, theClassName);
+            DBObject newObj = null;
             if (cs.existsCache(theDBObj.getClass().getName())) {
 //				DBObject oldDBObj = (DBObject) cs.getItem(theDBObj.getClass().getName(), theDBObj.getKey());
-				cs.removeItem(theDBObj.getClass().getName(), theDBObj);
+                cs.removeItem(theDBObj.getClass().getName(), theDBObj);
 //				newObj = prepareUpdateFieldsForStorage(oldDBObj, theDBObj, metadata);
-			} else {
-				newObj = prepareForStorage(theDBObj, metadata);
+            } else {
+                newObj = prepareForStorage(theDBObj, metadata);
+
+
+                Integer i = (Integer) theDBObj.getAttribute("TTL");
+                if (i == null || i.intValue() == 0) {
+                    cs.put(theClassName, newObj);
+                } else {
+                    //Set the cache value.
+                    cs.put(theClassName, newObj,
+                            i.intValue() * 1000 * 60);
+                }
+
+            }
+
+            if (log.isDebugEnabled()) {
+                log.debug("Adding item " + theDBObj.getKey() +
+                        " to cache for " + theClassName);
+            }
+        } catch (CacheException ce) {
+            throw new DBException(ce);
+        }
+
+    }
+
+    /**
+     * Adds a non-modified object to the cache.  This is most often called
+     * after DataObject.retrieve().  No related cache notification will occur
+     * when this happens
+     *
+     * @param theDBObj the object to add to the cache.
+     * @throws DBException upon add error (either Cache related or dbobject related)
+     */
+    public void addUnmodifiedToCache(DBObject theDBObj) throws DBException {
+        JDBCObjectMetaData metadata = theDBObj.getJDBCMetaData();
+        String theClassName = theDBObj.getClass().getName();
+
+        //
+        //Don't cache anything without key fields
+        //
+        if (metadata.getKeyFieldListArray().size() == 0) {
+            return;
+        }
+
+        /**
+         * Don't even proceed if cache size is  0
+         */
+        int cacheSize = theDBObj.getCacheSize();
+        if (cacheSize == 0) {
+            return;
+        }
+
+        CacheSystem cs = CacheManager.getCacheSystem(theDBObj.getDataContext());
+        if (cs == null) {
+            return;
+        }
+        try {
+            prepareCache(cs, cacheSize, theClassName);
+            DBObject newObj = prepareForStorage(theDBObj, metadata);
 
 
             Integer i = (Integer) theDBObj.getAttribute("TTL");
             if (i == null || i.intValue() == 0) {
-                cs.put(theClassName,newObj);
+                cs.put(theClassName, newObj);
             } else {
                 //Set the cache value.
                 cs.put(theClassName, newObj,
                         i.intValue() * 1000 * 60);
             }
 
-			}
 
             if (log.isDebugEnabled()) {
                 log.debug("Adding item " + theDBObj.getKey() +
@@ -154,63 +209,6 @@
 
     }
 
-	/**
-	 * Adds a non-modified object to the cache.  This is most often called
-	 * after DataObject.retrieve().  No related cache notification will occur
-	 * when this happens
-	 * @param theDBObj the object to add to the cache.
-	 * @throws DBException upon add error (either Cache related or dbobject related)
-	 */
-	public void addUnmodifiedToCache(DBObject theDBObj) throws DBException
-	{
-	    JDBCObjectMetaData metadata = theDBObj.getJDBCMetaData();
-	    String theClassName = theDBObj.getClass().getName();
-
-	    //
-	    //Don't cache anything without key fields
-	    //
-	    if (metadata.getKeyFieldListArray().size() == 0) {
-	        return;
-	    }
-
-	    /**
-	     * Don't even proceed if cache size is  0
-	     */
-	    int cacheSize = theDBObj.getCacheSize();
-	    if (cacheSize == 0) {
-	        return;
-	    }
-
-	    CacheSystem cs = CacheManager.getCacheSystem(theDBObj.getDataContext());
-	    if (cs == null) {
-	        return;
-	    }
-	    try {
-	        prepareCache(cs,cacheSize,theClassName);
-	        DBObject newObj = prepareForStorage(theDBObj, metadata);
-
-
-	        Integer i = (Integer) theDBObj.getAttribute("TTL");
-	        if (i == null || i.intValue() == 0) {
-	            cs.put(theClassName,newObj);
-	        } else {
-	            //Set the cache value.
-	            cs.put(theClassName, newObj,
-	                    i.intValue() * 1000 * 60);
-	        }
-
-
-	        if (log.isDebugEnabled()) {
-	            log.debug("Adding item " + theDBObj.getKey() +
-	                    " to cache for " + theClassName);
-	        }
-	    } catch (CacheException ce) {
-	        throw new DBException(ce);
-	    }
-
-	}
-
-
 
     /**
      * When using basic caching, this method is used to add a new DB object to the
@@ -219,10 +217,10 @@
      * property in expresso-config.xml, and the number of and time to live for
      * cache entries is controlled by DBObjLimit entries.
      *
-     * @see DBObject#setCacheLimit
      * @param theDBObj com.jcorporate.expresso.core.dbobj.DBObject The object to be
      *                 cached
      * @throws DBException upon add error (either Cache related or dbobject related)
+     * @see DBObject#setCacheLimit
      */
     public void addToCache(DBObject theDBObj)
             throws DBException {
@@ -274,7 +272,8 @@
 
     /**
      * Creates the appropriate cache if it doesn't already exist
-     * @param cs the cache system to add
+     *
+     * @param cs        the cache system to add
      * @param cacheSize the size of the cache
      * @param cacheName the name of the cache to prepare
      * @throws CacheException upon creation error
@@ -314,15 +313,16 @@
                 newObj.setDataField(oneField.getName(), df);
             }
         } /* for each field */
-        return newObj; }
+        return newObj;
+    }
 
-	/**
-	 * Creates a DBObject for storage in a cache, prepares the cache storage
-	 * @param theDBObj the source object in the cache
-	 * @param metadata the object's metadata for update
-	 * @return DBObject instance ready to store
-	 * @throws DBException upon DBObject access error
-	 */
+    /**
+     * Creates a DBObject for storage in a cache, prepares the cache storage
+     * @param theDBObj the source object in the cache
+     * @param metadata the object's metadata for update
+     * @return DBObject instance ready to store
+     * @throws DBException upon DBObject access error
+     */
 //	private DBObject prepareUpdateFieldsForStorage(DBObject theDBObj, DBObject newObj,
 //	                                          JDBCObjectMetaData metadata
 //	                                          )


More information about the cvs mailing list