[cvs] Expresso commit by lhamel: remove unused sListeners and associated

JCorporate Ltd jcorp at jcorp2.servlets.net
Tue Oct 12 11:23:45 PDT 2004


Log Message:
-----------
remove unused sListeners and associated code.  Previously removed addCacheEventListener() made sListeners unused. also fix deprecated calls, and change getLogger to return Logger instead of Category

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

Revision Data
-------------
Index: DBObject.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java,v
retrieving revision 1.213
retrieving revision 1.214
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java -u -r1.213 -r1.214
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java
@@ -64,36 +64,7 @@
 
 package com.jcorporate.expresso.core.dbobj;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.sql.SQLException;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.log4j.Category;
-import org.apache.log4j.Logger;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.PatternMatcher;
-import org.apache.oro.text.regex.Perl5Matcher;
-
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
-
 import com.jcorporate.expresso.core.cache.CacheException;
 import com.jcorporate.expresso.core.cache.CacheManager;
 import com.jcorporate.expresso.core.cache.CacheSystem;
@@ -115,8 +86,6 @@
 import com.jcorporate.expresso.core.db.DBConnectionPool;
 import com.jcorporate.expresso.core.db.DBException;
 import com.jcorporate.expresso.core.db.exception.DBRecordNotFoundException;
-import com.jcorporate.expresso.core.misc.CacheEvent;
-import com.jcorporate.expresso.core.misc.CacheEventListener;
 import com.jcorporate.expresso.core.misc.ConfigJdbc;
 import com.jcorporate.expresso.core.misc.ConfigManager;
 import com.jcorporate.expresso.core.misc.ConfigurationException;
@@ -128,6 +97,31 @@
 import com.jcorporate.expresso.services.dbobj.ChangeLog;
 import com.jcorporate.expresso.services.dbobj.DBObjLimit;
 import com.jcorporate.expresso.services.dbobj.Setup;
+import org.apache.log4j.Logger;
+import org.apache.oro.text.regex.Pattern;
+import org.apache.oro.text.regex.PatternMatcher;
+import org.apache.oro.text.regex.Perl5Matcher;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.sql.SQLException;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
 
 
 /**
@@ -199,15 +193,6 @@
     transient protected static final BigDecimal BIG_DECIMAL_ZERO = new BigDecimal(0.0);
 
 
-    /**
-     * DBChangeListener objects can ask to be notified when any
-     * change is made to objects of this type
-     *
-     * @todo move this static variable outside DBObject so we can wrap it for
-     * EJBs
-     */
-    transient private static Hashtable sListeners = null;
-
     /* the logs
     * @todo move this static variable outside DBObject so we can wrap it for
     * EJBs
@@ -1063,7 +1048,7 @@
 
     /**
      * Find the average of the values in the specified field of records
-     * se;lected by the DBObject selection criteria.
+     * selected by the DBObject selection criteria.
      *
      * @param fieldName String DBObject fieldName to average
      * @return double Average of the records matching the criteria
@@ -1088,7 +1073,6 @@
      *                     record has a duplicate key
      *                     <p/>
      *                     Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
-     * @since $DatabaseSchema  $Date$
      */
     public synchronized void basicAdd()
             throws DBException {
@@ -1728,7 +1712,6 @@
      * @param deleteDetails Delete associated detail records if true
      * @throws DBException Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
      * @see DBObject#deleteAll to delete objects identified by non-key fields
-     * @since $DatabaseSchema  $Date$
      */
     public synchronized void delete(boolean deleteDetails)
             throws DBException {
@@ -2170,9 +2153,7 @@
      *
      * @return boolean If the search resulted in a record
      * @throws DBException If the search could not be completed
-     *                     <p/>
      *                     Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
-     * @since $DatabaseSchema  $Date$
      */
     public boolean find()
             throws DBException {
@@ -2644,7 +2625,6 @@
      * @return String array of <b>distinct</b> field names in this object.
      *         <p/>
      *         author Peter Pilgrim <peter.pilgrim at db.com>
-     * @see #getDistinctFieldList()
      * @see #getDistinctFieldCount()
      * @see #isDistinct()
      */
@@ -3223,7 +3203,6 @@
         return;
     }
 
-    
     /**
      * This convenience method counts
      * <code>DBFields</code> belonging to this
@@ -3380,9 +3359,7 @@
      * @param fieldName   the Fieldname to get the max value for.
      * @param whereClause Use a custom whereclause?
      * @return a String containing the maximum value for this field name
-     *         <p/>
      *         Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
-     * @since $DatabaseSchema  $Date$
      */
     public String getMax(String fieldName, boolean whereClause)
             throws DBException {
@@ -4009,7 +3986,7 @@
                     // no sort
                 } else {
                     String sortField = descripField;
-                    if (thisObj.isVirtual(descripField)) {
+                    if (thisObj.getMetaData().getFieldMetadata(descripField).isVirtual()) {
                         sortField = valueField;
                     }
 
@@ -4218,7 +4195,7 @@
                 DBObject oneObj = null;
                 String sortField = descripField;
 
-                if (thisObj.isVirtual(descripField)) {
+                if (thisObj.getMetaData().getFieldMetadata(descripField).isVirtual()) {
                     sortField = valueField;
                 }
 
@@ -4741,65 +4718,6 @@
         } catch (CacheException ce) {
             log.error("Unable to clear caches correctly", ce);
         }
-        if (sListeners == null) {
-            return;
-        }
-
-        ArrayList listeners = (ArrayList) sListeners.get(myClassName);
-
-        if (listeners == null) {
-            if (log.isDebugEnabled()) {
-                log.debug("No listeners for " + myClassName);
-            }
-
-            return;
-        }
-        if (listeners.size() == 0) {
-            if (log.isDebugEnabled()) {
-                log.debug("Zero listeners for " + myClassName);
-            }
-
-            return;
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("" + listeners.size() + " listeners for " +
-                    myClassName);
-            log.debug("Notifying objects of update " + eventCode);
-        }
-
-        String oneListenerName = null;
-        CacheEventListener oneListener = null;
-        CacheEvent myEvent = new CacheEvent(myClassName, eventCode,
-                this);
-
-        for (Iterator it = listeners.iterator(); it.hasNext();) {
-            oneListenerName = (String) it.next();
-
-            if (log.isDebugEnabled()) {
-                log.debug("Notifying " + oneListenerName + " of event " +
-                        eventCode + " from " + myClassName);
-            }
-            try {
-                oneListener = (CacheEventListener) ClassLocator.loadClass(oneListenerName).newInstance();
-                oneListener.cacheEvent(myEvent);
-            } catch (IllegalAccessException ie) {
-                throw new DBException("Illegal Access Exception starting " +
-                        "CacheEventListener class " +
-                        oneListenerName, ie);
-            } catch (InstantiationException ie) {
-                throw new DBException("Can't instantiate " +
-                        "CacheEventListener class " +
-                        oneListenerName, ie);
-            } catch (ClassNotFoundException se) {
-                throw new DBException("Can't find a " +
-                        "CacheEventListener class called " +
-                        oneListenerName, se);
-            } catch (Exception eo) {
-                throw new DBException("Exception loading " +
-                        "object to notify - see detailed message in " +
-                        "standard error log", eo);
-            }
-        } /* for each item in the list to notify */
 
     } /* notifyListeners(String) */
 
@@ -5162,10 +5080,7 @@
      * foundKeys vector is populated with the keys of the records found by the search.
      *
      * @throws DBException if unable to retreive records due to a database problem
-     * @see #getFoundKeys()
-     *      <p/>
      *      Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
-     * @since $DatabaseSchema  $Date$
      */
     public synchronized void search()
             throws DBException {
@@ -6319,7 +6234,6 @@
      * DB object for field names, descriptions, etc. The schema
      * will be assumed to be Expresso's schema if not otherwise
      * set.
-     * <p/>
      * From expresso 5.3, this method is called in ConfigManager at startup. You probably do
      * not need to call it. (Previously, developers had to call it within each DBObject's setup().)
      *
@@ -6440,7 +6354,6 @@
      * This allows the invocation of the SQL AVG, MIN, MAX and SUM
      * aggregate functions on one of the DB's columns (the DBObject
      * fieldname is supplied).
-     * <p/>
      * This function is not meant to be used directly, but is here
      * as the common/shared code used by the following methods in DBObject:
      * avg(String), min(String), max(String), sum(String).
@@ -6449,9 +6362,7 @@
      * @param fieldName String The DBObject fieldName to use for the aggregate function
      * @return double The result of the SQL function invocation
      * @throws DBException If the function could not be completed
-     *                     <p/>
      *                     Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
-     * @since $DatabaseSchema  $Date$
      */
     protected synchronized double sqlAggrFunction(String func,
                                                   String fieldName)
@@ -6750,9 +6661,7 @@
      * @param updateChangedCache if true only modified fields (isChanged = true)
      *                           will be included in the update
      * @throws DataException upon error updating the object to the data source
-     *                       <p/>
      *                       Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
-     * @since $DatabaseSchema  $Date$
      */
     public void doUpdateAll(boolean updateChangedCache)
             throws DataException {
@@ -7477,7 +7386,7 @@
      *
      * @return Category for logging
      */
-    public Category getLogger() {
+    public Logger getLogger() {
         if (slog == null) slog = Logger.getLogger(getClass().getName());
 
         return slog;


More information about the cvs mailing list