cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r209432 - in /cocoon/blocks/portal/trunk: WEB-INF/xconf/cocoon-portal.xconf java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
Date Wed, 06 Jul 2005 08:20:27 GMT
Author: cziegeler
Date: Wed Jul  6 01:20:25 2005
New Revision: 209432

URL: http://svn.apache.org/viewcvs?rev=209432&view=rev
Log:
Use portal logger, log execution time for a portlet and properly release component

Modified:
    cocoon/blocks/portal/trunk/WEB-INF/xconf/cocoon-portal.xconf
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java

Modified: cocoon/blocks/portal/trunk/WEB-INF/xconf/cocoon-portal.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/WEB-INF/xconf/cocoon-portal.xconf?rev=209432&r1=209431&r2=209432&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/WEB-INF/xconf/cocoon-portal.xconf (original)
+++ cocoon/blocks/portal/trunk/WEB-INF/xconf/cocoon-portal.xconf Wed Jul  6 01:20:25 2005
@@ -29,19 +29,20 @@
   -->
   <source-factories>
     <!-- portal protocol -->
-    <component-instance class="org.apache.cocoon.portal.source.CopletSourceFactory" name="coplet"/>
+    <component-instance class="org.apache.cocoon.portal.source.CopletSourceFactory" 
+                        name="coplet" logger="portal"/>
   </source-factories>
   <input-modules>
-      <component-instance logger="core.modules.input" name="coplet" class="org.apache.cocoon.portal.components.modules.input.CopletModule"/>
-      <component-instance logger="core.modules.input" name="portal-layout" class="org.apache.cocoon.portal.components.modules.input.LayoutModule"/>
-      <component-instance logger="core.modules.input" name="portal-skin" class="org.apache.cocoon.portal.components.modules.input.SkinModule"/>
-      <component-instance logger="core.modules.input" name="portalpath" class="org.apache.cocoon.components.modules.input.ProjectPathModule">
+      <component-instance name="coplet" class="org.apache.cocoon.portal.components.modules.input.CopletModule"
logger="portal"/>
+      <component-instance name="portal-layout" class="org.apache.cocoon.portal.components.modules.input.LayoutModule"
logger="portal"/>
+      <component-instance name="portal-skin" class="org.apache.cocoon.portal.components.modules.input.SkinModule"
logger="portal"/>
+      <component-instance name="portalpath" class="org.apache.cocoon.components.modules.input.ProjectPathModule"
logger="portal">
        	<uri-prefix>samples/blocks/portal/</uri-prefix>
       </component-instance>
   </input-modules>
   
  <!-- Event Aspect configuration -->
- <component class="org.apache.cocoon.core.container.DefaultServiceSelector" role="org.apache.cocoon.portal.event.aspect.EventAspectSelector">
+ <component class="org.apache.cocoon.core.container.DefaultServiceSelector" role="org.apache.cocoon.portal.event.aspect.EventAspectSelector"
logger="portal">
     <aspect name="action-counter" class="org.apache.cocoon.portal.event.aspect.impl.ActionCounterEventAspect"/>
     <aspect name="request-parameter" class="org.apache.cocoon.portal.event.aspect.impl.RequestParameterEventAspect"/>
     <aspect name="frame" class="org.apache.cocoon.portal.event.aspect.impl.FrameEventAspect"/>
@@ -95,7 +96,7 @@
  </component>
  
  <!-- Event Factory configuration -->
- <component class="org.apache.cocoon.components.ExtendedComponentSelector" role="org.apache.cocoon.portal.event.ConvertableEventFactorySelector">
+ <component class="org.apache.cocoon.components.ExtendedComponentSelector" role="org.apache.cocoon.portal.event.ConvertableEventFactorySelector"
logger="portal">
    <!-- The events that can be marshalled. The name must match the Event's request parameter.
-->
    <factory name="cocoon-portal-fs" class="org.apache.cocoon.portal.event.impl.FullScreenCopletEventFactory"/>
    <factory name="url" class="org.apache.cocoon.portal.pluto.PortletURLProviderFactory"/>
@@ -141,15 +142,17 @@
                     logger="portal"/>
     <!-- This is an extension of the uri adapter -->
     <coplet-adapter name="caching-uri"
-                    class="org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter"
logger="portal"/>
+                    class="org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter"
+                    logger="portal"/>
     <!-- This is the application adapter -->
     <coplet-adapter name="application"
-                    class="org.apache.cocoon.portal.coplet.adapter.impl.ApplicationCopletAdapter"
logger="portal"/>
+                    class="org.apache.cocoon.portal.coplet.adapter.impl.ApplicationCopletAdapter"
+                    logger="portal"/>
  </component>
 
 
  <!-- Renderer Aspect configuration -->
- <component class="org.apache.cocoon.core.container.DefaultServiceSelector" role="org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectSelector">
+ <component class="org.apache.cocoon.core.container.DefaultServiceSelector" role="org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectSelector"
logger="portal">
     <aspect name="composite-content" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.CompositeContentAspect"/>
     <aspect name="tab-content" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.TabContentAspect"/>
     <aspect name="window" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.WindowAspect"/>
@@ -186,25 +189,26 @@
  <!-- Aspect Storage configuration -->
  <component class="org.apache.cocoon.core.container.DefaultServiceSelector" 
             role="org.apache.cocoon.portal.aspect.AspectDataStoreSelector">
-    <store name="temporary" class="org.apache.cocoon.portal.aspect.impl.TemporaryAspectDataStore"/>
-    <store name="request" class="org.apache.cocoon.portal.aspect.impl.RequestAspectDataStore"/>
-    <store name="session" class="org.apache.cocoon.portal.aspect.impl.SessionAspectDataStore"/>
-    <store name="persistent" class="org.apache.cocoon.portal.aspect.impl.PersistentAspectDataStore"/>
-    <store name="memory" class="org.apache.cocoon.portal.aspect.impl.MemoryAspectDataStore"/>
+    <store name="temporary" logger="portal" class="org.apache.cocoon.portal.aspect.impl.TemporaryAspectDataStore"/>
+    <store name="request"  logger="portal" class="org.apache.cocoon.portal.aspect.impl.RequestAspectDataStore"/>
+    <store name="session" logger="portal" class="org.apache.cocoon.portal.aspect.impl.SessionAspectDataStore"/>
+    <store name="persistent" logger="portal" class="org.apache.cocoon.portal.aspect.impl.PersistentAspectDataStore"/>
+    <store name="memory" logger="portal" class="org.apache.cocoon.portal.aspect.impl.MemoryAspectDataStore"/>
  </component>
 
-<component class="org.apache.cocoon.components.persistence.CastorSourceConverter" role="org.apache.cocoon.components.persistence.CastorSourceConverter">
+ <component class="org.apache.cocoon.components.persistence.CastorSourceConverter" role="org.apache.cocoon.components.persistence.CastorSourceConverter"
logger="portal">
  	<mapping-source source="layout">resource://org/apache/cocoon/portal/layout/layout.xml</mapping-source>
  	<mapping-source source="copletbasedata">resource://org/apache/cocoon/portal/coplet/copletbasedata.xml</mapping-source>
  	<mapping-source source="copletdata">resource://org/apache/cocoon/portal/coplet/copletdata.xml</mapping-source>
  	<mapping-source source="copletinstancedata">resource://org/apache/cocoon/portal/coplet/copletinstancedata.xml</mapping-source>
  </component>
- <component class="org.apache.cocoon.portal.profile.impl.MapProfileLS" role="org.apache.cocoon.portal.profile.ProfileLS"
/>
+ <component class="org.apache.cocoon.portal.profile.impl.MapProfileLS" role="org.apache.cocoon.portal.profile.ProfileLS"
logger="portal"/>
 
- <component class="org.apache.cocoon.components.variables.DefaultVariableResolverFactory"
role="org.apache.cocoon.components.variables.VariableResolverFactory" />
+ <component class="org.apache.cocoon.components.variables.DefaultVariableResolverFactory"
role="org.apache.cocoon.components.variables.VariableResolverFactory" logger="portal"/>
  <!-- This is the basket manager -->
  <component class="org.apache.cocoon.portal.coplets.basket.BasketManagerImpl" 
-            role="org.apache.cocoon.portal.coplets.basket.BasketManager">
+            role="org.apache.cocoon.portal.coplets.basket.BasketManager"
+            logger="portal">
      <!-- This is only a sample configuration, it doesn't really work -->
      <parameter name="basket:action:print" value="cocoon://print-basket"/>
      <parameter name="basket:action:email" value="cocoon://email-basket"/>

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java?rev=209432&r1=209431&r2=209432&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
Wed Jul  6 01:20:25 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2002,2004 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -100,8 +100,17 @@
                                          ContentHandler contentHandler)
     throws SAXException; 
     
+    /**
+     * This method streams the content of a coplet instance data.
+     * It handles buffering and timeout setting and calls
+     * {@link #streamContent(CopletInstanceData, ContentHandler)}
+     * for creating the content.
+     *
+     * @see org.apache.cocoon.portal.coplet.adapter.CopletAdapter#toSAX(org.apache.cocoon.portal.coplet.CopletInstanceData,
org.xml.sax.ContentHandler)
+     */
     public void toSAX(CopletInstanceData coplet, ContentHandler contentHandler)
     throws SAXException {
+        final long startTime = System.currentTimeMillis();
         Boolean bool = (Boolean) this.getConfiguration( coplet, "buffer" );
         Integer timeout = (Integer) this.getConfiguration( coplet, "timeout");
         if ( timeout != null ) {
@@ -119,8 +128,11 @@
                     final int milli = timeout.intValue() * 1000;
                     LoaderThread loader = new LoaderThread(this, coplet, buffer);
                     final RunnableManager runnableManager = (RunnableManager)this.manager.lookup(
RunnableManager.ROLE );
-                    runnableManager.execute( new CocoonRunnable(loader) );
-                    this.manager.release( runnableManager );
+                    try {
+                        runnableManager.execute( new CocoonRunnable(loader) );
+                    } finally {
+                        this.manager.release( runnableManager );
+                    }
                     try {
                         read = loader.join( milli );
                     } catch (InterruptedException ignore) {
@@ -154,7 +166,11 @@
         } else {
             this.streamContent( coplet, contentHandler );
         }
-        
+        if ( this.getLogger().isInfoEnabled() ) {
+            final long msecs = System.currentTimeMillis() - startTime;
+            this.getLogger().info("Streamed coplet " + coplet.getCopletData().getId() +
+                                  " (instance " + coplet.getId() + ") in " + msecs + "ms.");
+        }
     }
     
     /* (non-Javadoc)



Mime
View raw message