cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r433542 [1/2] - in /cocoon/trunk/blocks/cocoon-portal: cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/eve...
Date Tue, 22 Aug 2006 06:20:43 GMT
Author: cziegeler
Date: Mon Aug 21 23:20:41 2006
New Revision: 433542

URL: http://svn.apache.org/viewvc?rev=433542&view=rev
Log:
Start cleaning up aspect configuration/implementation

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspect.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectPrepareContext.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectPrepareContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectRenderContext.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectRenderContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspect.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspectContext.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspectContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PageLabelProfileManagerAspect.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/PageLabelProfileManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PreloadPortalManagerAspect.java
      - copied, changed from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PreloadPortalManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java   (with props)
Removed:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectPrepareContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectRenderContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/EventAspectChain.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/DefaultPortalManagerAspectContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerAspectChain.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PreloadPortalManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspectContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/DefaultProfileManagerAspectContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/PageLabelProfileManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/ProfileManagerAspectChain.java
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/EventConverter.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspectContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/NoClientCachingEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/PageLabelEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventAspectContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultLinkService.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/RegistrationBeanPostProcessor.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/xconf/cocoon-portal-sample.xconf
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java Mon Aug 21 23:20:41 2006
@@ -18,6 +18,7 @@
 import java.util.Properties;
 
 import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspect;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -62,4 +63,6 @@
     void showPortal(ContentHandler ch,
                     Properties     properties)
     throws SAXException;
+
+    void register(PortalManagerAspect aspect);
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java Mon Aug 21 23:20:41 2006
@@ -18,6 +18,7 @@
 import java.util.List;
 
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.event.EventConverter;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
 import org.apache.cocoon.portal.profile.ProfileManager;
@@ -114,6 +115,9 @@
      * Get the event manager
      */
     EventManager getEventManager();
+
+    /** Get the event converter. */
+    EventConverter getEventConverter();
 
     /**
      * Get the portal manager

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/EventConverter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/EventConverter.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/EventConverter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/EventConverter.java Mon Aug 21 23:20:41 2006
@@ -25,8 +25,6 @@
  */
 public interface EventConverter {
 
-    String ROLE = EventConverter.class.getName();
-
     /**
      * Encode an event.
      * This is used to "activate" events using a link

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspect.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspect.java Mon Aug 21 23:20:41 2006
@@ -15,8 +15,6 @@
  */
 package org.apache.cocoon.portal.event.aspect;
 
-import org.apache.cocoon.portal.PortalService;
-
 /**
  *
  * @version $Id$
@@ -25,6 +23,5 @@
 
     String ROLE = EventAspect.class.getName();
 
-    void process(EventAspectContext context,
-                 PortalService  service);
+    void process(EventAspectContext context);
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspectContext.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspectContext.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspectContext.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/EventAspectContext.java Mon Aug 21 23:20:41 2006
@@ -15,29 +15,17 @@
  */
 package org.apache.cocoon.portal.event.aspect;
 
-import java.util.Properties;
-
-import org.apache.cocoon.portal.PortalService;
-import org.apache.cocoon.portal.event.EventConverter;
+import org.apache.cocoon.portal.services.aspects.BasicAspectContext;
 
 /**
  *
  * @version $Id$
  */
-public interface EventAspectContext {
+public interface EventAspectContext
+    extends BasicAspectContext {
 
     /**
      * Invoke next aspect 
      */
-    void invokeNext(PortalService service);
-
-    /** 
-     * Get the {@link Properties} of the aspect.
-     */
-    Properties getAspectProperties();
-
-    /**
-     * Get the encoder
-     */
-    EventConverter getEventConverter();
+    void invokeNext();
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java Mon Aug 21 23:20:41 2006
@@ -75,19 +75,19 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
+     * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
      */
-    public void process(EventAspectContext context, PortalService service) {
-        final Request request = ObjectModelHelper.getRequest(service.getProcessInfoProvider().getObjectModel());
+    public void process(EventAspectContext context) {
+        final Request request = ObjectModelHelper.getRequest(context.getPortalService().getProcessInfoProvider().getObjectModel());
         String[] values = request.getParameterValues(this.getRequestParameterName());
         if (values != null) {
-            final EventManager publisher = service.getEventManager();
+            final EventManager publisher = context.getPortalService().getEventManager();
             for (int i = 0; i < values.length; i++) {
                 // first try to make an event out of the value of the parameter
                 final String value = values[i];
                 Event e = null;
                 try {
-                    e = context.getEventConverter().decode(value);
+                    e = context.getPortalService().getEventConverter().decode(value);
                     if (null != e) {
                         publisher.send(e);
                     }
@@ -116,7 +116,7 @@
                             tokenNumber = tokenNumber + 1;
                         } 
 
-                        this.publish( service, eventValues );
+                        this.publish( context.getPortalService(), eventValues );
 
                     } else {
                         this.getLogger().warn("Data for Event is not set correctly");
@@ -125,6 +125,6 @@
             }
         }
         // and invoke next one
-        context.invokeNext(service);
+        context.invokeNext();
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java Mon Aug 21 23:20:41 2006
@@ -23,7 +23,6 @@
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Response;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.aspect.EventAspect;
 import org.apache.cocoon.portal.event.aspect.EventAspectContext;
 
@@ -50,24 +49,24 @@
     protected String parameterName;
 
 	/**
-	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
 	 */
-	public void process(EventAspectContext context, PortalService service) {
+	public void process(EventAspectContext context) {
         final String requestParameterName = context.getAspectProperties().getProperty("parameter-name", this.parameterName);
 
         int actionCount;
 
-        Integer actionValue = (Integer) service.getUserService().getAttribute(ATTRIBUTE_NAME);
+        Integer actionValue = (Integer) context.getPortalService().getUserService().getAttribute(ATTRIBUTE_NAME);
         if (null == actionValue) {
             actionValue = new Integer(0);
-            service.getUserService().setAttribute(ATTRIBUTE_NAME, actionValue);
+            context.getPortalService().getUserService().setAttribute(ATTRIBUTE_NAME, actionValue);
             actionCount = 0;
         } else {
             actionCount = actionValue.intValue() + 1;
-            service.getUserService().setAttribute(ATTRIBUTE_NAME, new Integer(actionCount));
+            context.getPortalService().getUserService().setAttribute(ATTRIBUTE_NAME, new Integer(actionCount));
         }
 
-        final Request request = ObjectModelHelper.getRequest( service.getProcessInfoProvider().getObjectModel() );
+        final Request request = ObjectModelHelper.getRequest( context.getPortalService().getProcessInfoProvider().getObjectModel() );
         String value = request.getParameter( requestParameterName );
         if ( value != null && actionCount > 0) {
             // get number
@@ -80,12 +79,12 @@
 
             if ( number == actionCount - 1) {
                 // and invoke next one
-                context.invokeNext( service );
+                context.invokeNext();
             }
         }
-        service.getLinkService().addUniqueParameterToLink( requestParameterName, String.valueOf(actionCount));
+        context.getPortalService().getLinkService().addUniqueParameterToLink( requestParameterName, String.valueOf(actionCount));
 
-        final Response response = ObjectModelHelper.getResponse( service.getProcessInfoProvider().getObjectModel() );
+        final Response response = ObjectModelHelper.getResponse( context.getPortalService().getProcessInfoProvider().getObjectModel() );
         response.setHeader("Cache-Control", "no-cache");
         response.addHeader("Cache-Control", "no-store");
         response.setHeader("Pragma", "no-cache");

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/NoClientCachingEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/NoClientCachingEventAspect.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/NoClientCachingEventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/NoClientCachingEventAspect.java Mon Aug 21 23:20:41 2006
@@ -19,7 +19,6 @@
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Response;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.aspect.EventAspect;
 import org.apache.cocoon.portal.event.aspect.EventAspectContext;
 
@@ -35,17 +34,16 @@
 	implements EventAspect,
                ThreadSafe {
 
-    /**
-	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
+	/**
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
 	 */
-	public void process(EventAspectContext context, PortalService service) {
-
-        final Response response = ObjectModelHelper.getResponse( service.getProcessInfoProvider().getObjectModel() );
+	public void process(EventAspectContext context) {
+        final Response response = ObjectModelHelper.getResponse( context.getPortalService().getProcessInfoProvider().getObjectModel() );
         response.setHeader("Cache-Control", "no-cache");
         response.addHeader("Cache-Control", "no-store");
         response.setHeader("Pragma", "no-cache");
         response.setHeader("Expires", "Thu, 01 Jan 2000 00:00:00 GMT");
 
-        context.invokeNext(service);
+        context.invokeNext();
 	}
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/PageLabelEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/PageLabelEventAspect.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/PageLabelEventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/PageLabelEventAspect.java Mon Aug 21 23:20:41 2006
@@ -25,7 +25,6 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.impl.PageLabelManager;
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.event.EventManager;
@@ -69,12 +68,12 @@
     }
 
 	/**
-	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
 	 */
-	public void process(EventAspectContext context, PortalService service) {
+	public void process(EventAspectContext context) {
         if (this.labelManager != null) {
-            final EventManager publisher = service.getEventManager();
-            final Request request = ObjectModelHelper.getRequest(service.getProcessInfoProvider().getObjectModel());
+            final EventManager publisher = context.getPortalService().getEventManager();
+            final Request request = ObjectModelHelper.getRequest(context.getPortalService().getProcessInfoProvider().getObjectModel());
             final String parameterName = this.labelManager.getRequestParameterName();
 
             String label = request.getParameter(parameterName);
@@ -95,6 +94,6 @@
             }
         }
 
-        context.invokeNext( service );
+        context.invokeNext();
 	}
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java Mon Aug 21 23:20:41 2006
@@ -22,7 +22,6 @@
 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;
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.event.aspect.EventAspect;
@@ -38,15 +37,14 @@
 	implements EventAspect, ThreadSafe {
 
     protected void process(EventAspectContext context,
-                           PortalService      service,
                            Request            request, 
                            String             parameterName) {
         String[] values = request.getParameterValues( parameterName );
-        final EventManager publisher = service.getEventManager();
+        final EventManager publisher = context.getPortalService().getEventManager();
         if ( values != null ) {
             for(int i=0; i<values.length; i++) {
                 final String current = values[i];
-                final Event e = context.getEventConverter().decode(current);
+                final Event e = context.getPortalService().getEventConverter().decode(current);
                 if ( null != e) {
                     publisher.send(e);
                 }
@@ -63,24 +61,24 @@
     }
 
 	/**
-	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
 	 */
-	public void process(EventAspectContext context, PortalService service) {
-        final Request request = ObjectModelHelper.getRequest(service.getProcessInfoProvider().getObjectModel());
+	public void process(EventAspectContext context) {
+        final Request request = ObjectModelHelper.getRequest(context.getPortalService().getProcessInfoProvider().getObjectModel());
         final String requestParameterNames = context.getAspectProperties().getProperty("parameter-name", LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME);
         boolean processedDefault = false;
 
         StringTokenizer tokenizer = new StringTokenizer(requestParameterNames, ", ");
         while ( tokenizer.hasMoreTokens() ) {
             final String currentName = tokenizer.nextToken();
-            this.process(context, service, request, currentName);
+            this.process(context, request, currentName);
             if ( LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME.equals(currentName) ) {
                 processedDefault = true;
             }
         }
         if ( !processedDefault ) {
-            this.process( context, service, request, LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME );
+            this.process( context, request, LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME );
         }
-        context.invokeNext( service );        
+        context.invokeNext();        
 	}
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventAspectContext.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventAspectContext.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventAspectContext.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventAspectContext.java Mon Aug 21 23:20:41 2006
@@ -15,62 +15,32 @@
  */
 package org.apache.cocoon.portal.event.impl;
 
-import java.util.Iterator;
-import java.util.Properties;
-
 import org.apache.cocoon.portal.PortalService;
-import org.apache.cocoon.portal.event.EventConverter;
 import org.apache.cocoon.portal.event.aspect.EventAspect;
 import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
+import org.apache.cocoon.portal.services.aspects.support.BasicAspectContextImpl;
 
 /**
  *
  * @version $Id$
  */
-public final class DefaultEventAspectContext 
+public final class DefaultEventAspectContext
+    extends BasicAspectContextImpl
     implements EventAspectContext {
 
-    private Iterator iterator;
-    private Iterator configIterator;
-    private Properties config;
-
-    private EventConverter converter;
-
-    public DefaultEventAspectContext(EventAspectChain chain) {
-        this.iterator = chain.getIterator();
-        this.configIterator = chain.getConfigIterator();
+    public DefaultEventAspectContext(PortalService service, AspectChain chain) {
+        super(service, chain);
     }
 
 	/**
-	 * @see org.apache.cocoon.portal.event.aspect.EventAspectContext#invokeNext(org.apache.cocoon.portal.PortalService)
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspectContext#invokeNext()
 	 */
-	public void invokeNext(PortalService service) {
-		if (iterator.hasNext()) {
-            this.config = (Properties) this.configIterator.next();
-            final EventAspect aspect = (EventAspect) iterator.next();
-            aspect.process( this, service );
+	public void invokeNext() {
+        final EventAspect aspect = (EventAspect) this.getNext();
+		if (aspect != null ) {
+            aspect.process(this);
 		}
 
-	}
-
-	/**
-	 * @see org.apache.cocoon.portal.event.aspect.EventAspectContext#getAspectProperties()
-	 */
-	public Properties getAspectProperties() {
-		return this.config;
-	}
-
-    /**
-     * Get the encoder
-     */
-    public EventConverter getEventConverter(){
-        return this.converter;
-    }
-
-	/**
-	 * @param converter
-	 */
-	public void setEventConverter(EventConverter converter) {
-		this.converter = converter;
 	}
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java Mon Aug 21 23:20:41 2006
@@ -26,15 +26,15 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.Event;
-import org.apache.cocoon.portal.event.EventConverter;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.event.aspect.EventAspect;
 import org.apache.cocoon.portal.impl.AbstractComponent;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
 
 /**
  * This is the default implementation of the event manager.
@@ -59,7 +59,7 @@
     /** Our configuration. */
     protected Configuration configuration;
 
-    protected EventAspectChain chain;
+    protected AspectChain chain;
 
     /** Introspected receiver classes. */
     protected Map receiverClasses = new HashMap();
@@ -115,27 +115,15 @@
     throws ProcessingException {
         if ( this.configuration != null ) {
             try {
-                this.chain = new EventAspectChain();
-                this.chain.configure(this.manager, this.configuration.getChild("event-aspects"));
+                this.chain = new AspectChain();
+                this.chain.configure(this.manager, EventAspect.class, this.configuration);
             } catch (ConfigurationException ce) {
                 throw new ProcessingException("Unable configure component.", ce);
             }
             this.configuration = null;
         }
-        DefaultEventAspectContext eventContext = new DefaultEventAspectContext(this.chain);
-        EventConverter converter = null;
-        try {
-            converter = (EventConverter) this.manager.lookup(EventConverter.ROLE);
-
-            // Invoke aspects
-            eventContext.setEventConverter(converter);
-            eventContext.invokeNext( this.portalService );
-
-        } catch (ServiceException ce) {
-            throw new ProcessingException("Unable to lookup component.", ce);
-        } finally {
-            this.manager.release(converter);
-        }
+        DefaultEventAspectContext eventContext = new DefaultEventAspectContext(this.portalService, this.chain);
+        eventContext.invokeNext();
     }
 
     /**

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java Mon Aug 21 23:20:41 2006
@@ -28,10 +28,6 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.portal.LayoutException;
 import org.apache.cocoon.portal.PortalManager;
-import org.apache.cocoon.portal.PortalManagerAspect;
-import org.apache.cocoon.portal.PortalManagerAspectPrepareContext;
-import org.apache.cocoon.portal.PortalManagerAspectRenderContext;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
 import org.apache.cocoon.portal.om.CopletInstance;
@@ -39,6 +35,11 @@
 import org.apache.cocoon.portal.om.Layout;
 import org.apache.cocoon.portal.om.LayoutFeatures;
 import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspect;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext;
+import org.apache.cocoon.portal.services.aspects.impl.support.PortalManagerAspectContextImpl;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
 import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.cocoon.xml.XMLUtils;
 import org.apache.commons.lang.StringUtils;
@@ -53,7 +54,7 @@
 	extends AbstractComponent
 	implements PortalManager, PortalManagerAspect, Configurable {
 
-    protected PortalManagerAspectChain chain;
+    protected AspectChain chain;
 
     /**
      * @see org.apache.avalon.framework.activity.Disposable#dispose()
@@ -72,9 +73,8 @@
      */
     public void process()
     throws ProcessingException {
-        DefaultPortalManagerAspectContext aspectContext =
-            new DefaultPortalManagerAspectContext(this.chain,
-                                                  this.portalService);
+        PortalManagerAspectContextImpl aspectContext =
+            new PortalManagerAspectContextImpl(this.portalService, this.chain);
         aspectContext.invokeNext();
     }
 
@@ -83,9 +83,8 @@
 	 */
 	public void showPortal(ContentHandler contentHandler, Properties properties) 
     throws SAXException {
-        DefaultPortalManagerAspectContext aspectContext =
-            new DefaultPortalManagerAspectContext(this.chain,
-                                                  this.portalService);
+        PortalManagerAspectContextImpl aspectContext =
+            new PortalManagerAspectContextImpl(this.portalService, this.chain);
         aspectContext.invokeNext(contentHandler, properties);
 	}
 
@@ -93,45 +92,42 @@
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
     public void configure(Configuration conf) throws ConfigurationException {
-        this.chain = new PortalManagerAspectChain();
-        this.chain.configure(this.manager, 
-                             conf.getChild("aspects"), 
-                             this, 
-                             new Properties());
+        this.chain = new AspectChain();
+        this.chain.configure(this.manager, PortalManagerAspect.class, conf);
+        this.chain.addAspect(this, null);
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalManagerAspect#prepare(org.apache.cocoon.portal.PortalManagerAspectPrepareContext, org.apache.cocoon.portal.PortalService)
+     * @see org.apache.cocoon.portal.services.aspects.PortalManagerAspect#prepare(org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext)
      */
-    public void prepare(PortalManagerAspectPrepareContext renderContext, PortalService service) throws ProcessingException {
+    public void prepare(PortalManagerAspectPrepareContext renderContext) throws ProcessingException {
         EventManager eventManager = this.portalService.getEventManager();
         eventManager.processEvents();
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalManagerAspect#render(org.apache.cocoon.portal.PortalManagerAspectRenderContext, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler, java.util.Properties)
+     * @see org.apache.cocoon.portal.services.aspects.PortalManagerAspect#render(org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext, org.xml.sax.ContentHandler, java.util.Properties)
      */
     public void render(PortalManagerAspectRenderContext renderContext,
-                       PortalService                    service,
                        ContentHandler                   ch,
                        Properties                       properties)
     throws SAXException {
         final ProfileManager profileManager = this.portalService.getProfileManager();
 
         // test for ajax request
-        final Request req = ObjectModelHelper.getRequest(service.getProcessInfoProvider().getObjectModel());
+        final Request req = ObjectModelHelper.getRequest(this.portalService.getProcessInfoProvider().getObjectModel());
         if ( AjaxHelper.isAjaxRequest(req) ) {
             Layout rootLayout = profileManager.getLayout(null);
             ch.startDocument();
             XMLUtils.startElement(ch, "coplets");
-            final List changed = CopletInstanceFeatures.getChangedCopletInstanceDataObjects(service);
+            final List changed = CopletInstanceFeatures.getChangedCopletInstanceDataObjects(this.portalService);
             final Iterator i = changed.iterator();
             while ( i.hasNext() ) {
                 final CopletInstance current = (CopletInstance)i.next();
                 AttributesImpl a = new AttributesImpl();
                 a.addCDATAAttribute("id", current.getId());
                 XMLUtils.startElement(ch, "coplet", a);
-                final Layout l = LayoutFeatures.searchLayout(service, current.getId(), rootLayout);
+                final Layout l = LayoutFeatures.searchLayout(this.portalService, current.getId(), rootLayout);
                 Renderer portalLayoutRenderer = this.portalService.getRenderer( this.portalService.getLayoutFactory().getRendererName(l));
                 try {
                     portalLayoutRenderer.toSAX(l, this.portalService, ch);
@@ -154,14 +150,14 @@
             if ( StringUtils.isNotEmpty(copletId) ) {
                 final CopletInstance cid = profileManager.getCopletInstance(copletId);
                 if ( cid != null ) {
-                    portalLayout = LayoutFeatures.searchLayout(service, cid.getId(), profileManager.getLayout(null));
+                    portalLayout = LayoutFeatures.searchLayout(this.portalService, cid.getId(), profileManager.getLayout(null));
                 }
             } else if ( StringUtils.isNotEmpty(layoutId) ) {
                 portalLayout = profileManager.getLayout(layoutId);
             } else {
                 // first check for a full screen layout
                 Layout rootLayout = profileManager.getLayout(layoutId);
-                portalLayout = LayoutFeatures.getFullScreenInfo(service, rootLayout);
+                portalLayout = LayoutFeatures.getFullScreenInfo(this.portalService, rootLayout);
                 if ( portalLayout == null ) {
                     portalLayout = rootLayout;
                 }
@@ -184,5 +180,9 @@
         // although we should be the last in the queue,
         // let's invoke the next
         renderContext.invokeNext(ch, properties);
+    }
+
+    public void register(PortalManagerAspect aspect) {
+        this.chain.addAspect(aspect, null, 0);
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java Mon Aug 21 23:20:41 2006
@@ -42,6 +42,7 @@
 import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.event.EventConverter;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
 import org.apache.cocoon.portal.om.SkinDescription;
@@ -124,7 +125,6 @@
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.manager = serviceManager;
         this.processInfoProvider = (ProcessInfoProvider)this.manager.lookup(ProcessInfoProvider.ROLE);
-        this.userService = (UserService)this.manager.lookup(UserService.class.getName());
     }
 
     /**
@@ -408,6 +408,24 @@
      * @see org.apache.cocoon.portal.PortalService#getUserService()
      */
     public UserService getUserService() {
+        if ( this.userService == null ) {
+            try {
+                this.userService = (UserService)this.manager.lookup(UserService.class.getName());
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup user service.", e);
+            }
+        }
         return this.userService;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.PortalService#getEventConverter()
+     */
+    public EventConverter getEventConverter() {
+        try {
+            return (EventConverter)this.manager.lookup(EventConverter.class.getName());
+        } catch (ServiceException e) {
+            throw new PortalRuntimeException("Unable to lookup event converter.", e);
+        }
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java?rev=433542&r1=433541&r2=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java Mon Aug 21 23:20:41 2006
@@ -24,7 +24,6 @@
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.cocoon.portal.LayoutException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
@@ -40,8 +39,10 @@
 import org.apache.cocoon.portal.om.Layout;
 import org.apache.cocoon.portal.om.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileManager;
-import org.apache.cocoon.portal.profile.ProfileManagerAspect;
 import org.apache.cocoon.portal.scratchpad.Profile;
+import org.apache.cocoon.portal.services.aspects.ProfileManagerAspect;
+import org.apache.cocoon.portal.services.aspects.impl.support.ProfileManagerAspectContextImpl;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
 
 /**
  * Base class for all profile managers.
@@ -56,17 +57,13 @@
     protected Configuration configuration;
 
     /** The chain for the configured profile manager aspects. */
-    protected ProfileManagerAspectChain chain;
-
-    /** The service selector for the profile manager aspects. */
-    protected ServiceSelector aspectSelector;
+    protected AspectChain chain;
 
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager aManager) throws ServiceException {
         super.service(aManager);
-        this.aspectSelector = (ServiceSelector) this.manager.lookup( ProfileManagerAspect.ROLE+"Selector");
     }
 
     /**
@@ -75,10 +72,8 @@
     public void dispose() {
         if (this.manager != null) {
             if ( this.chain != null) {
-                this.chain.dispose( this.aspectSelector );
+                this.chain.dispose( this.manager );
             }
-            this.manager.release( this.aspectSelector );
-            this.aspectSelector = null;
         }
         super.dispose();
     }
@@ -88,8 +83,8 @@
      */
     public void configure(Configuration config) throws ConfigurationException {
         this.configuration = config;
-        this.chain = new ProfileManagerAspectChain();
-        this.chain.configure(this.aspectSelector, config.getChild("aspects"));
+        this.chain = new AspectChain();
+        this.chain.configure(this.manager, ProfileManagerAspect.class, config);
     }
 
     /**
@@ -225,9 +220,8 @@
     protected Profile processProfile(Profile profile) {
         // FIXME we should add the calls to prepareObject here as well
         if ( this.chain.hasAspects() ) {
-            DefaultProfileManagerAspectContext aspectContext = new DefaultProfileManagerAspectContext(this.chain, this.portalService);
+            ProfileManagerAspectContextImpl aspectContext = new ProfileManagerAspectContextImpl(this.portalService, this.chain);
             aspectContext.invokeNext(profile);
-            return aspectContext.getProfile();
         }
         return profile;
     }

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java?rev=433542&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java Mon Aug 21 23:20:41 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 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.
+ * 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.cocoon.portal.services.aspects;
+
+import java.util.Properties;
+
+import org.apache.cocoon.portal.PortalService;
+
+/**
+ * The base interface for all aspect contexts.
+ *
+ * @since 2.2
+ * @version $Id$
+ */
+public interface BasicAspectContext {
+
+    /** 
+     * Get the {@link Properties} of the aspect.
+     */
+    Properties getAspectProperties();
+
+    /**
+     * Get the portal service.
+     */
+    PortalService getPortalService();
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/BasicAspectContext.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspect.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspect.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspect.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspect.java Mon Aug 21 23:20:41 2006
@@ -13,12 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal;
+package org.apache.cocoon.portal.services.aspects;
 
 import java.util.Properties;
 
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.portal.PortalService;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -28,13 +27,11 @@
  */
 public interface PortalManagerAspect {
 
-    void prepare(PortalManagerAspectPrepareContext context,
-                 PortalService service)
+    void prepare(PortalManagerAspectPrepareContext context)
     throws ProcessingException;
 
     void render(PortalManagerAspectRenderContext context,
-                PortalService                  service,
-                ContentHandler                 ch,
-                Properties                     properties)
+                ContentHandler                   ch,
+                Properties                       properties)
     throws SAXException;
 }

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectPrepareContext.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectPrepareContext.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectPrepareContext.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectPrepareContext.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectPrepareContext.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectPrepareContext.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectPrepareContext.java Mon Aug 21 23:20:41 2006
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal;
-
-import java.util.Properties;
+package org.apache.cocoon.portal.services.aspects;
 
 import org.apache.cocoon.ProcessingException;
 
@@ -23,16 +21,12 @@
  * @since 2.1.8
  * @version $Id$
  */
-public interface PortalManagerAspectPrepareContext {
+public interface PortalManagerAspectPrepareContext
+    extends BasicAspectContext {
 
     /**
      * Invoke next aspect 
      */
     void invokeNext()
     throws ProcessingException;
-
-    /** 
-     * Get the {@link Properties} of the aspect.
-     */
-    Properties getAspectProperties();
 }

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectRenderContext.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectRenderContext.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectRenderContext.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectRenderContext.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectRenderContext.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspectRenderContext.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/PortalManagerAspectRenderContext.java Mon Aug 21 23:20:41 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal;
+package org.apache.cocoon.portal.services.aspects;
 
 import java.util.Properties;
 
@@ -24,7 +24,8 @@
  * @since 2.1.8
  * @version $Id$
  */
-public interface PortalManagerAspectRenderContext {
+public interface PortalManagerAspectRenderContext
+    extends BasicAspectContext {
 
     /**
      * Invoke next aspect 
@@ -32,9 +33,4 @@
     void invokeNext(ContentHandler ch,
                     Properties     parameters)
     throws SAXException;
-
-    /** 
-     * Get the {@link Properties} of the aspect.
-     */
-    Properties getAspectProperties();
 }

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspect.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspect.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspect.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspect.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspect.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspect.java Mon Aug 21 23:20:41 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal.profile;
+package org.apache.cocoon.portal.services.aspects;
 
 import org.apache.cocoon.portal.scratchpad.Profile;
 
@@ -25,9 +25,6 @@
  * @version $Id$
  */
 public interface ProfileManagerAspect {
-
-    /** The role to lookup an aspect. */
-    String ROLE = ProfileManagerAspect.class.getName();
 
     void prepare(ProfileManagerAspectContext context,
                  Profile profile);

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspectContext.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspectContext.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspectContext.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspectContext.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspectContext.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManagerAspectContext.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/ProfileManagerAspectContext.java Mon Aug 21 23:20:41 2006
@@ -13,32 +13,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal.profile;
+package org.apache.cocoon.portal.services.aspects;
 
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.scratchpad.Profile;
 
 /**
- * The context for a {@link  ProfileManagerAspect}
+ * The context for a {@link  ProfileManagerAspect}.
  *
  * @since 2.2
  * @version $Id$
  */
-public interface ProfileManagerAspectContext {
+public interface ProfileManagerAspectContext extends BasicAspectContext {
 
     /**
      * Invoke next aspect .
      */
     void invokeNext(Profile profile);
-
-    /** 
-     * Get the {@link Parameters} of the aspect.
-     */
-    Parameters getAspectParameters();
-
-    /**
-     * Get the portal service.
-     */
-    PortalService getPortalService();
 }

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PageLabelProfileManagerAspect.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/PageLabelProfileManagerAspect.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PageLabelProfileManagerAspect.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PageLabelProfileManagerAspect.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/PageLabelProfileManagerAspect.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/PageLabelProfileManagerAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PageLabelProfileManagerAspect.java Mon Aug 21 23:20:41 2006
@@ -13,16 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal.profile.impl;
+package org.apache.cocoon.portal.services.aspects.impl;
 
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.portal.om.CompositeLayout;
 import org.apache.cocoon.portal.om.Item;
 import org.apache.cocoon.portal.om.Layout;
 import org.apache.cocoon.portal.om.NamedItem;
-import org.apache.cocoon.portal.profile.ProfileManagerAspect;
-import org.apache.cocoon.portal.profile.ProfileManagerAspectContext;
 import org.apache.cocoon.portal.scratchpad.Profile;
+import org.apache.cocoon.portal.services.aspects.ProfileManagerAspect;
+import org.apache.cocoon.portal.services.aspects.ProfileManagerAspectContext;
 
 /**
  * $Id$
@@ -31,7 +31,7 @@
     implements ProfileManagerAspect, ThreadSafe {
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManagerAspect#prepare(org.apache.cocoon.portal.profile.ProfileManagerAspectContext, org.apache.cocoon.portal.scratchpad.Profile)
+     * @see org.apache.cocoon.portal.services.aspects.ProfileManagerAspect#prepare(org.apache.cocoon.portal.services.aspects.ProfileManagerAspectContext, org.apache.cocoon.portal.scratchpad.Profile)
      */
     public void prepare(ProfileManagerAspectContext context, Profile profile) {
         final Layout rootLayout = profile.getRootLayout();

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PreloadPortalManagerAspect.java (from r433231, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PreloadPortalManagerAspect.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PreloadPortalManagerAspect.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PreloadPortalManagerAspect.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PreloadPortalManagerAspect.java&r1=433231&r2=433542&rev=433542&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PreloadPortalManagerAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/PreloadPortalManagerAspect.java Mon Aug 21 23:20:41 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal.impl;
+package org.apache.cocoon.portal.services.aspects.impl;
 
 import java.util.Iterator;
 import java.util.List;
@@ -21,13 +21,12 @@
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.portal.PortalManagerAspect;
-import org.apache.cocoon.portal.PortalManagerAspectPrepareContext;
-import org.apache.cocoon.portal.PortalManagerAspectRenderContext;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
 import org.apache.cocoon.portal.om.CopletInstance;
 import org.apache.cocoon.portal.om.CopletInstanceFeatures;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspect;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
@@ -47,31 +46,29 @@
     protected static final ContentHandler nullHandler = new DefaultHandler();
 
     /**
-     * @see org.apache.cocoon.portal.PortalManagerAspect#prepare(org.apache.cocoon.portal.PortalManagerAspectPrepareContext, org.apache.cocoon.portal.PortalService)
+     * @see org.apache.cocoon.portal.services.aspects.PortalManagerAspect#prepare(org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext)
      */
-    public void prepare(PortalManagerAspectPrepareContext context,
-                        PortalService                     service)
+    public void prepare(PortalManagerAspectPrepareContext context)
     throws ProcessingException {
         // let's just invoke the next
         context.invokeNext();
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalManagerAspect#render(org.apache.cocoon.portal.PortalManagerAspectRenderContext, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler, java.util.Properties)
+     * @see org.apache.cocoon.portal.services.aspects.PortalManagerAspect#render(org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext, org.xml.sax.ContentHandler, java.util.Properties)
      */
     public void render(PortalManagerAspectRenderContext context,
-                       PortalService                    service,
                        ContentHandler                   ch,
                        Properties                       properties)
     throws SAXException {
         // we should be the first aspect for rendering
         // preload all changed coplets
-        final List changedCoplets = CopletInstanceFeatures.getChangedCopletInstanceDataObjects(service);
+        final List changedCoplets = CopletInstanceFeatures.getChangedCopletInstanceDataObjects(context.getPortalService());
         final Iterator i = changedCoplets.iterator();
         while (i.hasNext()) {
             final CopletInstance cid = (CopletInstance)i.next();
             final String adapterName = cid.getCopletDefinition().getCopletType().getCopletAdapterName();
-            final CopletAdapter adapter = service.getCopletAdapter(adapterName);
+            final CopletAdapter adapter = context.getPortalService().getCopletAdapter(adapterName);
             adapter.toSAX(cid, nullHandler );
         }
         // start "real" rendering

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java?rev=433542&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java Mon Aug 21 23:20:41 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 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.
+ * 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.cocoon.portal.services.aspects.impl.support;
+
+import java.util.Properties;
+
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspect;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext;
+import org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
+import org.apache.cocoon.portal.services.aspects.support.BasicAspectContextImpl;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * The aspect context is passed to every aspect.
+ * @since 2.1.8
+ * @version $Id$
+ */
+public final class PortalManagerAspectContextImpl
+    extends BasicAspectContextImpl
+    implements PortalManagerAspectRenderContext,
+               PortalManagerAspectPrepareContext {
+
+    public PortalManagerAspectContextImpl(PortalService service,
+                                          AspectChain    chain) {
+        super(service, chain);
+    }
+
+	/**
+	 * @see org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext#invokeNext()
+	 */
+	public void invokeNext() 
+    throws ProcessingException {
+        final PortalManagerAspect aspect = (PortalManagerAspect)this.getNext();
+        if ( aspect != null ) {
+            aspect.prepare(this);
+        }
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext#invokeNext(org.xml.sax.ContentHandler, org.apache.avalon.framework.parameters.Parameters)
+     */
+    public void invokeNext(ContentHandler ch, Properties properties) 
+    throws SAXException {
+        final PortalManagerAspect aspect = (PortalManagerAspect)this.getNext();
+        if ( aspect != null ) {
+            aspect.render(this, ch, properties);
+        }
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/PortalManagerAspectContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java?rev=433542&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java Mon Aug 21 23:20:41 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 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.
+ * 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.cocoon.portal.services.aspects.impl.support;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.scratchpad.Profile;
+import org.apache.cocoon.portal.services.aspects.ProfileManagerAspect;
+import org.apache.cocoon.portal.services.aspects.ProfileManagerAspectContext;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
+import org.apache.cocoon.portal.services.aspects.support.BasicAspectContextImpl;
+
+/**
+ * The aspect context is passed to every aspect.
+ * @since 2.2
+ * @version $Id$
+ */
+public final class ProfileManagerAspectContextImpl
+    extends BasicAspectContextImpl
+    implements ProfileManagerAspectContext {
+
+    public ProfileManagerAspectContextImpl(PortalService service,
+                                              AspectChain   chain) {
+        super(service, chain);
+    }
+
+	/**
+	 * @see org.apache.cocoon.portal.services.aspects.ProfileManagerAspectContext#invokeNext(org.apache.cocoon.portal.scratchpad.Profile)
+	 */
+	public void invokeNext(Profile portalProfile) {
+        final ProfileManagerAspect aspect = (ProfileManagerAspect)this.getNext();
+        if ( aspect != null ) {
+            aspect.prepare(this, portalProfile);
+        }
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/ProfileManagerAspectContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java?rev=433542&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java Mon Aug 21 23:20:41 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright 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.
+ * 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.cocoon.portal.services.aspects.support;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+
+/**
+ * Reusable implementation of an aspect chain.
+ *
+ * @since 2.2
+ * @version $Id$
+ */
+public final class AspectChain {
+
+    protected static Properties EMPTY_PROPERTIES = new Properties();
+
+    /** The aspects. */
+    protected List aspects = new ArrayList(3);
+
+    /** The configuration for the aspects. */
+    protected List configs = new ArrayList(3);
+
+    /** Do we have any aspects? */
+    protected boolean process = false;
+
+    public void configure(ServiceManager manager,
+                          Class          aspectClass,
+                          Configuration  conf)
+    throws ConfigurationException {
+        if ( conf != null ) {
+            final Configuration[] aspectConfigs = conf.getChild("aspects").getChildren("aspect");
+            for(int i=0; i < aspectConfigs.length; i++) {
+                this.process = true;
+                final Configuration current = aspectConfigs[i];
+                final String role = current.getAttribute("type");
+                try {
+                    final Object aspect = manager.lookup(aspectClass.getName() + '/' + role);
+                    if ( !aspectClass.isInstance(aspect) ) {
+                        throw new ConfigurationException("Configured aspect is not an instance of class " + aspectClass.getName() + " : " + role);
+                    }
+                    this.aspects.add(aspect);               
+                    this.configs.add(Parameters.toProperties(Parameters.fromConfiguration(current)));
+
+                } catch (ServiceException se) {
+                    throw new ConfigurationException("Unable to lookup aspect (" + aspectClass.getName() + "): " + role, se);
+                }
+            }
+        }
+    }
+
+    public void addAspect(Object aspect, Properties config) {
+        this.addAspect(aspect, config, -1);
+    }
+
+    public void addAspect(Object aspect, Properties config, int index) {
+        final Properties aspectConfig = (config == null ? EMPTY_PROPERTIES : config);
+        this.process = true;
+        if ( index == -1 ) {
+            this.aspects.add(aspect);
+            this.configs.add(aspectConfig);
+        } else {
+            this.aspects.add(index, aspect);
+            this.configs.add(index, aspectConfig);
+        }
+    }
+
+    public boolean hasAspects() {
+        return this.process;
+    }
+
+    public Iterator getIterator() {
+        return this.aspects.iterator();
+    }
+
+    public Iterator getConfigIterator() {
+        return this.configs.iterator();
+    }
+
+    public void dispose(ServiceManager manager) {
+        final Iterator i = this.aspects.iterator();
+        while (i.hasNext()) {
+            final Object component = i.next();
+            manager.release(component);
+        }
+        this.aspects.clear();
+        this.configs.clear();
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/AspectChain.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java?rev=433542&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java Mon Aug 21 23:20:41 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006 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.
+ * 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.cocoon.portal.services.aspects.support;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.services.aspects.BasicAspectContext;
+
+/**
+ * Reusable implementation of the {@link BasicAspectContext}.
+ *
+ * @since 2.2
+ * @version $Id$
+ */
+public abstract class BasicAspectContextImpl implements BasicAspectContext {
+
+    /** The portal service. */
+    protected final PortalService portalService;
+
+    /** The iterator used to iterate over the aspects. */
+    protected final Iterator iterator;
+    /** The iterator used to iterate over the configuration of the aspects. */
+    protected final Iterator configIterator;
+
+    /** The current configuration. */
+    protected Properties aspectConfig;
+
+    public BasicAspectContextImpl(PortalService service,
+                                  AspectChain   chain) {
+        this.portalService = service;
+        this.iterator = chain.getIterator();
+        this.configIterator = chain.getConfigIterator();
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.aspects.BasicAspectContext#getAspectProperties()
+     */
+    public Properties getAspectProperties() {
+        return this.aspectConfig;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.aspects.BasicAspectContext#getPortalService()
+     */
+    public PortalService getPortalService() {
+        return this.portalService;
+    }
+
+    protected Object getNext() {
+        if (this.iterator.hasNext()) {
+            this.aspectConfig = (Properties)this.configIterator.next();
+            return this.iterator.next();
+        }
+        return null;
+    }
+
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/support/BasicAspectContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message