cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r329272 [1/2] - in /cocoon/blocks: portal-sample/trunk/java/org/apache/cocoon/portal/coplets/basket/ portal/trunk/java/org/apache/cocoon/portal/ portal/trunk/java/org/apache/cocoon/portal/authenticationfw/ portal/trunk/java/org/apache/cocoo...
Date Fri, 28 Oct 2005 19:27:02 GMT
Author: cziegeler
Date: Fri Oct 28 12:19:23 2005
New Revision: 329272

URL: http://svn.apache.org/viewcvs?rev=329272&view=rev
Log:
Add some docs, clean up layout creation

Added:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalRuntimeException.java   (with props)
Modified:
    cocoon/blocks/portal-sample/trunk/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalException.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/authenticationfw/User.java
    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/CopletFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PageLabelManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/CompositeLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutDescription.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/FrameLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/layout.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletContainerEnvironmentImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileException.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
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/copletManagement/LayoutActions.java

Modified: cocoon/blocks/portal-sample/trunk/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal-sample/trunk/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java (original)
+++ cocoon/blocks/portal-sample/trunk/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java Fri Oct 28 12:19:23 2005
@@ -30,41 +30,35 @@
 import java.util.Map;
 
 import org.apache.avalon.excalibur.io.IOUtil;
-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.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
 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.Constants;
-import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.cron.CronJob;
 import org.apache.cocoon.components.cron.JobScheduler;
 import org.apache.cocoon.components.cron.ServiceableCronJob;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.portal.PortalException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplets.basket.events.AddItemEvent;
-import org.apache.cocoon.portal.coplets.basket.events.ContentStoreEvent;
 import org.apache.cocoon.portal.coplets.basket.events.CleanBriefcaseEvent;
+import org.apache.cocoon.portal.coplets.basket.events.ContentStoreEvent;
 import org.apache.cocoon.portal.coplets.basket.events.MoveItemEvent;
 import org.apache.cocoon.portal.coplets.basket.events.RefreshBasketEvent;
 import org.apache.cocoon.portal.coplets.basket.events.RemoveItemEvent;
 import org.apache.cocoon.portal.coplets.basket.events.ShowBasketEvent;
 import org.apache.cocoon.portal.coplets.basket.events.ShowItemEvent;
 import org.apache.cocoon.portal.coplets.basket.events.UploadItemEvent;
-import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.impl.AbstractComponent;
 import org.apache.cocoon.portal.layout.impl.CopletLayout;
 import org.apache.cocoon.servlet.multipart.Part;
 import org.apache.cocoon.servlet.multipart.PartOnDisk;
@@ -78,14 +72,8 @@
  * @version $Id$
  */
 public class BasketManagerImpl
-extends AbstractLogEnabled
-implements BasketManager, Serviceable, Receiver, Contextualizable, Initializable, Disposable, Parameterizable, ThreadSafe  {
-
-    /** The service manager */
-    protected ServiceManager manager;
-
-    /** The component context */
-    protected Context context;
+    extends AbstractComponent
+    implements BasketManager, Receiver, Parameterizable {
 
     /** The configuration for storing baskets */
     protected String directory;
@@ -140,7 +128,7 @@
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */
     public void contextualize(Context context) throws ContextException {
-        this.context = context;
+        super.contextualize(context);
         this.directory = ((File)context.get(Constants.CONTEXT_WORK_DIR)).getAbsolutePath();
     }
 
@@ -148,7 +136,7 @@
      * @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.scheduler = (JobScheduler)this.manager.lookup(JobScheduler.ROLE);
     }
 
@@ -159,21 +147,8 @@
         if ( this.manager != null ) {
             this.manager.release(this.scheduler);
             this.scheduler = null;
-            this.manager = null;
-        }
-    }
-
-    /**
-     * @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);
         }
+        super.dispose();
     }
 
     /**
@@ -253,16 +228,14 @@
      */
     protected void processShowItemEvent(ShowItemEvent event) {
         if ( event.getItem() instanceof ContentItem ) {
-            PortalService service = null;
             try {
-                service = (PortalService) this.manager.lookup(PortalService.ROLE);
 
                 ContentItem ci = (ContentItem)event.getItem();
                 CopletLayout layout = (CopletLayout) event.getLayout();
                 CopletInstanceData cid = null;
                 if ( ci.isContent() ) {
-                    CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
-                    cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
+                    CopletData copletData = this.portalService.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
+                    cid = this.portalService.getComponentManager().getCopletFactory().newInstance(copletData);
                     cid.setAttribute("item-content", ci.getContent());                
                 } else {
                     if ( ci.getURL() != null ) {
@@ -273,8 +246,8 @@
                             resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                             url = ci.getURL();
                             source = resolver.resolveURI(url);
-                            CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
-                            cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
+                            CopletData copletData = this.portalService.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
+                            cid = this.portalService.getComponentManager().getCopletFactory().newInstance(copletData);
                             cid.setAttribute("item-content", IOUtil.toByteArray(source.getInputStream()));
                         } catch (IOException se) {
                             this.getLogger().warn("Unable to get content for " + url, se);
@@ -288,9 +261,9 @@
                         }
                         
                     } else {
-                        final CopletInstanceData original = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
+                        final CopletInstanceData original = this.portalService.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                         final CopletData copletData = original.getCopletData();
-                        cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
+                        cid = this.portalService.getComponentManager().getCopletFactory().newInstance(copletData);
                         Map attributes = (Map) ci.getAttribute("coplet-attributes");
                         Iterator i = attributes.entrySet().iterator();
                         while ( i.hasNext() ) {
@@ -307,12 +280,8 @@
                     }
                 }
                 layout.setCopletInstanceData(cid);
-            } catch (ProcessingException pe) {
+            } catch (PortalException pe) {
                 this.getLogger().warn("Unable to create new instance.", pe);
-            } catch (ServiceException se) {
-                this.getLogger().warn("Unable to lookup portal service.", se);
-            } finally {
-                this.manager.release(service);
             }
         }
     }
@@ -383,56 +352,17 @@
         if ( item instanceof ContentItem ) {
             ContentItem ci = (ContentItem)item;
 
-                if ( ci.isContent() ) {
-                    SourceResolver resolver = null;
-                    Source source = null;
-                    String url = null;
-                    try {
-                        resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
-                        url = ci.getURL();
-                        if ( url == null ) {
+            if ( ci.isContent() ) {
+                SourceResolver resolver = null;
+                Source source = null;
+                String url = null;
+                try {
+                    resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+                    url = ci.getURL();
+                    if ( url == null ) {
                         // copy coplet attributes
-                        PortalService service = null;
-                        try {
-                            service = (PortalService) this.manager.lookup(PortalService.ROLE);
-                            CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
-                            url = "coplet://" + ci.getCopletId();
-                            Map attributes = new HashMap();
-                            Iterator i = cid.getAttributes().entrySet().iterator();
-                            while ( i.hasNext() ) {
-                                Map.Entry entry = (Map.Entry)i.next();
-                                attributes.put(entry.getKey(), entry.getValue());
-                            }
-                            i = cid.getCopletData().getAttributes().entrySet().iterator();
-                            while ( i.hasNext() ) {
-                                Map.Entry entry = (Map.Entry)i.next();
-                                attributes.put(entry.getKey(), entry.getValue());
-                            }
-                            ci.setAttribute("coplet-attributes", attributes);
-                        } catch (ServiceException se) {
-                            this.getLogger().warn("Unable to lookup portal service.", se);
-                        } finally {
-                            this.manager.release(service);
-                        }
-                        }
-                        source = resolver.resolveURI(url);
-                        ci.setContent(IOUtil.toByteArray(source.getInputStream()));
-                    } catch (IOException se) {
-                        this.getLogger().warn("Unable to get content for " + url, se);
-                    } catch (ServiceException se) {
-                        this.getLogger().warn("Unable to get source resolver.", se);
-                    } finally {
-                        if ( source != null ) {
-                            resolver.release(source);
-                        }
-                        this.manager.release(resolver);
-                    }
-                } else if ( ci.getURL() == null ) {
-                    // copy coplet attributes
-                    PortalService service = null;
-                    try {
-                        service = (PortalService) this.manager.lookup(PortalService.ROLE);
-                        CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
+                        CopletInstanceData cid = this.portalService.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
+                        url = "coplet://" + ci.getCopletId();
                         Map attributes = new HashMap();
                         Iterator i = cid.getAttributes().entrySet().iterator();
                         while ( i.hasNext() ) {
@@ -445,12 +375,35 @@
                             attributes.put(entry.getKey(), entry.getValue());
                         }
                         ci.setAttribute("coplet-attributes", attributes);
-                    } catch (ServiceException se) {
-                        this.getLogger().warn("Unable to lookup portal service.", se);
-                    } finally {
-                        this.manager.release(service);
                     }
+                    source = resolver.resolveURI(url);
+                    ci.setContent(IOUtil.toByteArray(source.getInputStream()));
+                } catch (IOException se) {
+                    this.getLogger().warn("Unable to get content for " + url, se);
+                } catch (ServiceException se) {
+                    this.getLogger().warn("Unable to get source resolver.", se);
+                } finally {
+                    if ( source != null ) {
+                        resolver.release(source);
+                    }
+                    this.manager.release(resolver);
+                }
+            } else if ( ci.getURL() == null ) {
+                // copy coplet attributes
+                CopletInstanceData cid = this.portalService.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
+                Map attributes = new HashMap();
+                Iterator i = cid.getAttributes().entrySet().iterator();
+                while ( i.hasNext() ) {
+                    Map.Entry entry = (Map.Entry)i.next();
+                    attributes.put(entry.getKey(), entry.getValue());
+                }
+                i = cid.getCopletData().getAttributes().entrySet().iterator();
+                while ( i.hasNext() ) {
+                    Map.Entry entry = (Map.Entry)i.next();
+                    attributes.put(entry.getKey(), entry.getValue());
                 }
+                ci.setAttribute("coplet-attributes", attributes);
+            }
             store.addItem(ci);
         } else { 
             store.addItem(item);
@@ -673,17 +626,7 @@
      * Get the current user
      */
     protected String getUser() {
-        PortalService service = null;
-        try {
-            service = (PortalService)this.manager.lookup(PortalService.ROLE);
-            return service.getComponentManager().getProfileManager().getUser().getUserName();
-        } catch (ServiceException ignore) {
-            // ignore this
-        } finally {
-            this.manager.release(service);
-        }
-        return null;
-        
+        return this.portalService.getComponentManager().getProfileManager().getUser().getUserName();        
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalException.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalException.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalException.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalException.java Fri Oct 28 12:19:23 2005
@@ -19,7 +19,8 @@
  *
  * @version $Id$
  */
-public class PortalException extends RuntimeException {
+public class PortalException extends Exception {
+
     public PortalException() {
         super();
     }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalManager.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalManager.java Fri Oct 28 12:19:23 2005
@@ -32,11 +32,34 @@
  */
 public interface PortalManager {
 
+    /** This parameter containing a layout id can be passed to the
+     * {@link #showPortal(ContentHandler, Parameters)} method. In this
+     * case only the tree starting with this layout object is rendered.
+     */
+    String PARAMETER_RENDER_LAYOUT = "render-layout";
+
+    /** This parameter containing a coplet instance id can be passed to the
+     * {@link #showPortal(ContentHandler, Parameters)} method. In this
+     * case only the coplet with the surrounding layout is rendered.
+     */
+    String PARAMETER_RENDER_COPLET = "render-coplet";
+
     String ROLE = PortalManager.class.getName();
 
+    /**
+     * Start the first phase of the request handling.
+     * In this phase all events are fired and processed.
+     * @throws ProcessingException
+     */
     void process()
     throws ProcessingException;
 
+    /**
+     * Render the portal.
+     * @param ch         The content handler receiving the sax events.
+     * @param parameters A parameters object.
+     * @throws SAXException
+     */
     void showPortal(ContentHandler ch,
                     Parameters     parameters)
     throws SAXException;

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalRuntimeException.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalRuntimeException.java?rev=329272&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalRuntimeException.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalRuntimeException.java Fri Oct 28 12:19:23 2005
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+/**
+ *
+ * @version $Id$
+ */
+public class PortalRuntimeException extends RuntimeException {
+
+    public PortalRuntimeException() {
+        super();
+    }
+
+    public PortalRuntimeException(String message) {
+        super(message);
+    }
+
+    public PortalRuntimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public PortalRuntimeException(Throwable cause) {
+        super(cause);
+    }
+}

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

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

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/authenticationfw/User.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/authenticationfw/User.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/authenticationfw/User.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/authenticationfw/User.java Fri Oct 28 12:19:23 2005
@@ -20,7 +20,7 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.portal.profile.PortalUser;
 import org.apache.cocoon.portal.profile.impl.AbstractPortalUser;
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.webapps.authentication.AuthenticationManager;
 import org.apache.cocoon.webapps.authentication.user.RequestState;
 import org.apache.cocoon.webapps.authentication.user.UserHandler;
@@ -66,7 +66,7 @@
 
             return info;
         } catch (ServiceException se) {
-            throw new PortalException("Unable to lookup authentication manager.", se);
+            throw new PortalRuntimeException("Unable to lookup authentication manager.", se);
         } finally {
             manager.release( authManager );
         }

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=329272&r1=329271&r2=329272&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 Fri Oct 28 12:19:23 2005
@@ -34,12 +34,21 @@
 
 	private String copletAdapterName;
 
+    /**
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CopletBaseData(String)} instead.
+     */
 	public CopletBaseData() {
         // this constructor is just to keep Castor happy (version 0.9.9)
         // we can remove it in later versions
         this.id = null;
+        throw new IllegalArgumentException("Only instantiate a coplet base data with the id constructor.");
     }
 
+    /**
+     * Create a new coplet base data object. 
+     * @param id The unique id of the object.
+     */
     public CopletBaseData(String id) {
         this.id = id;
     }

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=329272&r1=329271&r2=329272&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 Fri Oct 28 12:19:23 2005
@@ -47,14 +47,20 @@
     protected transient List allowedRolesList;
 
     /**
-     * Constructor
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CopletData(String)} instead.
      */
     public CopletData() {
         // this constructor is just to keep Castor happy (version 0.9.9)
         // we can remove it in later versions
         this.id = null;
+        throw new IllegalArgumentException("Only instantiate a coplet data with the id constructor.");
     }
 
+    /**
+     * Constructor to instantiate a new coplet data object.
+     * @param id The unique id of the object.
+     */
     public CopletData(String id) {
         this.id = id;
     }

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=329272&r1=329271&r2=329272&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 Fri Oct 28 12:19:23 2005
@@ -15,7 +15,7 @@
  */
 package org.apache.cocoon.portal.coplet;
 
-import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.portal.PortalException;
 
 /**
  * This factory is for creating and managing coplet objects.
@@ -31,7 +31,7 @@
      * This is also registered at the profile manager.
      */
     CopletInstanceData newInstance(CopletData copletData)
-    throws ProcessingException;
+    throws PortalException;
 
     /** 
      * Create a new coplet instance.
@@ -39,12 +39,11 @@
      */
     CopletInstanceData newInstance(CopletData copletData,
                                    String id)
-    throws ProcessingException;
+    throws PortalException;
 
     /**
      * Remove the coplet instance data.
      * This is also unregistered at the profile manager.
      */
-    void remove(CopletInstanceData copletInstanceData)
-    throws ProcessingException;
+    void remove(CopletInstanceData copletInstanceData);
 }

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=329272&r1=329271&r2=329272&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 Fri Oct 28 12:19:23 2005
@@ -66,16 +66,21 @@
     protected int size = SIZE_NORMAL;
 
     /**
-     * Constructor.
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CopletInstanceData(String)} instead.
      */
     public CopletInstanceData() {
         // this constructor is just to keep Castor happy (version 0.9.9)
         // we can remove it in later versions
         this.id = null;
+        throw new IllegalArgumentException("Only instantiate a coplet instance data with the id constructor.");
     }
 
     /**
-	 * Constructor.
+	 * Constructor to create a new coplet instance data object.
+     * Never create a coplet instance data object directly. Use the
+     * {@link CopletFactory} instead.
+     * @param id The unique id of the object.
 	 */
 	public CopletInstanceData(String id) {
         this.id = id;

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=329272&r1=329271&r2=329272&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 Fri Oct 28 12:19:23 2005
@@ -17,7 +17,7 @@
 
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.portal.PortalException;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletFactory;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
@@ -41,7 +41,7 @@
      * @see org.apache.cocoon.portal.coplet.CopletFactory#newInstance(org.apache.cocoon.portal.coplet.CopletData)
      */
     public CopletInstanceData newInstance(CopletData copletData)
-    throws ProcessingException {
+    throws PortalException {
         return this.newInstance(copletData, null);
     }
 
@@ -49,7 +49,7 @@
      * @see org.apache.cocoon.portal.coplet.CopletFactory#newInstance(org.apache.cocoon.portal.coplet.CopletData, String)
      */
     public CopletInstanceData newInstance(CopletData copletData, String id)
-    throws ProcessingException {
+    throws PortalException {
         if (id == null ) {
             synchronized (this) {
                 id = copletData.getId() + '-' + idCounter;
@@ -69,7 +69,7 @@
             adapter.init( instance );
             adapter.login( instance );
         } catch (ServiceException ce) {
-            throw new ProcessingException("Unable to lookup coplet adapter selector or adaptor.", ce);
+            throw new PortalException("Unable to lookup coplet adapter selector or adaptor.", ce);
         } finally {
             if ( adapterSelector != null) {
                 adapterSelector.release( adapter );
@@ -85,8 +85,7 @@
     /**
      * @see org.apache.cocoon.portal.coplet.CopletFactory#remove(org.apache.cocoon.portal.coplet.CopletInstanceData)
      */
-    public void remove(CopletInstanceData copletInstanceData) 
-    throws ProcessingException {
+    public void remove(CopletInstanceData copletInstanceData) {
         if ( copletInstanceData != null ) {
             // now lookup the adapter
             final String adapterName = copletInstanceData.getCopletData().getCopletBaseData().getCopletAdapterName();
@@ -98,7 +97,8 @@
                 adapter.logout( copletInstanceData );
                 adapter.destroy( copletInstanceData );
             } catch (ServiceException ce) {
-                throw new ProcessingException("Unable to lookup coplet adapter selector or adaptor.", ce);
+                // we ignore this exception as this is just a remove action
+                this.getLogger().warn("Unable to lookup coplet adaptor: " + adapterName);
             } finally {
                 if ( adapterSelector != null) {
                     adapterSelector.release( adapter );

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java Fri Oct 28 12:19:23 2005
@@ -25,7 +25,7 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.ConvertableEvent;
 import org.apache.cocoon.portal.event.Event;
@@ -84,9 +84,9 @@
             final Class factoryClass = ClassUtils.loadClass(factory);
             return factoryClass.getConstructor(new Class[] {PortalService.class, String.class});
         } catch (NoSuchMethodException nsme) {
-            throw new PortalException("Factory class does not provide required constructor: " + factory, nsme);
+            throw new PortalRuntimeException("Factory class does not provide required constructor: " + factory, nsme);
         } catch (ClassNotFoundException cnfe) {
-            throw new PortalException("Factory class can't be loaded: " + factory, cnfe);
+            throw new PortalRuntimeException("Factory class can't be loaded: " + factory, cnfe);
         }
     }
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java Fri Oct 28 12:19:23 2005
@@ -97,7 +97,7 @@
             try {
                 this.linkService = (LinkService)this.manager.lookup( LinkService.ROLE );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup link service.", e);
+                throw new PortalRuntimeException("Unable to lookup link service.", e);
             }
         }
         return this.linkService;
@@ -111,7 +111,7 @@
             try {
                 this.profileManager = (ProfileManager)this.manager.lookup( ProfileManager.ROLE );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup profile manager.", e);
+                throw new PortalRuntimeException("Unable to lookup profile manager.", e);
             }
         }
         return this.profileManager;
@@ -125,7 +125,7 @@
             try {
                 this.eventManager = (EventManager)this.manager.lookup( EventManager.ROLE );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup event manager.", e);
+                throw new PortalRuntimeException("Unable to lookup event manager.", e);
             }
         }
         return this.eventManager;
@@ -169,7 +169,7 @@
                 o = (Renderer) this.manager.lookup( Renderer.ROLE + '/' + hint );
                 this.renderers.put( hint, o );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup renderer with hint " + hint, e);
+                throw new PortalRuntimeException("Unable to lookup renderer with hint " + hint, e);
             }
         }
         return o;
@@ -183,7 +183,7 @@
             try {
                 this.copletFactory = (CopletFactory)this.manager.lookup( CopletFactory.ROLE );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup coplet factory.", e);
+                throw new PortalRuntimeException("Unable to lookup coplet factory.", e);
             }
         }
         return this.copletFactory;
@@ -197,7 +197,7 @@
             try {
                 this.layoutFactory = (LayoutFactory)this.manager.lookup( LayoutFactory.ROLE );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup layout factory.", e);
+                throw new PortalRuntimeException("Unable to lookup layout factory.", e);
             }
         }
         return this.layoutFactory;
@@ -211,7 +211,7 @@
             try {
                 this.portalManager = (PortalManager)this.manager.lookup( PortalManager.ROLE );
             } catch (ServiceException e) {
-                throw new PortalException("Unable to lookup portal manager.", e);
+                throw new PortalRuntimeException("Unable to lookup portal manager.", e);
             }
         }
         return this.portalManager;

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PageLabelManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PageLabelManager.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PageLabelManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PageLabelManager.java Fri Oct 28 12:19:23 2005
@@ -32,7 +32,7 @@
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.layout.LayoutChangeParameterEvent;
 import org.apache.cocoon.portal.layout.CompositeLayout;
@@ -157,7 +157,7 @@
 
             return map;
         } catch (ServiceException ce) {
-            throw new PortalException("Unable to lookup component.", ce);
+            throw new PortalRuntimeException("Unable to lookup component.", ce);
         } finally {
             this.manager.release(service);
         }
@@ -189,7 +189,7 @@
 
             return list;
         } catch (ServiceException ce) {
-            throw new PortalException("Unable to lookup component.", ce);
+            throw new PortalRuntimeException("Unable to lookup component.", ce);
         } finally {
             this.manager.release(service);
         }
@@ -210,7 +210,7 @@
             return labels;
         }
         catch (ServiceException ce) {
-            throw new PortalException("Unable to lookup component.", ce);
+            throw new PortalRuntimeException("Unable to lookup component.", ce);
         }
         finally {
             this.manager.release(service);

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java Fri Oct 28 12:19:23 2005
@@ -15,20 +15,15 @@
  */
 package org.apache.cocoon.portal.impl;
 
-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.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.parameters.Parameters;
 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.components.ContextHelper;
 import org.apache.cocoon.portal.PortalManager;
@@ -36,10 +31,14 @@
 import org.apache.cocoon.portal.PortalManagerAspectPrepareContext;
 import org.apache.cocoon.portal.PortalManagerAspectRenderContext;
 import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.coplet.CopletInstanceDataFeatures;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.Layout;
 import org.apache.cocoon.portal.layout.renderer.Renderer;
+import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.commons.lang.StringUtils;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -48,23 +47,14 @@
  * @version $Id$
  */
 public class PortalManagerImpl
-	extends AbstractLogEnabled
-	implements PortalManager, Serviceable, Disposable, ThreadSafe, Contextualizable, PortalManagerAspect, Configurable {
-
-    /** The service manager */
-    protected ServiceManager manager;
-
-    /** The portal service */
-    protected PortalService portalService;
+	extends AbstractComponent
+	implements PortalManager, PortalManagerAspect, Configurable {
 
     protected PortalManagerAspectChain chain;
 
     protected ServiceSelector aspectSelector;
     protected ServiceSelector adapterSelector;
 
-    /** The component context. */
-    protected Context context;
-
     private boolean fullScreenNav;
     public static final String FULLSCREEN = "fullScreenNav";
 
@@ -73,8 +63,7 @@
      */
     public void service(ServiceManager serviceManager)
     throws ServiceException {
-        this.manager = serviceManager;
-        this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
+        super.service(serviceManager);
         if ( this.manager.hasService(PortalManagerAspect.ROLE+"Selector") ) {
             this.aspectSelector = (ServiceSelector) this.manager.lookup( PortalManagerAspect.ROLE+"Selector");
         }
@@ -86,9 +75,6 @@
      */
     public void dispose() {
         if ( this.manager != null ) {
-            this.manager.release(this.portalService);
-            this.portalService = null;
-            this.manager = null;
             if ( this.chain != null) {
                 this.chain.dispose( this.aspectSelector, this.adapterSelector );
             }
@@ -96,8 +82,8 @@
             this.aspectSelector = null;
             this.manager.release( this.adapterSelector );
             this.adapterSelector = null;
-            this.manager = null;
         }
+        super.dispose();
     }
 
     /**
@@ -155,16 +141,37 @@
     /**
      * @see org.apache.cocoon.portal.PortalManagerAspect#render(org.apache.cocoon.portal.PortalManagerAspectRenderContext, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler, org.apache.avalon.framework.parameters.Parameters)
      */
-    public void render(PortalManagerAspectRenderContext context, PortalService service, ContentHandler ch, Parameters parameters) throws SAXException {
-        // first check for a full screen layout
-
+    public void render(PortalManagerAspectRenderContext context,
+                       PortalService                    service,
+                       ContentHandler                   ch,
+                       Parameters                       parameters)
+    throws SAXException {
         Layout portalLayout = null;
-        if (!this.fullScreenNav) {
-            // If fullscreen mode - otherwise TabContentAspect will deal with the layout
-            portalLayout = this.portalService.getEntryLayout(null);
+        final ProfileManager profileManager = this.portalService.getComponentManager().getProfileManager();
+
+        // check for parameters
+        final String copletId = parameters.getParameter(PortalManager.PARAMETER_RENDER_COPLET, null);
+        final String layoutId = parameters.getParameter(PortalManager.PARAMETER_RENDER_LAYOUT, null);
+        if ( StringUtils.isNotEmpty(copletId) && StringUtils.isNotEmpty(layoutId) ) {
+            throw new SAXException("Only one of the paramteters can be specified for rendering: coplet or layout.");
         }
-        if ( portalLayout == null ) {
-            portalLayout = this.portalService.getComponentManager().getProfileManager().getPortalLayout(null, null);
+        if ( StringUtils.isNotEmpty(copletId) ) {
+            final CopletInstanceData cid = profileManager.getCopletInstanceData(copletId);
+            if ( cid != null ) {
+                portalLayout = CopletInstanceDataFeatures.searchLayout(cid, profileManager.getPortalLayout(null, null));
+            }
+        } else if ( StringUtils.isNotEmpty(layoutId) ) {
+            portalLayout = profileManager.getPortalLayout(null, layoutId);
+        } else {
+            // first check for a full screen layout
+
+            if (!this.fullScreenNav) {
+                // If fullscreen mode - otherwise TabContentAspect will deal with the layout
+                portalLayout = this.portalService.getEntryLayout(null);
+            }
+            if ( portalLayout == null ) {
+                portalLayout = profileManager.getPortalLayout(null, null);
+            }
         }
         if ( portalLayout == null) {
             getLogger().error("No Layout to render");

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java Fri Oct 28 12:19:23 2005
@@ -17,10 +17,14 @@
 
 import java.util.Map;
 
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.commons.collections.map.LinkedMap;
 
 /**
- * FIXME - We have to remove the dependency to pluto
+ * This class can be used as a base class for all layout implementations that
+ * represent a leave in the layout tree.
+ * If you want to implement a container layout, use the
+ * {@link org.apache.cocoon.portal.layout.impl.CompositeLayoutImpl} class instead.
  *
  * @version $Id$
  */
@@ -28,63 +32,71 @@
     extends AbstractParameters
     implements Layout {
 
+    /** The renderer to render this layout if this layout object wants to use a different
+     * render than the default renderer.
+     */
     protected String rendererName;
 
+    /** The parent item of this layout or null if this is a layout root. */
     protected Item parent;
 
+    /** The name of the layout. */
     protected String name;
 
+    /** The unique identifier of this layout object or null. */
     protected String id;
 
-    /** TODO we should remove the description from here. */
+    /** The corresponding layout descripton. */
     transient protected LayoutDescription description;
 
     /** The temporary parameters. */
     protected Map temporaryParameters = new LinkedMap();
 
     /**
-     * @return The configured name
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * @param string
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #AbstractLayout(String, String)} instead.
      */
-    public void setName(String string) {
-        name = string;
+    public AbstractLayout() {
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        this.id = null;
+        throw new IllegalArgumentException("Only instantiate a layout with the id/string constructor.");
     }
 
     /**
-     * Set the layout description
+     * Create a new layout object.
+     * Never create a layout object directly. Use the
+     * {@link LayoutFactory} instead.
+     * @param id The unique identifier of the layout object or null.
+     * @param id The name of the layout.
      */
-    public void setDescription(LayoutDescription description) {
-        this.description = description;
+    public AbstractLayout (String id, String name) {
+        this.id = id;
+        this.name = name;
     }
 
     /**
-     * Get the unique id of this object
-     * @return String Unique id
+     * @see org.apache.cocoon.portal.layout.Layout#getName()
      */
-    public String getId() {
-        return this.id;
+    public String getName() {
+        return name;
     }
 
     /**
-     * Set the unique id of this object
+     * @see org.apache.cocoon.portal.layout.Layout#setDescription(org.apache.cocoon.portal.layout.LayoutDescription)
      */
-    public void setId(String id) {
-        this.id = id;
+    public void setDescription(LayoutDescription description) {
+        if ( this.description != null ) {
+            throw new PortalRuntimeException("The layout has already a layout description.");
+        }
+        this.description = description;
     }
 
     /**
-     * Initialize the object. This should only be called once directly
-     * after the creation
+     * @see org.apache.cocoon.portal.layout.Layout#getId()
      */
-    public void initialize(String name, String id) {
-        this.name = name;
-        this.id = id;
+    public String getId() {
+        return this.id;
     }
 
     /**
@@ -101,10 +113,16 @@
 		this.rendererName = value;
 	}
 
+    /**
+     * @see org.apache.cocoon.portal.layout.Layout#getParent()
+     */
     public Item getParent() {
         return this.parent;
     }
 
+    /**
+     * @see org.apache.cocoon.portal.layout.Layout#setParent(org.apache.cocoon.portal.layout.Item)
+     */
     public void setParent(Item item) {
         this.parent = item;
     }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/CompositeLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/CompositeLayout.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/CompositeLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/CompositeLayout.java Fri Oct 28 12:19:23 2005
@@ -73,9 +73,4 @@
      * @return Returns the item class name.
      */
     String getItemClassName();
-
-    /**
-     * @param value The item class name to set.
-     */
-    void setItemClassName(String value);
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java Fri Oct 28 12:19:23 2005
@@ -46,12 +46,6 @@
     void setDescription(LayoutDescription description);
 
     /**
-     * Initialize the object. This should only be called once directly
-     * after the creation.
-     */
-    void initialize(String name, String id);
-
-    /**
      * Get parameters map.
      * This method never returns null.
      * @return A map with key value pairs.
@@ -107,8 +101,14 @@
      */
     String getLayoutRendererName();
 
+    /**
+     * The parent of this layout object or null.
+     */
     Item getParent();
 
+    /**
+     * Set the parent item for this layout.
+     */
     void setParent(Item item);
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java Fri Oct 28 12:19:23 2005
@@ -19,39 +19,50 @@
 
 
 /**
- * A configured layout
+ * A configured layout.
+ * This description is used to instantiate new layout objects by the {@link LayoutFactory}.
+ * A layout has an associated class and an associated name. The name is used to differentiate
+ * layout objects having the same class but providing different features. For example
+ * a composite layout can either be a row or a column - both use the same implementation class
+ * but have different names.
  *
  * @version $Id$
  */
 public interface LayoutDescription {
 
     /**
-     * @return The class name
+     * The name of the implementation class for this layout object.
+     * @return The class name.
      */
     String getClassName();
 
     /**
-     * @return The configured name
+     * The associated name for this layout object.
+     * @return The configured name.
      */
     String getName();
 
     /**
-     * Create a unique id for objects of this type
+     * Should the layout factory create a unique id for objects of this type?
      */
     boolean createId();
 
     /**
+     * This is the name of the renderer used by default to render this layout object.
      * @return the default renderer name
      */
     String getDefaultRendererName();
 
     /**
-     * @return the names of all allowed renderers
+     * Each layout can have several associated renderers.
+     * @return the names of all allowed renderers.
      */
     Iterator getRendererNames();
 
     /**
-     * @return The class name of the item
+     * Each composite layout object can contain items. This is the class name
+     * of the item implementation.
+     * @return The class name of the item.
      */
     String getItemClassName();
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutFactory.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutFactory.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutFactory.java Fri Oct 28 12:19:23 2005
@@ -15,10 +15,6 @@
  */
 package org.apache.cocoon.portal.layout;
 
-import java.util.List;
-
-import org.apache.cocoon.ProcessingException;
-
 /**
  * This factory is for creating and managing layout objects.
  *
@@ -31,22 +27,27 @@
     /**
      * This method is invoked for a newly loaded profile
      */
-    void prepareLayout(Layout layout);
+    void prepareLayout(Layout layout)
+    throws LayoutException;
 
     /**
      * Create a new layout instance.
      * The instance is also registered at the profile manager.
      */
     Layout newInstance(String name)
-    throws ProcessingException;
+    throws LayoutException;
+
+    /**
+     * Create a new layout instance.
+     * The instance is also registered at the profile manager.
+     */
+    Layout newInstance(String name, String id)
+    throws LayoutException;
 
     /**
      * Remove the layout instance.
      * The instance (and all childs) will also be unregistered from
      * the profile manager.
      */
-    void remove(Layout layout)
-    throws ProcessingException;
-
-    List getLayoutDescriptions();
+    void remove(Layout layout);
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java Fri Oct 28 12:19:23 2005
@@ -23,6 +23,7 @@
 import org.apache.cocoon.portal.layout.CompositeLayout;
 import org.apache.cocoon.portal.layout.Item;
 import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.layout.LayoutFactory;
 import org.apache.cocoon.util.ClassUtils;
 
 
@@ -35,16 +36,29 @@
     extends AbstractLayout
     implements CompositeLayout {
 
+    /** The children of this layout object. */
     protected List items = new ArrayList();
 
-    /** The class name of the items */
-    protected String itemClassName;
-
     /**
-     * Constructor
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CompositeLayoutImpl(String, String)} instead.
      */
     public CompositeLayoutImpl() {
-        // nothing to do
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        super(null, null);
+        throw new IllegalArgumentException("Only instantiate a composite layout with the id/name constructor.");
+    }
+
+    /**
+     * Create a new composite layout object.
+     * Never create a layout object directly. Use the
+     * {@link LayoutFactory} instead.
+     * @param id The unique identifier of the layout object or null.
+     * @param id The name of the layout.
+     */
+    public CompositeLayoutImpl(String id, String name) {
+        super(id, name);
     }
 
 	/**
@@ -102,11 +116,11 @@
      * @see org.apache.cocoon.portal.layout.CompositeLayout#createNewItem()
      */
     public Item createNewItem() {
-        if ( this.itemClassName == null ) {
+        if ( this.description.getItemClassName() == null ) {
             return new Item();
         }
         try {
-            return (Item)ClassUtils.newInstance(this.itemClassName);
+            return (Item)ClassUtils.newInstance(this.description.getItemClassName());
         } catch (Exception ignore) {
             return new Item();
         }
@@ -116,14 +130,7 @@
      * @return Returns the item class name.
      */
     public String getItemClassName() {
-        return this.itemClassName;
-    }
-
-    /**
-     * @param value The item class name to set.
-     */
-    public void setItemClassName(String value) {
-        this.itemClassName = value;
+        return this.description.getItemClassName();
     }
 
     /**
@@ -138,7 +145,7 @@
         return clone;
     }
 
-    /*+
+    /**
      * @see org.apache.cocoon.portal.layout.Layout#copy(java.util.Map)
      */
     public Layout copy() {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java Fri Oct 28 12:19:23 2005
@@ -18,6 +18,7 @@
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.layout.AbstractLayout;
 import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.layout.LayoutFactory;
 
 /**
  * A coplet layout holds a coplet.
@@ -28,11 +29,30 @@
 
     protected CopletInstanceData copletInstanceData;
 
+    /**
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CopletLayout(String, String)} instead.
+     */
+    public CopletLayout() {
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        super(null, null);
+        throw new IllegalArgumentException("Only instantiate a coplet layout with the id/string constructor.");
+    }
+
+    /**
+     * Create a new coplet layout object.
+     * Never create a layout object directly. Use the
+     * {@link LayoutFactory} instead.
+     * @param id The unique identifier of the layout object or null.
+     * @param id The name of the layout.
+     */
+    public CopletLayout(String id, String name) {
+        super(id, name);
+    }
+
     public void setCopletInstanceData(CopletInstanceData cid) {
         this.copletInstanceData = cid;
-        if ( this.getId() == null ) {
-            this.setId(cid.getId());
-        }
     }
 
     public CopletInstanceData getCopletInstanceData() {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutDescription.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutDescription.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutDescription.java Fri Oct 28 12:19:23 2005
@@ -54,7 +54,7 @@
     }
 
     /**
-     * @return the names of all allowed renderers
+     * @see org.apache.cocoon.portal.layout.LayoutDescription#getRendererNames()
      */
     public Iterator getRendererNames() {
         return this.rendererNames.iterator();
@@ -65,7 +65,7 @@
     }
 
     /**
-     * @return Returns the itemClassName.
+     * @see org.apache.cocoon.portal.layout.LayoutDescription#getItemClassName()
      */
     public String getItemClassName() {
         return this.itemClassName;
@@ -79,14 +79,14 @@
     }
 
     /**
-     * @return The class name
+     * @see org.apache.cocoon.portal.layout.LayoutDescription#getClassName()
      */
     public String getClassName() {
         return className;
     }
 
     /**
-     * @return The configured name
+     * @see org.apache.cocoon.portal.layout.LayoutDescription#getName()
      */
     public String getName() {
         return name;
@@ -107,7 +107,7 @@
     }
 
     /**
-     * Create a unique id for objects of this type
+     * @see org.apache.cocoon.portal.layout.LayoutDescription#createId()
      */
     public boolean createId() {
         return this.createId;

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java Fri Oct 28 12:19:23 2005
@@ -15,23 +15,15 @@
  */
 package org.apache.cocoon.portal.layout.impl;
 
-import java.util.ArrayList;
+import java.lang.reflect.Constructor;
 import java.util.HashMap;
 import java.util.Iterator;
-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.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.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletFactory;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
@@ -41,6 +33,7 @@
 import org.apache.cocoon.portal.event.Receiver;
 import org.apache.cocoon.portal.event.coplet.CopletInstanceSizingEvent;
 import org.apache.cocoon.portal.event.impl.LayoutRemoveEvent;
+import org.apache.cocoon.portal.impl.AbstractComponent;
 import org.apache.cocoon.portal.layout.CompositeLayout;
 import org.apache.cocoon.portal.layout.Item;
 import org.apache.cocoon.portal.layout.Layout;
@@ -114,32 +107,15 @@
  * @version $Id$
  */
 public class DefaultLayoutFactory
-	extends AbstractLogEnabled
-    implements ThreadSafe, 
-                 LayoutFactory, 
-                 Configurable, 
-                 Disposable, 
-                 Serviceable,
-                 Initializable,
-                 Receiver {
+	extends AbstractComponent
+    implements LayoutFactory, Configurable {
 
     protected Map layouts = new HashMap();
 
-    protected List descriptions = new ArrayList();
-
-    protected ServiceManager manager;
-
     protected Configuration[] layoutsConf;
 
     protected static long idCounter = System.currentTimeMillis();
 
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager manager) throws ServiceException {
-        this.manager = manager;
-    }
-
     /** 
      * Configure a layout
      */
@@ -179,7 +155,6 @@
         }
 
         this.layouts.put(desc.getName(), desc);
-        this.descriptions.add(desc);
     }
 
     /**
@@ -200,7 +175,7 @@
                         try {
                             this.configureLayout( layoutsConf[i] );
                         } catch (ConfigurationException ce) {
-                            throw new LayoutException("Unable to configure layout.", ce);
+                            throw new PortalRuntimeException("Unable to configure layout.", ce);
                         }
                     }
                     this.layoutsConf = null;
@@ -212,7 +187,8 @@
     /**
      * @see org.apache.cocoon.portal.layout.LayoutFactory#prepareLayout(org.apache.cocoon.portal.layout.Layout)
      */
-    public void prepareLayout(Layout layout){
+    public void prepareLayout(Layout layout)
+    throws LayoutException {
         if ( layout != null ) {
 
             this.init();
@@ -232,7 +208,6 @@
             // recursive
             if ( layout instanceof CompositeLayout ) {
                 CompositeLayout composite = (CompositeLayout)layout;
-                composite.setItemClassName(layoutDescription.getItemClassName());
 
                 Iterator items = composite.getItems().iterator();
                 while ( items.hasNext() ) {
@@ -246,88 +221,43 @@
      * @see org.apache.cocoon.portal.layout.LayoutFactory#newInstance(java.lang.String)
      */
     public Layout newInstance(String layoutName) 
-    throws ProcessingException {
+    throws LayoutException {
+        return this.newInstance(layoutName, null);
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.layout.LayoutFactory#newInstance(java.lang.String, java.lang.String)
+     */
+    public Layout newInstance(String layoutName, String id) 
+    throws LayoutException {
         this.init();
 
         DefaultLayoutDescription layoutDescription = (DefaultLayoutDescription)this.layouts.get( layoutName );
 
         if ( layoutDescription == null ) {
-            throw new ProcessingException("LayoutDescription with name '" + layoutName + "' not found.");
+            throw new LayoutException("LayoutDescription with name '" + layoutName + "' not found.");
         }
 
-        Layout layout = null;
-        try {
-            Class clazz = ClassUtils.loadClass( layoutDescription.getClassName() );
-            layout = (Layout)clazz.newInstance();
-        } catch (Exception e) {
-            throw new ProcessingException("Unable to create new instance", e );
-        }
-
-        String id = null;
-        if ( layoutDescription.createId() ) {
+        if ( layoutDescription.createId() && id == null ) {
             synchronized (this) {
                 id = layoutName + '-' + idCounter;
                 idCounter += 1;
             }
         }
-        layout.initialize( layoutName, id ); 
-        layout.setDescription( layoutDescription );
-
-        if ( layout instanceof CompositeLayout ) {
-            CompositeLayout composite = (CompositeLayout)layout;
-            composite.setItemClassName(layoutDescription.getItemClassName());
-        }
-
-        PortalService service = null;
+        Layout layout = null;
         try {
-            service = (PortalService)this.manager.lookup(PortalService.ROLE);
-            service.getComponentManager().getProfileManager().register(layout);
-        } catch (ServiceException ce) {
-            throw new ProcessingException("Unable to lookup profile manager.", ce);
-        } finally {
-            this.manager.release( service );
+            Class clazz = ClassUtils.loadClass( layoutDescription.getClassName() );
+            Constructor constructor = clazz.getConstructor(new Class[] {String.class});
+            layout = (Layout)constructor.newInstance(new Object[] {id});
+        } catch (Exception e) {
+            throw new LayoutException("Unable to create new layout instance for: " + layoutDescription , e );
         }
-        return layout;
-    }
 
-    /**
-     * @see org.apache.cocoon.portal.layout.LayoutFactory#getLayoutDescriptions()
-     */
-    public List getLayoutDescriptions() {
-        this.init();
-        return this.descriptions;
-    }
-
-    /**
-     * @see org.apache.avalon.framework.activity.Disposable#dispose()
-     */
-    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 = null;
-        }
+        layout.setDescription( layoutDescription );
 
-    }
+        this.portalService.getComponentManager().getProfileManager().register(layout);
 
-    /**
-     * @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 );
-        }
+        return layout;
     }
 
     /**
@@ -336,19 +266,14 @@
     public void inform(LayoutEvent event, PortalService service) {
         Layout layout = (Layout)event.getTarget();
         if ( event instanceof LayoutRemoveEvent ) {
-            try {
-                this.remove( layout );
-            } catch (ProcessingException pe) {
-                throw new LayoutException("Exception during removal.", pe);
-            }
+            this.remove( layout );
         }
     }
 
     /**
      * @see org.apache.cocoon.portal.layout.LayoutFactory#remove(org.apache.cocoon.portal.layout.Layout)
      */
-    public void remove(Layout layout) 
-    throws ProcessingException {
+    public void remove(Layout layout) {
         if ( layout != null ) {
             this.init();
             if ( layout instanceof CompositeLayout ) {
@@ -363,29 +288,19 @@
                 parent.getParent().removeItem( parent );
             }
 
-            PortalService service = null;
-            EventManager eventManager = null;
-            try {
-                service = (PortalService)this.manager.lookup(PortalService.ROLE);                
-                ProfileManager profileManager = service.getComponentManager().getProfileManager();
-                if ( layout instanceof CopletLayout ) {
-                    // full screen?
-                    if ( layout.equals(service.getEntryLayout(null)) ) {
-                        Event event = new CopletInstanceSizingEvent(null, CopletInstanceData.SIZE_FULLSCREEN);
-                        eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
-                        eventManager.send(event);
-                        service.getComponentManager().getLinkService().addEventToLink(event);
-                    }
-                    CopletFactory factory = service.getComponentManager().getCopletFactory();
-                    factory.remove( ((CopletLayout)layout).getCopletInstanceData());
+            ProfileManager profileManager = this.portalService.getComponentManager().getProfileManager();
+            if ( layout instanceof CopletLayout ) {
+                // full screen?
+                if ( layout.equals(this.portalService.getEntryLayout(null)) ) {
+                    Event event = new CopletInstanceSizingEvent(null, CopletInstanceData.SIZE_FULLSCREEN);
+                    EventManager em = this.portalService.getComponentManager().getEventManager();
+                    em.send(event);
+                    this.portalService.getComponentManager().getLinkService().addEventToLink(event);
                 }
-                profileManager.unregister(layout);
-            } catch (ServiceException ce) {
-                throw new ProcessingException("Unable to lookup portal service.", ce);
-            } finally {
-                this.manager.release( service );
-                this.manager.release(eventManager);
+                CopletFactory factory = this.portalService.getComponentManager().getCopletFactory();
+                factory.remove( ((CopletLayout)layout).getCopletInstanceData());
             }
+            profileManager.unregister(layout);
         }
     }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/FrameLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/FrameLayout.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/FrameLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/FrameLayout.java Fri Oct 28 12:19:23 2005
@@ -16,6 +16,7 @@
 package org.apache.cocoon.portal.layout.impl;
 
 import org.apache.cocoon.portal.layout.AbstractLayout;
+import org.apache.cocoon.portal.layout.LayoutFactory;
 
 /**
  * A frame layout holds a source URI. The URI can be changed dynamically through
@@ -27,6 +28,28 @@
 public class FrameLayout extends AbstractLayout {
 
     protected String source;
+
+    /**
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CopletLayout(String, String)} instead.
+     */
+    public FrameLayout() {
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        super(null, null);
+        throw new IllegalArgumentException("Only instantiate a frame layout with the id/String constructor.");
+    }
+
+    /**
+     * Create a new frame layout object.
+     * Never create a layout object directly. Use the
+     * {@link LayoutFactory} instead.
+     * @param id The unique identifier of the layout object or null.
+     * @param id The name of the layout.
+     */
+    public FrameLayout(String id, String name) {
+        super(id, name);
+    }
 
     /**
      * @return String

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java Fri Oct 28 12:19:23 2005
@@ -17,6 +17,7 @@
 
 import org.apache.cocoon.portal.layout.AbstractLayout;
 import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.layout.LayoutFactory;
 
 /**
  * A link layout references another layout to be used instead. The reference
@@ -28,6 +29,28 @@
 
     protected String linkedLayoutKey;
     protected String linkedLayoutId;
+
+    /**
+     * DO NOT USE THIS CONSTRUCTOR - it's just here to keep Castor happy.
+     * Use {@link #CopletLayout(String, String)} instead.
+     */
+    public LinkLayout() {
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        super(null, null);
+        throw new IllegalArgumentException("Only instantiate a link layout with the id/string constructor.");
+    }
+
+    /**
+     * Create a new link layout object.
+     * Never create a layout object directly. Use the
+     * {@link LayoutFactory} instead.
+     * @param id The unique identifier of the layout object or null.
+     * @param id The name of the layout.
+     */
+    public LinkLayout(String id, String name) {
+        super(id, name);
+    }
 
     public void setLayoutId(String layoutId) {
         this.linkedLayoutId = layoutId;

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/layout.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/layout.xml?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/layout.xml (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/layout.xml Fri Oct 28 12:19:23 2005
@@ -32,16 +32,12 @@
   </class>
 
   <class name="org.apache.cocoon.portal.layout.AbstractLayout"
-    extends="org.apache.cocoon.portal.layout.AbstractParameters">
-    <field name="name" type="java.lang.String">
-      <bind-xml name="name" node="attribute"/>
-    </field>
-    <field name="id" type="java.lang.String">
-      <bind-xml name="id" node="attribute"/>
-    </field>
+         extends="org.apache.cocoon.portal.layout.AbstractParameters">
+
     <field name="layoutRendererName" type="java.lang.String">
       <bind-xml name="layout-renderer-name" node="attribute"/>
     </field>
+
     <field name="parameters" type="org.apache.cocoon.portal.pluto.om.common.ParameterImpl" collection="set"
       get-method="getCastorParameters" set-method="addParameter">
       <bind-xml name="parameter" node="element"/>
@@ -49,8 +45,17 @@
   </class>
 
   <class name="org.apache.cocoon.portal.layout.impl.LinkLayout"
-    extends="org.apache.cocoon.portal.layout.AbstractLayout">
+         extends="org.apache.cocoon.portal.layout.AbstractLayout">
     <map-to xml="link-layout"/>
+
+    <field name="id" type="java.lang.String" set-method="%1" get-method="getId">
+      <bind-xml name="id" node="attribute" />
+    </field>
+
+    <field name="name" type="java.lang.String" set-method="%2" get-method="getName">
+      <bind-xml name="name" node="attribute"/>
+    </field>
+
     <field name="layoutKey" type="java.lang.String">
       <bind-xml name="layout-key" node="attribute"/>
     </field>
@@ -60,24 +65,58 @@
   </class>
 
   <class name="org.apache.cocoon.portal.layout.impl.CompositeLayoutImpl"
-    extends="org.apache.cocoon.portal.layout.AbstractLayout">
+         extends="org.apache.cocoon.portal.layout.AbstractLayout">
     <map-to xml="composite-layout"/>
+
+    <field name="id" type="java.lang.String" set-method="%1" get-method="getId">
+      <bind-xml name="id" node="attribute" />
+    </field>
+
+    <field name="name" type="java.lang.String" set-method="%2" get-method="getName">
+      <bind-xml name="name" node="attribute"/>
+    </field>
+
     <field name="items" type="org.apache.cocoon.portal.layout.Item"
-      collection="collection"
-      set-method="addItem"
-      get-method="getItems">
+           collection="collection" set-method="addItem" get-method="getItems">
       <bind-xml auto-naming="deriveByClass"/>
     </field>
   </class>
 
+  <class name="org.apache.cocoon.portal.layout.impl.CopletLayout"
+         auto-complete="false"
+         extends="org.apache.cocoon.portal.layout.AbstractLayout">
+    <map-to xml="coplet-layout"/>
+
+    <field name="id" type="java.lang.String" set-method="%1" get-method="getId">
+      <bind-xml name="id" node="attribute" />
+    </field>
+
+    <field name="name" type="java.lang.String" set-method="%2" get-method="getName">
+      <bind-xml name="name" node="attribute"/>
+    </field>
+
+    <field name="copletInstanceData">
+      <bind-xml name="coplet-instance-data" reference="true"/>
+    </field>
+  </class>
+
   <class name="org.apache.cocoon.portal.layout.impl.FrameLayout"
          extends="org.apache.cocoon.portal.layout.AbstractLayout">
     <map-to xml="frame-layout"/>
+
+    <field name="id" type="java.lang.String" set-method="%1" get-method="getId">
+      <bind-xml name="id" node="attribute" />
+    </field>
+
+    <field name="name" type="java.lang.String" set-method="%2" get-method="getName">
+      <bind-xml name="name" node="attribute"/>
+    </field>
+
     <field name="source" type="java.lang.String"/>
   </class>
 
   <class name="org.apache.cocoon.portal.layout.Item"
-    extends="org.apache.cocoon.portal.layout.AbstractParameters">
+         extends="org.apache.cocoon.portal.layout.AbstractParameters">
     <field name="layout" type="org.apache.cocoon.portal.layout.Layout">
       <bind-xml auto-naming="deriveByClass"/>
     </field>
@@ -108,16 +147,6 @@
 
     <field name="value">
       <bind-xml name="value"/>
-    </field>
-  </class>
-
-  <class name="org.apache.cocoon.portal.layout.impl.CopletLayout"
-         auto-complete="false"
-         extends="org.apache.cocoon.portal.layout.AbstractLayout">
-    <map-to xml="coplet-layout"/>
-
-    <field name="copletInstanceData">
-      <bind-xml name="coplet-instance-data" reference="true"/>
     </field>
   </class>
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletContainerEnvironmentImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletContainerEnvironmentImpl.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletContainerEnvironmentImpl.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletContainerEnvironmentImpl.java Fri Oct 28 12:19:23 2005
@@ -33,7 +33,7 @@
 import org.apache.cocoon.portal.pluto.service.log.LogServiceImpl;
 import org.apache.cocoon.portal.pluto.services.PropertyManagerServiceImpl;
 import org.apache.cocoon.portal.pluto.services.factory.FactoryManagerServiceImpl;
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.pluto.services.ContainerService;
 import org.apache.pluto.services.PortletContainerEnvironment;
 import org.apache.pluto.services.factory.FactoryManagerService;
@@ -137,7 +137,7 @@
                     service = (ContainerService)this.manager.lookup(key);
                     this.services.put(key, service);
                 } catch (ServiceException se) {
-                    throw new PortalException("Unable to lookup service " + key, se);
+                    throw new PortalRuntimeException("Unable to lookup service " + key, se);
                 }
             }
         }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java Fri Oct 28 12:19:23 2005
@@ -28,7 +28,7 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.portal.LinkService;
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.event.CopletInstanceEvent;
@@ -85,7 +85,7 @@
             service = (PortalService) manager.lookup(PortalService.ROLE);
             this.linkService = service.getComponentManager().getLinkService();
         } catch (ServiceException se) {
-            throw new PortalException("Unable to lookup portal service.", se);
+            throw new PortalRuntimeException("Unable to lookup portal service.", se);
         } finally {
             manager.release(service);
         }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileException.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileException.java?rev=329272&r1=329271&r2=329272&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileException.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileException.java Fri Oct 28 12:19:23 2005
@@ -15,13 +15,13 @@
  */
 package org.apache.cocoon.portal.profile;
 
-import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalRuntimeException;
 
 /**
  *
  * @version $Id$
  */
-public class ProfileException extends PortalException {
+public class ProfileException extends PortalRuntimeException {
     public ProfileException() {
         super();
     }



Mime
View raw message