You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/10/16 19:54:50 UTC

svn commit: r322495 - in /cocoon/blocks: portal-sample/trunk/samples/conf/ portal/trunk/java/org/apache/cocoon/portal/coplet/ portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/ portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ por...

Author: cziegeler
Date: Sun Oct 16 10:52:43 2005
New Revision: 322495

URL: http://svn.apache.org/viewcvs?rev=322495&view=rev
Log:
Further clean up of event handling
Add new base class for all portal related components to make implementation even easier

Added:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java   (with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java   (with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java   (with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java   (with props)
Removed:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/subscriber/impl/
Modified:
    cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDataFeatures.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDescription.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletDescription.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/ChangeAspectDataEvent.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java

Modified: cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf (original)
+++ cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf Sun Oct 16 10:52:43 2005
@@ -120,9 +120,9 @@
     </event-aspects>
     <!-- add a new instance of each class as a receiver: -->
     <receiver-classes>
-        <class name="org.apache.cocoon.portal.event.subscriber.impl.DefaultCopletDataEventSubscriber"/>
-        <class name="org.apache.cocoon.portal.event.subscriber.impl.DefaultChangeAspectDataEventSubscriber"/>
-        <class name="org.apache.cocoon.portal.event.subscriber.impl.DefaultJXPathEventSubscriber"/>
+      <!--
+        class name="my.receiver.class"/>
+      -->
     </receiver-classes>
     <!-- add each component as a receiver (the component should be thread safe): -->
     <receiver-roles>

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -41,9 +41,9 @@
     protected Map attributes = new HashMap();
 
     protected String allowedRoles;
-    
+
     protected transient List allowedRolesList;
-    
+
 	/**
 	 * Signals whether a delta has been applied.
 	 */
@@ -91,7 +91,7 @@
     public Object removeAttribute(String key) {
         return this.attributes.remove(key);
     }
-    
+
     public Object getAttribute(String key) {
         return this.attributes.get(key);
     }
@@ -99,30 +99,30 @@
     public void setAttribute(String key, Object value) {
         this.attributes.put(key, value);
     }
-    
+
     public Map getAttributes() {
     	return this.attributes;
     }
-	
+
 	/**
 	 * Applies the specified delta.
 	 * @throws ClassCastException If the object is not of the expected type.
 	 */
 	public boolean applyDelta(Object object) {
 		CopletData data = (CopletData)object;
-		
+
 		this.deltaApplied = true;
-		
+
 		String title = data.getTitle();
 		if (title != null) {
             this.setTitle(title);
 		}
-			
+
 		CopletBaseData copletBaseData = data.getCopletBaseData();
 		if (copletBaseData != null)	{
 			this.setCopletBaseData(copletBaseData);
 		}
-			
+
 		Iterator iterator = data.getAttributes().entrySet().iterator();
 		Object attribute, delta;
 		String key;
@@ -148,23 +148,24 @@
 				this.setAttribute(key, delta);
 			}
 		}
-		
+
 		return true;
 	}
-	
+
 	/**
 	 * Checks if a delta has been applied.
 	 */
 	public boolean deltaApplied() {
 		return this.deltaApplied;
 	}
-    
+
     /**
      * @return Returns the allowed roles.
      */
     public String getAllowedRoles() {
         return this.allowedRoles;
     }
+
     /**
      * @param roles The allowed roles to set.
      */
@@ -172,7 +173,7 @@
         this.allowedRoles = roles;
         this.allowedRolesList = null;
     }
-    
+
     /**
      * Return the list of roles that are allowed to access this coplet
      * @return A list of roles or null if everyone is allowed.
@@ -195,7 +196,7 @@
         }
         return this.allowedRolesList;
     }
-    
+
     public void addToAllowedRoles(String role) {
         List l = this.getAllowedRolesList();
         if ( l == null ) {
@@ -208,7 +209,7 @@
         }
         this.buildRolesString(l);
     }
-    
+
     public void removeFromAllowedRoles(String role) {
         List l = this.getAllowedRolesList();
         if ( l != null && l.contains(role) ) {
@@ -221,7 +222,7 @@
             }
         }
     }
-    
+
     protected void buildRolesString(List fromList) {
         this.allowedRolesList = fromList;
         StringBuffer buffer = new StringBuffer();

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDataFeatures.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDataFeatures.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDataFeatures.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDataFeatures.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
  * 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.

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDescription.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDescription.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletDescription.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -17,11 +17,9 @@
 
 import org.apache.cocoon.portal.factory.ProducibleDescription;
 
-
-
 /**
- * A configured coplet
- * 
+ * A configured coplet.
+ *
  * @version $Id$
  */
 public interface CopletDescription

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletFactory.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletFactory.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletFactory.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -18,27 +18,27 @@
 import org.apache.cocoon.ProcessingException;
 
 /**
- * This factory is for creating and managing coplet objects
- * 
+ * This factory is for creating and managing coplet objects.
+ *
  * @version $Id$
  */
 public interface CopletFactory  {
-    
+
     String ROLE = CopletFactory.class.getName();
-    
+
     void prepare(CopletData copletData)
     throws ProcessingException;
-    
+
     void prepare(CopletInstanceData copletInstanceData)
     throws ProcessingException;
-    
+
     /** 
      * Create a new coplet instance.
      * This is also registered at the profile manager.
      */
     CopletInstanceData newInstance(CopletData copletData)
     throws ProcessingException;
-    
+
     /**
      * Remove the coplet instance data.
      * This is also unregistered at the profile manager.

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -76,11 +76,11 @@
     public void setAttribute(String key, Object value) {
         this.attributes.put(key, value);
     }
-    
+
     public Object removeAttribute(String key) {
         return this.attributes.remove(key);
     }
-    
+
     public Map getAttributes() {
         return this.attributes;
     }
@@ -110,11 +110,11 @@
     public void setTemporaryAttribute(String key, Object value) {
         this.temporaryAttributes.put(key, value);
     }
-    
+
     public Object removeTemporaryAttribute(String key) {
         return this.temporaryAttributes.remove(key);
     }
-    
+
     public Map getTemporaryAttributes() {
         return this.temporaryAttributes;
     }
@@ -155,7 +155,7 @@
      */
     protected Object clone() throws CloneNotSupportedException {
         CopletInstanceData clone = (CopletInstanceData)super.clone();
-        
+
         clone.copletData = this.copletData;
         clone.attributes = new HashMap(this.attributes);
         clone.temporaryAttributes = new HashMap(this.temporaryAttributes);
@@ -164,7 +164,7 @@
 
         return clone;
     }
-    
+
     public CopletInstanceData copy() {
         try {
             return (CopletInstanceData)this.clone();

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -26,16 +26,16 @@
  * Usually there is only one instance of an adapter (= singleton). 
  * Whenever an instance of this coplet is rendered, the
  * adapter is invoked to render the coplet.
- * 
+ *
  * The behaviour of the adapter can be controlled by a set of
  * parameters. In general, the coplet base data defines the default
  * for all coplets, but the value can be overriden by the coplet
  * data. The coplet base data stores the information in the coplet
  * config map whereas the coplet data stores them in the attributes.
  * Apart from that the keys and the data types are the same.
- * 
+ *
  * Configuration:
- * 
+ *
  * buffer - A boolean value (default is false) that defines if the
  *          xml data stream from the coplet is buffered. If the stream
  *          is not buffered and an exception occurs then the whole
@@ -45,13 +45,16 @@
  *           If the timeout is reached the content is assumed as not
  *           gettable. If you set a timeout, the content is automatically
  *           buffered.
- * 
+ *
+ * Each implementation should extend the {@link org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter}
+ * to be prepared for possible extensions to this interface in future versions.
+ *
  * @version $Id$
  */
 public interface CopletAdapter {
 
     String ROLE = CopletAdapter.class.getName();
-    
+
     /**
      * Initialize the coplet
      * This method is called immediately after a new instance is created.
@@ -59,7 +62,7 @@
      * @param coplet The coplet
      */
     void init(CopletInstanceData coplet);
-    
+
     /**
      * Destroy the coplet
      * This method is invoked when a coplet instance will be destroyed
@@ -73,14 +76,14 @@
      */
     void toSAX(CopletInstanceData coplet, ContentHandler contentHandler)
     throws SAXException;
-    
+
     /**
      * User logs in to a coplet
      * This method is invoked when a user logs in for each coplet instance
      * of the user
      */
     void login(CopletInstanceData coplet);
-        
+
     /**
      * User logs out from a coplet
      * This method is invoked when a user logs out for each coplet instance

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=322495&r1=322494&r2=322495&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 Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
  * 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.
  * 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.
@@ -18,25 +18,22 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.thread.RunnableManager;
 import org.apache.cocoon.environment.CocoonRunnable;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.impl.AbstractComponent;
 import org.apache.cocoon.xml.SaxBuffer;
 import org.apache.cocoon.xml.XMLUtils;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
+
 import EDU.oswego.cs.dl.util.concurrent.CountDown;
 
 /**
  * This is the abstract base adapter to use pipelines as coplets
- * 
+ *
  * <h2>Configuration</h2>
  * <table><tbody>
  * <tr>
@@ -59,22 +56,12 @@
  *   <td><code>null</code></td>
  *  </tr>
  * </tbody></table>
- * 
+ *
  * @version $Id$
  */
 public abstract class AbstractCopletAdapter 
-    extends AbstractLogEnabled
-    implements CopletAdapter, ThreadSafe, Serviceable {
-	
-    /** The service manager */
-    protected ServiceManager manager;
-
-    /* (non-Javadoc)
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager manager) throws ServiceException {
-        this.manager = manager;
-    }
+    extends AbstractComponent
+    implements CopletAdapter {
 
     /**
      * Get a configuration value
@@ -89,7 +76,7 @@
         }
         return data;
     }
-    
+
     /**
      * Get a configuration value
      * First the coplet data is queried and if it doesn't provide an
@@ -112,7 +99,7 @@
     public abstract void streamContent(CopletInstanceData coplet, 
                                          ContentHandler contentHandler)
     throws SAXException; 
-    
+
     /**
      * This method streams the content of a coplet instance data.
      * It handles buffering and timeout setting and calls
@@ -130,13 +117,13 @@
             // if timeout is set we have to buffer!
             bool = Boolean.TRUE;
         }
-        
+
         if ( bool != null && bool.booleanValue() ) {
             boolean read = false;
             SaxBuffer buffer = new SaxBuffer();
             Exception error = null;
             try {
-                
+
                 if ( timeout != null ) {
                     final int milli = timeout.intValue() * 1000;
                     LoaderThread loader = new LoaderThread(this, coplet, buffer);
@@ -163,7 +150,7 @@
                 error = exception;
                 this.getLogger().warn("Unable to get content of coplet: " + coplet.getId(), exception);
             }
-            
+
             if ( read ) {
                 buffer.toSAX( contentHandler );
             } else {
@@ -185,22 +172,22 @@
                                   " (instance " + coplet.getId() + ") in " + msecs + "ms.");
         }
     }
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.cocoon.portal.coplet.adapter.CopletAdapter#init(org.apache.cocoon.portal.coplet.CopletInstanceData)
      */
     public void init(CopletInstanceData coplet) {
         // nothing to do here, can be overwritten in subclasses
     }
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.cocoon.portal.coplet.adapter.CopletAdapter#destroy(org.apache.cocoon.portal.coplet.CopletInstanceData)
      */
     public void destroy(CopletInstanceData coplet) {
         // nothing to do here, can be overwritten in subclasses
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.portal.coplet.adapter.CopletAdapter#login(org.apache.cocoon.portal.coplet.CopletInstanceData)
      */
     public void login(CopletInstanceData coplet) {
@@ -214,14 +201,14 @@
             }
         }
     }
-        
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.cocoon.portal.coplet.adapter.CopletAdapter#logout(org.apache.cocoon.portal.coplet.CopletInstanceData)
      */
     public void logout(CopletInstanceData coplet) {
         // nothing to do here, can be overwritten in subclasses
     }
-    
+
     /**
      * Render the error content for a coplet
      * @param coplet  The coplet instance data
@@ -239,7 +226,7 @@
 }
 
 final class LoaderThread implements Runnable {
-    
+
     private final AbstractCopletAdapter adapter;
     private final ContentHandler        handler;
     private final CopletInstanceData    coplet;
@@ -254,7 +241,7 @@
         this.handler = handler;
         this.finished = new CountDown( 1 );
     }
-    
+
     public void run() {
         try {
             adapter.streamContent( this.coplet, this.handler );
@@ -264,10 +251,9 @@
             this.finished.release();
         }
     }
-    
+
     boolean join( final long milis )
     throws InterruptedException {
         return this.finished.attempt( milis );
     }
-    
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -46,7 +46,7 @@
  * plugged into the portal.
  *
  * @author <a href="mailto:gerald.kahrer@rizit.at">Gerald Kahrer</a>
- * 
+ *
  * @version $Id$
  */
 public class ApplicationCopletAdapter extends CachingURICopletAdapter {
@@ -77,12 +77,12 @@
      */
     public void handleCopletInstanceEvent(CopletInstanceEvent e) {
         super.handleCopletInstanceEvent(e);
-        
+
         if ( e instanceof CopletLinkEvent ) {
             CopletLinkEvent event = (CopletLinkEvent) e;
             CopletInstanceData coplet = (CopletInstanceData) event.getTarget();
             String link = event.getLink();
-    
+
             if ("createNewCopletInstance".equals(link)) {
                 try {
                     createNewInstance(coplet);
@@ -215,5 +215,4 @@
 
         return true;
     }
-
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java Sun Oct 16 10:52:43 2005
@@ -51,7 +51,7 @@
  */
 public class CachingURICopletAdapter
     extends URICopletAdapter {
-    
+
     /** The configuration name for enabling/disabling the cache. */
     public static final String CONFIGURATION_ENABLE_CACHING = "cache-enabled";
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -21,11 +21,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
@@ -38,7 +33,6 @@
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.event.CopletInstanceEvent;
-import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.event.Receiver;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
@@ -46,27 +40,17 @@
 import org.xml.sax.SAXException;
 
 /**
- * This is the adapter to use pipelines as coplets
+ * This is the adapter to use pipelines as coplets.
  *
  * @version $Id$
  */
 public class URICopletAdapter 
     extends AbstractCopletAdapter
-    implements Disposable, Receiver, Initializable, Contextualizable {
-	
+    implements Receiver {
+
     /** The source resolver */
     protected SourceResolver resolver;
-    
-    /** The application context */
-    protected Context context;
-    
-    /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
-     */
-    public void contextualize(Context context) throws ContextException {
-        this.context = context;
-    }
-    
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
@@ -74,7 +58,7 @@
         super.service( manager );
         this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
     }
-    
+
     /**
      * @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#streamContent(org.apache.cocoon.portal.coplet.CopletInstanceData, org.xml.sax.ContentHandler)
      */
@@ -98,9 +82,9 @@
                 portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
 
                 Boolean handlePars = (Boolean)this.getConfiguration( coplet, "handleParameters", Boolean.FALSE);
-                
+
                 String sourceUri = uri;
-                
+
                 if ( handlePars.booleanValue() ) {
                     List list = (List) portalService.getTemporaryAttribute(URICopletAdapter.class.getName());
                     if ( list != null && list.contains( coplet )) {
@@ -115,11 +99,11 @@
                         }
                     }
                 }
-                
+
 				HashMap par = new HashMap();
 				par.put(Constants.PORTAL_NAME_KEY, portalService.getPortalName());
 				par.put(Constants.COPLET_ID_KEY, coplet.getId());
-            
+
 				copletSource = this.resolver.resolveURI(sourceUri, null, par);
 			} else {
 				copletSource = this.resolver.resolveURI(uri);
@@ -142,20 +126,10 @@
      */
     public void dispose() {
         if ( this.manager != null ) {
-            EventManager eventManager = null;
-            try { 
-                eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
-                eventManager.unsubscribe(this);
-            } catch (Exception ignore) {
-                // ignore
-            } finally {
-                this.manager.release( eventManager ); 
-            }
-            
             this.manager.release( this.resolver );
             this.resolver = null;
-            this.manager = null;
         }
+        super.dispose();
     }
 
     /**
@@ -173,19 +147,6 @@
     }
 
     /**
-     * @see org.apache.avalon.framework.activity.Initializable#initialize()
-     */
-    public void initialize() throws Exception {
-        EventManager eventManager = null;
-        try { 
-            eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
-            eventManager.subscribe( this );
-        } finally {
-            this.manager.release( eventManager );
-        }
-    }
-
-    /**
      * Render the error content for a coplet
      * @param coplet  The coplet instance data
      * @param handler The content handler
@@ -221,7 +182,7 @@
                     objectModel.put(org.apache.cocoon.Constants.NOTIFYING_OBJECT, currentNotifying);                    
                     objectModel.put(ObjectModelHelper.THROWABLE_OBJECT, error);
                 }
-            
+
                 try {
                     this.streamContent( coplet, uri, handler);
                 } finally {
@@ -229,10 +190,10 @@
                     objectModel.remove(ObjectModelHelper.THROWABLE_OBJECT);
                 }
             } else {
-            
+
                 this.streamContent( coplet, uri, handler);
             }
-                        
+   
             return true;
         }
         return false;

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletDescription.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletDescription.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletDescription.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -22,10 +22,9 @@
 import org.apache.cocoon.portal.aspect.AspectDescription;
 import org.apache.cocoon.portal.factory.impl.AbstractProducibleDescription;
 
-
 /**
- * A description of a coplet data or a coplet instance data
- * 
+ * A description of a coplet data or a coplet instance data.
+ *
  * @version $Id$
  */
 public class DefaultCopletDescription
@@ -55,5 +54,4 @@
         }
         return desc;
     }
-
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -20,18 +20,13 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.activity.Disposable;
 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.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.aspect.AspectDataHandler;
 import org.apache.cocoon.portal.aspect.AspectDataStore;
 import org.apache.cocoon.portal.aspect.AspectDescription;
@@ -41,39 +36,40 @@
 import org.apache.cocoon.portal.coplet.CopletFactory;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.event.coplet.CopletInstanceDataAddedEvent;
+import org.apache.cocoon.portal.event.coplet.CopletInstanceDataRemovedEvent;
+import org.apache.cocoon.portal.impl.AbstractComponent;
 
 /**
- * This factory is for creating and managing coplet objects
- * 
+ * This factory is for creating and managing coplet objects.
+ *
  * @version $Id$
  */
 public class DefaultCopletFactory  
-    extends AbstractLogEnabled 
-    implements ThreadSafe, CopletFactory, Serviceable, Disposable, Configurable {
-    
-    protected ServiceManager manager;
-    
+    extends AbstractComponent 
+    implements CopletFactory, Configurable {
+
     protected Map coplets = new HashMap();
-    
+
     protected List descriptions = new ArrayList();
-    
+
     protected ServiceSelector storeSelector;
 
     protected static long idCounter = System.currentTimeMillis();
-	
+
     /**
      * @see org.apache.cocoon.portal.coplet.CopletFactory#prepare(org.apache.cocoon.portal.coplet.CopletData)
      */
     public void prepare(CopletData copletData)
     throws ProcessingException {
         if ( copletData != null ) {
-     
+
             final String copletName = copletData.getName();
             if ( copletName == null ) {
                 throw new ProcessingException("CopletData "+copletData.getId()+" has no associated name.");
             }
             Object[] o = (Object[]) this.coplets.get( copletName );
-            
+
             if ( o == null ) {
                 throw new ProcessingException("CopletDescription with name " + copletName + " not found.");
             }
@@ -82,32 +78,29 @@
             copletData.setDescription( copletDescription );            
         }
     }
-    
+
     /**
      * @see org.apache.cocoon.portal.coplet.CopletFactory#prepare(org.apache.cocoon.portal.coplet.CopletInstanceData)
      */
     public void prepare(CopletInstanceData copletInstanceData)
     throws ProcessingException {
         if ( copletInstanceData != null ) {
-     
+
             final String copletName = copletInstanceData.getName();
             if ( copletName == null ) {
                 throw new ProcessingException("CopletInstanceData "+copletInstanceData.getId()+" has no associated name.");
             }
             Object[] o = (Object[]) this.coplets.get( copletName );
-            
+
             if ( o == null ) {
                 throw new ProcessingException("CopletDescription with name " + copletName + " not found.");
             }
             DefaultCopletDescription copletDescription = (DefaultCopletDescription)o[0];
-
             copletInstanceData.setDescription( copletDescription );
             copletInstanceData.setAspectDataHandler((AspectDataHandler)o[1]);
-            
         }
     }
 
-    
     /**
      * @see org.apache.cocoon.portal.coplet.CopletFactory#newInstance(org.apache.cocoon.portal.coplet.CopletData)
      */
@@ -115,14 +108,14 @@
     throws ProcessingException {
         String name = copletData.getName();
         Object[] o = (Object[]) this.coplets.get( name );
-            
+
         if ( o == null ) {
             throw new ProcessingException("CopletDescription with name " + name + " not found.");
         }
         DefaultCopletDescription copletDescription = (DefaultCopletDescription)o[0];
-        
+
         CopletInstanceData instance = new CopletInstanceData();
-        
+
         String id = null;
         if ( copletDescription.createId() ) {
             synchronized (this) {
@@ -131,11 +124,11 @@
             }
         }
         instance.initialize( name, id );
-        
+
         instance.setDescription( copletDescription );
         instance.setAspectDataHandler((AspectDataHandler)o[1]);
         instance.setCopletData(copletData);
-        
+
         // now lookup the adapter
         final String adapterName = copletData.getCopletBaseData().getCopletAdapterName();
         CopletAdapter adapter = null;
@@ -153,24 +146,17 @@
             }
             this.manager.release( adapterSelector );
         }
-        
-        PortalService service = null;
-        try {
-            service = (PortalService)this.manager.lookup(PortalService.ROLE);
-            service.getComponentManager().getProfileManager().register(instance);
-        } catch (ServiceException ce) {
-            throw new ProcessingException("Unable to lookup profile manager.", ce);
-        } finally {
-            this.manager.release( service );
-        }
+
+        // send an event
+        this.portalService.getComponentManager().getEventManager().send(new CopletInstanceDataAddedEvent(instance));
         return instance;
     }
-    
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager manager) throws ServiceException {
-        this.manager = manager;
+        super.service(manager);
         this.storeSelector = (ServiceSelector)this.manager.lookup( AspectDataStore.ROLE+"Selector" );
     }
 
@@ -181,8 +167,8 @@
         if ( this.manager != null ) {
             this.manager.release( this.storeSelector );
             this.storeSelector = null;
-            this.manager = null;
         }
+        super.dispose();
     }
 
     /**
@@ -195,7 +181,7 @@
             DefaultCopletDescription desc = new DefaultCopletDescription();
             DefaultCopletDescription instanceDesc = new DefaultCopletDescription();
             final String name = copletsConf[i].getAttribute("name");
-            
+
             // unique test
             if ( this.coplets.get(name) != null) {
                 throw new ConfigurationException("Coplet name must be unique. Double definition for " + name);
@@ -203,7 +189,7 @@
             desc.setName(name);
             instanceDesc.setName(name);
             instanceDesc.setCreateId(copletsConf[i].getAttributeAsBoolean("create-id", true));
-            
+
             // and now the aspects of the instances
             Configuration[] aspectsConf = copletsConf[i].getChild("coplet-instance-data-aspects").getChildren("aspect");
             for(int m=0; m < aspectsConf.length; m++) {
@@ -240,17 +226,9 @@
                 }
                 this.manager.release( adapterSelector );
             }
-            
-            PortalService service = null;
-            try {
-                service = (PortalService)this.manager.lookup(PortalService.ROLE);
-                service.getComponentManager().getProfileManager().unregister(copletInstanceData);
-            } catch (ServiceException ce) {
-                throw new ProcessingException("Unable to lookup portal service.", ce);
-            } finally {
-                this.manager.release( service );
-            }
+
+            // send an event
+            this.portalService.getComponentManager().getEventManager().send(new CopletInstanceDataRemovedEvent(copletInstanceData));
         }
     }
-
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java Sun Oct 16 10:52:43 2005
@@ -1,12 +1,12 @@
 /*
- * 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.
  * 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.
@@ -17,7 +17,7 @@
 
 /**
  * Constants for sizing.
- * 
+ *
  * @version $Id$
  */
 public final class SizingStatus {

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java?rev=322495&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java Sun Oct 16 10:52:43 2005
@@ -0,0 +1,34 @@
+/*
+ * 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.event.coplet;
+
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.event.CopletInstanceEvent;
+import org.apache.cocoon.portal.event.impl.AbstractActionEvent;
+
+/**
+ * This event is fired if a new instance is created.
+ *
+ * @version $Id$
+ */
+public class CopletInstanceDataAddedEvent
+    extends AbstractActionEvent
+    implements CopletInstanceEvent {
+
+    public CopletInstanceDataAddedEvent(CopletInstanceData target) {
+        super(target);
+    }    
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataAddedEvent.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java?rev=322495&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java Sun Oct 16 10:52:43 2005
@@ -0,0 +1,34 @@
+/*
+ * 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.event.coplet;
+
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.event.CopletInstanceEvent;
+import org.apache.cocoon.portal.event.impl.AbstractActionEvent;
+
+/**
+ * This event is fired if an instance is removed.
+ *
+ * @version $Id$
+ */
+public class CopletInstanceDataRemovedEvent
+    extends AbstractActionEvent
+    implements CopletInstanceEvent {
+
+    public CopletInstanceDataRemovedEvent(CopletInstanceData target) {
+        super(target);
+    }    
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/coplet/CopletInstanceDataRemovedEvent.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/ChangeAspectDataEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/ChangeAspectDataEvent.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/ChangeAspectDataEvent.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/ChangeAspectDataEvent.java Sun Oct 16 10:52:43 2005
@@ -16,7 +16,6 @@
 package org.apache.cocoon.portal.event.impl;
 
 import org.apache.cocoon.portal.aspect.Aspectalizable;
-import org.apache.cocoon.portal.event.ActionEvent;
 import org.apache.cocoon.portal.event.ComparableEvent;
 import org.apache.cocoon.portal.event.RequestEvent;
 
@@ -27,7 +26,7 @@
  */
 public class ChangeAspectDataEvent
     extends AbstractActionEvent
-    implements ActionEvent, RequestEvent, ComparableEvent {
+    implements RequestEvent, ComparableEvent {
 
     protected String aspectName;
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventManager.java Sun Oct 16 10:52:43 2005
@@ -174,6 +174,9 @@
                 this.subscribe(receiver);
             }
         }
+
+        // subscribe all receivers that are necessary for the portal to work
+        this.subscribe(new InternalEventReceiver());
     }
 
     /**

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java?rev=322495&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java Sun Oct 16 10:52:43 2005
@@ -0,0 +1,86 @@
+/*
+ * 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.event.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.aspect.Aspectalizable;
+import org.apache.cocoon.portal.coplet.CopletData;
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.event.CopletDataEvent;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.EventManager;
+import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.commons.jxpath.JXPathContext;
+
+/**
+ * This subscriber processes JXPath events.
+ * @version $Id$
+ */
+public final class InternalEventReceiver 
+    implements Receiver {
+
+    public InternalEventReceiver() {
+        // nothing to do 
+    }
+
+    /**
+     * @see Receiver
+     */
+    public void inform(ChangeAspectDataEvent event, PortalService service) {
+        final Aspectalizable target = event.getAspectalizable();
+        target.setAspectData(event.getAspectName(), event.getData());
+    }
+
+    /**
+     * @see Receiver
+     */
+    public void inform(JXPathEvent event, PortalService service) {
+        final Object target = event.getTarget();
+        if ( target != null ) {
+            final JXPathContext jxpathContext = JXPathContext.newContext(target);
+            jxpathContext.setValue(event.getPath(), event.getValue());
+        }
+    }
+
+    /**
+     * @see Receiver
+     */
+    public void inform(CopletDataEvent e, PortalService service) {
+        CopletData data = (CopletData)e.getTarget();
+        List instances = null;
+
+        ProfileManager profileManager = service.getComponentManager().getProfileManager();
+        instances = profileManager.getCopletInstanceData(data);
+
+        if ( instances != null && e instanceof ChangeCopletsJXPathEvent ) {
+            EventManager eventManager = service.getComponentManager().getEventManager();
+            final String path = ((ChangeCopletsJXPathEvent)e).getPath();
+            final Object value = ((ChangeCopletsJXPathEvent)e).getValue();
+  
+            Iterator i = instances.iterator();
+            while ( i.hasNext() ) {
+                CopletInstanceData current = (CopletInstanceData) i.next();
+                Event event = new CopletJXPathEvent(current, path, value);
+                eventManager.send(event);
+            }
+        }
+    }
+
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java Sun Oct 16 10:52:43 2005
@@ -19,7 +19,8 @@
 
 /**
  * This event is send when a user logs out from the portal.
- * Note, that not in all circumstances a logout is received from a user.
+ * Note, that not in all circumstances a logout is received from a user, e.g. when
+ * the session expires and the user does not explicitly logout.
  *
  * @version $Id$
  * @since 2.2

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java?rev=322495&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java Sun Oct 16 10:52:43 2005
@@ -0,0 +1,91 @@
+/*
+ * 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.impl;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Receiver;
+
+/**
+ * This class can be used as a base class for all portal related components.
+ * It already implements some Avalon lifecycle interfaces and stores
+ * the portal service in an instance variable ({@link #portalService}) and
+ * the Avalon component context in another one.
+ *
+ * If the sub class implements the {@link org.apache.cocoon.portal.event.Receiver}
+ * interface, the component is subscribed/unsubcribed to/from the {@link org.apache.cocoon.portal.event.EventManager}.
+ *
+ * @version $Id$
+ */
+public class AbstractComponent
+    extends AbstractLogEnabled
+    implements Contextualizable, Serviceable, Disposable, ThreadSafe, Initializable {
+
+    /** The service manager. */
+    protected ServiceManager manager;
+
+    /** The portal service. */
+    protected PortalService portalService;
+
+    /** The application context */
+    protected Context context;
+
+    /**
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(Context context) throws ContextException {
+        this.context = context;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
+    }
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            if ( this instanceof Receiver && this.portalService != null ) {
+                this.portalService.getComponentManager().getEventManager().unsubscribe((Receiver)this);
+            }
+            this.manager.release(this.portalService);
+            this.portalService = null;
+            this.manager = null;
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     */
+    public void initialize() throws Exception {
+        if ( this instanceof Receiver ) {
+            this.portalService.getComponentManager().getEventManager().subscribe((Receiver)this);
+        }
+    }
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java Sun Oct 16 10:52:43 2005
@@ -56,16 +56,6 @@
     CopletData getCopletData(String copletDataId);
 
     /**
-     * New coplet instance datas have to be registered using this method.
-     */
-    void register(CopletInstanceData coplet);
-
-    /**
-     * Removed coplet instance datas have to be unregistered using this method.
-     */
-    void unregister(CopletInstanceData coplet);
-
-    /**
      * New layouts have to be registered using this method.
      */
     void register(Layout layout);

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java Sun Oct 16 10:52:43 2005
@@ -15,19 +15,12 @@
  */
 package org.apache.cocoon.portal.profile.impl;
 
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.portal.PortalService;
-import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.event.Receiver;
 import org.apache.cocoon.portal.event.user.UserDidLoginEvent;
 import org.apache.cocoon.portal.event.user.UserEvent;
 import org.apache.cocoon.portal.event.user.UserWillLogoutEvent;
+import org.apache.cocoon.portal.impl.AbstractComponent;
 import org.apache.cocoon.portal.layout.Layout;
 import org.apache.cocoon.portal.profile.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileManager;
@@ -39,47 +32,12 @@
  * @version $Id$
  */
 public abstract class AbstractProfileManager 
-    extends AbstractLogEnabled 
-    implements Serviceable, Disposable, ProfileManager, ThreadSafe, Receiver, Initializable {
+    extends AbstractComponent 
+    implements ProfileManager, Receiver {
 
     /** Attribute to store the current user. */
     public static final String USER_ATTRIBUTE = AbstractProfileManager.class.getName() + "/User";
 
-    /** The service manager of the portal application. */
-    protected ServiceManager manager;
-
-    /** The corresponding portal service. */
-    protected PortalService portalService;
-
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager manager) throws ServiceException {
-        this.manager = manager;
-        this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
-    }
-
-    /**
-     * @see org.apache.avalon.framework.activity.Disposable#dispose()
-     */
-    public void dispose() {
-        if ( this.manager != null ) {
-            if ( this.portalService != null ) {
-                this.portalService.getComponentManager().getEventManager().unsubscribe(this);
-            }
-            this.manager.release(this.portalService);
-            this.portalService = null;
-            this.manager = null;
-        }
-    }
-
-    /**
-     * @see org.apache.avalon.framework.activity.Initializable#initialize()
-     */
-    public void initialize() throws Exception {
-        this.portalService.getComponentManager().getEventManager().subscribe(this);
-    }
-
     /**
      * Receives any user related event and invokes login, logout etc.
      * @see Receiver
@@ -94,13 +52,6 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
-     */
-    public void register(CopletInstanceData coplet) {
-        // overwrite in subclass
-    }
-
-    /**
      * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.layout.Layout)
      */
     public void register(Layout layout) {
@@ -127,13 +78,6 @@
      */
     public void saveUserLayout(String layoutKey) {
         // override in subclass
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.coplet.CopletInstanceData)
-     */
-    public void unregister(CopletInstanceData coplet) {
-        // overwrite in subclass
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java Sun Oct 16 10:52:43 2005
@@ -29,6 +29,9 @@
 import org.apache.cocoon.portal.coplet.CopletFactory;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.event.coplet.CopletInstanceDataAddedEvent;
+import org.apache.cocoon.portal.event.coplet.CopletInstanceDataRemovedEvent;
 import org.apache.cocoon.portal.layout.CompositeLayout;
 import org.apache.cocoon.portal.layout.Item;
 import org.apache.cocoon.portal.layout.Layout;
@@ -36,6 +39,7 @@
 import org.apache.cocoon.portal.profile.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileException;
 import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalService;
 
 /**
  * An abstract profile manager providing a different profile for each user.
@@ -190,23 +194,25 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
+     * Receives a coplet instance data added event.
+     * @see Receiver
      */
-    public void register(CopletInstanceData coplet) {
+    public void inform(CopletInstanceDataAddedEvent event, PortalService service) {
         final String layoutKey = this.portalService.getDefaultLayoutKey();
         final String attribute = "CopletInstanceData:" + layoutKey;
         CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)this.portalService.getAttribute(attribute);
-        copletInstanceDataManager.putCopletInstanceData( coplet );
+        copletInstanceDataManager.putCopletInstanceData( (CopletInstanceData) event.getTarget() );
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.coplet.CopletInstanceData)
+     * Receives a coplet instance data added event.
+     * @see Receiver
      */
-    public void unregister(CopletInstanceData coplet) {
+    public void inform(CopletInstanceDataRemovedEvent event, PortalService service) {
         final String layoutKey = this.portalService.getDefaultLayoutKey();
         final String attribute = "CopletInstanceData:" + layoutKey;
         CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)this.portalService.getAttribute(attribute);
-        copletInstanceDataManager.getCopletInstanceData().remove(coplet.getId());
+        copletInstanceDataManager.getCopletInstanceData().remove(((CopletInstanceData) event.getTarget()).getId());
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java Sun Oct 16 10:52:43 2005
@@ -37,6 +37,9 @@
 import org.apache.cocoon.portal.coplet.CopletFactory;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.event.coplet.CopletInstanceDataAddedEvent;
+import org.apache.cocoon.portal.event.coplet.CopletInstanceDataRemovedEvent;
 import org.apache.cocoon.portal.layout.Layout;
 import org.apache.cocoon.portal.profile.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileLS;
@@ -44,6 +47,7 @@
 import org.apache.cocoon.portal.scratchpad.Profile;
 import org.apache.cocoon.portal.scratchpad.ProfileImpl;
 import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalService;
 import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.excalibur.source.SourceNotFoundException;
@@ -265,19 +269,21 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
+     * Receives a coplet instance data added event.
+     * @see Receiver
      */
-    public void register(CopletInstanceData coplet) {
+    public void inform(CopletInstanceDataAddedEvent event, PortalService service) {
         final ProfileImpl profile = this.getUserProfile(null);
-        profile.add(coplet);
+        profile.add((CopletInstanceData) event.getTarget());
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.coplet.CopletInstanceData)
+     * Receives a coplet instance data added event.
+     * @see Receiver
      */
-    public void unregister(CopletInstanceData coplet) {
+    public void inform(CopletInstanceDataRemovedEvent event, PortalService service) {
         final ProfileImpl profile = this.getUserProfile(null);
-        profile.remove(coplet);
+        profile.remove((CopletInstanceData) event.getTarget());
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java?rev=322495&r1=322494&r2=322495&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java Sun Oct 16 10:52:43 2005
@@ -275,34 +275,6 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
-     */
-    public void register(CopletInstanceData coplet) {
-        // nothing to do
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.coplet.CopletInstanceData)
-     */
-    public void unregister(CopletInstanceData coplet) {
-        // nothing to do
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.layout.Layout)
-     */
-    public void register(Layout layout) {
-        // nothing to do
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.layout.Layout)
-     */
-    public void unregister(Layout layout) {
-        // nothing to do
-    }
-
-    /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
     public void configure(Configuration configuration)