r9992 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Tue, 24 Nov 2009 11:34:50 +0100 (CET)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20091124103450.87A763D0E2@mia>
Author: hannes
Date: 2009-11-24 11:34:50 +0100 (Tue, 24 Nov 2009)
New Revision: 9992

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/Node.java
   helma/helma/trunk/src/helma/objectmodel/db/Relation.java
Log:
Revert to old style, unsegmented collection loading as default and only do segmented loading when collection.loadmode = lazy is set.

Details at http://dev.helma.org/trac/helma/changeset/9992

Modified: helma/helma/trunk/src/helma/objectmodel/db/Node.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-11-24 10:25:31 UTC (rev 9991)
+++ helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-11-24 10:34:50 UTC (rev 9992)
@@ -1441,7 +1441,9 @@
      * @return List an empty List of the type used by this Node
      */
     public SubnodeList createSubnodeList() {
-        subnodes = new SegmentedSubnodeList(this);
+        Relation subrel = dbmap == null ? null : dbmap.getSubnodeRelation();
+        subnodes = subrel == null || !subrel.lazyLoading ?
+                new SubnodeList(this) : new SegmentedSubnodeList(this);
         return subnodes;
     }
 

Modified: helma/helma/trunk/src/helma/objectmodel/db/Relation.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Relation.java	2009-11-24 10:25:31 UTC (rev 9991)
+++ helma/helma/trunk/src/helma/objectmodel/db/Relation.java	2009-11-24 10:34:50 UTC (rev 9992)
@@ -82,6 +82,7 @@
     Constraint[] constraints;
     boolean virtual;
     boolean readonly;
+    boolean lazyLoading;
     boolean aggressiveLoading;
     boolean aggressiveCaching;
     boolean isPrivate = false;
@@ -128,6 +129,7 @@
         this.constraints =              rel.constraints;
         this.accessName =               rel.accessName;
         this.logicalOperator =          rel.logicalOperator;
+        this.lazyLoading =              rel.lazyLoading;
         this.aggressiveLoading =        rel.aggressiveLoading;
         this.aggressiveCaching =        rel.aggressiveCaching;
         this.updateCriteria =           rel.updateCriteria;
@@ -298,8 +300,21 @@
     protected void parseOptions(Vector cnst, Properties props) {
         String loading = props.getProperty("loadmode");
 
-        aggressiveLoading = (loading != null) &&
-                            "aggressive".equalsIgnoreCase(loading.trim());
+        if (loading != null) {
+            loading = loading.trim();
+            if ("aggressive".equalsIgnoreCase(loading)) {
+                aggressiveLoading = true;
+                lazyLoading = false;
+            } else if ("lazy".equalsIgnoreCase(loading)) {
+                lazyLoading = true;
+                aggressiveLoading = false;
+            } else {
+                System.err.println("Unsupported loadmode property in " + ownType + ": " + loading);
+                aggressiveLoading = lazyLoading = false;
+            }
+        } else {
+            aggressiveLoading = lazyLoading = false;
+        }
 
         String caching = props.getProperty("cachemode");