cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r329462 - in /cocoon/blocks/portal/trunk: ./ java/org/apache/cocoon/environment/portlet/ java/org/apache/cocoon/portal/ java/org/apache/cocoon/portal/coplet/impl/ java/org/apache/cocoon/portal/event/impl/ java/org/apache/cocoon/portal/impl/...
Date Sat, 29 Oct 2005 18:08:56 GMT
Author: cziegeler
Date: Sat Oct 29 11:08:42 2005
New Revision: 329462

URL: http://svn.apache.org/viewcvs?rev=329462&view=rev
Log:
Make coplet adapters accessible from component manager
Fix compilation problems

Removed:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/MaximizeEvent.java
Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletException.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalComponentManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
    cocoon/blocks/portal/trunk/status.xml

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletException.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletException.java?rev=329462&r1=329461&r2=329462&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletException.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletException.java
Sat Oct 29 11:08:42 2005
@@ -15,13 +15,13 @@
  */
 package org.apache.cocoon.environment.portlet;
 
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 
 /**
  *
  * @version $Id$
  */
-public class PortletException extends PortalException {
+public class PortletException extends PortalRuntimeException {
 
     public PortletException() {
         super();

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalComponentManager.java?rev=329462&r1=329461&r2=329462&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalComponentManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalComponentManager.java Sat
Oct 29 11:08:42 2005
@@ -18,6 +18,7 @@
 import org.apache.cocoon.core.Core;
 import org.apache.avalon.framework.context.Context;
 import org.apache.cocoon.portal.coplet.CopletFactory;
+import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.LayoutFactory;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
@@ -50,7 +51,12 @@
     /**
      * Get the renderer.
      */
-    Renderer getRenderer(String hint);
+    Renderer getRenderer(String name);
+
+    /**
+     * Get the coplet adapter.
+     */
+    CopletAdapter getCopletAdapter(String name);
 
     /**
      * Get the coplet factory.

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java?rev=329462&r1=329461&r2=329462&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
Sat Oct 29 11:08:42 2005
@@ -15,8 +15,6 @@
  */
 package org.apache.cocoon.portal.coplet.impl;
 
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.cocoon.portal.PortalException;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletFactory;
@@ -61,21 +59,9 @@
 
         // now lookup the adapter
         final String adapterName = copletData.getCopletBaseData().getCopletAdapterName();
-        CopletAdapter adapter = null;
-        ServiceSelector adapterSelector = null;
-        try {
-            adapterSelector = (ServiceSelector) this.manager.lookup( CopletAdapter.ROLE +
"Selector");
-            adapter = (CopletAdapter)adapterSelector.select( adapterName );
-            adapter.init( instance );
-            adapter.login( instance );
-        } catch (ServiceException ce) {
-            throw new PortalException("Unable to lookup coplet adapter selector or adaptor.",
ce);
-        } finally {
-            if ( adapterSelector != null) {
-                adapterSelector.release( adapter );
-            }
-            this.manager.release( adapterSelector );
-        }
+        final CopletAdapter adapter = this.portalService.getComponentManager().getCopletAdapter(adapterName);
+        adapter.init( instance );
+        adapter.login( instance );
 
         // send an event
         this.portalService.getComponentManager().getEventManager().send(new CopletInstanceDataAddedEvent(instance));
@@ -89,22 +75,9 @@
         if ( copletInstanceData != null ) {
             // now lookup the adapter
             final String adapterName = copletInstanceData.getCopletData().getCopletBaseData().getCopletAdapterName();
-            CopletAdapter adapter = null;
-            ServiceSelector adapterSelector = null;
-            try {
-                adapterSelector = (ServiceSelector) this.manager.lookup( CopletAdapter.ROLE
+ "Selector");
-                adapter = (CopletAdapter)adapterSelector.select( adapterName );
-                adapter.logout( copletInstanceData );
-                adapter.destroy( copletInstanceData );
-            } catch (ServiceException ce) {
-                // we ignore this exception as this is just a remove action
-                this.getLogger().warn("Unable to lookup coplet adaptor: " + adapterName);
-            } finally {
-                if ( adapterSelector != null) {
-                    adapterSelector.release( adapter );
-                }
-                this.manager.release( adapterSelector );
-            }
+            final CopletAdapter adapter = this.portalService.getComponentManager().getCopletAdapter(adapterName);
+            adapter.logout( copletInstanceData );
+            adapter.destroy( copletInstanceData );
 
             // send an event
             this.portalService.getComponentManager().getEventManager().send(new CopletInstanceDataRemovedEvent(copletInstanceData));

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java?rev=329462&r1=329461&r2=329462&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
Sat Oct 29 11:08:42 2005
@@ -29,6 +29,7 @@
 import org.apache.cocoon.core.Core;
 import org.apache.cocoon.portal.*;
 import org.apache.cocoon.portal.coplet.CopletFactory;
+import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.LayoutFactory;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
@@ -55,6 +56,8 @@
 
     protected Map renderers = new HashMap();
 
+    protected Map copletAdapters = new HashMap();
+
     protected CopletFactory copletFactory;
 
     protected LayoutFactory layoutFactory;
@@ -141,6 +144,11 @@
                 this.manager.release(i.next());
             }
             this.renderers.clear();
+            i = this.copletAdapters.values().iterator();
+            while (i.hasNext()) {
+                this.manager.release(i.next());
+            }
+            this.copletAdapters.clear();
             this.manager.release(this.profileManager);
             this.profileManager = null;
             this.manager.release(this.linkService);
@@ -162,14 +170,30 @@
     /**
      * @see org.apache.cocoon.portal.PortalComponentManager#getRenderer(java.lang.String)
      */
-    public Renderer getRenderer(String hint) {
-        Renderer o = (Renderer) this.renderers.get( hint );
+    public Renderer getRenderer(String name) {
+        Renderer o = (Renderer) this.renderers.get( name );
+        if ( o == null ) {
+            try {
+                o = (Renderer) this.manager.lookup( Renderer.ROLE + '/' + name );
+                this.renderers.put( name, o );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup renderer with name " +
name, e);
+            }
+        }
+        return o;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.PortalComponentManager#getCopletAdapter(java.lang.String)
+     */
+    public CopletAdapter getCopletAdapter(String name) {
+        CopletAdapter o = (CopletAdapter) this.copletAdapters.get( name );
         if ( o == null ) {
             try {
-                o = (Renderer) this.manager.lookup( Renderer.ROLE + '/' + hint );
-                this.renderers.put( hint, o );
+                o = (CopletAdapter) this.manager.lookup( CopletAdapter.ROLE + '/' + name
);
+                this.copletAdapters.put( name, o );
             } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup renderer with hint " +
hint, e);
+                throw new PortalRuntimeException("Unable to lookup coplet adapter with name
" + name, e);
             }
         }
         return o;

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java?rev=329462&r1=329461&r2=329462&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
Sat Oct 29 11:08:42 2005
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.portal.layout.renderer.aspect.impl;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 

Modified: cocoon/blocks/portal/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/status.xml?rev=329462&r1=329461&r2=329462&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/status.xml (original)
+++ cocoon/blocks/portal/trunk/status.xml Sat Oct 29 11:08:42 2005
@@ -66,6 +66,9 @@
  <changes>
   <release version="@version@" date="@date@">
     <action dev="CZ" type="add">
+      Make coplet adapters accessible from component manager.
+    </action>
+    <action dev="CZ" type="add">
       Add layout source to stream complete coplets/layouts.
     </action>
     <action dev="CZ" type="add">



Mime
View raw message