You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/09/29 22:00:02 UTC
svn commit: r292525 - in /cocoon/blocks: portal-sample/trunk/samples/conf/
portal/trunk/java/org/apache/cocoon/portal/
portal/trunk/java/org/apache/cocoon/portal/acting/
portal/trunk/java/org/apache/cocoon/portal/generation/
portal/trunk/java/org/apach...
Author: cziegeler
Date: Thu Sep 29 12:58:47 2005
New Revision: 292525
URL: http://svn.apache.org/viewcvs?rev=292525&view=rev
Log:
Fix temporary attributes and further simplify configuration
Added:
cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf (with props)
cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf (with props)
Removed:
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/ObjectModelAction.java
Modified:
cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-sample.xconf
cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-tools.xconf
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/generation/PortalGenerator.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles
Added: cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf?rev=292525&view=auto
==============================================================================
--- cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf (added)
+++ cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf Thu Sep 29 12:58:47 2005
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--+
+ | This is the configuration for using CoWarp for authentication.
+ |
+ | SVN $Id$
+ +-->
+<components>
+ <!-- Include CoWarp components. -->
+ <include src="resource://org/osoco/cowarp/roles.xconf"/>
+
+ <!-- This security handler uses OJB and the hsqldb for the authentication: -->
+ <component role="org.osoco.cowarp.SecurityHandler/portal"
+ class="org.apache.cocoon.portal.security.DBSecurityHandler"/>
+ <!-- If you want to use a pipeline for the authentication use this configuration:
+ <component role="org.osoco.cowarp.SecurityHandler/portal"
+ class="org.osoco.cowarp.impl.PipelineSecurityHandler">
+ <authentication-resource>cocoon:raw:/sunrise-authuser</authentication-resource>
+ </component>
+ -->
+ <component role="org.osoco.cowarp.Application/portal"
+ class="org.osoco.cowarp.portal.StandardPortalApplication"
+ security-handler="portal">
+ <profiles>
+ <copletbasedata-global-load uri="cocoon:raw:/load-global-profile?profile=copletbasedata"/>
+ <copletdata-global-load uri="cocoon:raw:/load-global-profile?profile=copletdata"/>
+ <copletdata-role-load uri="cocoon:raw:/load-role-profile?profile=copletdata"/>
+ <copletdata-user-load uri="cocoon:raw:/load-user-profile?profile=copletdata"/>
+ <copletinstancedata-global-load uri="cocoon:raw:/load-global-profile?profile=copletinstancedata"/>
+ <copletinstancedata-role-load uri="cocoon:raw:/load-role-profile?profile=copletinstancedata"/>
+ <copletinstancedata-user-load uri="cocoon:raw:/load-user-profile?profile=copletinstancedata"/>
+ <copletinstancedata-user-save uri="cocoon:raw:/save-user-profile?profile=copletinstancedata"/>
+ <layout-global-load uri="cocoon:raw:/load-global-profile?profile=layout"/>
+ <layout-role-load uri="cocoon:raw:/load-role-profile?profile=layout"/>
+ <layout-user-load uri="cocoon:raw:/load-user-profile?profile=layout"/>
+ <layout-user-save uri="cocoon:raw:/save-user-profile?profile=layout"/>
+ </profiles>
+ </component>
+ <component class="org.apache.cocoon.portal.profile.impl.GroupBasedProfileManager"
+ role="org.apache.cocoon.portal.profile.ProfileManager">
+ <parameter name="userinfo-provider" value="org.osoco.cowarp.portal.UserInfoProviderImpl"/>
+ </component>
+
+</components>
\ No newline at end of file
Propchange: cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/portal-sample/trunk/samples/conf/auth-cowarp.xconf
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf?rev=292525&view=auto
==============================================================================
--- cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf (added)
+++ cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf Thu Sep 29 12:58:47 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--+
+ | This is the configuration for using the authentication framework.
+ | If you use the authentication framework you also have to configure the
+ | authentication manager in the sitemap.
+ |
+ | SVN $Id$
+ +-->
+<components>
+ <component class="org.apache.cocoon.portal.profile.impl.AuthenticationProfileManager"
+ role="org.apache.cocoon.portal.profile.ProfileManager"/>
+</components>
+
Propchange: cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/portal-sample/trunk/samples/conf/auth-fw.xconf
------------------------------------------------------------------------------
svn:keywords = Id
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=292525&r1=292524&r2=292525&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 Thu Sep 29 12:58:47 2005
@@ -37,8 +37,12 @@
<!-- If you don't need WSRP support, you can remove the following include: -->
<include src="resource://org/apache/cocoon/portal/wsrp/portal.roles"/>
- <!-- Include CoWarp components. If you don't use CoWarp you this statement. -->
- <include src="resource://org/osoco/cowarp/roles.xconf"/>
+ <!-- We use CoWarp for authentication. If you don't use CoWarp remove this line: -->
+ <include src="auth-cowarp.xconf"/>
+
+ <!-- If you want to use the authentication-fw use the following include:
+ <include src="auth-fw.xconf"/>
+ -->
<input-modules>
<component-instance name="portalpath"
@@ -47,54 +51,14 @@
</component-instance>
</input-modules>
- <!-- This security handler uses OJB and the hsqldb for the authentication: -->
- <component role="org.osoco.cowarp.SecurityHandler/portal"
- class="org.apache.cocoon.portal.security.DBSecurityHandler"/>
- <!-- If you want to use a pipeline for the authentication use this configuration:
- <component role="org.osoco.cowarp.SecurityHandler/portal"
- class="org.osoco.cowarp.impl.PipelineSecurityHandler">
- <authentication-resource>cocoon:raw:/sunrise-authuser</authentication-resource>
- </component>
- -->
- <component role="org.osoco.cowarp.Application/portal"
- class="org.osoco.cowarp.portal.StandardPortalApplication"
- security-handler="portal">
- <profiles>
- <copletbasedata-global-load uri="cocoon:raw:/load-global-profile?profile=copletbasedata"/>
- <copletdata-global-load uri="cocoon:raw:/load-global-profile?profile=copletdata"/>
- <copletdata-role-load uri="cocoon:raw:/load-role-profile?profile=copletdata"/>
- <copletdata-user-load uri="cocoon:raw:/load-user-profile?profile=copletdata"/>
- <copletinstancedata-global-load uri="cocoon:raw:/load-global-profile?profile=copletinstancedata"/>
- <copletinstancedata-role-load uri="cocoon:raw:/load-role-profile?profile=copletinstancedata"/>
- <copletinstancedata-user-load uri="cocoon:raw:/load-user-profile?profile=copletinstancedata"/>
- <copletinstancedata-user-save uri="cocoon:raw:/save-user-profile?profile=copletinstancedata"/>
- <layout-global-load uri="cocoon:raw:/load-global-profile?profile=layout"/>
- <layout-role-load uri="cocoon:raw:/load-role-profile?profile=layout"/>
- <layout-user-load uri="cocoon:raw:/load-user-profile?profile=layout"/>
- <layout-user-save uri="cocoon:raw:/save-user-profile?profile=layout"/>
- </profiles>
- </component>
- <component class="org.apache.cocoon.portal.profile.impl.GroupBasedProfileManager"
- role="org.apache.cocoon.portal.profile.ProfileManager/Cowarp">
- <parameter name="userinfo-provider" value="org.osoco.cowarp.portal.UserInfoProviderImpl"/>
- </component>
-
<portal-service>
<portal name="portal">
- <!-- This is the sample portal:
- - we use the cowarp profile manager
- -->
- <profile-manager>org.apache.cocoon.portal.profile.ProfileManager/Cowarp</profile-manager>
- <!-- If you want to use the authentication framework, comment out the above line
- and uncomment the following line:
- <profile-manager>org.apache.cocoon.portal.profile.ProfileManager/Auth</profile-manager>
- -->
<!-- These are the skins the user can choose from: -->
<skins>
- <skin name="basic" base-path="context://samples/blocks/portal-sample/skins/basic">
+ <skin name="basic" base-path="skins/basic">
<thumbnail-path>images/thumb.jpg</thumbnail-path>
</skin>
- <skin name="common" base-path="context://samples/blocks/portal-sample/skins/common">
+ <skin name="common" base-path="skins/common">
<thumbnail-path>images/thumb.jpg</thumbnail-path>
</skin>
</skins>
@@ -177,10 +141,6 @@
<parameter name="defaultSecurePort" value="443"/>
</portal-link-service>
- <component class="org.apache.cocoon.portal.profile.impl.AuthenticationProfileManager"
- role="org.apache.cocoon.portal.profile.ProfileManager/Auth"/>
-
-
<!-- Renderer configuration -->
<component class="org.apache.cocoon.core.container.DefaultServiceSelector"
role="org.apache.cocoon.portal.layout.renderer.RendererSelector">
@@ -369,8 +329,7 @@
</component>
<!-- Layout factory configuration -->
- <component class="org.apache.cocoon.portal.layout.impl.DefaultLayoutFactory"
- role="org.apache.cocoon.portal.layout.LayoutFactory">
+ <portal-layout-factory>
<layouts>
<layout name="column"
class="org.apache.cocoon.portal.layout.impl.CompositeLayoutImpl">
@@ -448,11 +407,10 @@
</aspects>
</layout>
</layouts>
- </component>
+ </portal-layout-factory>
<!-- Coplet factory configuration -->
- <component class="org.apache.cocoon.portal.coplet.impl.DefaultCopletFactory"
- role="org.apache.cocoon.portal.coplet.CopletFactory">
+ <portal-coplet-factory>
<coplets>
<coplet name="standard"
class="org.apache.cocoon.portal.coplet.CopletData">
@@ -471,7 +429,7 @@
</coplet-instance-data-aspects>
</coplet>
</coplets>
- </component>
+ </portal-coplet-factory>
<!-- This is the basket manager -->
<component class="org.apache.cocoon.portal.coplets.basket.BasketManagerImpl"
Modified: cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-tools.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-tools.xconf?rev=292525&r1=292524&r2=292525&view=diff
==============================================================================
--- cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-tools.xconf (original)
+++ cocoon/blocks/portal-sample/trunk/samples/conf/cocoon-portal-tools.xconf Thu Sep 29 12:58:47 2005
@@ -22,7 +22,7 @@
<component class="org.apache.cocoon.portal.tools.PortalToolManager"
role="org.apache.cocoon.portal.tools.PortalToolManager">
- <parameter name="root" value="context://samples/blocks/portal-sample/tools/"/>
+ <parameter name="root" value="tools/"/>
<parameter name="conf" value="conf.xml"/>
<parameter name="auth" value="auth.xml"/>
</component>
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/generation/PortalGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/generation/PortalGenerator.java?rev=292525&r1=292524&r2=292525&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/generation/PortalGenerator.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/generation/PortalGenerator.java Thu Sep 29 12:58:47 2005
@@ -66,7 +66,7 @@
this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
}
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.generation.Generator#generate()
*/
public void generate()
@@ -79,7 +79,7 @@
pm.showPortal(this.xmlConsumer, this.parameters);
}
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
*/
public void setup(SourceResolver resolver,
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java?rev=292525&r1=292524&r2=292525&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java Thu Sep 29 12:58:47 2005
@@ -21,14 +21,10 @@
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.core.Core;
@@ -43,11 +39,7 @@
import org.apache.cocoon.portal.profile.ProfileManager;
/**
- * Default {@link PortalComponentManager} implementation
- *
- * @see org.apache.cocoon.portal.PortalComponentManager
- *
- * TODO Handle non ThreadSafe components
+ * Default {@link PortalComponentManager} implementation.
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
*
@@ -55,7 +47,7 @@
*/
public class DefaultPortalComponentManager
extends AbstractLogEnabled
- implements PortalComponentManager, Serviceable, Disposable, ThreadSafe, Configurable {
+ implements PortalComponentManager, Serviceable, Disposable, ThreadSafe {
/** The avalon component manager */
protected ServiceManager manager;
@@ -63,27 +55,18 @@
/** The portal service */
protected final PortalService portalService;
- protected String profileManagerRole;
protected ProfileManager profileManager;
- protected String linkServiceRole;
protected LinkService linkService;
- protected String rendererSelectorRole;
- protected ServiceSelector rendererSelector;
-
- protected Map renderers;
+ protected Map renderers = new HashMap();
- protected String copletFactoryRole;
protected CopletFactory copletFactory;
- protected String layoutFactoryRole;
protected LayoutFactory layoutFactory;
- protected String eventManagerRole;
protected EventManager eventManager;
- protected String portalManagerRole;
protected PortalManager portalManager;
protected final Context context;
@@ -112,62 +95,58 @@
this.core = (Core)this.manager.lookup(Core.ROLE);
}
- /* (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 );
+ this.linkService = (LinkService)this.manager.lookup( LinkService.ROLE );
} catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup link service with role " + this.linkServiceRole, e);
+ throw new CascadingRuntimeException("Unable to lookup link service.", 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 );
+ this.profileManager = (ProfileManager)this.manager.lookup( ProfileManager.ROLE );
} catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup profile manager with role " + this.profileManagerRole, e);
+ throw new CascadingRuntimeException("Unable to lookup profile manager.", e);
}
}
return this.profileManager;
}
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.portal.PortalComponentManager#getEventManager()
*/
public EventManager getEventManager() {
if ( null == this.eventManager ) {
try {
- this.eventManager = (EventManager)this.manager.lookup( this.eventManagerRole );
+ this.eventManager = (EventManager)this.manager.lookup( EventManager.ROLE );
} catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup event manager with role " + this.eventManagerRole, e);
+ throw new CascadingRuntimeException("Unable to lookup event manager.", e);
}
}
return this.eventManager;
}
- /* (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(i.next());
- }
- this.manager.release(this.rendererSelector);
- this.rendererSelector = null;
- this.renderers = null;
+ Iterator i = this.renderers.values().iterator();
+ while (i.hasNext()) {
+ this.manager.release(i.next());
}
+ this.renderers.clear();
this.manager.release(this.profileManager);
this.profileManager = null;
this.manager.release(this.linkService);
@@ -186,35 +165,14 @@
}
}
- /* (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);
- this.eventManagerRole = config.getChild("event-manager").getValue(EventManager.ROLE);
- this.portalManagerRole = config.getChild("portal-manager").getValue(PortalManager.ROLE);
- }
-
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.portal.PortalComponentManager#getRenderer(java.lang.String)
*/
public Renderer getRenderer(String hint) {
- if ( rendererSelector == null ) {
- try {
- this.rendererSelector = (ServiceSelector)this.manager.lookup( this.rendererSelectorRole );
- } catch (ServiceException 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 );
+ o = (Renderer) this.manager.lookup( Renderer.ROLE + '/' + hint );
this.renderers.put( hint, o );
} catch (ServiceException e) {
throw new CascadingRuntimeException("Unable to lookup renderer with hint " + hint, e);
@@ -223,29 +181,29 @@
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);
+ this.copletFactory = (CopletFactory)this.manager.lookup( CopletFactory.ROLE );
} catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup coplet factory with role " + this.copletFactoryRole, e);
+ throw new CascadingRuntimeException("Unable to lookup coplet factory.", 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);
+ this.layoutFactory = (LayoutFactory)this.manager.lookup( LayoutFactory.ROLE );
} catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup layout factory with role " + this.layoutFactoryRole, e);
+ throw new CascadingRuntimeException("Unable to lookup layout factory.", e);
}
}
return this.layoutFactory;
@@ -257,9 +215,9 @@
public PortalManager getPortalManager() {
if ( null == this.portalManager ) {
try {
- this.portalManager = (PortalManager)this.manager.lookup( this.portalManagerRole);
+ this.portalManager = (PortalManager)this.manager.lookup( PortalManager.ROLE );
} catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup portal manager with role " + this.portalManagerRole, e);
+ throw new CascadingRuntimeException("Unable to lookup portal manager.", e);
}
}
return this.portalManager;
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=292525&r1=292524&r2=292525&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 Thu Sep 29 12:58:47 2005
@@ -18,7 +18,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -39,12 +38,15 @@
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;
import org.apache.cocoon.portal.layout.SkinDescription;
import org.apache.cocoon.servlet.CocoonServlet;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
/**
* Default implementation of a portal service using a session to store
@@ -64,20 +66,25 @@
Disposable,
Configurable {
+ /** The component context. */
protected Context context;
-
+
+ /** The service locator. */
protected ServiceManager manager;
+ /** The manager for some core portal components. */
protected PortalComponentManager portalComponentManager;
-
+
+ /** The list of skins. */
protected List skinList = new ArrayList();
+ /** The name of the portal. */
protected String portalName;
+ /** The default layout key. */
protected String defaultLayoutKey;
- protected final Map temporaryAttributes = new HashMap();
-
+ /** The attribute prefix used to prefix attributes in the session and request. */
protected String attributePrefix;
final protected static String KEY = PortalServiceImpl.class.getName();
@@ -156,28 +163,47 @@
* @see org.apache.cocoon.portal.PortalService#getTemporaryAttribute(java.lang.String)
*/
public Object getTemporaryAttribute(String key) {
- return this.temporaryAttributes.get( key );
+ final Request request = ContextHelper.getRequest(this.context);
+ return request.getAttribute(this.attributePrefix + key);
}
/**
* @see org.apache.cocoon.portal.PortalService#setTemporaryAttribute(java.lang.String, java.lang.Object)
*/
public void setTemporaryAttribute(String key, Object value) {
- this.temporaryAttributes.put( key, value );
+ final Request request = ContextHelper.getRequest(this.context);
+ request.setAttribute( this.attributePrefix + key, value );
}
/**
* @see org.apache.cocoon.portal.PortalService#removeTemporaryAttribute(java.lang.String)
*/
public Object removeTemporaryAttribute(String key) {
- return this.temporaryAttributes.remove( key );
+ final Request request = ContextHelper.getRequest(this.context);
+ final Object oldValue = request.getAttribute(this.attributePrefix + key);
+ if ( oldValue != null ) {
+ request.removeAttribute( this.attributePrefix + key );
+ }
+ return oldValue;
}
/**
* @see org.apache.cocoon.portal.PortalService#getTemporaryAttributeNames()
*/
public Iterator getTemporaryAttributeNames() {
- return this.temporaryAttributes.keySet().iterator();
+ final Request request = ContextHelper.getRequest(this.context);
+ List names = new ArrayList();
+ Enumeration e = request.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();
}
/**
@@ -229,7 +255,9 @@
this.portalName = portal.getAttribute("name");
this.defaultLayoutKey = portal.getAttribute("default-layout-key", "portal");
this.attributePrefix = this.getClass().getName() + '/' + this.portalName + '/';
+ SourceResolver resolver = null;
try {
+ resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
PortalComponentManager c = new DefaultPortalComponentManager(this, this.context);
this.portalComponentManager = c;
ContainerUtil.enableLogging( c, this.getLogger() );
@@ -246,7 +274,13 @@
final String skinName = currentSkin.getAttribute("name");
final SkinDescription desc = new SkinDescription();
desc.setName(skinName);
- desc.setBasePath(currentSkin.getAttribute("base-path"));
+ Source source = null;
+ try {
+ source = resolver.resolveURI(currentSkin.getAttribute("base-path"));
+ desc.setBasePath(source.getURI());
+ } finally {
+ resolver.release(source);
+ }
desc.setThumbnailPath(currentSkin.getChild("thumbnail-path").getValue(null));
this.skinList.add(desc);
}
@@ -255,6 +289,8 @@
throw ce;
} catch (Exception e) {
throw new ConfigurationException("Unable to setup new portal component manager for portal " + this.portalName, e);
+ } finally {
+ this.manager.release(resolver);
}
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles?rev=292525&r1=292524&r2=292525&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles Thu Sep 29 12:58:47 2005
@@ -276,4 +276,19 @@
default-class="org.apache.cocoon.portal.impl.DefaultLinkService"
shorthand="portal-link-service"/>
+ <!--+
+ | Layout Factory.
+ |
+ +-->
+ <role name="org.apache.cocoon.portal.layout.LayoutFactory"
+ default-class="org.apache.cocoon.portal.layout.impl.DefaultLayoutFactory"
+ shorthand="portal-layout-factory"/>
+
+ <!--+
+ | Coplet Factory.
+ |
+ +-->
+ <role name="org.apache.cocoon.portal.coplet.CopletFactory"
+ default-class="org.apache.cocoon.portal.coplet.impl.DefaultCopletFactory"
+ shorthand="portal-coplet-factory"/>
</role-list>