[cvs] expresso commit by rimovm: API Refactoring: New ExpressoThread and

JCorporate Ltd jcorp at jcorp2.servlets.net
Tue Nov 9 07:18:10 PST 2004


Log Message:
-----------
API Refactoring:  New ExpressoThread and ExpressoThreadContext class to allow for propagation of the RequestRegistry across threads.
New Unit Tests to verify it.
Unit tests for RowSecuredDBObject.
Moved to only access the RequestRegistry during getDataContext() for DBObjects.

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.226
retrieving revision 1.227
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.226 -r1.227
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java
@@ -421,11 +421,6 @@
     public DBObject()
             throws DBException {
         initialize();
-        try {
-            this.setDataContext(RequestRegistry.getDataContext());
-        } catch (Exception ex) {
-            log.warn(ex.getMessage());
-        }
     } /* DBObject() */
 
     /**
@@ -7222,12 +7217,21 @@
      */
     public String getDataContext() {
         if ((dbKey == null) || (dbKey.equals(""))) {
-
             try {
-                setDBName("default");
-            } catch (DBException de) {
-                log.error("Unable to set database to 'default'", de);
+                this.setDataContext(RequestRegistry.getDataContext());
+            } catch (Exception ex) {
+                log.warn("No data context set for this thread.  You may" +
+                    " need to install a servlet filter or create a new "
+                    + " RequestRegistry for this thread "
+                    + "to set the data context");
+
+                try {
+                    setDBName("default");
+                } catch (DBException de) {
+                    log.error("Unable to set database to 'default'", de);
+                }
             }
+
         }
 
         return dbKey;


More information about the cvs mailing list