portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r348625 - in /portals/jetspeed-2/trunk: components/prefs/src/java/org/apache/jetspeed/prefs/impl/ components/prefs/src/java/org/apache/jetspeed/prefs/om/impl/ jetspeed-api/src/java/org/apache/jetspeed/prefs/
Date Thu, 24 Nov 2005 03:10:26 GMT
Author: ate
Date: Wed Nov 23 19:10:13 2005
New Revision: 348625

URL: http://svn.apache.org/viewcvs?rev=348625&view=rev
Log:
Very nasty Preferences NodeImpl caching bug caused the TestPortletEntityDAO to fail (now that
it really runs against our own prefs impl).
Debugging the prefs turned out to be quite an excercise in patience ...

Fixing this required me to change the public api of the PreferencesProvider! 

Modified:
    portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
    portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
    portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/om/impl/NodeImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/prefs/PreferencesProvider.java

Modified: portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java?rev=348625&r1=348624&r2=348625&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
(original)
+++ portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
Wed Nov 23 19:10:13 2005
@@ -307,11 +307,20 @@
         getPersistenceBrokerTemplate().store(node);
     }
 
-    public void removeNode(Node node)
+    public void removeNode(Node parentNode, Node node)
     {
         NodeCache key = new NodeCache(node);
         nodeMap.remove(key);
-        getPersistenceBrokerTemplate().delete(node);
+        if ( parentNode != null )
+        {
+            key = new NodeCache(parentNode);
+            key = (NodeCache)nodeMap.get(key);
+            if ( key != null && key.isChildrenLoaded() )
+            {
+                key.getChildren().remove(node);
+            }
+        }
+        getPersistenceBrokerTemplate().delete(node);        
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java?rev=348625&r1=348624&r2=348625&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
Wed Nov 23 19:10:13 2005
@@ -287,8 +287,14 @@
      * @see java.util.prefs.Preferences#removeNodeSpi()
      */
     public void removeNodeSpi() throws BackingStoreException
-    {        
-       prefsProvider.removeNode(node);
+    {      
+        Node parentNode = null;
+        Preferences parent = parent();
+        if ( parent != null && parent instanceof PreferencesImpl )
+        {
+            parentNode = ((PreferencesImpl)parent).getNode();
+        }
+        prefsProvider.removeNode(parentNode, node);
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/om/impl/NodeImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/om/impl/NodeImpl.java?rev=348625&r1=348624&r2=348625&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/om/impl/NodeImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/om/impl/NodeImpl.java
Wed Nov 23 19:10:13 2005
@@ -229,6 +229,12 @@
     {
         this.modifiedDate = modifiedDate;
     }
+    
+    public boolean equals(Object o)
+    {
+        return fullPath != null && o != null && o instanceof NodeImpl &&
((NodeImpl) o).fullPath != null
+                        && fullPath.equals(((NodeImpl) o).fullPath);
+    }
 
     /**
      * <p>

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/prefs/PreferencesProvider.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/prefs/PreferencesProvider.java?rev=348625&r1=348624&r2=348625&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/prefs/PreferencesProvider.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/prefs/PreferencesProvider.java
Wed Nov 23 19:10:13 2005
@@ -40,7 +40,7 @@
     
     void storeNode(Node node);
     
-    void removeNode(Node node);
+    void removeNode(Node parentNode, Node node);
     
     /**
      * Lookup a preference node given the preference name, a property name and value.



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message