portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r740461 - in /portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE: commons/src/java/org/apache/jetspeed/util/ components/page-manager/ components/prefs/ components/prefs/src/java/org/apache/jetspeed/prefs/impl/ src/webapp/WEB-INF/...
Date Tue, 03 Feb 2009 21:38:03 GMT
Author: taylor
Date: Tue Feb  3 21:38:02 2009
New Revision: 740461

URL: http://svn.apache.org/viewvc?rev=740461&view=rev
Log:
Backport of preferences fix: when redeploying Jetspeed, the Java Preferences would hold on
(via a static) to the old Preferences Spring component, not allowing the newly created Preferences
Spring component to replace it. Fixed this by wrappering the Spring Preferences component
and always intercepting calls to userRoot and systemRoot

Added:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
  (with props)
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
  (with props)
Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/page-manager/project.xml
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/pom.xml
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/src/webapp/WEB-INF/assembly/prefs.xml

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java?rev=740461&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
(added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
Tue Feb  3 21:38:02 2009
@@ -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/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/commons/src/java/org/apache/jetspeed/util/PreferencesRootWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/page-manager/project.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/page-manager/project.xml?rev=740461&r1=740460&r2=740461&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/page-manager/project.xml
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/page-manager/project.xml
Tue Feb  3 21:38:02 2009
@@ -90,6 +90,7 @@
             <excludes>
                 <exclude>**/PageManagerTestShared.java</exclude>
               <exclude>**/DirectoryXMLTransform.java</exclude>
+              <exclude>**/TestTransactions.java</exclude>
             </excludes>
             <resources>
                 <resource>

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/pom.xml?rev=740461&r1=740460&r2=740461&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/pom.xml
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/pom.xml
Tue Feb  3 21:38:02 2009
@@ -50,6 +50,11 @@
             <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-rdbms</artifactId>
         </dependency>
+       <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-commons</artifactId>
+            <scope>provided</scope>
+        </dependency>        
         <!--
             Note: junit is normally required only for test, but 
             in this case, abstract test cases are included in the

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java?rev=740461&r1=740460&r2=740461&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
Tue Feb  3 21:38:02 2009
@@ -523,5 +523,12 @@
     {
         return new PropertyImpl(node.getNodeId(), name, value);
     }
+ 
+    public void destroy()
+    {
+        NodeImplProxy.setProvider(null);
+        preferenceCache = null;
+    }
+    
     
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java?rev=740461&r1=740460&r2=740461&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesFactoryImpl.java
Tue Feb  3 21:38:02 2009
@@ -16,35 +16,57 @@
  */
 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>
  */
 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 +74,7 @@
      */
     public Preferences userRoot()
     {
-        return  PreferencesImpl.userRoot;
+        return userRootWrapper;
     }
     
     /**
@@ -65,35 +87,44 @@
     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 destroy()
     {
-        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;
+    }    
+
     
     /**
      * <p>
      * 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/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java?rev=740461&r1=740460&r2=740461&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesImpl.java
Tue Feb  3 21:38:02 2009
@@ -57,12 +57,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,12 +77,13 @@
      * @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);
+        this.ppw = ppw;
         try
         {
-            node = prefsProvider.getNode(this.absolutePath(), nodeType);
+            node = ppw.provider().getNode(this.absolutePath(), nodeType);
             newNode = false;
         }
         catch (NodeDoesNotExistException e1)
@@ -90,11 +92,11 @@
             {
                 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;
@@ -110,7 +112,7 @@
             {
                 try
                 {
-                    node = prefsProvider.getNode(this.absolutePath(), nodeType);
+                    node = ppw.provider().getNode(this.absolutePath(), nodeType);
                     newNode = false;
                 }
                 catch (NodeDoesNotExistException e2)
@@ -134,7 +136,7 @@
      */
     public String[] childrenNamesSpi() throws BackingStoreException
     {
-        Collection nodes = prefsProvider.getChildren(getNode());
+        Collection nodes = ppw.provider().getChildren(getNode());
 
         if (null != nodes)
         {
@@ -159,7 +161,7 @@
      */
     public AbstractPreferences childSpi(String name)
     {
-        return new PreferencesImpl(this, name, node.getNodeType());
+        return new PreferencesImpl(this, ppw, name, node.getNodeType());
     }
 
     /**
@@ -167,7 +169,7 @@
      */
     public void flushSpi() throws BackingStoreException
     {
-        prefsProvider.storeNode(this.node);
+        ppw.provider().storeNode(this.node);
     }
 
     /**
@@ -249,7 +251,7 @@
             properties.add(new PropertyImpl(node.getNodeId(), key, value));
         }
 
-        prefsProvider.storeNode(node);
+        ppw.provider().storeNode(node);
     }
 
     /**
@@ -263,7 +265,7 @@
         {
             parentNode = ((PreferencesImpl) parent).getNode();
         }
-        prefsProvider.removeNode(parentNode, node);
+        ppw.provider().removeNode(parentNode, node);
     }
 
     /**
@@ -283,7 +285,7 @@
             }
         }
         // Update node.
-        prefsProvider.storeNode(node);
+        ppw.provider().storeNode(node);
     }
 
     /**
@@ -307,19 +309,4 @@
         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;
-    }
 }
\ No newline at end of file

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java?rev=740461&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
(added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
Tue Feb  3 21:38:02 2009
@@ -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/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PreferencesProviderWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/src/webapp/WEB-INF/assembly/prefs.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/src/webapp/WEB-INF/assembly/prefs.xml?rev=740461&r1=740460&r2=740461&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/src/webapp/WEB-INF/assembly/prefs.xml
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/src/webapp/WEB-INF/assembly/prefs.xml
Tue Feb  3 21:38:02 2009
@@ -19,7 +19,8 @@
 <beans>
 
     <!-- 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>
@@ -47,7 +48,10 @@
     </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