Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 40391 invoked from network); 28 Sep 2005 19:45:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Sep 2005 19:45:24 -0000 Received: (qmail 82157 invoked by uid 500); 28 Sep 2005 19:45:20 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 82126 invoked by uid 500); 28 Sep 2005 19:45:20 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 82113 invoked by uid 99); 28 Sep 2005 19:45:20 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 28 Sep 2005 12:45:19 -0700 Received: (qmail 39805 invoked by uid 65534); 28 Sep 2005 19:44:58 -0000 Message-ID: <20050928194458.39791.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r292281 - in /cocoon: blocks/portal-sample/trunk/ blocks/portal-sample/trunk/samples/ blocks/portal-sample/trunk/samples/conf/ blocks/portal/trunk/ blocks/portal/trunk/java/org/apache/cocoon/portal/ blocks/portal/trunk/java/org/apache/cocoo... Date: Wed, 28 Sep 2005 19:44:53 -0000 To: cvs@cocoon.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Wed Sep 28 12:44:06 2005 New Revision: 292281 URL: http://svn.apache.org/viewcvs?rev=292281&view=rev Log: Update to CoWarp 0.4 Make use of per sitemap components and simplify component handling Added: cocoon/trunk/legal/cowarp-0.4.jar.license.txt - copied unchanged from r292229, cocoon/trunk/legal/cowarp-0.3.jar.license.txt cocoon/trunk/lib/optional/cowarp-0.4.jar (with props) Removed: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/PreparePortalAction.java cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceInfo.java cocoon/trunk/legal/cowarp-0.3.jar.license.txt cocoon/trunk/lib/optional/cowarp-0.3.jar Modified: cocoon/blocks/portal-sample/trunk/pom.xml cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf cocoon/blocks/portal-sample/trunk/samples/sitemap.xmap cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/Constants.java cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalService.java cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java cocoon/blocks/portal/trunk/pom.xml cocoon/trunk/lib/jars.xml Modified: cocoon/blocks/portal-sample/trunk/pom.xml URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/pom.xml?rev=292281&r1=292280&r2=292281&view=diff ============================================================================== --- cocoon/blocks/portal-sample/trunk/pom.xml (original) +++ cocoon/blocks/portal-sample/trunk/pom.xml Wed Sep 28 12:44:06 2005 @@ -68,7 +68,7 @@ cowarp cowarp - 0.3 + 0.4 Modified: cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf?rev=292281&r1=292280&r2=292281&view=diff ============================================================================== --- cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf (original) +++ cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf Wed Sep 28 12:44:06 2005 @@ -37,6 +37,9 @@ + + + @@ -44,8 +47,6 @@ - @@ -79,27 +80,25 @@ - - - - org.apache.cocoon.portal.profile.ProfileManager/Cowarp - - - - - images/thumb.jpg - - - images/thumb.jpg - - - - + + + org.apache.cocoon.portal.profile.ProfileManager/Cowarp + + + + + images/thumb.jpg + + + images/thumb.jpg + + + + + @@ -60,17 +63,8 @@ - - - - - @@ -96,16 +90,6 @@ - - - - - - - Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/Constants.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/Constants.java?rev=292281&r1=292280&r2=292281&view=diff ============================================================================== --- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/Constants.java (original) +++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/Constants.java Wed Sep 28 12:44:06 2005 @@ -20,7 +20,7 @@ * * @author Björn Lütkemeier * - * @version CVS $Id: Constants.java,v 1.3 2004/03/05 13:02:08 bdelacretaz Exp $ + * @version CVS $Id$ */ public class Constants { Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalService.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalService.java?rev=292281&r1=292280&r2=292281&view=diff ============================================================================== --- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalService.java (original) +++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/PortalService.java Wed Sep 28 12:44:06 2005 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2002,2004 The Apache Software Foundation. + * Copyright 1999-2002,2004-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,55 +43,53 @@ */ String getPortalName(); - void setPortalName(String value); - /** - * Return the value of an attribute + * 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 + * Set an attribute. * @param key The key of the attribute * @param value The new value */ void setAttribute(String key, Object value); /** - * Remove an attribute + * Remove an attribute. * @param key The key of the attribute */ - void removeAttribute(String key); + Object removeAttribute(String key); /** - * Return the names of all attributes + * Return the names of all attributes. */ Iterator getAttributeNames(); /** - * Return the value of a temporary attribute + * 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 + * 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 + * Remove a temporary attribute. * @param key The key of the attribute */ - void removeTemporaryAttribute(String key); + Object removeTemporaryAttribute(String key); /** - * Return the names of all temporary attributes + * Return the names of all temporary attributes. */ Iterator getTemporaryAttributeNames(); Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?rev=292281&r1=292280&r2=292281&view=diff ============================================================================== --- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java (original) +++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java Wed Sep 28 12:44:06 2005 @@ -16,6 +16,8 @@ package org.apache.cocoon.portal.impl; import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -37,7 +39,7 @@ import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.components.ContextHelper; -import org.apache.cocoon.environment.Request; +import org.apache.cocoon.environment.Session; import org.apache.cocoon.portal.PortalComponentManager; import org.apache.cocoon.portal.PortalService; import org.apache.cocoon.portal.layout.Layout; @@ -66,12 +68,18 @@ protected ServiceManager manager; - protected Map portalComponentManagers = new HashMap(); + protected PortalComponentManager portalComponentManager; - protected Map portalConfigurations = new HashMap(); - - protected Map skins = new HashMap(); + protected List skinList = new ArrayList(); + + protected String portalName; + + protected String defaultLayoutKey; + + protected final Map temporaryAttributes = new HashMap(); + protected String attributePrefix; + final protected static String KEY = PortalServiceImpl.class.getName(); /** @@ -81,92 +89,102 @@ this.manager = serviceManager; } - protected PortalServiceInfo getInfo() { - final Request request = ContextHelper.getRequest( this.context ); - PortalServiceInfo info = (PortalServiceInfo) request.getAttribute(KEY, Request.GLOBAL_SCOPE); - if ( info == null ) { - info = new PortalServiceInfo(); - info.setup(ContextHelper.getObjectModel(this.context), this.portalComponentManagers); - request.setAttribute(KEY, info, Request.GLOBAL_SCOPE); - } - return info; - } - /** * @see org.apache.cocoon.portal.PortalService#getPortalName() */ public String getPortalName() { - return this.getInfo().getPortalName(); - } - - /** - * @see org.apache.cocoon.portal.PortalService#setPortalName(java.lang.String) - */ - public void setPortalName(String value) { - this.getInfo().setPortalName(value); + return this.portalName; } /** * @see org.apache.cocoon.portal.PortalService#getAttribute(java.lang.String) */ public Object getAttribute(String key) { - return this.getInfo().getAttribute(key); + final Session session = ContextHelper.getRequest(this.context).getSession(false); + if (session == null) { + return null; + } + return session.getAttribute( this.attributePrefix + key); } /** * @see org.apache.cocoon.portal.PortalService#setAttribute(java.lang.String, java.lang.Object) */ public void setAttribute(String key, Object value) { - this.getInfo().setAttribute(key, value); + final Session session = ContextHelper.getRequest(this.context).getSession(); + session.setAttribute( this.attributePrefix + key, value); } /** * @see org.apache.cocoon.portal.PortalService#removeAttribute(java.lang.String) */ - public void removeAttribute(String key) { - this.getInfo().removeAttribute(key); + public Object removeAttribute(String key) { + final Session session = ContextHelper.getRequest(this.context).getSession(false); + if ( session != null ) { + Object value = session.getAttribute(this.attributePrefix + key); + if ( value != null ) { + session.removeAttribute( this.attributePrefix + key ); + } + return value; + } + return null; } /** * @see org.apache.cocoon.portal.PortalService#getAttributeNames() */ public Iterator getAttributeNames() { - return this.getInfo().getAttributeNames(); + final Session session = ContextHelper.getRequest(this.context).getSession(false); + if ( session != null ) { + List names = new ArrayList(); + Enumeration e = session.getAttributeNames(); + final int pos = this.attributePrefix.length() + 1; + if ( e != null ) { + while ( e.hasMoreElements() ) { + final String name = (String)e.nextElement(); + if ( name.startsWith( this.attributePrefix )) { + names.add( name.substring( pos ) ); + } + } + } + return names.iterator(); + } + return Collections.EMPTY_MAP.keySet().iterator(); } /** * @see org.apache.cocoon.portal.PortalService#getTemporaryAttribute(java.lang.String) */ public Object getTemporaryAttribute(String key) { - return this.getInfo().getTemporaryAttribute(key); + return this.temporaryAttributes.get( key ); } /** * @see org.apache.cocoon.portal.PortalService#setTemporaryAttribute(java.lang.String, java.lang.Object) */ public void setTemporaryAttribute(String key, Object value) { - this.getInfo().setTemporaryAttribute(key, value); + this.temporaryAttributes.put( key, value ); } /** * @see org.apache.cocoon.portal.PortalService#removeTemporaryAttribute(java.lang.String) */ - public void removeTemporaryAttribute(String key) { - this.getInfo().removeTemporaryAttribute(key); + public Object removeTemporaryAttribute(String key) { + return this.temporaryAttributes.remove( key ); } /** * @see org.apache.cocoon.portal.PortalService#getTemporaryAttributeNames() */ public Iterator getTemporaryAttributeNames() { - return this.getInfo().getTemporaryAttributeNames(); + return this.temporaryAttributes.keySet().iterator(); } /** * @see org.apache.cocoon.portal.PortalService#getComponentManager() */ public PortalComponentManager getComponentManager() { - return this.getInfo().getComponentManager(); + return this.portalComponentManager; } /** @@ -190,13 +208,8 @@ * @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(); - this.portalConfigurations.clear(); - // remove the portal service to the servlet context - if available + ContainerUtil.dispose( this.portalComponentManager ); + // remove the portal service from the servlet context - if available try { final ServletConfig servletConfig = (ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); servletConfig.getServletContext().removeAttribute(PortalService.ROLE); @@ -209,40 +222,39 @@ * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ 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 { - PortalComponentManager c = new DefaultPortalComponentManager(this, this.context); - this.portalComponentManagers.put( name, c ); - ContainerUtil.enableLogging( c, this.getLogger() ); - ContainerUtil.contextualize( c, this.context ); - ContainerUtil.service( c, this.manager ); - ContainerUtil.configure( c, current ); - ContainerUtil.initialize( c ); - - this.portalConfigurations.put( name, current ); - - // scan for skins - final List skinList = new ArrayList(); - this.skins.put(name, skinList); - final Configuration[] skinConfs = current.getChild("skins").getChildren("skin"); - if ( skinConfs != null ) { - for(int s=0;s cowarp cowarp - 0.3 + 0.4 Modified: cocoon/trunk/lib/jars.xml URL: http://svn.apache.org/viewcvs/cocoon/trunk/lib/jars.xml?rev=292281&r1=292280&r2=292281&view=diff ============================================================================== --- cocoon/trunk/lib/jars.xml (original) +++ cocoon/trunk/lib/jars.xml Wed Sep 28 12:44:06 2005 @@ -1086,7 +1086,7 @@ with special support for the portal. Portal - optional/cowarp-0.3.jar + optional/cowarp-0.4.jar http://osoco.sourceforge.net/cowarp/ Added: cocoon/trunk/lib/optional/cowarp-0.4.jar URL: http://svn.apache.org/viewcvs/cocoon/trunk/lib/optional/cowarp-0.4.jar?rev=292281&view=auto ============================================================================== Binary file - no diff available. Propchange: cocoon/trunk/lib/optional/cowarp-0.4.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream