portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r643116 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-prefs/ components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/ jetspeed-commons/src/main/java/org/apache/jetspeed/util/ jetspeed-portal-resources/src/main/re...
Date Mon, 31 Mar 2008 19:55:58 GMT
Author: ate
Date: Mon Mar 31 12:55:46 2008
New Revision: 643116

URL: http://svn.apache.org/viewvc?rev=643116&view=rev
Log:
Fixing a serious flaw in the initialization of Jetspeed (persistent) Preferences.
Java Preferences initializes the preferences spi using the default *or* provided PreferencesFactory
only *once* per JVM.
The instantiated PreferencesFactory is stored as static *final* instance globally for the
full JVM.
Restarting Jetspeed or its Spring container (like when running multiple unforked unit tests)
will never lead to instantiating a new/fresh instance of its PreferencesFactory.
As our current implementation loads an OJB based PreferencesProvider in the JetspeedPreferences,
reloading the Spring container leads to broken/invalid proxies and/or Class cast exceptions!
The following fix resolves this issue by wrapping the Jetspeed Preferences userRoot and systemRoot
themselves (trough a higher (system) classloader loaded Observer interface).
Restarting the Jetspeed Spring container within the same JVM now properly injects a new/clean
instance of the PersistenceBrokerPreferencesProvider, even if the Spring container is reloaded
through a new classloader.

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
  (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
  (with props)
Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/pom.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/prefs.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/pom.xml?rev=643116&r1=643115&r2=643116&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/pom.xml Mon Mar 31 12:55:46
2008
@@ -47,6 +47,11 @@
         </dependency>
         <dependency>
             <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-commons</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-rdbms</artifactId>
         </dependency>
 

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java?rev=643116&r1=643115&r2=643116&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
Mon Mar 31 12:55:46 2008
@@ -215,6 +215,13 @@
         this.preloadedApplications = apps;
         this.preloadEntities = preloadEntities;
     }
+    
+    public void destroy()
+    {
+        NodeImplProxy.setProvider(null);
+        preferenceCache = null;
+        preloadedApplications = null;
+    }
 
     protected void addToCache(NodeCache content)
     {

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java?rev=643116&r1=643115&r2=643116&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
Mon Mar 31 12:55:46 2008
@@ -16,35 +16,54 @@
  */
 package org.apache.jetspeed.prefs.impl;
 
+import java.util.Observer;
 import java.util.prefs.Preferences;
 import java.util.prefs.PreferencesFactory;
 
 import org.apache.jetspeed.prefs.PreferencesException;
 import org.apache.jetspeed.prefs.PreferencesProvider;
+import org.apache.jetspeed.util.PreferencesRootWrapper;
 
 /**
  * <p>{@link java.util.prefs.PreferencesFactory} implementation to
  * return {@link PreferencesImpl}.</p>
  *
  * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
  */
 public class PreferencesFactoryImpl implements PreferencesFactory
 {
+    private Preferences userRootWrapper;
+    private Preferences systemRootWrapper;
+    private PreferencesImpl userRoot;
+    private PreferencesImpl systemRoot;
+    private PreferencesProvider preferencesProvider;
     
-    protected static PreferencesProvider prefsProvider;
-
+    /**
+     * Java Preferences invoked constructor
+     */
     public PreferencesFactoryImpl()
     {
-        super();        
-        System.setProperty("java.util.prefs.PreferencesFactory", getClass().getName());
-    }  
+        userRootWrapper = new PreferencesRootWrapper();
+        systemRootWrapper = new PreferencesRootWrapper();
+    }
 
     /**
+     * Spring invoked constructor with a dummy parameter to distinguish it from the default
constructor invoked by the Java Preferences
+     * @param dummy
+     */
+    public PreferencesFactoryImpl(int dummy)
+    {
+        System.setProperty("java.util.prefs.PreferencesFactory", getClass().getName());
+    }
+    
+    /**
      * @see java.util.prefs.PreferencesFactory#systemRoot()
      */
     public Preferences systemRoot()
     {
-      return  PreferencesImpl.systemRoot;
+      return  systemRootWrapper;
     }
 
     /**
@@ -52,7 +71,7 @@
      */
     public Preferences userRoot()
     {
-        return  PreferencesImpl.userRoot;
+        return  userRootWrapper;
     }
     
     /**
@@ -65,24 +84,32 @@
     public void init() throws Exception
     {        
         try
-        {           
-              PreferencesImpl.setPreferencesProvider(prefsProvider);
-              PreferencesImpl.systemRoot = new PreferencesImpl(null, "", PreferencesImpl.SYSTEM_NODE_TYPE);
-              PreferencesImpl.userRoot =  new PreferencesImpl(null, "", PreferencesImpl.USER_NODE_TYPE);
           
+        {   
+            // Wrap the PreferencesProvider to provide a single instance to be stored in
the Preferences nodes
+            // which can be disposed at once for all
+            PreferencesProviderWrapper ppw = new PreferencesProviderWrapper(preferencesProvider);
+            preferencesProvider = null;
+            userRoot = new PreferencesImpl(null, ppw, "", PreferencesImpl.USER_NODE_TYPE);
+            systemRoot = new PreferencesImpl(null, ppw, "", PreferencesImpl.SYSTEM_NODE_TYPE);
+            // set/update the Java Preferences userRoot and systeRoot PreferencesRootWrapper
instances
+            ((Observer)Preferences.userRoot()).update(null, userRoot);
+            ((Observer)Preferences.systemRoot()).update(null, systemRoot);
         }
         catch(Throwable e)
         {
-	    e.printStackTrace();
-            throw new PreferencesException("Failed to initialize prefs api.  "+e.toString());
+            throw new PreferencesException("Failed to initialize prefs api.  "+e.getMessage(),
e);
         }
     }
     
-    /**
-     * @return The {@link PreferencesProvider}
-     */
-    public PreferencesProvider getPrefsProvider()
+    public void dispose()
     {
-        return prefsProvider;
+        ((Observer)Preferences.userRoot()).update(null, null);
+        ((Observer)Preferences.systemRoot()).update(null, null);
+        userRoot.disposeNode();
+        systemRoot.disposeNode();
+        userRoot.ppw.dispose();
+        userRoot = null;
+        systemRoot = null;
     }
     
     /**
@@ -90,10 +117,10 @@
      * Set the preferences provider.
      * </p>
      * 
-     * @param prefsProvider The {@link PreferencesProvider}
+     * @param preferencesProvider The {@link PreferencesProvider}
      */
-    public void setPrefsProvider(PreferencesProvider prefsProvider)
+    public void setPrefsProvider(PreferencesProvider preferencesProvider)
     {
-        PreferencesFactoryImpl.prefsProvider = prefsProvider;
+        this.preferencesProvider = preferencesProvider;
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java?rev=643116&r1=643115&r2=643116&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
Mon Mar 31 12:55:46 2008
@@ -29,7 +29,6 @@
 import org.apache.jetspeed.prefs.FailedToCreateNodeException;
 import org.apache.jetspeed.prefs.NodeAlreadyExistsException;
 import org.apache.jetspeed.prefs.NodeDoesNotExistException;
-import org.apache.jetspeed.prefs.PreferencesProvider;
 import org.apache.jetspeed.prefs.om.Node;
 import org.apache.jetspeed.prefs.om.Property;
 import org.apache.jetspeed.prefs.om.impl.PropertyImpl;
@@ -41,6 +40,8 @@
  * </p>
  * 
  * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
  */
 public class PreferencesImpl extends AbstractPreferences
 {
@@ -57,12 +58,13 @@
     /** Logger. */
     private static final Log log = LogFactory.getLog(PreferencesImpl.class);
 
-    protected static PreferencesProvider prefsProvider;
-
-    static PreferencesImpl systemRoot;
-
-    static PreferencesImpl userRoot;
-
+    PreferencesProviderWrapper ppw;
+    
+    void disposeNode()
+    {
+        node = null;
+    }
+    
     /**
      * <p>
      * Constructs a root node in the underlying datastore if they have not yet
@@ -76,19 +78,20 @@
      * @param nodeName The node name.
      * @param nodeType The node type.
      */
-    public PreferencesImpl(PreferencesImpl parent, String nodeName, int nodeType) throws
IllegalStateException
+    PreferencesImpl(PreferencesImpl parent, PreferencesProviderWrapper ppw, String nodeName,
int nodeType) throws IllegalStateException
     {
         super(parent, nodeName);
 
         try
         {
+            this.ppw = ppw;
             if (parent != null)
             {
-                this.node = prefsProvider.createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
+                this.node = ppw.provider().createNode(parent.getNode(), nodeName, nodeType,
this.absolutePath());
             }
             else
             {
-                this.node = prefsProvider.createNode(null, nodeName, nodeType, this.absolutePath());
+                this.node = ppw.provider().createNode(null, nodeName, nodeType, this.absolutePath());
             }
 
             newNode = true;
@@ -104,7 +107,7 @@
         {
             try
             {
-                node = prefsProvider.getNode(this.absolutePath(), nodeType);
+                node = ppw.provider().getNode(this.absolutePath(), nodeType);
                 newNode = false;
             }
             catch (NodeDoesNotExistException e1)
@@ -128,7 +131,7 @@
      */
     public String[] childrenNamesSpi() throws BackingStoreException
     {
-        Collection nodes = prefsProvider.getChildren(getNode());
+        Collection nodes = ppw.provider().getChildren(getNode());
 
         if (null != nodes)
         {
@@ -153,7 +156,7 @@
      */
     public AbstractPreferences childSpi(String name)
     {
-        return new PreferencesImpl(this, name, node.getNodeType());
+        return new PreferencesImpl(this, ppw, name, node.getNodeType());
     }
 
     /**
@@ -161,7 +164,7 @@
      */
     public void flushSpi() throws BackingStoreException
     {
-        prefsProvider.storeNode(this.node);
+        ppw.provider().storeNode(this.node);
     }
 
     /**
@@ -243,7 +246,7 @@
             properties.add(new PropertyImpl(node.getNodeId(), key, value));
         }
 
-        prefsProvider.storeNode(node);
+        ppw.provider().storeNode(node);
     }
 
     /**
@@ -257,7 +260,7 @@
         {
             parentNode = ((PreferencesImpl) parent).getNode();
         }
-        prefsProvider.removeNode(parentNode, node);
+        ppw.provider().removeNode(parentNode, node);
     }
 
     /**
@@ -277,7 +280,7 @@
             }
         }
         // Update node.
-        prefsProvider.storeNode(node);
+        ppw.provider().storeNode(node);
     }
 
     /**
@@ -299,21 +302,5 @@
     public Node getNode()
     {
         return node;
-    }
-
-    /**
-     * 
-     * <p>
-     * setPreferencesProvider
-     * </p>
-     * Sets the <code>org.apache.jetspeed.prefs.PreferencesProvider</code>
-     * that will support backing store operations for all
-     * <code>PreferencesImpls</code>
-     * 
-     * @param prefsProvider
-     */
-    public static void setPreferencesProvider(PreferencesProvider prefsProvider)
-    {
-        PreferencesImpl.prefsProvider = prefsProvider;
     }
 }

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java?rev=643116&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
Mon Mar 31 12:55:46 2008
@@ -0,0 +1,42 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.prefs.impl;
+
+import org.apache.jetspeed.prefs.PreferencesProvider;
+
+/**
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
+ */
+public class PreferencesProviderWrapper
+{
+    PreferencesProvider provider;
+    PreferencesProviderWrapper(PreferencesProvider provider)
+    {
+        this.provider = provider;
+    }
+    
+    PreferencesProvider provider()
+    {
+        return provider;
+    }
+    
+    void dispose()
+    {
+        provider = null;
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java?rev=643116&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
(added)
+++ portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
Mon Mar 31 12:55:46 2008
@@ -0,0 +1,234 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.NodeChangeListener;
+import java.util.prefs.PreferenceChangeListener;
+import java.util.prefs.Preferences;
+
+/**
+ * PreferencesRootWrapper is a lightweight wrapper around the Jetspeed persistent PreferencesImpl
to allow
+ * restarting the Jetspeed Portal.
+ * <p>
+ * As the (Sun) Java Preferences implementation only creates a PreferencesFactory instance
*once* per JVM
+ * (as static final), reloading the Jetspeed Portal (using a new classloader) requires a
wrapper solution
+ * to prevent ClassCastExceptions and/or out-of-sync kept proxies and caches.
+ * </p>
+ * <p>
+ * As a newly created Jetspeed Portal classloader can no longer cast a previous Preferences
root to its
+ * own PreferencesImpl, a "trick" is used by also implementing the Observer interface (which
is provided by
+ * the Java system classloader). The Observer interface is used because it is very lightweight
and allows
+ * passing an Object instance through its update method. That update method is used to "inject"
the newly
+ * created Preferences root instance. 
+ * </p>
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
+ */
+public class PreferencesRootWrapper extends Preferences implements Observer
+{
+    private Preferences root;
+    
+    public String absolutePath()
+    {
+        return root.absolutePath();
+    }
+
+    public void addNodeChangeListener(NodeChangeListener ncl)
+    {
+        root.addNodeChangeListener(ncl);
+    }
+
+    public void addPreferenceChangeListener(PreferenceChangeListener pcl)
+    {
+        root.addPreferenceChangeListener(pcl);
+    }
+
+    public String[] childrenNames() throws BackingStoreException
+    {
+        return root.childrenNames();
+    }
+
+    public void clear() throws BackingStoreException
+    {
+        root.clear();
+    }
+
+    public boolean equals(Object obj)
+    {
+        return root.equals(obj);
+    }
+
+    public void exportNode(OutputStream os) throws IOException, BackingStoreException
+    {
+        root.exportNode(os);
+    }
+
+    public void exportSubtree(OutputStream os) throws IOException, BackingStoreException
+    {
+        root.exportSubtree(os);
+    }
+
+    public void flush() throws BackingStoreException
+    {
+        root.flush();
+    }
+
+    public String get(String key, String def)
+    {
+        return root.get(key, def);
+    }
+
+    public boolean getBoolean(String key, boolean def)
+    {
+        return root.getBoolean(key, def);
+    }
+
+    public byte[] getByteArray(String key, byte[] def)
+    {
+        return root.getByteArray(key, def);
+    }
+
+    public double getDouble(String key, double def)
+    {
+        return root.getDouble(key, def);
+    }
+
+    public float getFloat(String key, float def)
+    {
+        return root.getFloat(key, def);
+    }
+
+    public int getInt(String key, int def)
+    {
+        return root.getInt(key, def);
+    }
+
+    public long getLong(String key, long def)
+    {
+        return root.getLong(key, def);
+    }
+
+    public int hashCode()
+    {
+        return root.hashCode();
+    }
+
+    public boolean isUserNode()
+    {
+        return root.isUserNode();
+    }
+
+    public String[] keys() throws BackingStoreException
+    {
+        return root.keys();
+    }
+
+    public String name()
+    {
+        return root.name();
+    }
+
+    public Preferences node(String pathName)
+    {
+        return root.node(pathName);
+    }
+
+    public boolean nodeExists(String pathName) throws BackingStoreException
+    {
+        return root.nodeExists(pathName);
+    }
+
+    public Preferences parent()
+    {
+        return root.parent();
+    }
+
+    public void put(String key, String value)
+    {
+        root.put(key, value);
+    }
+
+    public void putBoolean(String key, boolean value)
+    {
+        root.putBoolean(key, value);
+    }
+
+    public void putByteArray(String key, byte[] value)
+    {
+        root.putByteArray(key, value);
+    }
+
+    public void putDouble(String key, double value)
+    {
+        root.putDouble(key, value);
+    }
+
+    public void putFloat(String key, float value)
+    {
+        root.putFloat(key, value);
+    }
+
+    public void putInt(String key, int value)
+    {
+        root.putInt(key, value);
+    }
+
+    public void putLong(String key, long value)
+    {
+        root.putLong(key, value);
+    }
+
+    public void remove(String key)
+    {
+        root.remove(key);
+    }
+
+    public void removeNode() throws BackingStoreException
+    {
+        root.removeNode();
+    }
+
+    public void removeNodeChangeListener(NodeChangeListener ncl)
+    {
+        root.removeNodeChangeListener(ncl);
+    }
+
+    public void removePreferenceChangeListener(PreferenceChangeListener pcl)
+    {
+        root.removePreferenceChangeListener(pcl);
+    }
+
+    public void sync() throws BackingStoreException
+    {
+        root.sync();
+    }
+
+    public String toString()
+    {
+        return root.toString();
+    }
+
+    public void update(Observable o, Object arg)
+    {
+        root = (Preferences)arg;
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/prefs.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/prefs.xml?rev=643116&r1=643115&r2=643116&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/prefs.xml
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/prefs.xml
Mon Mar 31 12:55:46 2008
@@ -20,7 +20,7 @@
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
     <!-- Preferences Implementation -->
-    <bean id="PreferencesProviderImpl" class="org.apache.jetspeed.prefs.impl.PersistenceBrokerPreferencesProvider"
name="prefsPersistenceBroker" init-method="init">
+    <bean id="PreferencesProviderImpl" class="org.apache.jetspeed.prefs.impl.PersistenceBrokerPreferencesProvider"
name="prefsPersistenceBroker" init-method="init" destroy-method="destroy">
         <constructor-arg index="0">
             <value>JETSPEED-INF/ojb/prefs_repository.xml</value>
         </constructor-arg>
@@ -37,7 +37,7 @@
         <constructor-arg index='3'><value type="boolean">false</value></constructor-arg>
       
     </bean>
 
-    <bean id="org.apache.jetspeed.prefs.PreferencesProvider" parent="baseTransactionProxy"
name="prefsProvider">
+    <bean id="org.apache.jetspeed.prefs.PreferencesProvider" parent="baseTransactionProxy"
name="prefsProvider" destroy-method="destroy">
         <property name="proxyInterfaces">
             <value>org.apache.jetspeed.prefs.PreferencesProvider</value>
         </property>
@@ -56,7 +56,9 @@
     </bean>
 
     <!-- PreferencesFactory implementation -->
-    <bean id="java.util.prefs.PreferencesFactory" class="org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl"
name="prefsFactory" init-method="init">
+    <bean id="java.util.prefs.PreferencesFactory" class="org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl"
name="prefsFactory" init-method="init" destroy-method="destroy">
+        <!-- dummy constructor argument to distinguish it from the default constructor
invoked by the Java Preferences itself --> 
+        <constructor-arg><value>1</value></constructor-arg>
         <property name="prefsProvider">
             <ref bean="prefsProvider" />
         </property>



---------------------------------------------------------------------
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