[cvs] expresso commit by lhamel: javadoc and comment out unused
JCorporate Ltd
jcorp at jcorporate.com
Sun Feb 20 22:10:35 UTC 2005
Log Message:
-----------
javadoc and comment out unused
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.11
retrieving revision 1.12
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.11 -r1.12
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/CacheUtils.java
@@ -64,18 +64,16 @@
package com.jcorporate.expresso.core.dbobj;
-import java.util.Iterator;
-
-import org.apache.log4j.Logger;
-
import com.jcorporate.expresso.core.cache.CacheException;
import com.jcorporate.expresso.core.cache.CacheManager;
import com.jcorporate.expresso.core.cache.CacheSystem;
import com.jcorporate.expresso.core.dataobjects.DataField;
-import com.jcorporate.expresso.core.dataobjects.DataObject;
import com.jcorporate.expresso.core.dataobjects.DefaultDataField;
import com.jcorporate.expresso.core.dataobjects.jdbc.JDBCObjectMetaData;
import com.jcorporate.expresso.core.db.DBException;
+import org.apache.log4j.Logger;
+
+import java.util.Iterator;
/**
@@ -128,6 +126,7 @@
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);
// newObj = prepareUpdateFieldsForStorage(oldDBObj, theDBObj, metadata);
} else {
@@ -166,14 +165,14 @@
{
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
*/
@@ -181,7 +180,7 @@
if (cacheSize == 0) {
return;
}
-
+
CacheSystem cs = CacheManager.getCacheSystem(theDBObj.getDataContext());
if (cs == null) {
return;
@@ -189,8 +188,8 @@
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);
@@ -199,8 +198,8 @@
cs.put(theClassName, newObj,
i.intValue() * 1000 * 60);
}
-
-
+
+
if (log.isDebugEnabled()) {
log.debug("Adding item " + theDBObj.getKey() +
" to cache for " + theClassName);
@@ -208,7 +207,7 @@
} catch (CacheException ce) {
throw new DBException(ce);
}
-
+
}
@@ -216,9 +215,11 @@
/**
* When using basic caching, this method is used to add a new DB object to the
* cache, where it is later used when retrieveing data instead of going directly
- * to the database. This functionality can be controlled with the "dbCache"
- * property in the properties file(s).
+ * to the database. This functionality can be turned on and off with the "dbCache"
+ * 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)
@@ -318,40 +319,39 @@
/**
* Creates a DBObject for storage in a cache, prepares the cache storage
* @param theDBObj the source object in the cache
- * @param newDBObj the modified object for update
* @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
- )
- throws DBException {
-
-// DBObject newObj = theDBObj.newInstance();
-// newObj.setDataContext(theDBObj.getDataContext());
-
- DBField oneField = null;
-
- for (Iterator i = metadata.getAllFieldsMap().values().iterator();
- i.hasNext();) {
- oneField = (DBField) i.next();
-
- if (!oneField.isVirtual() && !oneField.isBinaryObjectType()) {
-
- if (newObj.getDataField(oneField.getName()).isValueSet() &&
- newObj.getStatus().equals(DataObject.STATUS_NEW)) {
- ; // noop
- } else {
- if (!newObj.getDataField(oneField.getName()).isChanged()) {
- continue;
- }
- }
-
- DataField df = DefaultDataField.getInstance(oneField, newObj);
- df.setValue(newObj.getDataField(oneField.getName()).getValue());
- theDBObj.setDataField(oneField.getName(), df);
- }
- } /* for each field */
- return theDBObj; }
+// private DBObject prepareUpdateFieldsForStorage(DBObject theDBObj, DBObject newObj,
+// JDBCObjectMetaData metadata
+// )
+// throws DBException {
+//
+//// DBObject newObj = theDBObj.newInstance();
+//// newObj.setDataContext(theDBObj.getDataContext());
+//
+// DBField oneField = null;
+//
+// for (Iterator i = metadata.getAllFieldsMap().values().iterator();
+// i.hasNext();) {
+// oneField = (DBField) i.next();
+//
+// if (!oneField.isVirtual() && !oneField.isBinaryObjectType()) {
+//
+// if (newObj.getDataField(oneField.getName()).isValueSet() &&
+// newObj.getStatus().equals(DataObject.STATUS_NEW)) {
+// ; // noop
+// } else {
+// if (!newObj.getDataField(oneField.getName()).isChanged()) {
+// continue;
+// }
+// }
+//
+// DataField df = DefaultDataField.getInstance(oneField, newObj);
+// df.setValue(newObj.getDataField(oneField.getName()).getValue());
+// theDBObj.setDataField(oneField.getName(), df);
+// }
+// } /* for each field */
+// return theDBObj; }
}
More information about the cvs
mailing list