cziegeler    2003/07/18 07:41:46

  Modified:    src/blocks/portal/conf portal.xconf
               src/blocks/portal/java/org/apache/cocoon/portal/layout/impl
                        DefaultLayoutFactory.java
               src/blocks/portal/java/org/apache/cocoon/portal/source
                        CopletSourceFactory.java
               src/blocks/portal/samples/skins/common/styles window.xsl
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        SizingAspect.java TabContentAspect.java
                        RemovableAspect.java FullScreenCopletAspect.java
                        AbstractCompositeAspect.java
               src/blocks/portal/java/org/apache/cocoon/portal/acting
                        LoginAction.java LogoutAction.java
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl
                        DefaultLinkRenderer.java AbstractRenderer.java
               src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl
                        AbstractContentEventAspect.java
                        ActionCounterEventAspect.java
                        FullScreenCopletEventAspect.java
               src/blocks/portal/java/org/apache/cocoon/portal/profile
                        ProfileManager.java
               src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
                        AbstractProfileManager.java
                        StaticProfileManager.java
                        AbstractUserProfileManager.java
               src/blocks/portal/java/org/apache/cocoon/portal
                        PortalManager.java PortalService.java
               src/blocks/portal/java/org/apache/cocoon/portal/transformation
                        AbstractCopletTransformer.java
               src/blocks/portal/java/org/apache/cocoon/portal/impl
                        PortalManagerImpl.java PortalServiceImpl.java
               src/blocks/portal/samples/skins/basic/styles window.xsl
               
src/blocks/portal/java/org/apache/cocoon/portal/components/modules/input
                        CopletModule.java
               src/blocks/portal/java/org/apache/cocoon/portal/coplet/impl
                        DefaultCopletFactory.java
  Added:       src/blocks/portal/conf portal.samplesxconf
                        authportal.samplesxconf
               src/blocks/portal/java/org/apache/cocoon/portal
                        PortalComponentManager.java
               src/blocks/portal/java/org/apache/cocoon/portal/impl
                        DefaultPortalComponentManager.java
  Log:
  Changing component handling in the portal
  Fixing full-screen coplet bug
  Separating sample configuration from framework configuration
  
  Revision  Changes    Path
  1.20      +6 -135    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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- portal.xconf      10 Jul 2003 13:17:06 -0000      1.19
  +++ portal.xconf      18 Jul 2003 14:41:44 -0000      1.20
  @@ -19,17 +19,19 @@
       </event-aspects>
    </component>
   
  - <component 
class="org.apache.cocoon.portal.profile.impl.AuthenticationProfileManager" 
logger="portal" role="org.apache.cocoon.portal.profile.ProfileManager">
  - </component>
  -
    <component class="org.apache.cocoon.portal.impl.PortalManagerImpl" 
logger="portal" role="org.apache.cocoon.portal.PortalManager"/>
   
  - <component class="org.apache.cocoon.portal.impl.PortalServiceImpl" 
logger="portal" role="org.apache.cocoon.portal.PortalService"/>
  + <component class="org.apache.cocoon.portal.impl.PortalServiceImpl" 
logger="portal" role="org.apache.cocoon.portal.PortalService">
  +   <portals>
  +     <!-- Configure your portals here: -->
  +   </portals>
  + </component>
   
    <component class="org.apache.cocoon.portal.impl.DefaultLinkService" 
logger="portal" role="org.apache.cocoon.portal.LinkService"/>
   
    <component 
class="org.apache.cocoon.portal.event.impl.DefaultEventConverter" 
logger="portal" role="org.apache.cocoon.portal.event.EventConverter">
    </component>
  +
    <!-- Coplet Adapter configuration -->
    <component class="org.apache.cocoon.components.ExtendedComponentSelector" 
role="org.apache.cocoon.portal.coplet.adapter.CopletAdapterSelector">
        <coplet-adapter name="uri" 
class="org.apache.cocoon.portal.coplet.adapter.impl.URICopletAdapter" 
logger="portal"/>
  @@ -61,69 +63,6 @@
       <aspect name="xslt" 
class="org.apache.cocoon.portal.layout.renderer.aspect.impl.XSLTAspect"/>
    </component>
   
  - <!-- Renderer configuration -->
  - <component class="org.apache.cocoon.components.ExtendedComponentSelector" 
role="org.apache.cocoon.portal.layout.renderer.RendererSelector">
  -     <renderer name="column" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
  -         <aspects>
  -             <aspect type="xslt">
  -                 <parameter name="style" 
value="{global:skin}styles/column.xsl"/>
  -             </aspect>
  -             <aspect type="composite-content">
  -                 <parameter name="tag-name" value="column-layout"/>
  -             </aspect>
  -         </aspects>
  -     </renderer>
  -     <renderer name="row" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
  -         <aspects>
  -             <aspect type="xslt">
  -                 <parameter name="style" 
value="{global:skin}styles/row.xsl"/>
  -             </aspect>
  -             <aspect type="composite-content">
  -                 <parameter name="tag-name" value="row-layout"/>
  -             </aspect>
  -         </aspects>
  -     </renderer>
  -     <renderer name="tab" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
  -         <aspects>
  -             <aspect type="xslt">
  -                 <parameter name="style" 
value="{global:skin}styles/tab.xsl"/>
  -             </aspect>
  -             <aspect type="tab-content">
  -                 <parameter name="tag-name" value="tab-layout"/>
  -                 <parameter name="store"    value="session"/>
  -             </aspect>
  -         </aspects>
  -     </renderer>
  -     <renderer name="window" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
  -         <aspects>
  -             <aspect type="xslt">
  -                 <parameter name="style" 
value="{global:skin}styles/window.xsl"/>
  -             </aspect>
  -             <aspect type="window">
  -                 <parameter name="tag-name" value="window"/>
  -             </aspect>
  -             <aspect type="coplet-removing"/>
  -             <aspect type="coplet-full-screen"/>
  -             <aspect type="coplet-sizing"/>
  -             <aspect type="coplet-cinclude"/>
  -         </aspects>
  -     </renderer>
  -     <renderer name="frame" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
  -         <aspects>
  -             <aspect type="frame">
  -                 <parameter name="store" value="request"/>
  -             </aspect>
  -         </aspects>
  -     </renderer>
  -     <renderer name="nowindow" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
  -         <aspects>
  -             <aspect type="coplet"/>
  -         </aspects>
  -     </renderer>
  -     <renderer name="link" 
class="org.apache.cocoon.portal.layout.renderer.impl.DefaultLinkRenderer" 
logger="portal"/>
  - </component>
  - 
  -
    <!-- Aspect Storage configuration -->
    <component class="org.apache.cocoon.components.ExtendedComponentSelector" 
               role="org.apache.cocoon.portal.aspect.AspectDataStoreSelector">
  @@ -131,74 +70,6 @@
       <store name="session" 
class="org.apache.cocoon.portal.aspect.impl.SessionAspectDataStore"/>
       <store name="persistent" 
class="org.apache.cocoon.portal.aspect.impl.PersistentAspectDataStore"/>
    </component>
  -
  -<!-- Layout factory configuration -->
  -<component class="org.apache.cocoon.portal.layout.impl.DefaultLayoutFactory"
  -           role="org.apache.cocoon.portal.layout.LayoutFactory">
  -    <layouts>
  -        <layout name="column" 
  -                class="org.apache.cocoon.portal.layout.impl.CompositeLayout">
  -            <renderers default="column">
  -                <renderer name="column"/>
  -            </renderers>
  -        </layout>
  -        <layout name="row" 
  -                class="org.apache.cocoon.portal.layout.impl.CompositeLayout">
  -            <renderers default="row">
  -                <renderer name="row"/>
  -            </renderers>
  -        </layout>
  -        <layout name="tab" 
  -                class="org.apache.cocoon.portal.layout.impl.CompositeLayout">
  -            <renderers default="tab">
  -                <renderer name="tab"/>
  -            </renderers>
  -        </layout>
  -        <layout name="frame" 
  -                class="org.apache.cocoon.portal.layout.impl.FrameLayout"
  -                create-id="true">
  -            <renderers default="frame">
  -                <renderer name="frame"/>
  -            </renderers>
  -        </layout>
  -        <layout name="coplet" 
  -                class="org.apache.cocoon.portal.layout.impl.CopletLayout">
  -            <renderers default="window">
  -                <renderer name="window"/>
  -            </renderers>
  -        </layout>
  -    </layouts>
  -</component>
  -
  -<!-- Coplet factory configuration -->
  -<component class="org.apache.cocoon.portal.coplet.impl.DefaultCopletFactory"
  -           role="org.apache.cocoon.portal.coplet.CopletFactory">
  -    <coplets>
  -        <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="java.lang.Integer"
  -                        store="session"
  -                        auto-create="true"
  -                        value="1"/>
  -            </coplet-instance-data-aspects>
  -        </coplet>
  -    </coplets>
  -</component>
   
   <component 
class="org.apache.cocoon.components.persistance.CastorSourceConverter" 
role="org.apache.cocoon.components.persistance.CastorSourceConverter">
        <mapping-source 
source="layout">context://samples/portal/profiles/mapping/layout.xml</mapping-source>
  
  
  
  1.1                  cocoon-2.1/src/blocks/portal/conf/portal.samplesxconf
  
  Index: portal.samplesxconf
  ===================================================================
  <?xml version="1.0"?>
  
  <samplesxconf xpath="/cocoon" unless="[EMAIL 
PROTECTED]'org.apache.cocoon.portal.profile.ProfileManager']">
  
   <component 
class="org.apache.cocoon.portal.profile.impl.AuthenticationProfileManager" 
logger="portal" role="org.apache.cocoon.portal.profile.ProfileManager/Auth">
   </component>
  
   <!-- Renderer configuration -->
   <component class="org.apache.cocoon.components.ExtendedComponentSelector" 
role="org.apache.cocoon.portal.layout.renderer.RendererSelector">
       <renderer name="column" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
           <aspects>
               <aspect type="xslt">
                   <parameter name="style" 
value="{global:skin}styles/column.xsl"/>
               </aspect>
               <aspect type="composite-content">
                   <parameter name="tag-name" value="column-layout"/>
               </aspect>
           </aspects>
       </renderer>
       <renderer name="row" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
           <aspects>
               <aspect type="xslt">
                   <parameter name="style" value="{global:skin}styles/row.xsl"/>
               </aspect>
               <aspect type="composite-content">
                   <parameter name="tag-name" value="row-layout"/>
               </aspect>
           </aspects>
       </renderer>
       <renderer name="tab" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
           <aspects>
               <aspect type="xslt">
                   <parameter name="style" value="{global:skin}styles/tab.xsl"/>
               </aspect>
               <aspect type="tab-content">
                   <parameter name="tag-name" value="tab-layout"/>
                   <parameter name="store"    value="session"/>
               </aspect>
           </aspects>
       </renderer>
       <renderer name="window" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
           <aspects>
               <aspect type="xslt">
                   <parameter name="style" 
value="{global:skin}styles/window.xsl"/>
               </aspect>
               <aspect type="window">
                   <parameter name="tag-name" value="window"/>
               </aspect>
               <aspect type="coplet-removing"/>
               <aspect type="coplet-full-screen"/>
               <aspect type="coplet-sizing"/>
               <aspect type="coplet-cinclude"/>
           </aspects>
       </renderer>
       <renderer name="frame" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
           <aspects>
               <aspect type="frame">
                   <parameter name="store" value="request"/>
               </aspect>
           </aspects>
       </renderer>
       <renderer name="nowindow" 
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
logger="portal" >
           <aspects>
               <aspect type="coplet"/>
           </aspects>
       </renderer>
       <renderer name="link" 
class="org.apache.cocoon.portal.layout.renderer.impl.DefaultLinkRenderer" 
logger="portal"/>
   </component>
   
  <!-- Layout factory configuration -->
  <component class="org.apache.cocoon.portal.layout.impl.DefaultLayoutFactory"
             role="org.apache.cocoon.portal.layout.LayoutFactory">
      <layouts>
          <layout name="column" 
                  class="org.apache.cocoon.portal.layout.impl.CompositeLayout">
              <renderers default="column">
                  <renderer name="column"/>
              </renderers>
          </layout>
          <layout name="row" 
                  class="org.apache.cocoon.portal.layout.impl.CompositeLayout">
              <renderers default="row">
                  <renderer name="row"/>
              </renderers>
          </layout>
          <layout name="tab" 
                  class="org.apache.cocoon.portal.layout.impl.CompositeLayout">
              <renderers default="tab">
                  <renderer name="tab"/>
              </renderers>
          </layout>
          <layout name="frame" 
                  class="org.apache.cocoon.portal.layout.impl.FrameLayout"
                  create-id="true">
              <renderers default="frame">
                  <renderer name="frame"/>
              </renderers>
          </layout>
          <layout name="coplet" 
                  class="org.apache.cocoon.portal.layout.impl.CopletLayout">
              <renderers default="window">
                  <renderer name="window"/>
              </renderers>
          </layout>
      </layouts>
  </component>
  
  <!-- Coplet factory configuration -->
  <component class="org.apache.cocoon.portal.coplet.impl.DefaultCopletFactory"
             role="org.apache.cocoon.portal.coplet.CopletFactory">
      <coplets>
          <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="java.lang.Integer"
                          store="session"
                          auto-create="true"
                          value="1"/>
              </coplet-instance-data-aspects>
          </coplet>
      </coplets>
  </component>
  
  </samplesxconf>
  
  
  
  1.1                  cocoon-2.1/src/blocks/portal/conf/authportal.samplesxconf
  
  Index: authportal.samplesxconf
  ===================================================================
  <?xml version="1.0"?>
  
  <samplesxconf xpath="/cocoon/[EMAIL 
PROTECTED]'org.apache.cocoon.portal.PortalService']/portals" unless="[EMAIL 
PROTECTED]'portal']">
  
   <portal name="portal">
     
<profile-manager>org.apache.cocoon.portal.profile.ProfileManager/Auth</profile-manager>
   </portal>
  
  </samplesxconf>
  
  
  
  1.13      +53 -43    
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultLayoutFactory.java 14 Jun 2003 17:55:43 -0000      1.12
  +++ DefaultLayoutFactory.java 18 Jul 2003 14:41:44 -0000      1.13
  @@ -70,6 +70,8 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.portal.PortalComponentManager;
  +import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.aspect.AspectDataHandler;
   import org.apache.cocoon.portal.aspect.AspectDataStore;
   import org.apache.cocoon.portal.aspect.AspectDescription;
  @@ -82,12 +84,11 @@
   import org.apache.cocoon.portal.event.LayoutEvent;
   import org.apache.cocoon.portal.event.Subscriber;
   import org.apache.cocoon.portal.event.impl.LayoutRemoveEvent;
  -import org.apache.cocoon.portal.layout.*;
  +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.portal.layout.renderer.Renderer;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.cocoon.util.ClassUtils;
   
   /**
  @@ -116,6 +117,8 @@
       
       protected ComponentManager manager;
       
  +    protected Configuration[] layoutsConf;
  +    
       /** 
        * Configure a layout
        */
  @@ -162,32 +165,26 @@
               }
           }
           // now query all configured renderers for their aspects
  -        ComponentSelector rendererSelector = null;
  +        PortalService service = null;
           try {
  -            rendererSelector = 
(ComponentSelector)this.manager.lookup(Renderer.ROLE+"Selector");
  +            service = (PortalService)this.manager.lookup(PortalService.ROLE);
  +            PortalComponentManager pcManager = service.getComponentManager();
               
               Iterator rendererIterator = desc.getRendererNames();
               while (rendererIterator.hasNext()) {
                   final String rendererName = (String)rendererIterator.next();
  -                Renderer renderer = null;
  -                try { 
  -                    renderer = (Renderer) rendererSelector.select( 
rendererName );
  -                    
  -                    Iterator aspectIterator = 
renderer.getAspectDescriptions();
  -                    while (aspectIterator.hasNext()) {
  -                        final AspectDescription adesc = (AspectDescription) 
aspectIterator.next();
  -                        desc.addAspectDescription( adesc );
  -                    }
  -                } catch (ComponentException ce ) {
  -                    throw new ConfigurationException("Unable to lookup 
renderer '" + rendererName + "'", ce);
  -                } finally {
  -                    rendererSelector.release( renderer );
  +                Renderer renderer = pcManager.getRenderer( rendererName );
  +                
  +                Iterator aspectIterator = renderer.getAspectDescriptions();
  +                while (aspectIterator.hasNext()) {
  +                    final AspectDescription adesc = (AspectDescription) 
aspectIterator.next();
  +                    desc.addAspectDescription( adesc );
                   }
               }
           } catch (ComponentException ce ) {
               throw new ConfigurationException("Unable to lookup renderer 
selector.", ce);
           } finally {
  -            this.manager.release( rendererSelector );
  +            this.manager.release( service );
           }
           
           // set the aspect data handler
  @@ -201,17 +198,33 @@
        */
       public void configure(Configuration configuration) 
       throws ConfigurationException {
  -        final Configuration[] layoutsConf = 
configuration.getChild("layouts").getChildren("layout");
  -        if ( layoutsConf != null ) {
  -            for(int i=0; i < layoutsConf.length; i++ ) {
  -                this.configureLayout( layoutsConf[i] );
  +        this.layoutsConf = 
configuration.getChild("layouts").getChildren("layout");
  +    }
  +
  +    protected void init() {
  +        // FIXME when we switch to another container we can remove
  +        //        the lazy evaluation
  +        if ( this.layoutsConf != null ) {
  +            synchronized (this) {
  +                if ( this.layoutsConf != null ) {
  +                    for(int i=0; i < layoutsConf.length; i++ ) {
  +                        try {
  +                            this.configureLayout( layoutsConf[i] );
  +                        } catch (ConfigurationException ce) {
  +                            throw new CascadingRuntimeException("Unable to 
configure layout.", ce);
  +                        }
  +                    }
  +                    this.layoutsConf = null;
  +                }
               }
           }
       }
  -
  +    
       public void prepareLayout(Layout layout) 
       throws ProcessingException {
           if ( layout != null ) {
  +            
  +            this.init();
        
               final String layoutName = layout.getName();
               if ( layoutName == null ) {
  @@ -240,6 +253,8 @@
   
       public Layout newInstance(String layoutName) 
       throws ProcessingException {
  +        this.init();
  +        
           Object[] o = (Object[]) this.layouts.get( layoutName );
               
           if ( o == null ) {
  @@ -265,19 +280,20 @@
           layout.setDescription( layoutDescription );
           layout.setAspectDataHandler((AspectDataHandler)o[1]);
   
  -        ProfileManager profileManager = null;
  +        PortalService service = null;
           try {
  -            profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  -            profileManager.register(layout);
  +            service = (PortalService)this.manager.lookup(PortalService.ROLE);
  +            
service.getComponentManager().getProfileManager().register(layout);
           } catch (ComponentException ce) {
               throw new ProcessingException("Unable to lookup profile 
manager.", ce);
           } finally {
  -            this.manager.release( profileManager );
  +            this.manager.release( service );
           }
           return layout;
       }
       
       public List getLayoutDescriptions() {
  +        this.init();
           return this.descriptions;
       }
   
  @@ -356,6 +372,7 @@
       public void remove(Layout layout) 
       throws ProcessingException {
           if ( layout != null ) {
  +            this.init();
               if ( layout instanceof CompositeLayout ) {
                   Iterator itemIterator = 
((CompositeLayout)layout).getItems().iterator();
                   while ( itemIterator.hasNext() ) {
  @@ -367,25 +384,18 @@
                   parent.getParent().removeItem( parent );
               }
               
  -            if ( layout instanceof CopletLayout ) {
  -                CopletFactory factory = null;
  -                try {
  -                    factory = 
(CopletFactory)this.manager.lookup(CopletFactory.ROLE);
  +            PortalService service = null;
  +            try {
  +                service = 
(PortalService)this.manager.lookup(PortalService.ROLE);
  +                if ( layout instanceof CopletLayout ) {
  +                    CopletFactory factory = 
service.getComponentManager().getCopletFactory();
                       factory.remove( 
((CopletLayout)layout).getCopletInstanceData());
  -                } catch (ComponentException ce) {
  -                    throw new ProcessingException("Unable to lookup coplet 
factory.", ce);
  -                } finally {
  -                    this.manager.release( (Component)factory );
                   }
  -            }
  -            ProfileManager profileManager = null;
  -            try {
  -                profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  -                profileManager.unregister(layout);
  +                
service.getComponentManager().getProfileManager().unregister(layout);
               } catch (ComponentException ce) {
  -                throw new ProcessingException("Unable to lookup profile 
manager.", ce);
  +                throw new ProcessingException("Unable to lookup portal 
service.", ce);
               } finally {
  -                this.manager.release( profileManager );
  +                this.manager.release( service );
               }
           }
       }
  
  
  
  1.4       +6 -6      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/source/CopletSourceFactory.java
  
  Index: CopletSourceFactory.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/source/CopletSourceFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CopletSourceFactory.java  10 Jun 2003 06:15:42 -0000      1.3
  +++ CopletSourceFactory.java  18 Jul 2003 14:41:44 -0000      1.4
  @@ -59,8 +59,8 @@
   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.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   import org.apache.excalibur.source.SourceFactory;
  @@ -102,11 +102,11 @@
               protocol = location.substring(0, position);
               location = location.substring(position+2);
           }
  -        ProfileManager profileManager = null;
  +        PortalService service = null;
           CopletInstanceData coplet = null;
           try {
  -            profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  -            coplet = profileManager.getCopletInstanceData(location);
  +            service = (PortalService)this.manager.lookup(PortalService.ROLE);
  +            coplet = 
service.getComponentManager().getProfileManager().getCopletInstanceData(location);
               CopletSource copletSource =
                   new CopletSource(uri, protocol,
                                    coplet);
  @@ -115,7 +115,7 @@
           } catch (ComponentException ce) {
               throw new SourceException("Unable to lookup profile manager.", 
ce);
           } finally {
  -            this.manager.release(profileManager);
  +            this.manager.release(service);
           }
        }
   
  
  
  
  1.5       +1 -1      
cocoon-2.1/src/blocks/portal/samples/skins/common/styles/window.xsl
  
  Index: window.xsl
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/samples/skins/common/styles/window.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- window.xsl        25 Jun 2003 08:23:16 -0000      1.4
  +++ window.xsl        18 Jul 2003 14:41:44 -0000      1.5
  @@ -34,7 +34,7 @@
                        </font>
            </td>
                <td align="right" bgColor="{$bgColor}">
  -                     <xsl:if test="fullscreen-uri">
  +                     <xsl:if test="fullscreen-uri and not(maximize-uri)">
                                <a href="{fullscreen-uri}">
                                    <img src="customize.gif" border="0" 
alt="Full Screen"/>
                                </a>
  
  
  
  1.5       +3 -3      
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SizingAspect.java 26 May 2003 13:18:19 -0000      1.4
  +++ SizingAspect.java 18 Jul 2003 14:41:44 -0000      1.5
  @@ -92,12 +92,12 @@
   
               if ( !size.equals(SizingStatus.STATUS_MINIMIZED)) {
                   event = new ChangeCopletInstanceAspectDataEvent(cid, "size", 
SizingStatus.STATUS_MINIMIZED);
  -                XMLUtils.createElement(handler, "minimize-uri", 
service.getLinkService().getLinkURI(event));
  +                XMLUtils.createElement(handler, "minimize-uri", 
service.getComponentManager().getLinkService().getLinkURI(event));
               }
   
               if ( !size.equals(SizingStatus.STATUS_MAXIMIZED)) {
                   event = new ChangeCopletInstanceAspectDataEvent(cid, "size", 
SizingStatus.STATUS_MAXIMIZED);
  -                XMLUtils.createElement(handler, "maximize-uri", 
service.getLinkService().getLinkURI(event));
  +                XMLUtils.createElement(handler, "maximize-uri", 
service.getComponentManager().getLinkService().getLinkURI(event));
               }
               if (size != SizingStatus.STATUS_MINIMIZED) {
                   context.invokeNext(layout, service, handler);
  
  
  
  1.9       +2 -2      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
  
  Index: TabContentAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TabContentAspect.java     15 Jun 2003 16:56:09 -0000      1.8
  +++ TabContentAspect.java     18 Jul 2003 14:41:44 -0000      1.9
  @@ -120,7 +120,7 @@
                           attributes.addCDATAAttribute("selected", "true");
                       } else {
                           ChangeAspectDataEvent event = new 
ChangeAspectDataEvent(tabLayout, "tab", new Integer(j));
  -                        attributes.addCDATAAttribute("parameter", 
portalService.getLinkService().getLinkURI(event));
  +                        attributes.addCDATAAttribute("parameter", 
portalService.getComponentManager().getLinkService().getLinkURI(event));
                       }
                       XMLUtils.startElement(handler, "named-item", attributes);
                       if (j == selected) {
  
  
  
  1.5       +2 -2      
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RemovableAspect.java      26 May 2003 13:18:19 -0000      1.4
  +++ RemovableAspect.java      18 Jul 2003 14:41:45 -0000      1.5
  @@ -84,7 +84,7 @@
           Boolean mandatory = 
(Boolean)cid.getCopletData().getAspectData("mandatory");
           if ( !mandatory.booleanValue() ) {
               LayoutRemoveEvent lre = new LayoutRemoveEvent(layout);
  -            XMLUtils.createElement(handler, "remove-uri", 
service.getLinkService().getLinkURI(lre));
  +            XMLUtils.createElement(handler, "remove-uri", 
service.getComponentManager().getLinkService().getLinkURI(lre));
           }
           context.invokeNext(layout, service, handler);
        }
  
  
  
  1.3       +4 -5      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FullScreenCopletAspect.java
  
  Index: FullScreenCopletAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FullScreenCopletAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FullScreenCopletAspect.java       6 Jun 2003 11:33:39 -0000       1.2
  +++ FullScreenCopletAspect.java       18 Jul 2003 14:41:45 -0000      1.3
  @@ -80,13 +80,12 @@
           
           CopletInstanceData cid = 
((CopletLayout)layout).getCopletInstanceData();
   
  -        Layout fullScreenLayout = 
(Layout)service.getTemporaryAttribute("DEFAULT_LAYOUT");
  +        final Layout fullScreenLayout = 
(Layout)service.getComponentManager().getProfileManager().getEntryLayout();
           if ( fullScreenLayout != null && fullScreenLayout.equals( layout )) {
  -            FullScreenCopletEvent event = new FullScreenCopletEvent( cid, 
null );
  -            XMLUtils.createElement(handler, "fullscreen-uri", 
service.getLinkService().getRefreshLinkURI());
  +            XMLUtils.createElement(handler, "fullscreen-uri", 
service.getComponentManager().getLinkService().getRefreshLinkURI());
           } else {
               FullScreenCopletEvent event = new FullScreenCopletEvent( cid, 
layout );
  -            XMLUtils.createElement(handler, "fullscreen-uri", 
service.getLinkService().getLinkURI(event));
  +            XMLUtils.createElement(handler, "fullscreen-uri", 
service.getComponentManager().getLinkService().getLinkURI(event));
           }
   
           context.invokeNext(layout, service, handler);
  
  
  
  1.3       +3 -22     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java
  
  Index: AbstractCompositeAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractCompositeAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractCompositeAspect.java      19 May 2003 12:50:59 -0000      1.2
  +++ AbstractCompositeAspect.java      18 Jul 2003 14:41:45 -0000      1.3
  @@ -52,8 +52,6 @@
   
   import java.util.Iterator;
   
  -import org.apache.avalon.framework.CascadingRuntimeException;
  -import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.CompositeLayout;
  @@ -105,25 +103,8 @@
       protected void processLayout(Layout layout, PortalService service, 
ContentHandler handler) throws SAXException {
           final String rendererName = layout.getRendererName();
           Renderer renderer = null;
  -        try {
  -            renderer = (Renderer) 
this.getRenderSelector().select(rendererName);
  -            renderer.toSAX(layout, service, handler);
  -        } catch (ComponentException ce) {
  -            throw new SAXException("Unable to lookup renderer for role " + 
rendererName, ce);
  -        } finally {
  -            this.getRenderSelector().release(renderer);
  -        }
  -    }
  -
  -    protected ComponentSelector getRenderSelector() {
  -        if ( null == this.rendererSelector ) {
  -            try {
  -                this.rendererSelector = (ComponentSelector) 
this.manager.lookup(Renderer.ROLE + "Selector");
  -            } catch (ComponentException local) {
  -                throw new CascadingRuntimeException("Unable to lookup 
component selector for portal layout selector.", local);
  -            }
  -        }
  -        return this.rendererSelector;
  +        renderer = service.getComponentManager().getRenderer(rendererName);
  +        renderer.toSAX(layout, service, handler);
       }
   
       /**
  
  
  
  1.2       +2 -12     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/LoginAction.java
  
  Index: LoginAction.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/LoginAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LoginAction.java  28 May 2003 07:14:41 -0000      1.1
  +++ LoginAction.java  18 Jul 2003 14:41:45 -0000      1.2
  @@ -52,7 +52,6 @@
   
   import java.util.Map;
   
  -import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
  @@ -62,7 +61,6 @@
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
    * This action logs the user into the portal
  @@ -91,21 +89,13 @@
           try {
               service = (PortalService)this.manager.lookup(PortalService.ROLE);
               service.setPortalName(par.getParameter("portal-name"));
  +            service.getComponentManager().getProfileManager().login();
           } catch (ParameterException pe) {
               throw new ProcessingException("Parameter portal-name is 
required.");
           } catch (ComponentException ce) {
               throw new ProcessingException("Unable to lookup portal 
service.", ce);
           } finally {
               this.manager.release(service);
  -        }
  -
  -        // login
  -        ProfileManager profileManager = null;
  -        try {
  -            profileManager = (ProfileManager) 
this.manager.lookup(ProfileManager.ROLE);
  -            profileManager.login();
  -        } finally {
  -            this.manager.release( (Component)profileManager );
           }
   
           if (this.getLogger().isDebugEnabled() ) {
  
  
  
  1.2       +2 -12     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/LogoutAction.java
  
  Index: LogoutAction.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/LogoutAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogoutAction.java 28 May 2003 07:14:41 -0000      1.1
  +++ LogoutAction.java 18 Jul 2003 14:41:45 -0000      1.2
  @@ -52,7 +52,6 @@
   
   import java.util.Map;
   
  -import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
  @@ -62,7 +61,6 @@
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
    *  This action logs the current user out of the portal
  @@ -91,21 +89,13 @@
           try {
               service = (PortalService)this.manager.lookup(PortalService.ROLE);
               service.setPortalName(par.getParameter("portal-name"));
  +            service.getComponentManager().getProfileManager().logout();
           } catch (ParameterException pe) {
               throw new ProcessingException("Parameter portal-name is 
required.");
           } catch (ComponentException ce) {
               throw new ProcessingException("Unable to lookup portal 
service.", ce);
           } finally {
               this.manager.release(service);
  -        }
  -
  -        // logout
  -        ProfileManager profileManager = null;
  -        try {
  -            profileManager = (ProfileManager) 
this.manager.lookup(ProfileManager.ROLE);
  -            profileManager.logout();
  -        } finally {
  -            this.manager.release( (Component)profileManager );
           }
   
           if (this.getLogger().isDebugEnabled() ) {
  
  
  
  1.3       +9 -19     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
  
  Index: DefaultLinkRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultLinkRenderer.java  10 Jul 2003 13:16:59 -0000      1.2
  +++ DefaultLinkRenderer.java  18 Jul 2003 14:41:45 -0000      1.3
  @@ -50,11 +50,9 @@
   */
   package org.apache.cocoon.portal.layout.renderer.impl;
   
  -import org.apache.avalon.framework.component.ComponentException;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.layout.impl.LinkLayout;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -71,22 +69,14 @@
       public void process(Layout layout, PortalService service, ContentHandler 
handler)
       throws SAXException {
           if (layout instanceof LinkLayout) {
  -            ProfileManager profileManager = null;
  -            try {
  -                profileManager = 
(ProfileManager)this.componentManager.lookup(ProfileManager.ROLE);
  -                String layoutKey = 
(String)layout.getAspectData("link-layout-key");
  -                             String layoutId = 
(String)layout.getAspectData("link-layout-id");
  -                if ( layoutKey == null && layoutId == null){
  -                                     // get default values
  -                                     layoutKey = 
((LinkLayout)layout).getLayoutKey();
  -                                     layoutId = 
((LinkLayout)layout).getLayoutId();
  -                             }
  -                this.processLayout(profileManager.getPortalLayout(layoutKey, 
layoutId), service, handler);
  -            } catch (ComponentException ce) {
  -                throw new SAXException("Unable to lookup profile manager.", 
ce);
  -            } finally {
  -                this.componentManager.release(profileManager);
  -            }
  +            String layoutKey = 
(String)layout.getAspectData("link-layout-key");
  +                     String layoutId = 
(String)layout.getAspectData("link-layout-id");
  +            if ( layoutKey == null && layoutId == null){
  +                             // get default values
  +                             layoutKey = ((LinkLayout)layout).getLayoutKey();
  +                             layoutId = ((LinkLayout)layout).getLayoutId();
  +                     }
  +            
this.processLayout(service.getComponentManager().getProfileManager().getPortalLayout(layoutKey,
 layoutId), service, handler);
           } else {
               throw new SAXException("Wrong layout type, LinkLayout expected: 
" + layout.getClass().getName());
           }        
  
  
  
  1.4       +3 -21     
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractRenderer.java     14 Jun 2003 17:55:43 -0000      1.3
  +++ AbstractRenderer.java     18 Jul 2003 14:41:45 -0000      1.4
  @@ -56,7 +56,6 @@
   import javax.xml.transform.sax.SAXResult;
   import javax.xml.transform.sax.TransformerHandler;
   
  -import org.apache.avalon.framework.CascadingRuntimeException;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  @@ -157,27 +156,10 @@
       protected void processLayout(Layout layout, PortalService service, 
ContentHandler handler) throws SAXException {
           final String rendererName = layout.getRendererName();
           Renderer renderer = null;
  -        try {
  -            renderer = (Renderer) 
this.getRenderSelector().select(rendererName);
  -            renderer.toSAX(layout, service, handler);
  -        } catch (ComponentException ce) {
  -            throw new SAXException("Unable to lookup renderer for role " + 
rendererName, ce);
  -        } finally {
  -            this.getRenderSelector().release(renderer);
  -        }
  +        renderer = service.getComponentManager().getRenderer(rendererName);
  +        renderer.toSAX(layout, service, handler);
       }
   
  -    protected ComponentSelector getRenderSelector() {
  -        if ( null == this.rendererSelector ) {
  -            try {
  -                this.rendererSelector = (ComponentSelector) 
this.componentManager.lookup(Renderer.ROLE + "Selector");
  -            } catch (ComponentException local) {
  -                throw new CascadingRuntimeException("Unable to lookup 
component selector for portal layout selector.", local);
  -            }
  -        }
  -        return this.rendererSelector;
  -    }
  -        
       protected abstract void process(Layout layout, PortalService service, 
ContentHandler handler) throws SAXException;
   
       /**
  
  
  
  1.2       +6 -14     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java
  
  Index: AbstractContentEventAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractContentEventAspect.java   14 Jul 2003 10:12:14 -0000      1.1
  +++ AbstractContentEventAspect.java   18 Jul 2003 14:41:45 -0000      1.2
  @@ -65,7 +65,6 @@
   import org.apache.cocoon.portal.event.aspect.EventAspect;
   import org.apache.cocoon.portal.event.aspect.EventAspectContext;
   import org.apache.cocoon.portal.layout.Layout;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
    *
  @@ -99,17 +98,10 @@
        * values and invokes [EMAIL PROTECTED] #publish(Publisher, Layout, 
String[])}.
        * @param values The values contained in the request
        */
  -    protected void publish(Publisher publisher, String[] values) {
  -        ProfileManager profileManager = null;
  -        try {
  -            profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  -            Layout layout = profileManager.getPortalLayout(values[0], 
values[1] );
  -            if ( layout != null ) {
  -                this.publish( publisher, layout, values);
  -            }
  -        } catch (ComponentException ignore) {
  -        } finally {
  -            this.manager.release( profileManager );
  +    protected void publish( PortalService service, Publisher publisher, 
String[] values) {
  +        Layout layout = 
service.getComponentManager().getProfileManager().getPortalLayout(values[0], 
values[1] );
  +        if ( layout != null ) {
  +            this.publish( publisher, layout, values);
           }
       }
       
  @@ -154,7 +146,7 @@
                               tokenNumber = tokenNumber + 1;
                           } 
                       
  -                        this.publish( publisher, eventValues );
  +                        this.publish( service, publisher, eventValues );
   
                       } else {
                           this.getLogger().warn("Data for Event is not set 
correctly");
  
  
  
  1.2       +2 -2      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java
  
  Index: ActionCounterEventAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActionCounterEventAspect.java     7 May 2003 06:22:27 -0000       1.1
  +++ ActionCounterEventAspect.java     18 Jul 2003 14:41:45 -0000      1.2
  @@ -113,7 +113,7 @@
                   context.invokeNext( service );
               }
           }
  -        service.getLinkService().addParameterToLink( requestParameterName, 
String.valueOf(actionCount));        
  +        service.getComponentManager().getLinkService().addParameterToLink( 
requestParameterName, String.valueOf(actionCount));        
        }
   
   
  
  
  
  1.3       +6 -7      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java
  
  Index: FullScreenCopletEventAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FullScreenCopletEventAspect.java  10 Jul 2003 13:17:03 -0000      1.2
  +++ FullScreenCopletEventAspect.java  18 Jul 2003 14:41:45 -0000      1.3
  @@ -69,7 +69,6 @@
   import org.apache.cocoon.portal.event.aspect.EventAspectContext;
   import org.apache.cocoon.portal.event.impl.FullScreenCopletEvent;
   import org.apache.cocoon.portal.layout.Layout;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
    *
  @@ -105,7 +104,7 @@
                       publisher.publish(e);
                       FullScreenCopletEvent fsce = (FullScreenCopletEvent)e;
                       if ( fsce.getLayout() != null) {
  -                        service.getLinkService().addEventToLink( e );
  +                        
service.getComponentManager().getLinkService().addEventToLink( e );
                       }
                   }
               }
  @@ -135,14 +134,14 @@
           FullScreenCopletEvent e = (FullScreenCopletEvent) event;
           final Layout startingLayout = e.getLayout();
           if ( null != startingLayout ) {
  -            ProfileManager profileManager = null;
  +            PortalService portalService = null;
               try {
  -                profileManager = (ProfileManager) 
this.manager.lookup(ProfileManager.ROLE);
  -                profileManager.setEntryLayout( startingLayout );
  +                portalService = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  +                
portalService.getComponentManager().getProfileManager().setEntryLayout( 
startingLayout );
               } catch (ComponentException ce) {
                   // ignore
               } finally {
  -                this.manager.release(profileManager);
  +                this.manager.release(portalService);
               }
           }
       }
  
  
  
  1.7       +2 -1      
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProfileManager.java       10 Jul 2003 13:17:04 -0000      1.6
  +++ ProfileManager.java       18 Jul 2003 14:41:45 -0000      1.7
  @@ -87,6 +87,7 @@
        * FIXME this is for the full-screen function
        */
       void setEntryLayout(Layout object);
  +    Layout getEntryLayout();
       
       /**
        * Change the default layout key for most functions
  
  
  
  1.2       +29 -1     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
  
  Index: AbstractProfileManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractProfileManager.java       10 Jul 2003 13:17:00 -0000      1.1
  +++ AbstractProfileManager.java       18 Jul 2003 14:41:45 -0000      1.2
  @@ -57,6 +57,7 @@
   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.layout.Layout;
   import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
  @@ -127,5 +128,32 @@
       
       public void logout() {
       }
  +
  +    public void setEntryLayout(Layout object) {
  +        String layoutKey = this.getDefaultLayoutKey();
  +        PortalService service = null;
  +        try {
  +            service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  +            service.setTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey, 
object);
  +        } catch (ComponentException e) {
  +            throw new CascadingRuntimeException("Unable to lookup service 
manager.", e);
  +        } finally {
  +            this.manager.release(service);
  +        }
  +    }
  +
  +    public Layout getEntryLayout() {
  +        String layoutKey = this.getDefaultLayoutKey();
  +        PortalService service = null;
  +        try {
  +            service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  +            return (Layout)service.getTemporaryAttribute("DEFAULT_LAYOUT:" + 
layoutKey);
  +        } catch (ComponentException e) {
  +            throw new CascadingRuntimeException("Unable to lookup service 
manager.", e);
  +        } finally {
  +            this.manager.release(service);
  +        }
  +    }
  +
       
   }
  
  
  
  1.6       +3 -19     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
  
  Index: StaticProfileManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StaticProfileManager.java 11 Jul 2003 07:49:57 -0000      1.5
  +++ StaticProfileManager.java 18 Jul 2003 14:41:45 -0000      1.6
  @@ -96,7 +96,6 @@
        * @see 
org.apache.cocoon.portal.profile.ProfileManager#getPortalLayout(String, String)
        */
       public Layout getPortalLayout(String layoutKey, String layoutID) {
  -        LayoutFactory factory = null;
           PortalService service = null;
           ProfileLS adapter = null;
           try {
  @@ -169,7 +168,7 @@
               service.setAttribute(serviceKey + "defaultKey", layout.getId());
               cacheLayouts(layouts, layout);
   
  -            factory = (LayoutFactory) 
this.manager.lookup(LayoutFactory.ROLE);
  +            LayoutFactory factory = 
service.getComponentManager().getLayoutFactory();
               factory.prepareLayout(layout);
   
               // store the new values in the service
  @@ -187,8 +186,7 @@
               return (Layout) layouts.get(layoutID);
   
           } catch (Exception ce) {
  -            // TODO
  -            throw new CascadingRuntimeException("Arg", ce);
  +            throw new CascadingRuntimeException("Unable to get layout.", ce);
           } finally {
               this.manager.release(service);
               this.manager.release((Component)adapter);
  @@ -272,20 +270,6 @@
           } catch (ComponentException e) {
               throw new CascadingRuntimeException(
                   "Unable to lookup portal service.",
  -                e);
  -        } finally {
  -            this.manager.release(service);
  -        }
  -    }
  -
  -    public void setEntryLayout(Layout object) {
  -        PortalService service = null;
  -        try {
  -            service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  -            service.setTemporaryAttribute("DEFAULT_LAYOUT", object);
  -        } catch (ComponentException e) {
  -            throw new CascadingRuntimeException(
  -                "Unable to lookup service manager.",
                   e);
           } finally {
               this.manager.release(service);
  
  
  
  1.2       +5 -23     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
  
  Index: AbstractUserProfileManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractUserProfileManager.java   10 Jul 2003 13:17:00 -0000      1.1
  +++ AbstractUserProfileManager.java   18 Jul 2003 14:41:45 -0000      1.2
  @@ -57,7 +57,6 @@
   import java.util.Map;
   
   import org.apache.avalon.framework.CascadingRuntimeException;
  -import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.cocoon.ProcessingException;
  @@ -298,32 +297,18 @@
           }
       }
   
  -    public void setEntryLayout(Layout object) {
  -        String layoutKey = this.getDefaultLayoutKey();
  -        PortalService service = null;
  -        try {
  -            service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  -            service.setTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey, 
object);
  -        } catch (ComponentException e) {
  -            throw new CascadingRuntimeException("Unable to lookup service 
manager.", e);
  -        } finally {
  -            this.manager.release(service);
  -        }
  -    }
  -
       /* (non-Javadoc)
        * @see 
org.apache.cocoon.portal.profile.ProfileManager#getPortalLayout(java.lang.String,
 java.lang.String)
        */
       public Layout getPortalLayout(String layoutKey, String layoutID) {
           PortalService service = null;
  -        LayoutFactory factory = null;
  -        CopletFactory copletFactory = null;
           ComponentSelector adapterSelector = null;
           
           try {
               service = (PortalService) 
this.manager.lookup(PortalService.ROLE);
  -            factory = (LayoutFactory) 
this.manager.lookup(LayoutFactory.ROLE);
  -            copletFactory = (CopletFactory) 
this.manager.lookup(CopletFactory.ROLE);
  +            LayoutFactory factory = 
service.getComponentManager().getLayoutFactory();
  +            CopletFactory copletFactory = 
service.getComponentManager().getCopletFactory();
  +            
               adapterSelector = 
(ComponentSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
               
               if ( null == layoutKey ) {
  @@ -358,12 +343,9 @@
               
               return layout;
           } catch (Exception ce) {
  -            // TODO
  -            throw new CascadingRuntimeException("Arg", ce);
  +            throw new CascadingRuntimeException("Exception during loading of 
profile.", ce);
           } finally {
               this.manager.release(service);
  -            this.manager.release((Component)factory);
  -            this.manager.release((Component)copletFactory);
               this.manager.release(adapterSelector);
           }
       }
  
  
  
  1.2       +8 -2      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/PortalManager.java
  
  Index: PortalManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/PortalManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortalManager.java        7 May 2003 06:22:28 -0000       1.1
  +++ PortalManager.java        18 Jul 2003 14:41:45 -0000      1.2
  @@ -57,7 +57,13 @@
   import org.xml.sax.SAXException;
   
   /**
  - *
  + * This is the main component that has currently two actions:
  + * Invoke the request processing using the [EMAIL PROTECTED] #process()} 
method,
  + * this starts the event handling for the current request (evaluating
  + * request parameters etc.)
  + * The section method [EMAIL PROTECTED] #showPortal(ContentHandler, 
Parameters)}
  + * starts rendering the portal.
  + * 
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Volker Schmitt</a>
    * 
  
  
  
  1.2       +42 -4     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/PortalService.java
  
  Index: PortalService.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/PortalService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortalService.java        7 May 2003 06:22:27 -0000       1.1
  +++ PortalService.java        18 Jul 2003 14:41:45 -0000      1.2
  @@ -55,7 +55,11 @@
   import org.apache.avalon.framework.component.Component;
   
   /**
  - *
  + * This is the central component in the portal. It holds the configuration
  + * of the portal, the current name etc.
  + * The main use of this component is to get the [EMAIL PROTECTED] 
PortalComponentManager}
  + * to get all the other portal components.
  + * 
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Volker Schmitt</a>
    * 
  @@ -69,24 +73,58 @@
       
       void setPortalName(String value);
       
  +    /**
  +     * Return the value of an attribute
  +     * @param key The key of the attribute
  +     * @return The value of the attribute or null.
  +     */
       Object getAttribute(String key);
       
  +    /**
  +     * Set an attribute
  +     * @param key    The key of the attribute
  +     * @param value  The new value
  +     */
       void setAttribute(String key, Object value);
       
  +    /**
  +     * Remove an attribute
  +     * @param key The key of the attribute
  +     */
       void removeAttribute(String key);
       
  +    /**
  +     * Return the names of all attributes
  +     */
       Iterator getAttributeNames();
       
  +    /**
  +     * Return the value of a temporary attribute
  +     * @param key The key of the attribute
  +     * @return The value of the attribute or null.
  +     */
       Object getTemporaryAttribute(String key);
       
  +    /**
  +     * Set a temporary attribute
  +     * @param key    The key of the attribute
  +     * @param value  The new value
  +     */
       void setTemporaryAttribute(String key, Object value);
       
  +    /**
  +     * Remove a temporary attribute
  +     * @param key The key of the attribute
  +     */
       void removeTemporaryAttribute(String key);
       
  +    /**
  +     * Return the names of all temporary attributes
  +     */
       Iterator getTemporaryAttributeNames();
   
       /**
  -     * Get the link service
  +     * Return the component manager for the current portal
        */
  -    LinkService getLinkService();
  +    PortalComponentManager getComponentManager();
   }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/PortalComponentManager.java
  
  Index: PortalComponentManager.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;
  
  import org.apache.cocoon.portal.coplet.CopletFactory;
  import org.apache.cocoon.portal.layout.LayoutFactory;
  import org.apache.cocoon.portal.layout.renderer.Renderer;
  import org.apache.cocoon.portal.profile.ProfileManager;
  
  /**
   * This component provides access to all other components used
   * throughout the portal.
   * Any component in the portal should never lookup these components
   * itself, but use this component manager instead.
   * 
   * This manager allows to run differently configured portals in Cocoon
   * at the same time. This component can't be looked up using the
   * usual Avalon mechanisms, it has to be get by the [EMAIL PROTECTED] 
PortalService}.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: PortalComponentManager.java,v 1.1 2003/07/18 14:41:45 
cziegeler Exp $
   */
  public interface PortalComponentManager {
  
      /**
       * Get the link service
       */
      LinkService getLinkService();
      
      /**
       * Get the current profile manager
       */
      ProfileManager getProfileManager();
      
      /**
       * Get the renderer 
       */
      Renderer getRenderer(String hint);
      
      /**
       * Get the coplet factory
       */
      CopletFactory getCopletFactory();
      
      /**
       * Get the layout factory
       */
      LayoutFactory getLayoutFactory();
  }
  
  
  
  1.3       +7 -10     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/AbstractCopletTransformer.java
  
  Index: AbstractCopletTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/AbstractCopletTransformer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractCopletTransformer.java    27 May 2003 11:54:17 -0000      1.2
  +++ AbstractCopletTransformer.java    18 Jul 2003 14:41:46 -0000      1.3
  @@ -58,7 +58,6 @@
   import org.apache.cocoon.portal.Constants;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.cocoon.transformation.AbstractSAXTransformer;
   import org.xml.sax.SAXException;
   
  @@ -94,9 +93,10 @@
   
       protected CopletInstanceData getCopletInstanceData() 
       throws SAXException {
  -        ProfileManager profileManager = null;
  +        PortalService portalService = null;
           try {
  -            profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  +
  +            portalService = 
(PortalService)this.manager.lookup(PortalService.ROLE);
   
               // determine coplet id
               String copletId = null;            
  @@ -108,12 +108,9 @@
                       copletId = this.parameters.getParameter(COPLET_ID_PARAM);
                           
                       // set portal name
  -                    PortalService portalService = null;
                       try {
  -                        portalService = 
(PortalService)this.manager.lookup(PortalService.ROLE);
                           
portalService.setPortalName(this.parameters.getParameter(PORTAL_NAME_PARAM));
                       } finally {
  -                        this.manager.release(portalService);
                       }
                   } catch (ParameterException e) {
                       throw new SAXException("copletId and portalName must be 
passed as parameter or in the object model within the parent context.");
  @@ -124,7 +121,7 @@
               }
   
   
  -            CopletInstanceData object = 
profileManager.getCopletInstanceData( copletId );
  +            CopletInstanceData object = 
portalService.getComponentManager().getProfileManager().getCopletInstanceData( 
copletId );
                   
               if (object == null) {
                   throw new SAXException("Could not find coplet instance data 
for " + copletId);
  @@ -132,9 +129,9 @@
                   
               return object;
           } catch (ComponentException e) {
  -            throw new SAXException("Error getting profile manager.", e);
  +            throw new SAXException("Error getting portal service.", e);
           } finally {
  -            this.manager.release(profileManager);
  +            this.manager.release( portalService );
           }
       }
   }
  
  
  
  1.5       +10 -24    
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
  
  Index: PortalManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortalManagerImpl.java    10 Jul 2003 13:17:02 -0000      1.4
  +++ PortalManagerImpl.java    18 Jul 2003 14:41:46 -0000      1.5
  @@ -52,7 +52,6 @@
   
   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.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.Parameters;
  @@ -63,7 +62,6 @@
   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.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -78,18 +76,18 @@
        extends AbstractLogEnabled
        implements PortalManager, Composable, ThreadSafe {
   
  -    private ComponentManager componentManager;
  +    private ComponentManager manager;
           
       public void process()
       throws ProcessingException {
           EventManager eventManager = null;
           try {
  -            eventManager = 
(EventManager)this.componentManager.lookup(EventManager.ROLE);
  +            eventManager = 
(EventManager)this.manager.lookup(EventManager.ROLE);
               eventManager.processEvents();
           } catch (ComponentException ce) {
               throw new ProcessingException("Unable to lookup portal 
service.", ce);
           } finally {
  -            this.componentManager.release(eventManager);
  +            this.manager.release(eventManager);
           }
       }
   
  @@ -101,32 +99,20 @@
   //        final boolean useContentDeliverer = (parameters == null ? true :
   //                                               
parameters.getParameterAsBoolean("use-content-deliverer", true));
           
  -        ProfileManager profileManager = null;
  -        ComponentSelector rendererSelector = null;
  -        Renderer portalLayoutRenderer = null;
           PortalService service = null;
           try {
  -            service = 
(PortalService)this.componentManager.lookup(PortalService.ROLE);
  -            profileManager = 
(ProfileManager)this.componentManager.lookup(ProfileManager.ROLE);
  -            Layout portalLayout = profileManager.getPortalLayout(null, null);
  +            service = (PortalService)this.manager.lookup(PortalService.ROLE);
  +            Layout portalLayout = 
service.getComponentManager().getProfileManager().getPortalLayout(null, null);
   
  -            rendererSelector = 
(ComponentSelector)this.componentManager.lookup(Renderer.ROLE+"Selector");
  -            portalLayoutRenderer = 
(Renderer)rendererSelector.select(portalLayout.getRendererName());       
  +            Renderer portalLayoutRenderer = 
service.getComponentManager().getRenderer( portalLayout.getRendererName());     
  
   
               contentHandler.startDocument();
               portalLayoutRenderer.toSAX(portalLayout, service, 
contentHandler);
               contentHandler.endDocument();
           } catch (ComponentException ce) {
  -            throw new SAXException("Unable to lookup profile manager.", ce);
  +            throw new SAXException("Unable to lookup portal service.", ce);
           } finally {
  -            if ( null != portalLayoutRenderer) {
  -                rendererSelector.release(portalLayoutRenderer);
  -            }
  -            this.componentManager.release(rendererSelector);
  -            if (null != profileManager) {
  -                this.componentManager.release(profileManager);
  -            }
  -            this.componentManager.release(service);
  +            this.manager.release(service);
           }
        }
   
  @@ -135,7 +121,7 @@
         */
        public void compose(ComponentManager componentManager)
                throws ComponentException {
  -        this.componentManager = componentManager;
  +        this.manager = componentManager;
        }
   
   }
  
  
  
  1.6       +68 -20    
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
  
  Index: PortalServiceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PortalServiceImpl.java    11 Jul 2003 11:06:22 -0000      1.5
  +++ PortalServiceImpl.java    18 Jul 2003 14:41:46 -0000      1.6
  @@ -52,18 +52,19 @@
   
   import java.io.IOException;
   import java.util.*;
  -import java.util.ArrayList;
  -import java.util.Collections;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
   
   import org.apache.avalon.excalibur.pool.Recyclable;
  -import org.apache.avalon.framework.CascadingRuntimeException;
  +import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   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.container.ContainerUtil;
  +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.cocoon.ProcessingException;
   import org.apache.cocoon.components.RequestLifecycleComponent;
  @@ -71,7 +72,7 @@
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.portal.Constants;
  -import org.apache.cocoon.portal.LinkService;
  +import org.apache.cocoon.portal.PortalComponentManager;
   import org.apache.cocoon.portal.PortalService;
   import org.xml.sax.SAXException;
   
  @@ -91,11 +92,16 @@
       implements Composable,
                   RequestLifecycleComponent, 
                   PortalService, 
  -                Recyclable {
  +                Contextualizable,
  +                Recyclable,
  +                Disposable,
  +                Configurable {
   
  +    protected Context context;
  +    
       protected Map objectModel;
  +   
       protected Map temporaryAttributes = new HashMap();
  -    protected LinkService linkService;
       
       protected ComponentManager manager;
   
  @@ -103,6 +109,10 @@
   
       protected String attributePrefix;
       
  +    protected PortalComponentManager portalComponentManager;
  +    
  +    protected Map portalComponentManagers = new HashMap();
  +    
       public void compose(ComponentManager componentManager) throws 
ComponentException {
           this.manager = componentManager;
       }
  @@ -127,6 +137,10 @@
       public void setPortalName(String value) {
           this.portalName = value;
           this.attributePrefix = this.getClass().getName() + '/' + 
this.portalName + '/';
  +        this.portalComponentManager = (PortalComponentManager) 
this.portalComponentManagers.get(this.portalName);
  +        if ( this.portalComponentManager == null ) {
  +            throw new RuntimeException("Portal '"+this.portalName+"' is not 
configured.");
  +        }
       }
   
       /* (non-Javadoc)
  @@ -135,8 +149,7 @@
       public void recycle() {
           this.portalName = null;
           this.temporaryAttributes.clear();
  -        this.manager.release( this.linkService );
  -        this.linkService = null;
  +        this.portalComponentManager = null;
       }
   
       public Object getAttribute(String key) {
  @@ -194,18 +207,53 @@
           return this.temporaryAttributes.keySet().iterator();
       }
   
  +
       /**
  -     * Get the link service
  +     * Return the component manager for the current portal
  +     */
  +    public PortalComponentManager getComponentManager() {
  +        return this.portalComponentManager;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see 
org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
  +     */
  +    public void contextualize(Context context) throws ContextException {
  +        this.context = context;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.avalon.framework.activity.Disposable#dispose()
  +     */
  +    public void dispose() {
  +        final Iterator i = this.portalComponentManagers.values().iterator();
  +        while ( i.hasNext() ) {
  +            ContainerUtil.dispose( i.next() );
  +        }
  +        this.portalComponentManagers.clear();       
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see 
org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
        */
  -    public LinkService getLinkService() {
  -        if ( null == this.linkService ) {
  +    public void configure(Configuration config) throws 
ConfigurationException {
  +        final Configuration[] portals = 
config.getChild("portals").getChildren("portal");
  +        for(int i=0; i < portals.length; i++ ) {
  +            final Configuration current = portals[i];
  +            final String name = current.getAttribute("name");
               try {
  -                this.linkService = (LinkService)this.manager.lookup( 
LinkService.ROLE);
  -            } catch (ComponentException e) {
  -                throw new CascadingRuntimeException("Unable to lookup link 
service.", e);
  +                PortalComponentManager c = new 
DefaultPortalComponentManager();
  +                this.portalComponentManagers.put( name, c );
  +                ContainerUtil.enableLogging( c, this.getLogger() );
  +                ContainerUtil.contextualize( c, this.context );
  +                ContainerUtil.compose( c, this.manager );
  +                ContainerUtil.configure( c, current );
  +                ContainerUtil.initialize( c );
  +            } catch (Exception e) {
  +                throw new ConfigurationException("Unable to setup new portal 
component manager for portal " + name, e);
               }
  +            
           }
  -        return this.linkService;
       }
   
   }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
  
  Index: DefaultPortalComponentManager.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.impl;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  
  import org.apache.avalon.framework.CascadingRuntimeException;
  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.portal.LinkService;
  import org.apache.cocoon.portal.PortalComponentManager;
  import org.apache.cocoon.portal.coplet.CopletFactory;
  import org.apache.cocoon.portal.layout.LayoutFactory;
  import org.apache.cocoon.portal.layout.renderer.Renderer;
  import org.apache.cocoon.portal.profile.ProfileManager;
  
  /**
   * Default [EMAIL PROTECTED] PortalComponentManager} implementation
   * 
   * @see org.apache.cocoon.portal.PortalComponentManager
   * 
   * TODO Handle non ThreadSafe components
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: DefaultPortalComponentManager.java,v 1.1 2003/07/18 
14:41:46 cziegeler Exp $
   */
  public class DefaultPortalComponentManager
      extends AbstractLogEnabled
      implements PortalComponentManager, Composable, Disposable, ThreadSafe, 
Configurable {
  
      protected ComponentManager manager;
  
      protected LinkService linkService;
  
      protected ProfileManager profileManager;
  
      protected String profileManagerRole;
      
      protected String linkServiceRole;
      
      protected String rendererSelectorRole;
      
      protected ComponentSelector rendererSelector;
      
      protected Map renderers;
      
      protected String copletFactoryRole;
      
      protected String layoutFactoryRole;
      
      protected CopletFactory copletFactory;
      
      protected LayoutFactory layoutFactory;
      
      /* (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;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.portal.PortalComponentManager#getLinkService()
       */
      public LinkService getLinkService() {
          if ( null == this.linkService ) {
              try {
                  this.linkService = (LinkService)this.manager.lookup( 
this.linkServiceRole );
              } catch (ComponentException e) {
                  throw new CascadingRuntimeException("Unable to lookup link 
service with role " + this.linkServiceRole, e);
              }
          }
          return this.linkService;
      }
  
      /* (non-Javadoc)
       * @see 
org.apache.cocoon.portal.PortalComponentManager#getProfileManager()
       */
      public ProfileManager getProfileManager() {
          if ( null == this.profileManager ) {
              try {
                  this.profileManager = (ProfileManager)this.manager.lookup( 
this.profileManagerRole );
              } catch (ComponentException e) {
                  throw new CascadingRuntimeException("Unable to lookup profile 
manager with role " + this.profileManagerRole, e);
              }
          }
          return this.profileManager;
      }
  
      /* (non-Javadoc)
       * @see org.apache.avalon.framework.activity.Disposable#dispose()
       */
      public void dispose() {
          if ( this.manager != null ) {
              if ( this.rendererSelector != null) {
                  Iterator i = this.renderers.values().iterator();
                  while ( i.hasNext() ) {
                      this.rendererSelector.release( (Component) i.next());
                  }
                  this.manager.release( this.rendererSelector );
                  this.rendererSelector = null;
                  this.renderers = null;
              }
              this.manager.release( this.profileManager );
              this.manager.release( this.linkService );
              this.manager = null;
              this.profileManager = null;
              this.linkService = null;
              this.manager.release( (Component)this.copletFactory );
              this.manager.release( (Component)this.layoutFactory );
              this.copletFactory = null;
              this.layoutFactory = null;
          }
  
      }
  
      /* (non-Javadoc)
       * @see 
org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
       */
      public void configure(Configuration config) throws ConfigurationException 
{
          this.profileManagerRole = 
config.getChild("profile-manager").getValue(ProfileManager.ROLE);
          this.linkServiceRole = 
config.getChild("link-service").getValue(LinkService.ROLE);
          this.rendererSelectorRole = 
config.getChild("renderer-selector").getValue(Renderer.ROLE+"Selector");
          this.copletFactoryRole = 
config.getChild("coplet-factory").getValue(CopletFactory.ROLE);
          this.layoutFactoryRole = 
config.getChild("layout-factory").getValue(LayoutFactory.ROLE);
      }
  
      /* (non-Javadoc)
       * @see 
org.apache.cocoon.portal.PortalComponentManager#getRenderer(java.lang.String)
       */
      public Renderer getRenderer(String hint) {
          if ( rendererSelector == null ) {
              try {
                  this.rendererSelector = 
(ComponentSelector)this.manager.lookup( this.rendererSelectorRole );
              } catch (ComponentException e) {
                  throw new CascadingRuntimeException("Unable to lookup 
renderer selector with role " + this.rendererSelectorRole, e);
              }
              this.renderers = new HashMap();
          }
          Renderer o = (Renderer) this.renderers.get( hint );
          if ( o == null ) {
              try {
                  o = (Renderer) this.rendererSelector.select( hint );
                  this.renderers.put( hint, o );
              } catch (ComponentException e) {
                  throw new CascadingRuntimeException("Unable to lookup 
renderer with hint " + hint, e);
              }
          }
          return o;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.portal.PortalComponentManager#getCopletFactory()
       */
      public CopletFactory getCopletFactory() {
          if ( null == this.copletFactory ) {
              try {
                  this.copletFactory = (CopletFactory)this.manager.lookup( 
this.copletFactoryRole);
              } catch (ComponentException e) {
                  throw new CascadingRuntimeException("Unable to lookup coplet 
factory with role " + this.copletFactoryRole, e);
              }
          }
          return this.copletFactory;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.portal.PortalComponentManager#getLayoutFactory()
       */
      public LayoutFactory getLayoutFactory() {
          if ( null == this.layoutFactory ) {
              try {
                  this.layoutFactory = (LayoutFactory)this.manager.lookup( 
this.layoutFactoryRole);
              } catch (ComponentException e) {
                  throw new CascadingRuntimeException("Unable to lookup layout 
factory with role " + this.copletFactoryRole, e);
              }
          }
          return this.layoutFactory;
      }
  
  }
  
  
  
  1.2       +1 -1      
cocoon-2.1/src/blocks/portal/samples/skins/basic/styles/window.xsl
  
  Index: window.xsl
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/samples/skins/basic/styles/window.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- window.xsl        25 Jun 2003 08:23:16 -0000      1.1
  +++ window.xsl        18 Jul 2003 14:41:46 -0000      1.2
  @@ -33,7 +33,7 @@
                        </font>
            </td>
                <td align="right" bgColor="{$bgColor}">
  -                     <xsl:if test="fullscreen-uri">
  +                     <xsl:if test="fullscreen-uri and not(maximize-uri)">
                                <a href="{fullscreen-uri}">
                                    <img src="customize.gif" border="0" 
alt="Full Screen"/>
                                </a>
  
  
  
  1.4       +7 -13     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/components/modules/input/CopletModule.java
  
  Index: CopletModule.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/components/modules/input/CopletModule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CopletModule.java 10 Jul 2003 13:17:03 -0000      1.3
  +++ CopletModule.java 18 Jul 2003 14:41:46 -0000      1.4
  @@ -64,7 +64,6 @@
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.portal.Constants;
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.commons.jxpath.JXPathContext;
   
   /**
  @@ -116,9 +115,10 @@
        */
        public Object getAttribute(String name, Configuration modeConf, Map 
objectModel) 
       throws ConfigurationException {
  -        ProfileManager profileManager = null;
  +        PortalService portalService = null;
           try {
  -            profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  +
  +            portalService = 
(PortalService)this.manager.lookup(PortalService.ROLE);
   
               // determine coplet id
               String copletId = null;            
  @@ -129,20 +129,14 @@
                   copletId = (String)objectModel.get(Constants.COPLET_ID_KEY);
                   
                   // set portal name
  -                PortalService portalService = null;
  -                try {
  -                    portalService = 
(PortalService)this.manager.lookup(PortalService.ROLE);
  -                    
portalService.setPortalName((String)objectModel.get(Constants.PORTAL_NAME_KEY));
  -                } finally {
  -                    this.manager.release(portalService);
  -                }
  +                
portalService.setPortalName((String)objectModel.get(Constants.PORTAL_NAME_KEY));
               }
               
               if (copletId == null) {
                   throw new ConfigurationException("copletId must be passed in 
the object model either directly (e.g. by using ObjectModelAction) or within 
the parent context.");
               }
               
  -            JXPathContext jxpathContext = 
JXPathContext.newContext(profileManager.getCopletInstanceData(copletId));
  +            JXPathContext jxpathContext = 
JXPathContext.newContext(portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId));
               Object value = jxpathContext.getValue(name);
                   
               if (value == null) {
  @@ -154,7 +148,7 @@
           } catch (ComponentException e) {
               throw new ConfigurationException("ComponentException ", e);
           } finally {
  -            this.manager.release(profileManager);
  +            this.manager.release(portalService);
           }
        }
   
  
  
  
  1.7       +11 -11    
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
  
  Index: DefaultCopletFactory.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultCopletFactory.java 14 Jun 2003 17:55:43 -0000      1.6
  +++ DefaultCopletFactory.java 18 Jul 2003 14:41:46 -0000      1.7
  @@ -67,6 +67,7 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.aspect.AspectDataHandler;
   import org.apache.cocoon.portal.aspect.AspectDataStore;
   import org.apache.cocoon.portal.aspect.AspectDescription;
  @@ -76,7 +77,6 @@
   import org.apache.cocoon.portal.coplet.CopletFactory;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
   import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
  -import org.apache.cocoon.portal.profile.ProfileManager;
   
   /**
    * This factory is for creating and managing coplet objects
  @@ -181,14 +181,14 @@
               this.manager.release( adapterSelector );
           }
           
  -        ProfileManager profileManager = null;
  +        PortalService service = null;
           try {
  -            profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  -            profileManager.register(instance);
  +            service = (PortalService)this.manager.lookup(PortalService.ROLE);
  +            
service.getComponentManager().getProfileManager().register(instance);
           } catch (ComponentException ce) {
               throw new ProcessingException("Unable to lookup profile 
manager.", ce);
           } finally {
  -            this.manager.release( profileManager );
  +            this.manager.release( service );
           }
           return instance;
       }
  @@ -283,14 +283,14 @@
                   this.manager.release( adapterSelector );
               }
               
  -            ProfileManager profileManager = null;
  +            PortalService service = null;
               try {
  -                profileManager = 
(ProfileManager)this.manager.lookup(ProfileManager.ROLE);
  -                profileManager.unregister(copletInstanceData);
  +                service = 
(PortalService)this.manager.lookup(PortalService.ROLE);
  +                
service.getComponentManager().getProfileManager().unregister(copletInstanceData);
               } catch (ComponentException ce) {
  -                throw new ProcessingException("Unable to lookup profile 
manager.", ce);
  +                throw new ProcessingException("Unable to lookup portal 
service.", ce);
               } finally {
  -                this.manager.release( profileManager );
  +                this.manager.release( service );
               }
           }
       }
  
  
  

Reply via email to