cziegeler    2003/05/22 05:32:48

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/layout/impl
                        DefaultLayoutFactory.java
               src/blocks/portal/java/org/apache/cocoon/portal/coplet/status
                        SizingStatus.java
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        SizingAspect.java AbstractAspect.java
                        RemovableAspect.java FrameAspect.java
               src/blocks/portal/java/org/apache/cocoon/portal/coplet
                        CopletData.java
               src/blocks/portal/java/org/apache/cocoon/portal/profile
                        ProfileManager.java
               src/blocks/portal/samples/profiles/mapping copletdata.xml
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl
                        AbstractRenderer.java
               src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl
                        AbstractAspectalizableDescription.java
                        DefaultAspectDescription.java AspectUtil.java
               src/blocks/portal/conf portal.xconf
               src/blocks/portal/java/org/apache/cocoon/portal/aspect
                        AspectDescription.java
               src/blocks/portal/samples/profiles/copletinstancedata
                        portal.xml
               src/blocks/portal/samples/profiles/copletdata portal.xml
               src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl
                        FrameEventAspect.java SizingEventSubscriber.java
               src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
                        SimpleProfileManager.java
  Added:       src/blocks/portal/java/org/apache/cocoon/portal/coplet
                        CopletDescription.java CopletFactory.java
               src/blocks/portal/java/org/apache/cocoon/portal/coplet/impl
                        DefaultCopletDescription.java
                        DefaultCopletFactory.java
  Removed:     src/blocks/portal/java/org/apache/cocoon/portal/coplet/status
                        SizeableStatus.java MandatoryStatus.java
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        MaxPageAspect.java MaximizableAspect.java
               src/blocks/portal/java/org/apache/cocoon/portal/layout/aspect
                        CompositeLayoutStatus.java
                        MaximizableLayoutStatus.java
                        StaticLayoutStatus.java FrameStatus.java
               src/blocks/portal/java/org/apache/cocoon/portal/aspect
                        AspectStatus.java
  Log:
  Making coplets aspectalizable and removing currently unused stuff
  
  Revision  Changes    Path
  1.6       +10 -4     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
  
  Index: DefaultLayoutFactory.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultLayoutFactory.java 21 May 2003 13:06:00 -0000      1.5
  +++ DefaultLayoutFactory.java 22 May 2003 12:32:46 -0000      1.6
  @@ -106,8 +106,13 @@
           if ( layoutsConf != null ) {
               for(int i=0; i < layoutsConf.length; i++ ) {
                   DefaultLayoutDescription desc = new 
DefaultLayoutDescription();
  -                // TODO unique name test
  -                desc.setName(layoutsConf[i].getAttribute("name"));
  +                final String name = layoutsConf[i].getAttribute("name");
  +                
  +                // unique test
  +                if ( this.layouts.get(name) != null) {
  +                    throw new ConfigurationException("Layout name must be 
unique. Double definition for " + name);
  +                }
  +                desc.setName(name);
                   desc.setClassName(layoutsConf[i].getAttribute("class"));     
   
                   
desc.setRendererName(layoutsConf[i].getAttribute("renderer")); 
                   
  @@ -120,7 +125,8 @@
                           adesc.setName(aspectsConf[m].getAttribute("name"));
                           
adesc.setPersistence(aspectsConf[m].getAttribute("store"));
                           
adesc.setAutoCreate(aspectsConf[m].getAttributeAsBoolean("auto-create", false));
  -                        desc.addAspect( adesc );
  +                        
adesc.setDefaultValue(aspectsConf[m].getAttribute("value", null));
  +                        desc.addAspectDescription( adesc );
                       }
                   }
                   DefaultAspectDataHandler handler = new 
DefaultAspectDataHandler(desc, this.storeSelector);
  
  
  
  1.2       +2 -4      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java
  
  Index: SizingStatus.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/status/SizingStatus.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SizingStatus.java 7 May 2003 06:22:27 -0000       1.1
  +++ SizingStatus.java 22 May 2003 12:32:46 -0000      1.2
  @@ -50,8 +50,6 @@
   */
   package org.apache.cocoon.portal.coplet.status;
   
  -import org.apache.cocoon.portal.aspect.AspectStatus;
  -
   /**
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  @@ -59,7 +57,7 @@
    * 
    * @version CVS $Id$
    */
  -public final class SizingStatus implements AspectStatus {
  +public final class SizingStatus {
   
       public final static int STATUS_MINIMIZED = 0;
       public final static int STATUS_MAXIMIZED = 1;
  
  
  
  1.3       +9 -11     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java
  
  Index: SizingAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SizingAspect.java 20 May 2003 14:32:36 -0000      1.2
  +++ SizingAspect.java 22 May 2003 12:32:46 -0000      1.3
  @@ -52,13 +52,11 @@
   
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  -import org.apache.cocoon.portal.coplet.status.SizeableStatus;
   import org.apache.cocoon.portal.coplet.status.SizingStatus;
   import org.apache.cocoon.portal.event.impl.SizingStatusEvent;
   import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.layout.impl.CopletLayout;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.cocoon.xml.XMLUtils;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
  @@ -83,20 +81,20 @@
           
           CopletInstanceData cid = 
((CopletLayout)layout).getCopletInstanceData();
   
  -        SizeableStatus sizeable = (SizeableStatus) 
this.getStatus(SizeableStatus.class, ProfileManager.SESSION_STATUS, 
cid.getCopletData().getId());
  -        if ( sizeable != null ) {
  -            SizingStatus sizingstatus = 
(SizingStatus)this.getStatus(SizingStatus.class, ProfileManager.SESSION_STATUS, 
cid.getId());
  -            int status = (sizingstatus == null ? 
SizingStatus.STATUS_MAXIMIZED : sizingstatus.getStatus());
  +        Boolean sizable = 
(Boolean)cid.getCopletData().getAspectData("sizable");
  +        if ( sizable.booleanValue() ) {
  +            SizingStatus size = (SizingStatus)cid.getAspectData("size");
  +            int status = (size == null ? SizingStatus.STATUS_MAXIMIZED : 
size.getStatus());
   
               SizingStatusEvent event;    
   
  -            if (sizeable.isMinimizable() && status != 
SizingStatus.STATUS_MINIMIZED) {
  -                event = new SizingStatusEvent(cid, 
SizingStatus.STATUS_MINIMIZED, sizingstatus);
  +            if ( status != SizingStatus.STATUS_MINIMIZED) {
  +                event = new SizingStatusEvent(cid, 
SizingStatus.STATUS_MINIMIZED, size);
                   XMLUtils.createElement(handler, "minimize-uri", 
service.getLinkService().getLinkURI(event));
               }
   
  -            if (sizeable.isMaximizable() && status != 
SizingStatus.STATUS_MAXIMIZED) {
  -                event = new SizingStatusEvent(cid, 
SizingStatus.STATUS_MAXIMIZED, sizingstatus);
  +            if ( status != SizingStatus.STATUS_MAXIMIZED) {
  +                event = new SizingStatusEvent(cid, 
SizingStatus.STATUS_MAXIMIZED, size);
                   XMLUtils.createElement(handler, "maximize-uri", 
service.getLinkService().getLinkURI(event));
               }
               if (status != SizingStatus.STATUS_MINIMIZED) {
  
  
  
  1.2       +1 -19     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractAspect.java
  
  Index: AbstractAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractAspect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractAspect.java       7 May 2003 06:22:22 -0000       1.1
  +++ AbstractAspect.java       22 May 2003 12:32:46 -0000      1.2
  @@ -55,9 +55,7 @@
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.thread.ThreadSafe;
  -import org.apache.cocoon.portal.aspect.AspectStatus;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
    *
  @@ -79,20 +77,4 @@
           this.manager = componentManager;
       }
   
  -    /**
  -     * Get the layout status
  -     */
  -    protected AspectStatus getStatus(Class type, String mode, String key) {
  -        ProfileManager profileManager = null;
  -        try {
  -            profileManager = (ProfileManager) 
this.manager.lookup(ProfileManager.ROLE);
  -            return profileManager.getAspectStatus(type, mode, key);
  -        } catch (ComponentException ce) {
  -            // ignore
  -        } finally {
  -            this.manager.release(profileManager);
  -        }
  -        return null;
  -    }
  -    
   }
  
  
  
  1.2       +3 -8      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/RemovableAspect.java
  
  Index: RemovableAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/RemovableAspect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RemovableAspect.java      21 May 2003 13:06:04 -0000      1.1
  +++ RemovableAspect.java      22 May 2003 12:32:46 -0000      1.2
  @@ -52,12 +52,10 @@
   
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  -import org.apache.cocoon.portal.coplet.status.MandatoryStatus;
   import org.apache.cocoon.portal.event.impl.LayoutRemoveEvent;
   import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.layout.impl.CopletLayout;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.cocoon.xml.XMLUtils;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
  @@ -82,11 +80,8 @@
           
           CopletInstanceData cid = 
((CopletLayout)layout).getCopletInstanceData();
   
  -        if (cid.getCopletData().isRemovable()) {
  -        } 
  -
  -        MandatoryStatus mandatory = (MandatoryStatus) 
this.getStatus(MandatoryStatus.class, ProfileManager.SESSION_STATUS, 
cid.getCopletData().getId());
  -        if ( mandatory == null || !mandatory.isMandatory()) {
  +        Boolean mandatory = 
(Boolean)cid.getCopletData().getAspectData("mandatory");
  +        if ( !mandatory.booleanValue() ) {
               LayoutRemoveEvent lre = new LayoutRemoveEvent(layout, 0);
               XMLUtils.createElement(handler, "remove-uri", 
service.getLinkService().getLinkURI(lre));
           }
  
  
  
  1.4       +3 -6      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java
  
  Index: FrameAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FrameAspect.java  8 May 2003 13:38:11 -0000       1.3
  +++ FrameAspect.java  22 May 2003 12:32:46 -0000      1.4
  @@ -52,10 +52,8 @@
   
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.Layout;
  -import org.apache.cocoon.portal.layout.aspect.FrameStatus;
   import org.apache.cocoon.portal.layout.impl.FrameLayout;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -75,9 +73,8 @@
               throw new SAXException("Wrong layout type, FrameLayout expected: 
" + layout.getClass().getName());
           }
   
  -        FrameStatus status =
  -            (FrameStatus) this.getStatus(FrameStatus.class, 
ProfileManager.REQUEST_STATUS, layout.getId());
  -        String source = (status == null ? null : status.getLink());
  +        String status = (String)layout.getAspectData("frame");
  +        String source = (status == null ? null : status);
           if (source == null) {
               source = ((FrameLayout) layout).getSource();
           }
  
  
  
  1.5       +3 -45     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletData.java
  
  Index: CopletData.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletData.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CopletData.java   21 May 2003 13:06:01 -0000      1.4
  +++ CopletData.java   22 May 2003 12:32:47 -0000      1.5
  @@ -54,6 +54,7 @@
   import java.util.Iterator;
   import java.util.Map;
   
  +import org.apache.cocoon.portal.factory.impl.AbstractProducible;
   import org.apache.cocoon.portal.util.DeltaApplicable;
   
   /**
  @@ -65,16 +66,13 @@
    * @version CVS $Id$
    */
   public class CopletData 
  +extends AbstractProducible
   implements DeltaApplicable {
   
  -    protected String id;
  -
       protected String title;
   
       protected Boolean maxpageable;
       
  -    protected Boolean removable;
  -
       protected CopletBaseData copletBaseData;
   
       protected Map attributes = new HashMap();
  @@ -85,14 +83,6 @@
       public CopletData() {
       }
   
  -    public String getId() {
  -        return id;
  -    }
  -
  -    public void setId(String name) {
  -        this.id = name;
  -    }
  -
       /**
         * Returns the maxpageable as boolean. If it has not been set "true" is 
returned.
         * @return boolean
  @@ -105,18 +95,6 @@
        }
       }
   
  -    /**
  -     * Returns the removable as boolean. If it has not been set "true" is 
returned.
  -     * @return boolean
  -     */
  -    public boolean isRemovable() {
  -             if (this.removable == null) {
  -                     return true;
  -             } else {
  -                     return this.removable.booleanValue();
  -             }
  -    }
  -
        /**
          * Returns the maxpageable as Boolean.
          * @return boolean
  @@ -125,14 +103,6 @@
                return this.maxpageable;
        }
   
  -     /**
  -      * Returns the removable as Boolean.
  -      * @return boolean
  -      */
  -     public Boolean getRemovable() {
  -             return this.removable;
  -     }
  -
       /**
        * Sets the maxpageable.
        * @param maxpageable The maxpageable to set
  @@ -142,14 +112,6 @@
       }
   
       /**
  -     * Sets the removable.
  -     * @param removable The removable to set
  -     */
  -    public void setRemovable(boolean removable) {
  -        this.removable = new Boolean(removable);
  -    }
  -
  -    /**
        * Returns the title.
        * @return String
        */
  @@ -204,10 +166,6 @@
                if (maxpageable != null)
                        this.maxpageable = maxpageable;
                
  -             Boolean removable = data.removable;
  -             if (removable != null)
  -                     this.removable = removable;
  -
                String title = data.getTitle();
                if (title != null)
                        this.setTitle(title);
  
  
  
  1.1                  
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletDescription.java
  
  Index: CopletDescription.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
   */
  package org.apache.cocoon.portal.coplet;
  
  import org.apache.cocoon.portal.factory.ProducibleDescription;
  
  
  
  /**
   * A configured layout
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: CopletDescription.java,v 1.1 2003/05/22 12:32:47 
cziegeler Exp $
   */
  public interface CopletDescription
      extends ProducibleDescription  {
  
  }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletFactory.java
  
  Index: CopletFactory.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.portal.coplet;
  
  import org.apache.cocoon.ProcessingException;
  
  /**
   * This factory is for creating and managing coplet objects
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: CopletFactory.java,v 1.1 2003/05/22 12:32:47 cziegeler 
Exp $
   */
  public interface CopletFactory  {
      
      String ROLE = CopletFactory.class.getName();
      
        // TODO - define the interface
      void prepare(CopletData copletData)
      throws ProcessingException;
      
      void prepare(CopletInstanceData copletInstanceData)
      throws ProcessingException;
      
      CopletInstanceData newInstance(String name)
      throws ProcessingException;
      
  }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletDescription.java
  
  Index: DefaultCopletDescription.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
   */
  package org.apache.cocoon.portal.coplet.impl;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  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
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: DefaultCopletDescription.java,v 1.1 2003/05/22 12:32:47 
cziegeler Exp $
   */
  public class DefaultCopletDescription
      extends AbstractProducibleDescription  {
  
      protected List instanceAspects = new ArrayList();
  
      /**
       * @return
       */
      public List getInstanceAspectDescriptions() {
          return this.instanceAspects;
      }
  
      public void addInstanceAspectDescription(AspectDescription aspect) {
          this.instanceAspects.add(aspect);
      }
  
      /**
       * Return the description for an aspect
       */
      public AspectDescription getInstanceAspectDescription(String name) {
          AspectDescription desc = null;
          Iterator i = this.instanceAspects.iterator();
          while (desc == null && i.hasNext() ) {
              AspectDescription current = (AspectDescription)i.next();
              if ( name.equals(current.getName())) {
                  desc = current;
              }
          }
          return desc;
      }
  
  }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
  
  Index: DefaultCopletFactory.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.portal.coplet.impl;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentSelector;
  import org.apache.avalon.framework.component.Composable;
  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.thread.ThreadSafe;
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.portal.aspect.AspectDataHandler;
  import org.apache.cocoon.portal.aspect.AspectDataStore;
  import org.apache.cocoon.portal.aspect.impl.DefaultAspectDataHandler;
  import org.apache.cocoon.portal.aspect.impl.DefaultAspectDescription;
  import org.apache.cocoon.portal.coplet.CopletData;
  import org.apache.cocoon.portal.coplet.CopletFactory;
  import org.apache.cocoon.portal.coplet.CopletInstanceData;
  
  /**
   * This factory is for creating and managing coplet objects
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: DefaultCopletFactory.java,v 1.1 2003/05/22 12:32:47 
cziegeler Exp $
   */
  public class DefaultCopletFactory  
      extends AbstractLogEnabled 
      implements Component, ThreadSafe, CopletFactory, Composable, Disposable, 
Configurable {
      
      protected ComponentManager manager;
      
      protected Map coplets = new HashMap();
      
      protected List descriptions = new ArrayList();
      
      protected ComponentSelector storeSelector;
  
      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.");
              }
              DefaultCopletDescription copletDescription = 
(DefaultCopletDescription)o[0];
  
              copletData.setDescription( copletDescription );
              copletData.setAspectDataHandler((AspectDataHandler)o[1]);
              
          }
      }
      
      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[2]);
              
          }
      }
  
      
      public CopletInstanceData newInstance(String name)
      throws ProcessingException {
          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();
          
          // TODO - create unique id
          String id = name + '-' + System.currentTimeMillis();
          instance.initialize( name, id );
          instance.setDescription( copletDescription );
          instance.setAspectDataHandler((AspectDataHandler)o[2]);
  
          return instance;
      }
      
      /* (non-Javadoc)
       * @see 
org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager)
       */
      public void compose(ComponentManager manager) 
      throws ComponentException {
          this.manager = manager;
          this.storeSelector = (ComponentSelector)this.manager.lookup( 
AspectDataStore.ROLE+"Selector" );
      }
  
      /* (non-Javadoc)
       * @see org.apache.avalon.framework.activity.Disposable#dispose()
       */
      public void dispose() {
          if ( this.manager != null ) {
              this.manager.release( this.storeSelector );
              this.storeSelector = null;
              this.manager = null;
          }
      }
  
      /* (non-Javadoc)
       * @see 
org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
       */
      public void configure(Configuration configuration) 
      throws ConfigurationException {
          final Configuration[] copletsConf = 
configuration.getChild("coplets").getChildren("coplet");
          if ( copletsConf != null ) {
              for(int i=0; i < copletsConf.length; i++ ) {
                  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);
                  }
                  desc.setName(copletsConf[i].getAttribute("name"));
                  instanceDesc.setName(copletsConf[i].getAttribute("name"));
                  
                  // and now the aspects
                  Configuration[] aspectsConf = 
copletsConf[i].getChild("coplet-data-aspects").getChildren("aspect");
                  if (aspectsConf != null) {
                      for(int m=0; m < aspectsConf.length; m++) {
                          DefaultAspectDescription adesc = new 
DefaultAspectDescription();
                          
adesc.setClassName(aspectsConf[m].getAttribute("class"));
                          adesc.setName(aspectsConf[m].getAttribute("name"));
                          
adesc.setPersistence(aspectsConf[m].getAttribute("store"));
                          
adesc.setAutoCreate(aspectsConf[m].getAttributeAsBoolean("auto-create", false));
                          
adesc.setDefaultValue(aspectsConf[m].getAttribute("value", null));
                          desc.addAspectDescription( adesc );
                      }
                  }
  
                  // and now the aspects of the instances
                  aspectsConf = 
copletsConf[i].getChild("coplet-instance-data-aspects").getChildren("aspect");
                  if (aspectsConf != null) {
                      for(int m=0; m < aspectsConf.length; m++) {
                          DefaultAspectDescription adesc = new 
DefaultAspectDescription();
                          
adesc.setClassName(aspectsConf[m].getAttribute("class"));
                          adesc.setName(aspectsConf[m].getAttribute("name"));
                          
adesc.setPersistence(aspectsConf[m].getAttribute("store"));
                          
adesc.setAutoCreate(aspectsConf[m].getAttributeAsBoolean("auto-create", false));
                          
adesc.setDefaultValue(aspectsConf[m].getAttribute("value", null));
                          desc.addInstanceAspectDescription( adesc );
                          instanceDesc.addAspectDescription( adesc );
                      }
                  }
  
                  DefaultAspectDataHandler handler = new 
DefaultAspectDataHandler(desc, this.storeSelector);
                  DefaultAspectDataHandler instanceHandler = new 
DefaultAspectDataHandler(instanceDesc, this.storeSelector);
                  this.coplets.put(desc.getName(), new Object[] {desc, handler, 
instanceHandler});
                  this.descriptions.add(desc);
              }
          }
      }
  
  }
  
  
  
  1.2       +1 -12     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
  
  Index: ProfileManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileManager.java       7 May 2003 06:22:28 -0000       1.1
  +++ ProfileManager.java       22 May 2003 12:32:47 -0000      1.2
  @@ -51,7 +51,6 @@
   package org.apache.cocoon.portal.profile;
   
   import org.apache.avalon.framework.component.Component;
  -import org.apache.cocoon.portal.aspect.AspectStatus;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
   import org.apache.cocoon.portal.layout.Layout;
   
  @@ -66,20 +65,10 @@
       
       String ROLE = ProfileManager.class.getName();
       
  -    String REQUEST_STATUS = "request.status";
  -    
  -    String SESSION_STATUS = "session.status";
  -    
  -    String PERSISTENT_SESSION_STATUS = "session.status.persistent";
  -    
       Layout getPortalLayout(String key);
       
       void setDefaultLayout(Layout object);
       
       CopletInstanceData getCopletInstanceData(String copletID);
       
  -    AspectStatus getAspectStatus(Class statusClass, String mode, String key);
  -    
  -    // FIXME - rename this
  -    void setAspectStatus(String mode, String key, AspectStatus status);
   }
  
  
  
  1.4       +15 -9     
cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletdata.xml
  
  Index: copletdata.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletdata.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- copletdata.xml    21 May 2003 13:06:00 -0000      1.3
  +++ copletdata.xml    22 May 2003 12:32:47 -0000      1.4
  @@ -2,6 +2,19 @@
   <mapping>
        <description>Coplet data mapping file</description>
   
  +     <class 
name="org.apache.cocoon.portal.aspect.impl.AbstractAspectalizable">
  +    </class>
  +
  +     <class name="org.apache.cocoon.portal.factory.impl.AbstractProducible"
  +            
extends="org.apache.cocoon.portal.aspect.impl.AbstractAspectalizable">
  +        <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>
  +    </class>
  +
        <class name="org.apache.cocoon.portal.profile.impl.CopletDataManager">
                <map-to xml="coplets" />
   
  @@ -10,23 +23,16 @@
                </field>
        </class>
   
  -     <class name="org.apache.cocoon.portal.coplet.CopletData">
  +     <class name="org.apache.cocoon.portal.coplet.CopletData"
  +            
extends="org.apache.cocoon.portal.factory.impl.AbstractProducible">
                <map-to xml="coplet-data" />
   
  -             <field name="id" type="java.lang.String">
  -                     <bind-xml name="id" node="attribute" />
  -             </field>
  -
                <field name="title" type="java.lang.String">
                        <bind-xml name="title"/>
                </field>
   
                <field name="maxpageable" type="java.lang.Boolean">
                        <bind-xml name="maxpageable" />
  -             </field>
  -
  -             <field name="removable" type="java.lang.Boolean">
  -                     <bind-xml name="removable" />
                </field>
   
                <field name="attributes" 
type="org.exolab.castor.mapping.MapItem" collection="map" 
handler="org.apache.cocoon.portal.profile.impl.AttributesFieldHandler">
  
  
  
  1.2       +2 -20     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl/AbstractRenderer.java
  
  Index: AbstractRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl/AbstractRenderer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractRenderer.java     7 May 2003 06:22:22 -0000       1.1
  +++ AbstractRenderer.java     22 May 2003 12:32:47 -0000      1.2
  @@ -62,10 +62,8 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.cocoon.portal.aspect.AspectStatus;
   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.cocoon.xml.IncludeXMLConsumer;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
  @@ -176,23 +174,7 @@
           }
           return this.rendererSelector;
       }
  -    
  -    /**
  -     * Get the layout status
  -     */
  -    protected AspectStatus getLayoutStatus(Layout layout) {
  -        ProfileManager profileManager = null;
  -        try {
  -            profileManager = (ProfileManager) 
this.componentManager.lookup(ProfileManager.ROLE);
  -            return profileManager.getAspectStatus(null, null, 
layout.getId());
  -        } catch (ComponentException ce) {
  -            // ignore
  -        } finally {
  -            this.componentManager.release(profileManager);
  -        }
  -        return null;
  -    }
  -    
  +        
       protected abstract void process(Layout layout, PortalService service, 
ContentHandler handler) throws SAXException;
       
   }
  
  
  
  1.3       +2 -2      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AbstractAspectalizableDescription.java
  
  Index: AbstractAspectalizableDescription.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AbstractAspectalizableDescription.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractAspectalizableDescription.java    21 May 2003 13:06:02 -0000      
1.2
  +++ AbstractAspectalizableDescription.java    22 May 2003 12:32:47 -0000      
1.3
  @@ -77,7 +77,7 @@
           return this.aspects;
       }
   
  -    public void addAspect(AspectDescription aspect) {
  +    public void addAspectDescription(AspectDescription aspect) {
           this.aspects.add(aspect);
       }
       
  
  
  
  1.2       +13 -1     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/DefaultAspectDescription.java
  
  Index: DefaultAspectDescription.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/DefaultAspectDescription.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultAspectDescription.java     20 May 2003 14:06:43 -0000      1.1
  +++ DefaultAspectDescription.java     22 May 2003 12:32:47 -0000      1.2
  @@ -72,6 +72,8 @@
   
       protected boolean autoCreate;
       
  +    protected String defaultValue;
  +    
       /**
        * @return
        */
  @@ -128,4 +130,14 @@
           autoCreate = b;
       }
   
  +    /**
  +     * Default value
  +     */
  +    public String getDefaultValue() {
  +        return this.defaultValue;
  +    }
  +
  +    public void setDefaultValue(String value) {
  +        this.defaultValue = value;
  +    }
   }
  
  
  
  1.2       +7 -2      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AspectUtil.java
  
  Index: AspectUtil.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AspectUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AspectUtil.java   20 May 2003 14:06:43 -0000      1.1
  +++ AspectUtil.java   22 May 2003 12:32:47 -0000      1.2
  @@ -75,8 +75,13 @@
               Class clazz = ClassUtils.loadClass(desc.getClassName());
               if ( clazz.getName().startsWith("java.lang.")) {
                   Constructor constructor = clazz.getConstructor(new Class[] 
{String.class});
  -                return constructor.newInstance(new String[] {"0"});
  +                String value = (desc.getDefaultValue() == null ? "0" : 
desc.getDefaultValue());
  +                return constructor.newInstance(new String[] {value});
               } else {
  +                if ( desc.getDefaultValue() != null ) {
  +                    Constructor constructor = clazz.getConstructor(new 
Class[] {String.class});
  +                    return constructor.newInstance(new String[] 
{desc.getDefaultValue()});
  +                }
                   return clazz.newInstance();
               }
           } catch (Exception ignore) {
  
  
  
  1.8       +15 -0     cocoon-2.1/src/blocks/portal/conf/portal.xconf
  
  Index: portal.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/conf/portal.xconf,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- portal.xconf      22 May 2003 10:46:34 -0000      1.7
  +++ portal.xconf      22 May 2003 12:32:47 -0000      1.8
  @@ -171,8 +171,23 @@
           <coplet name="standard"
                   class="org.apache.cocoon.portal.coplet.CopletData">
               <coplet-data-aspects>
  +                <aspect name="sizable"
  +                        class="java.lang.Boolean"
  +                        store="persistent"
  +                        auto-create="true"
  +                        value="true"/>
  +                <aspect name="mandatory"
  +                        class="java.lang.Boolean"
  +                        store="persistent"
  +                        auto-create="true"
  +                        value="false"/>
               </coplet-data-aspects>
  +            
               <coplet-instance-data-aspects>
  +                <aspect name="size"
  +                        class="org.apache.cocoon.portal.aspect.AspectStatus"
  +                        store="session"
  +                        auto-create="true"/>
               </coplet-instance-data-aspects>
           </coplet>
       </coplets>
  
  
  
  1.3       +6 -1      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDescription.java
  
  Index: AspectDescription.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDescription.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AspectDescription.java    21 May 2003 13:06:05 -0000      1.2
  +++ AspectDescription.java    22 May 2003 12:32:47 -0000      1.3
  @@ -79,5 +79,10 @@
        * If the data is not available, create it automatically (or not)
        */
       boolean isAutoCreate();
  +    
  +    /**
  +     * Default value
  +     */
  +    String getDefaultValue();
   
   }
  
  
  
  1.2       +12 -12    
cocoon-2.1/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml
  
  Index: portal.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- portal.xml        19 May 2003 09:14:11 -0000      1.1
  +++ portal.xml        22 May 2003 12:32:47 -0000      1.2
  @@ -1,61 +1,61 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <coplets>
  -   <coplet-instance-data id="Newsweek-1">
  +   <coplet-instance-data id="Newsweek-1" name="standard">
         <coplet-data>Newsweek</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="NYTBusiness-1">
  +   <coplet-instance-data id="NYTBusiness-1" name="standard">
         <coplet-data>NYTBusiness</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="BBCNews-1">
  +   <coplet-instance-data id="BBCNews-1" name="standard">
         <coplet-data>BBCNews</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="CNET News-1">
  +   <coplet-instance-data id="CNET News-1" name="standard">
         <coplet-data>CNET News</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="CNET Business-1">
  +   <coplet-instance-data id="CNET Business-1" name="standard">
         <coplet-data>CNET Business</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="CSTNews-1">
  +   <coplet-instance-data id="CSTNews-1" name="standard">
         <coplet-data>CSTNews</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="CNNEurope-1">
  +   <coplet-instance-data id="CNNEurope-1" name="standard">
         <coplet-data>CNNEurope</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="ML Weblog-1">
  +   <coplet-instance-data id="ML Weblog-1" name="standard">
         <coplet-data>ML Weblog</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="CZ Weblog-1">
  +   <coplet-instance-data id="CZ Weblog-1" name="standard">
         <coplet-data>CZ Weblog</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="Weblog-1">
  +   <coplet-instance-data id="Weblog-1" name="standard">
         <coplet-data>Weblog</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="Introduction-1">
  +   <coplet-instance-data id="Introduction-1" name="standard">
         <coplet-data>Introduction</coplet-data>
         <status>1</status>
      </coplet-instance-data>
   
  -   <coplet-instance-data id="Overview-1">
  +   <coplet-instance-data id="Overview-1" name="standard">
         <coplet-data>Overview</coplet-data>
         <status>1</status>
      </coplet-instance-data>
  
  
  
  1.3       +12 -24    
cocoon-2.1/src/blocks/portal/samples/profiles/copletdata/portal.xml
  
  Index: portal.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/copletdata/portal.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- portal.xml        20 May 2003 14:32:37 -0000      1.2
  +++ portal.xml        22 May 2003 12:32:48 -0000      1.3
  @@ -1,9 +1,8 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <coplets>
  -   <coplet-data id="Newsweek">
  +   <coplet-data id="Newsweek" name="standard">
         <title>Newsweek</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -11,10 +10,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="NYTBusiness">
  +   <coplet-data id="NYTBusiness" name="standard">
         <title>NYT Business</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -22,10 +20,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="BBCNews">
  +   <coplet-data id="BBCNews" name="standard">
         <title>BBC News</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -33,10 +30,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="CNET News">
  +   <coplet-data id="CNET News" name="standard">
         <title>CNET News</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -44,10 +40,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="CNET Business">
  +   <coplet-data id="CNET Business" name="standard">
         <title>CNET Business News</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -55,10 +50,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="CSTNews">
  +   <coplet-data id="CSTNews" name="standard">
         <title>Chicago Sunday Times</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -66,10 +60,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="CNNEurope">
  +   <coplet-data id="CNNEurope" name="standard">
         <title>CNN Europe</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -77,10 +70,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="ML Weblog">
  +   <coplet-data id="ML Weblog" name="standard">
         <title>ML's Weblog</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -88,10 +80,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="CZ Weblog">
  +   <coplet-data id="CZ Weblog" name="standard">
         <title>CZ's Weblog</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -99,10 +90,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="Weblog">
  +   <coplet-data id="Weblog" name="standard">
         <title>Another Weblog</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -110,10 +100,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="Introduction">
  +   <coplet-data id="Introduction" name="standard">
         <title>Cocoon Introduction</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  @@ -121,10 +110,9 @@
         </attribute>
      </coplet-data>
   
  -   <coplet-data id="Overview">
  +   <coplet-data id="Overview" name="standard">
         <title>Cocoon Overview</title>
         <maxpageable>true</maxpageable>
  -      <removable>true</removable>
         <coplet-base-data>URICoplet</coplet-base-data>
         <attribute>
                <name>uri</name>
  
  
  
  1.3       +8 -15     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FrameEventAspect.java
  
  Index: FrameEventAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FrameEventAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FrameEventAspect.java     8 May 2003 13:38:10 -0000       1.2
  +++ FrameEventAspect.java     22 May 2003 12:32:48 -0000      1.3
  @@ -67,8 +67,8 @@
   import org.apache.cocoon.portal.event.Subscriber;
   import org.apache.cocoon.portal.event.aspect.EventAspect;
   import org.apache.cocoon.portal.event.aspect.EventAspectContext;
  -import org.apache.cocoon.portal.event.impl.*;
  -import org.apache.cocoon.portal.layout.aspect.FrameStatus;
  +import org.apache.cocoon.portal.event.impl.FrameSourceEvent;
  +import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
  @@ -149,23 +149,16 @@
           ProfileManager profileManager = null;
           try {
               profileManager = (ProfileManager) 
this.manager.lookup(ProfileManager.ROLE);
  -            FrameStatus status =
  -                (FrameStatus) profileManager.getAspectStatus(
  -                    FrameStatus.class,
  -                    ProfileManager.REQUEST_STATUS,
  -                    layoutID);
  +            // TODO - does this work?
  +            Layout layout = profileManager.getPortalLayout( layoutID );
  +            String status = (String)layout.getAspectData("frame");
               String link = statusEvent.getLink();
               if (status == null) {
                   if (link != null) {
  -                    status = new FrameStatus();
  -                    status.setLink(link);
  -                    
profileManager.setAspectStatus(ProfileManager.REQUEST_STATUS, layoutID, status);
  +                    layout.setAspectData("frame", link);
                   }
               } else if (link != null) {
  -                status.setLink(link);
  -            } else {
  -                // remove status if link == null
  -                
profileManager.setAspectStatus(ProfileManager.REQUEST_STATUS, layoutID, null);
  +                layout.setAspectData("frame", link);
               }
           } catch (ComponentException ce) {
               // ignore
  
  
  
  1.3       +2 -4      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/SizingEventSubscriber.java
  
  Index: SizingEventSubscriber.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/SizingEventSubscriber.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SizingEventSubscriber.java        20 May 2003 14:32:37 -0000      1.2
  +++ SizingEventSubscriber.java        22 May 2003 12:32:48 -0000      1.3
  @@ -98,9 +98,7 @@
           try {
               profileManager = (ProfileManager) 
this.componentManager.lookup(ProfileManager.ROLE);
               target = new SizingStatus();
  -            profileManager.setAspectStatus(ProfileManager.SESSION_STATUS, 
  -                                           
statusEvent.getCopletInstanceData().getId(), 
  -                                           target);
  +            statusEvent.getCopletInstanceData().setAspectData("size", 
target);
           } catch (ComponentException ce) {
               // ignore
           } finally {
  
  
  
  1.6       +19 -55    
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/SimpleProfileManager.java
  
  Index: SimpleProfileManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/SimpleProfileManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SimpleProfileManager.java 21 May 2003 13:06:04 -0000      1.5
  +++ SimpleProfileManager.java 22 May 2003 12:32:48 -0000      1.6
  @@ -51,6 +51,7 @@
   package org.apache.cocoon.portal.profile.impl;
   
   import java.util.HashMap;
  +import java.util.Iterator;
   import java.util.Map;
   
   import org.apache.avalon.framework.CascadingRuntimeException;
  @@ -62,9 +63,9 @@
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.cocoon.portal.aspect.AspectStatus;
  +import org.apache.cocoon.portal.coplet.CopletData;
  +import org.apache.cocoon.portal.coplet.CopletFactory;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  -import org.apache.cocoon.portal.coplet.status.SizeableStatus;
   import org.apache.cocoon.portal.layout.CompositeLayout;
   import org.apache.cocoon.portal.layout.Item;
   import org.apache.cocoon.portal.layout.Layout;
  @@ -109,10 +110,12 @@
       public Layout getPortalLayout(String key) {
           PortalService service = null;
           LayoutFactory factory = null;
  +        CopletFactory copletFactory = null;
           
           try {
               service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
               factory = (LayoutFactory) 
this.manager.lookup(LayoutFactory.ROLE);
  +            copletFactory = (CopletFactory) 
this.manager.lookup(CopletFactory.ROLE);
               
               if ( null == key ) {
                   Layout l = (Layout) 
service.getTemporaryAttribute("DEFAULT_LAYOUT");
  @@ -153,6 +156,12 @@
                                copletDataManager.update(copletBaseDataManager);
                        }
                        lastLoaded = loaded;
  +            // updating
  +            Iterator i = 
copletDataManager.getCopletData().values().iterator();
  +            while ( i.hasNext()) {
  +                CopletData cd = (CopletData)i.next();
  +                copletFactory.prepare(cd);
  +            }
   
                        // load coplet instance data
                        map.put("profile", "copletinstancedata");
  @@ -164,6 +173,12 @@
                                
copletInstanceDataManager.update(copletDataManager);
                        }
                        lastLoaded = loaded;
  +            // updating
  +            i = 
copletInstanceDataManager.getCopletInstanceData().values().iterator();
  +            while ( i.hasNext()) {
  +                CopletInstanceData cid = (CopletInstanceData)i.next();
  +                copletFactory.prepare(cid);
  +            }
   
                        // load layout
                        map.put("profile", "layout");
  @@ -185,6 +200,7 @@
           } finally {
               this.manager.release(service);
               this.manager.release((Component)factory);
  +            this.manager.release((Component)copletFactory);
           }
       }
       
  @@ -559,60 +575,8 @@
                       throw new ProcessingException("CopletInstanceData " + 
copletLayout.getCopletInstanceData().getId() + " has no coplet data.");
                   }
               }
  -            this.setAspectStatus(ProfileManager.SESSION_STATUS, 
copletLayout.getCopletInstanceData().getCopletData().getId(), new 
SizeableStatus());
           }
           layout.setParent(item);
       }
  -     /* (non-Javadoc)
  -      * @see 
org.apache.cocoon.portal.profile.ProfileManager#getLayoutStatus(java.lang.String)
  -      */
  -     public AspectStatus getAspectStatus(Class type, String mode, String 
key) {
  -        if ( ProfileManager.REQUEST_STATUS.equals( mode )) {
  -            PortalService service = null;
  -            try {
  -                service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  -                return 
(AspectStatus)service.getTemporaryAttribute(type.getName()+"."+key);
  -            } catch (ComponentException ce) {
  -                // ignore
  -                return null;
  -            } finally {
  -                this.manager.release( service );
  -            }
  -        } else {
  -            // FIXME implement session mode
  -            Map stati = (Map) this.layoutStati.get( type.getName() );
  -            return (stati == null ? null : (AspectStatus)stati.get(key));
  -        }
  -     }
  -
  -     /* (non-Javadoc)
  -      * @see 
org.apache.cocoon.portal.profile.ProfileManager#setLayoutStatus(java.lang.String,
 org.apache.cocoon.portal.layout.LayoutStatus)
  -      */
  -     public void setAspectStatus( String mode, String key, AspectStatus 
status) {
  -        if ( ProfileManager.REQUEST_STATUS.equals( mode )) {
  -            PortalService service = null;
  -            try {
  -                service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  -                final String attribute = status.getClass().getName() + "." + 
key;
  -                if (null == status) {
  -                    service.removeTemporaryAttribute(attribute);
  -                } else {
  -                    service.setTemporaryAttribute(attribute, status);
  -                }
  -            } catch (ComponentException ce) {
  -                // ignore
  -            } finally {
  -                this.manager.release( service );
  -            }
  -        } else {
  -            // FIXME implement session mode
  -            Map stati = (Map) this.layoutStati.get( 
status.getClass().getName() );
  -            if ( stati == null ) {
  -                stati = new HashMap(5);
  -                this.layoutStati.put( status.getClass().getName(), stati );
  -            }
  -            stati.put(key, status);
  -        }
  -     }
   
   }
  
  
  

Reply via email to