cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r365359 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/ src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ src/blocks/portal/java/org/apache/cocoon/portal/wsrp/...
Date Mon, 02 Jan 2006 15:20:11 GMT
Author: cziegeler
Date: Mon Jan  2 07:19:58 2006
New Revision: 365359

URL: http://svn.apache.org/viewcvs?rev=365359&view=rev
Log:
Make wsrp event adapter thread safe, fix error in disposing wsrp
producer and update portals bridges to 1.0.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerRegistryImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java
Mon Jan  2 07:19:58 2006
@@ -16,13 +16,11 @@
 package org.apache.cocoon.portal.layout.renderer.aspect.impl;
 
 import java.util.Iterator;
-import java.util.List;
 
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.layout.CompositeLayout;
 import org.apache.cocoon.portal.layout.Item;
 import org.apache.cocoon.portal.layout.Layout;
-import org.apache.cocoon.portal.layout.NamedItem;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
 import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext;
 import org.xml.sax.ContentHandler;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
Mon Jan  2 07:19:58 2006
@@ -208,30 +208,6 @@
         return Collections.singletonList(desc).iterator();
     }
 
-    /**
-     *
-     * @param service
-     * @param tab
-     */
-    private Layout getNextLayout(PortalService service, Item tab) {
-        Layout tabLayout = tab.getLayout();
-        if (tabLayout instanceof CompositeLayout) {
-            CompositeLayout layout = (CompositeLayout)tabLayout;
-            List list = layout.getItems();
-            int size = list.size();
-            for (int i = 0; i < size; i++) {
-                if (list.get(i) instanceof NamedItem) {
-                    return tabLayout;
-                }
-            }
-        }
-        Layout nextLayout = service.getEntryLayout(null);
-        if (nextLayout == null) {
-            nextLayout = tab.getLayout();
-        }
-        return nextLayout;
-    }
-
     /*
      * Generate the sub navigation for non-selected tabs
      * @param context

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java
Mon Jan  2 07:19:58 2006
@@ -101,7 +101,7 @@
     }
 
     /**
-     * @see javax.servlet.http.HttpServletResponse#redirect(java.lang.String)
+     * @see javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)
      */
     public void sendRedirect(String arg0) throws IOException {
         this.redirectURL = arg0;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
Mon Jan  2 07:19:58 2006
@@ -18,7 +18,6 @@
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.servlet.ServletConfig;
@@ -254,23 +253,13 @@
      * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */
     public void dispose() {
-        
-        consumerEnvironment.getPortletRegistry().removeAllPortlets();
-        
-        Iterator producers = consumerEnvironment.getProducerRegistry().getAllProducers();
-        Producer producer;
-        while (producers.hasNext()) {
-            producer = (Producer) producers.next();
-            try {
-                producer.deregister();    
-            } catch (WSRPException e) {
-                this.getLogger().error("deregister() producer: " + producer.getName());
-            }
+        if ( this.consumerEnvironment != null ) {
+            this.consumerEnvironment.getPortletRegistry().removeAllPortlets();
+
+            this.consumerEnvironment.getProducerRegistry().removeAllProducers();
+
+            this.consumerEnvironment.getUserRegistry().removeAllUsers();
         }
-        consumerEnvironment.getProducerRegistry().removeAllProducers();
-        
-        consumerEnvironment.getUserRegistry().removeAllUsers();
-        
         if ( this.manager != null ) {
             EventManager eventManager = null;
             try {

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java
Mon Jan  2 07:19:58 2006
@@ -19,6 +19,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.portal.PortalService;
@@ -35,7 +36,7 @@
  * 
  * @version $Id$
  */
-public class WSRPEventAspect implements EventAspect {
+public class WSRPEventAspect implements EventAspect, ThreadSafe {
 
     public static final String REQUEST_PARAMETER_NAME = "cocoon-wsrpevent";
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java
Mon Jan  2 07:19:58 2006
@@ -17,6 +17,8 @@
 
 import oasis.names.tc.wsrp.v1.types.StateChange;
 
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
@@ -45,7 +47,8 @@
  * @version $Id$
  **/
 public class ConsumerEnvironmentImpl
-    extends GenericConsumerEnvironment {
+    extends GenericConsumerEnvironment
+    implements Disposable {
 
     /** The generator used to rewrite the urls. */
     protected URLGenerator urlGenerator;
@@ -141,5 +144,20 @@
         User user = (User)coplet.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_USER);
         
         return ((UserContextExtension)user.getUserContext()).getUserAuthentication();
-    }    
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        // dispose in reverse order
+        ContainerUtil.dispose(this.urlGenerator);
+        ContainerUtil.dispose(this.getPortletDriverRegistry());
+        ContainerUtil.dispose(this.getURLRewriter());
+        ContainerUtil.dispose(this.getTemplateComposer());
+        ContainerUtil.dispose(this.getPortletRegistry());
+        ContainerUtil.dispose(this.getProducerRegistry());
+        ContainerUtil.dispose(this.getSessionHandler());
+        ContainerUtil.dispose(this.getUserRegistry());
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerRegistryImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerRegistryImpl.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerRegistryImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerRegistryImpl.java
Mon Jan  2 07:19:58 2006
@@ -197,7 +197,18 @@
      * @see org.apache.wsrp4j.consumer.ProducerRegistry#removeAllProducers()
      */
     public void removeAllProducers() {
-        this.checkInitialized();
+        // we only remove all producers if we are initialized
+        if ( this.initialized ) {
+            Iterator iter = this.descriptions.values().iterator();
+            while (iter.hasNext()) {
+                final Producer producer = (Producer) iter.next();
+                try {
+                    producer.deregister();    
+                } catch (WSRPException e) {
+                    this.logger.error("deregister() producer: " + producer.getName());
+                }
+            }
+        }
         this.descriptions.clear();
         super.removeAllProducers();
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
Mon Jan  2 07:19:58 2006
@@ -78,7 +78,6 @@
 import java.io.PrintStream;
 import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
-import java.net.SocketException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java
Mon Jan  2 07:19:58 2006
@@ -54,10 +54,8 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.PrintStream;
 import java.net.MalformedURLException;
-import java.net.SocketException;
 import java.net.URL;
 import java.util.HashMap;
 

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=365359&r1=365358&r2=365359&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Jan  2 07:19:58 2006
@@ -179,6 +179,10 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.9" date="TBD">
+   <action dev="CZ" type="fix">
+      Portal Block: Make wsrp event adapter thread safe, fix error in disposing wsrp
+                    producer and update portals bridges to 1.0.
+    </action> 
    <action dev="AG" type="update">
      Replace deprecated library excalibur-io 1.1 with commons-io 1.1.
      The file excalibur-io-1.1.jar is no longer part of the cocoon distribution.



Mime
View raw message