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 2007/03/08 16:58:34 UTC
svn commit: r516084 - in /cocoon/trunk/blocks/cocoon-portal:
cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/
cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/
cocoon-portal-impl/src/main/java/org/a...
Author: cziegeler
Date: Thu Mar 8 07:58:32 2007
New Revision: 516084
URL: http://svn.apache.org/viewvc?view=rev&rev=516084
Log:
Migrate coplet adapter from avalon to spring
Removed:
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/NewPageLabelEventConverter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PageLabelManager.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPRequestProcessorAspect.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/resources/org/apache/cocoon/portal/wsrp/cocoon-portal-wsrp-components.xml
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/resources/org/apache/cocoon/portal/wsrp/portal-wsrp.roles
Modified:
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortletAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverRegistryImpl.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/URLGeneratorImpl.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProvider.java
cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProviderImpl.java
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/CopletAdapter.java Thu Mar 8 07:58:32 2007
@@ -25,7 +25,7 @@
* This is the "portlet" implementation.
* A coplet adapter is the interface between the portal engine and
* the implementation of a coplet.
- * Usually there is only one instance of an adapter (= singleton).
+ * Usually there is only one instance of an adapter (= singleton).
* Whenever an instance of this coplet is rendered, the
* adapter is invoked to render the coplet.
*
@@ -55,8 +55,6 @@
* @version $Id$
*/
public interface CopletAdapter {
-
- String ROLE = CopletAdapter.class.getName();
/**
* Initialize the coplet definition.
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java Thu Mar 8 07:58:32 2007
@@ -23,8 +23,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.Cache;
import org.apache.cocoon.caching.CachedResponse;
@@ -38,7 +36,7 @@
import org.apache.cocoon.portal.om.CopletDefinition;
import org.apache.cocoon.portal.om.CopletInstance;
import org.apache.cocoon.portal.om.CopletInstanceFeatures;
-import org.apache.cocoon.portal.util.AbstractComponent;
+import org.apache.cocoon.portal.util.AbstractBean;
import org.apache.cocoon.util.NetUtils;
import org.apache.cocoon.xml.SaxBuffer;
import org.apache.cocoon.xml.XMLUtils;
@@ -54,7 +52,7 @@
* implementation. It already provides several base features which can
* be used by sub classes.
*
- * This adapter adds a caching mechanism. The result of the called coplet is cached until a
+ * This adapter adds a caching mechanism. The result of the called coplet is cached until a
* {@link org.apache.cocoon.portal.event.CopletInstanceEvent} for that coplet instance
* is received. The content can eiter be cached in the user session or globally. The default
* is the user session.
@@ -64,7 +62,7 @@
* <tr>
* <th>buffer</th>
* <td>Shall the content of the coplet be buffered? If a coplet is
- * buffered, errors local to the coplet are caught and a not
+ * buffered, errors local to the coplet are caught and a not
* availability notice is delivered instead. Buffering does not
* cache responses for subsequent requests.</td>
* <td></td>
@@ -91,7 +89,7 @@
* <th>ignore-sizing-events</th>
* <td>
* The cached content of a coplet is invalidated if an event for this coplet is received.
- * If sizing events should be ignored, turn on this configuration.
+ * If sizing events should be ignored, turn on this configuration.
* </td>
* <td></td>
* <td>boolean</td>
@@ -131,14 +129,14 @@
*
* @version $Id$
*/
-public abstract class AbstractCopletAdapter
- extends AbstractComponent
+public abstract class AbstractCopletAdapter
+ extends AbstractBean
implements CopletAdapter, Receiver {
/** The configuration name for buffering. */
public static final String CONFIGURATION_BUFFERING = "buffer";
- /** The configuration name for timeout. */
+ /** The configuration name for timeout. */
public static final String CONFIGURATION_TIMEOUT = "timeout";
/** The configuration name for enabling/disabling the cache. */
@@ -162,33 +160,19 @@
/** This temporary attribute can be set on the instance to not cache the current response. */
public static final String DO_NOT_CACHE = "doNotCache";
-
+
/** The cache to use for global caching. */
protected Cache cache;
/** The runnable manager for starting background tasks. */
protected RunnableManager runnableManager;
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager aManager) throws ServiceException {
- super.service(aManager);
- this.cache = (Cache)this.manager.lookup(Cache.ROLE);
- this.runnableManager = (RunnableManager)this.manager.lookup( RunnableManager.ROLE );
+ public void setCache(Cache cache) {
+ this.cache = cache;
}
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if ( this.manager != null ) {
- this.manager.release(this.cache);
- this.cache = null;
- this.manager.release(this.runnableManager);
- this.runnableManager = null;
- }
- super.dispose();
+ public void setRunnableManager(RunnableManager runnableManager) {
+ this.runnableManager = runnableManager;
}
/**
@@ -224,9 +208,9 @@
/**
* Implement this and not toSAX().
*/
- public abstract void streamContent(CopletInstance coplet,
- ContentHandler contentHandler)
- throws SAXException;
+ protected abstract void streamContent(CopletInstance coplet,
+ ContentHandler contentHandler)
+ throws SAXException;
/**
* This method streams the content of a coplet instance data.
@@ -263,7 +247,7 @@
}
error = loader.exception;
if ( error != null && this.getLogger().isWarnEnabled() ) {
- this.getLogger().warn("Unable to get content of coplet: " + coplet.getId(), error);
+ this.getLogger().warn("Unable to get content of coplet: " + coplet.getId(), error);
}
} else {
this.streamContentAndCache( coplet, buffer );
@@ -274,7 +258,7 @@
this.getLogger().error("Unable to get content of coplet: " + coplet.getId(), exception);
} catch (Throwable t ) {
error = new ProcessingException("Unable to get content of coplet: " + coplet.getId(), t);
- this.getLogger().error("Unable to get content of coplet: " + coplet.getId(), t);
+ this.getLogger().error("Unable to get content of coplet: " + coplet.getId(), t);
}
if ( read ) {
@@ -286,7 +270,7 @@
XMLUtils.startElement( contentHandler, "p");
XMLUtils.data( contentHandler, "The coplet " + coplet.getId() + " is currently not available.");
XMLUtils.endElement(contentHandler, "p");
- contentHandler.endDocument();
+ contentHandler.endDocument();
}
}
} else {
@@ -329,11 +313,11 @@
coplet.removeTemporaryAttribute(DO_NOT_CACHE);
if ( cacheGlobal ) {
final String key = this.getCacheKey(coplet);
- this.cache.remove(key);
+ this.cache.remove(key);
} else {
coplet.removeTemporaryAttribute(CACHE);
}
- this.streamContent(coplet, contentHandler);
+ this.streamContent(coplet, contentHandler);
} else {
XMLByteStreamCompiler bc = new XMLByteStreamCompiler();
@@ -426,7 +410,7 @@
* @return True if the error content has been rendered, otherwise false
* @throws SAXException
*/
- protected boolean renderErrorContent(CopletInstance coplet,
+ protected boolean renderErrorContent(CopletInstance coplet,
ContentHandler handler,
Exception error)
throws SAXException {
@@ -529,7 +513,7 @@
}
}
}
- return buffer.toString();
+ return buffer.toString();
}
}
@@ -541,7 +525,7 @@
private final CountDown finished;
Exception exception;
- public LoaderThread(AbstractCopletAdapter adapter,
+ public LoaderThread(AbstractCopletAdapter adapter,
CopletInstance coplet,
ContentHandler handler) {
this.adapter = adapter;
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java Thu Mar 8 07:58:32 2007
@@ -21,8 +21,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.notification.Notifying;
import org.apache.cocoon.components.notification.NotifyingBuilder;
@@ -41,24 +39,26 @@
*
* @version $Id$
*/
-public class URICopletAdapter
+public class URICopletAdapter
extends AbstractCopletAdapter {
/** The source resolver */
protected SourceResolver resolver;
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager aManager) throws ServiceException {
- super.service( aManager );
- this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+ protected NotifyingBuilder notifyingBuilder;
+
+ public void setSourceResolver(SourceResolver resolver) {
+ this.resolver = resolver;
+ }
+
+ public void setNotifyingBuilder(NotifyingBuilder notifyingBuilder) {
+ this.notifyingBuilder = notifyingBuilder;
}
/**
* @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#streamContent(org.apache.cocoon.portal.om.CopletInstance, org.xml.sax.ContentHandler)
*/
- public void streamContent(CopletInstance coplet, ContentHandler contentHandler)
+ protected void streamContent(CopletInstance coplet, ContentHandler contentHandler)
throws SAXException {
final String uri = (String)coplet.getCopletDefinition().getAttribute("uri");
if ( uri == null ) {
@@ -67,7 +67,7 @@
this.streamContent( coplet, uri, contentHandler);
}
- protected void streamContent(final CopletInstance coplet,
+ protected void streamContent(final CopletInstance coplet,
final String uri,
final ContentHandler contentHandler)
throws SAXException {
@@ -86,7 +86,7 @@
if ( list.contains( coplet )) {
// add parameters
if ( uri.startsWith("cocoon:raw:") ) {
- sourceUri = "cocoon:" + uri.substring(11);
+ sourceUri = "cocoon:" + uri.substring(11);
}
} else {
// remove parameters
@@ -115,17 +115,6 @@
}
/**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if ( this.manager != null ) {
- this.manager.release( this.resolver );
- this.resolver = null;
- }
- super.dispose();
- }
-
- /**
* Render the error content for a coplet
* @param coplet The coplet instance data
* @param handler The content handler
@@ -133,7 +122,7 @@
* @return True if the error content has been rendered, otherwise false
* @throws SAXException
*/
- protected boolean renderErrorContent(CopletInstance coplet,
+ protected boolean renderErrorContent(CopletInstance coplet,
ContentHandler handler,
Exception error)
throws SAXException {
@@ -143,22 +132,16 @@
// and use directly the error-uri from now on
if ( uri.startsWith("cocoon:") && error != null) {
- // Create a Notifying
- NotifyingBuilder notifyingBuilder = null;
+ // Create a Notifying object - if builder is set
Notifying currentNotifying = null;
- try {
- notifyingBuilder= (NotifyingBuilder)this.manager.lookup(NotifyingBuilder.ROLE);
+ if ( this.notifyingBuilder != null ) {
currentNotifying = notifyingBuilder.build(this, error);
- } catch (Exception ignore) {
- // ignore
- } finally {
- this.manager.release(notifyingBuilder);
}
final Map objectModel = this.portalService.getProcessInfoProvider().getObjectModel();
// Add it to the object model
if ( currentNotifying != null ) {
- objectModel.put(org.apache.cocoon.Constants.NOTIFYING_OBJECT, currentNotifying);
+ objectModel.put(org.apache.cocoon.Constants.NOTIFYING_OBJECT, currentNotifying);
objectModel.put(ObjectModelHelper.THROWABLE_OBJECT, error);
}
@@ -172,7 +155,7 @@
this.streamContent( coplet, uri, handler);
}
-
+
return true;
}
return false;
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java Thu Mar 8 07:58:32 2007
@@ -19,7 +19,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -97,7 +96,7 @@
protected Map renderers = Collections.EMPTY_MAP;
/** The used coplet adapters. */
- protected Map copletAdapters = new HashMap();
+ protected Map copletAdapters = Collections.EMPTY_MAP;
/** The coplet factory. */
protected CopletFactory copletFactory;
@@ -124,6 +123,7 @@
this.manager = serviceManager;
this.processInfoProvider = (ProcessInfoProvider)this.manager.lookup(ProcessInfoProvider.ROLE);
this.renderers = (Map)this.manager.lookup(Renderer.class.getName()+"Map");
+ this.copletAdapters = (Map)this.manager.lookup(CopletAdapter.class.getName()+"Map");
}
/**
@@ -151,11 +151,6 @@
this.servletContext.removeAttribute(PortalService.class.getName());
}
if ( this.manager != null ) {
- Iterator i = this.copletAdapters.values().iterator();
- while (i.hasNext()) {
- this.manager.release(i.next());
- }
- this.copletAdapters.clear();
this.manager.release(this.profileManager);
this.profileManager = null;
this.manager.release(this.linkService);
@@ -331,12 +326,7 @@
public CopletAdapter getCopletAdapter(String name) {
CopletAdapter o = (CopletAdapter) this.copletAdapters.get( name );
if ( o == null ) {
- try {
- o = (CopletAdapter) this.manager.lookup( CopletAdapter.ROLE + '/' + name );
- this.copletAdapters.put( name, o );
- } catch (ServiceException e) {
- throw new PortalRuntimeException("Unable to lookup coplet adapter with name " + name, e);
- }
+ throw new PortalRuntimeException("Unable to lookup coplet adapter with name " + name);
}
return o;
}
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml Thu Mar 8 07:58:32 2007
@@ -41,6 +41,37 @@
</bean>
<!--+
+ | Coplet Adapters
+ |
+ +-->
+ <bean name="org.apache.cocoon.portal.coplet.adapter.AbstractCopletAdapter"
+ class="org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter"
+ parent="org.apache.cocoon.portal.util.AbstractBean" abstract="true">
+ <property name="cache" ref="org.apache.cocoon.caching.Cache"/>
+ <property name="runnableManager" ref="org.apache.cocoon.components.thread.RunnableManager"/>
+ </bean>
+
+ <!--+
+ | This is the pipeline/uri based adapter.
+ +-->
+ <bean name="org.apache.cocoon.portal.coplet.adapter.CopletAdapter/uri"
+ class="org.apache.cocoon.portal.coplet.adapter.impl.URICopletAdapter"
+ parent="org.apache.cocoon.portal.coplet.adapter.AbstractCopletAdapter" scope="singleton">
+ <property name="notifyingBuilder" ref="org.apache.cocoon.components.notification.NotifyingBuilder"/>
+ <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
+ </bean>
+
+ <!--+
+ | This is the application adapter.
+ +-->
+ <bean name="org.apache.cocoon.portal.coplet.adapter.CopletAdapter/application"
+ class="org.apache.cocoon.portal.coplet.adapter.impl.ApplicationCopletAdapter"
+ parent="org.apache.cocoon.portal.coplet.adapter.AbstractCopletAdapter" scope="singleton">
+ <property name="notifyingBuilder" ref="org.apache.cocoon.components.notification.NotifyingBuilder"/>
+ <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
+ </bean>
+
+ <!--+
| Renderer Aspects
|
+-->
@@ -220,4 +251,11 @@
+-->
<configurator:bean-map id="org.apache.cocoon.portal.layout.renderer.RendererMap"
type="org.apache.cocoon.portal.layout.renderer.Renderer"/>
+
+ <!--+
+ | Coplet Adapter map
+ |
+ +-->
+ <configurator:bean-map id="org.apache.cocoon.portal.coplet.adapter.CopletAdapterMap"
+ type="org.apache.cocoon.portal.coplet.adapter.CopletAdapter"/>
</beans>
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles Thu Mar 8 07:58:32 2007
@@ -32,22 +32,6 @@
<role name="org.apache.cocoon.portal.profile.ProfileLS"
default-class="org.apache.cocoon.portal.profile.impl.MapProfileLS"/>
- <!--+
- | Coplet Adapters
- |
- +-->
- <!--+
- | This is the pipeline/uri based adapter.
- +-->
- <role name="org.apache.cocoon.portal.coplet.adapter.CopletAdapter/uri"
- default-class="org.apache.cocoon.portal.coplet.adapter.impl.URICopletAdapter"/>
-
- <!--+
- | This is the application adapter.
- +-->
- <role name="org.apache.cocoon.portal.coplet.adapter.CopletAdapter/application"
- default-class="org.apache.cocoon.portal.coplet.adapter.impl.ApplicationCopletAdapter"/>
-
<!--+
| Coplet and Layout Source.
@@ -77,14 +61,6 @@
<role name="org.apache.cocoon.portal.PortalService"
default-class="org.apache.cocoon.portal.impl.PortalServiceImpl"
shorthand="portal-service"/>
-
- <!--+
- | Page Label Manager.
- |
- +-->
- <role name="org.apache.cocoon.portal.impl.PageLabelManager"
- default-class="org.apache.cocoon.portal.impl.PageLabelManager"
- shorthand="page-label-manager"/>
<!--+
| Layout Factory.
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java Thu Mar 8 07:58:32 2007
@@ -29,6 +29,7 @@
import org.apache.cocoon.core.container.spring.avalon.ComponentInfo;
import org.apache.cocoon.core.container.spring.avalon.ConfigurationInfo;
import org.apache.cocoon.environment.mock.MockContext;
+import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
import org.apache.cocoon.portal.impl.PortalServiceImpl;
import org.apache.cocoon.portal.layout.renderer.Renderer;
import org.apache.cocoon.processing.ProcessInfoProvider;
@@ -38,7 +39,7 @@
* test cases.
* It provides a service manager with a setup portal service etc.
*
- * $Id$
+ * $Id$
*/
public abstract class AbstractPortalTestCase extends CocoonTestCase {
@@ -60,7 +61,7 @@
public String getServletName() {
return "cocoon";
}
-
+
};
}
@@ -88,6 +89,11 @@
rendererMap.setComponentClassName(HashMap.class.getName());
rendererMap.setRole(Renderer.class.getName()+"Map");
info.addComponent(rendererMap);
+ // CopletAdapterMap
+ final ComponentInfo copletAdapterMap = new ComponentInfo();
+ copletAdapterMap.setComponentClassName(HashMap.class.getName());
+ copletAdapterMap.setRole(CopletAdapter.class.getName()+"Map");
+ info.addComponent(copletAdapterMap);
// Add portal service
final ComponentInfo portalServiceInfo = new ComponentInfo();
portalServiceInfo.setComponentClassName(PortalServiceImpl.class.getName());
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java Thu Mar 8 07:58:32 2007
@@ -28,9 +28,8 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.components.serializers.EncodingSerializer;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.http.HttpEnvironment;
@@ -54,9 +53,9 @@
import org.apache.cocoon.portal.pluto.servlet.ServletResponseImpl;
import org.apache.cocoon.portal.services.aspects.DynamicAspect;
import org.apache.cocoon.portal.services.aspects.RequestProcessorAspect;
+import org.apache.cocoon.portal.services.aspects.RequestProcessorAspectContext;
import org.apache.cocoon.portal.services.aspects.ResponseProcessorAspect;
import org.apache.cocoon.portal.services.aspects.ResponseProcessorAspectContext;
-import org.apache.cocoon.portal.services.aspects.RequestProcessorAspectContext;
import org.apache.cocoon.portal.util.HtmlSaxParser;
import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletContainerException;
@@ -83,7 +82,7 @@
*/
public class PortletAdapter
extends AbstractCopletAdapter
- implements RequestProcessorAspect, ResponseProcessorAspect, DynamicAspect, CopletDecorationProvider, Receiver, Parameterizable {
+ implements RequestProcessorAspect, ResponseProcessorAspect, DynamicAspect, CopletDecorationProvider, Receiver {
/** Name of the temporary coplet instance attribute holding the portlet window. */
public static final String PORTLET_WINDOW_ATTRIBUTE_NAME = PortletAdapter.class.getName() + "/window";
@@ -109,20 +108,22 @@
/** The Portlet Container environment. */
protected PortletContainerEnvironmentImpl portletContainerEnvironment;
- /** The configuration. */
- protected Parameters parameters;
-
/** Is full-screen enabled? */
protected boolean enableFullScreen;
/** Is maximized enabled? */
protected boolean enableMaximized;
- /**
- * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
- */
- public void parameterize(Parameters params) throws ParameterException {
- this.parameters = params;
+ protected Properties properties;
+
+ protected ServiceManager manager;
+
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ public void setServiceManager(ServiceManager manager) {
+ this.manager = manager;
}
/**
@@ -177,8 +178,8 @@
/**
* @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#streamContent(org.apache.cocoon.portal.om.CopletInstance, org.xml.sax.ContentHandler)
*/
- public void streamContent(CopletInstance coplet,
- ContentHandler contentHandler)
+ protected void streamContent(CopletInstance coplet,
+ ContentHandler contentHandler)
throws SAXException {
try {
final String portletEntityId = (String) getConfiguration(coplet, "portlet");
@@ -226,9 +227,10 @@
}
/**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ * Destroy this component.
+ * Shutdown Pluto.
*/
- public void dispose() {
+ public void destroy() {
try {
ContainerUtil.dispose(this.portletContainerEnvironment);
this.portletContainerEnvironment = null;
@@ -239,14 +241,13 @@
} catch (Throwable t) {
this.getLogger().error("Destruction failed!", t);
}
- super.dispose();
}
/**
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ * Initialize this component.
+ * Setup Pluto.
*/
- public void initialize() throws Exception {
- super.initialize();
+ public void init() throws Exception {
this.enableFullScreen = this.portalService.getConfigurationAsBoolean(Constants.CONFIGURATION_FULL_SCREEN_ENABLED, Constants.DEFAULT_CONFIGURATION_FULL_SCREEN_ENABLED);
this.enableMaximized = this.portalService.getConfigurationAsBoolean(Constants.CONFIGURATION_MAXIMIZED_ENABLED, Constants.DEFAULT_CONFIGURATION_MAXIMIZED_ENABLED);
this.initContainer();
@@ -279,7 +280,7 @@
this.portletContainerEnvironment = new PortletContainerEnvironmentImpl();
this.portletContainerEnvironment.setLogger(this.getLogger());
- ContainerUtil.parameterize(this.portletContainerEnvironment, this.parameters);
+ ContainerUtil.parameterize(this.portletContainerEnvironment, Parameters.fromProperties(this.properties));
ContainerUtil.service(this.portletContainerEnvironment, this.manager);
ContainerUtil.initialize(this.portletContainerEnvironment);
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortletAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortletAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortletAdapter.java Thu Mar 8 07:58:32 2007
@@ -108,18 +108,7 @@
super.logout(coplet);
}
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- super.dispose();
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
- */
- public void initialize() throws Exception {
- super.initialize();
+ public void init() throws Exception {
this.enableFullScreen = this.portalService.getConfigurationAsBoolean(Constants.CONFIGURATION_FULL_SCREEN_ENABLED, Constants.DEFAULT_CONFIGURATION_FULL_SCREEN_ENABLED);
this.enableMaximized = this.portalService.getConfigurationAsBoolean(Constants.CONFIGURATION_MAXIMIZED_ENABLED, Constants.DEFAULT_CONFIGURATION_MAXIMIZED_ENABLED);
this.initContainer();
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf Thu Mar 8 07:58:32 2007
@@ -34,11 +34,9 @@
<!-- Include portal roles -->
<include src="resource://org/apache/cocoon/portal/portal.roles"/>
- <!-- If you don't need JSR 168 support, you can remove the following include. -->
+ <!-- If you don't need JSR 168 support, you can remove the following include.
<include src="resource://org/apache/cocoon/portal/pluto/portal-pluto.roles"/>
-
- <!-- If you don't need WSRP support, you can remove the following include -->
- <include src="resource://org/apache/cocoon/portal/wsrp/portal-wsrp.roles"/>
+ -->
<!-- We use Castor for persisting/mapping the profiles to XML: -->
<include src="resource://org/apache/cocoon/portal/persistence/castor/portal-castor.roles"/>
@@ -129,10 +127,5 @@
</layout>
</layouts>
</portal-layout-factory>
-
- <wsrp-adapter>
- <!-- This is the WSRP configuration containing the producers etc. -->
- <parameter name="wsrp-config" value="config/wsrp-config.xml"/>
- </wsrp-adapter>
</components>
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml Thu Mar 8 07:58:32 2007
@@ -30,7 +30,7 @@
<!-- Include default beans -->
<import resource="classpath:org/apache/cocoon/portal/cocoon-portal-components.xml"/>
- <!-- If you don't need WSRP support, you can remove the following include -->
+ <!-- If you don't need WSRP support, you can remove the following include: -->
<import resource="classpath:org/apache/cocoon/portal/wsrp/cocoon-portal-wsrp-components.xml"/>
<!--+
@@ -85,11 +85,6 @@
<!-- aspect type="action-counter"/ -->
<portal:aspect type="frame"/>
<portal:aspect type="link"/>
- <!-- Uncomment the following when using PageLabels
- <portal:aspect type="page-label"/>
- -->
- <!-- Comment the following out if you don't need WSRP: -->
- <portal:aspect type="wsrp"/>
</portal:request-processor-aspects>
<!--+
@@ -107,4 +102,5 @@
<portal:profile-manager-aspects id="org.apache.cocoon.portal.profile.ProfileManager.aspects">
<!-- Add your aspects here -->
</portal:profile-manager-aspects>
+
</beans>
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java Thu Mar 8 07:58:32 2007
@@ -33,7 +33,7 @@
import org.xml.sax.SAXException;
/**
- * This coplet adapter is used to connect to external applications that are
+ * This coplet adapter is used to connect to external applications that are
* plugged into the portal.
*
* TODO: Decide if we still need this adapter.
@@ -44,9 +44,9 @@
/**
* @see org.apache.cocoon.portal.coplet.adapter.impl.URICopletAdapter#streamContent(org.apache.cocoon.portal.om.CopletInstance, java.lang.String, org.xml.sax.ContentHandler)
*/
- public void streamContent(final CopletInstance coplet,
- final String uri,
- final ContentHandler contentHandler)
+ protected void streamContent(final CopletInstance coplet,
+ final String uri,
+ final ContentHandler contentHandler)
throws SAXException {
try {
super.streamContent(coplet, uri, contentHandler);
@@ -79,7 +79,7 @@
if ( addParams.booleanValue() ) {
final StringBuffer uri = new StringBuffer(event.getLink());
boolean hasParams = (uri.toString().indexOf("?") != -1);
-
+
// append parameters - if any
LinkService linkService = this.portalService.getLinkService();
final Map objectModel = this.portalService.getProcessInfoProvider().getObjectModel();
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java Thu Mar 8 07:58:32 2007
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -40,10 +41,6 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.components.serializers.EncodingSerializer;
import org.apache.cocoon.environment.ObjectModelHelper;
@@ -58,6 +55,9 @@
import org.apache.cocoon.portal.om.CopletInstance;
import org.apache.cocoon.portal.om.Layout;
import org.apache.cocoon.portal.om.LayoutFeatures;
+import org.apache.cocoon.portal.services.aspects.DynamicAspect;
+import org.apache.cocoon.portal.services.aspects.RequestProcessorAspect;
+import org.apache.cocoon.portal.services.aspects.RequestProcessorAspectContext;
import org.apache.cocoon.portal.util.HtmlSaxParser;
import org.apache.cocoon.portal.wsrp.consumer.ConsumerEnvironmentImpl;
import org.apache.cocoon.portal.wsrp.consumer.ProducerDescription;
@@ -111,11 +111,9 @@
*
* @version $Id$
*/
-public class WSRPAdapter
+public class WSRPAdapter
extends AbstractCopletAdapter
- implements CopletDecorationProvider,
- Parameterizable,
- Receiver {
+ implements CopletDecorationProvider, Receiver, RequestProcessorAspect, DynamicAspect {
/** Key to store the consumer map into the coplet instance data object as a temporary attribute. */
public static final String ATTRIBUTE_NAME_CONSUMER_MAP = "wsrp-consumer-map";
@@ -140,13 +138,15 @@
/** Unique name of the consumer. */
public static final String CONSUMER_URL = "http://cocoon.apache.org/portal/wsrp-consumer";
-
+
/** Name of the service. */
public static final String consumerAgent = "Apache Cocoon Portal." + org.apache.cocoon.Constants.VERSION;
-
+
+ public static final String REQUEST_PARAMETER_NAME = "cocoon-wsrpevent";
+
/** The consumer environment implementation. */
protected ConsumerEnvironmentImpl consumerEnvironment;
-
+
/** Stores the current coplet instance data per thread. */
protected final ThreadLocal copletInstance = new ThreadLocal();
@@ -154,7 +154,7 @@
protected UserContextProvider userContextProvider;
/** Location of the wsrp configuration. */
- protected String wsrpConfigLocation;
+ protected String wsrpConfigLocation = "config/wsrp-config.xml";
/** Initialized? */
protected boolean initialized = false;
@@ -162,45 +162,49 @@
/** The wsrp configuration. */
protected Configuration wsrpConfiguration;
- /** The configuration for this adapter. */
- protected Parameters parameters;
+ protected SourceResolver sourceResolver;
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager serviceManager) throws ServiceException {
- super.service(serviceManager);
- this.userContextProvider = (UserContextProvider)this.manager.lookup(UserContextProvider.ROLE);
+ protected Properties properties;
+
+ protected ServiceManager manager;
+
+ public void setSourceResolver(SourceResolver sourceResolver) {
+ this.sourceResolver = sourceResolver;
}
- /**
- * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
- */
- public void parameterize(Parameters params) throws ParameterException {
- this.wsrpConfigLocation = params.getParameter("wsrp-config", "config/wsrp-config.xml");
- this.parameters = params;
+ public void setUserContextProvider(UserContextProvider userContextProvider) {
+ this.userContextProvider = userContextProvider;
+ }
+
+ public void setConfigLocation(String location) {
+ this.wsrpConfigLocation = location;
+ }
+
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ public void setServiceManager(ServiceManager manager) {
+ this.manager = manager;
}
/**
* Sets the <tt>WSRPLogger</tt>, the <tt>producerConfig</tt> and the <tt>consumerEnvironment</tt><br/>
- *
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ *
*/
- public void initialize() throws Exception {
- super.initialize();
+ public void init() throws Exception {
LogManager.setLogManager(new WSRPLogManager(new WSRPLogger(this.getLogger())));
this.consumerEnvironment = new ConsumerEnvironmentImpl();
- this.consumerEnvironment.init(this.portalService,
+ this.consumerEnvironment.init(this.portalService,
this);
this.consumerEnvironment.setConsumerAgent(consumerAgent);
}
/**
* Removes all portlets, producers and users out of the <tt>consumerEnvironment</tt>-registries<br/>
- *
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ *
*/
- public void dispose() {
+ public void destroy() {
if ( this.consumerEnvironment != null ) {
this.consumerEnvironment.getPortletRegistry().removeAllPortlets();
@@ -208,24 +212,19 @@
this.consumerEnvironment.getUserRegistry().removeAllUsers();
}
- if ( this.manager != null ) {
- this.manager.release(this.userContextProvider);
- this.userContextProvider = null;
- }
try {
ContainerUtil.dispose(this.consumerEnvironment);
this.consumerEnvironment = null;
} catch (Throwable t) {
this.getLogger().error("Destruction failed!", t);
}
- super.dispose();
}
/**
* Gets the required information of the producer, user, wsrp-portlet, window-states, window-modes<br/>
* and stores its into the copletInstanceData<br/>
* After that it initiates the <tt>getServiceDescription()</tt>-call<br/>
- *
+ *
* @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#login(org.apache.cocoon.portal.om.CopletInstance)
*/
public void login(CopletInstance coplet) {
@@ -238,7 +237,7 @@
if ( producerId == null ) {
// if the producer can't be found, we simply return
this.getLogger().error("Producer not configured in wsrp coplet " + copletData.getId());
- return;
+ return;
}
final Producer producer = consumerEnvironment.getProducerRegistry().getProducer(producerId);
if ( producer == null ) {
@@ -248,7 +247,7 @@
}
// get the wsrp user and store it as an attribute on the instance
- final String currentUserID = this.portalService.getUserService().getUser().getUserName();
+ final String currentUserID = this.portalService.getUserService().getUser().getUserName();
User user = this.consumerEnvironment.getUserRegistry().getUser(currentUserID);
if ( user == null ) {
// create a new user
@@ -263,7 +262,7 @@
if ( portletHandle == null ) {
// if the portlet handle can't be found, we simply return
this.getLogger().error("Portlet handle not configured in wsrp coplet " + copletData.getId());
- return;
+ return;
}
// get the wsrp portlet
@@ -295,9 +294,9 @@
try {
// this call includes the getServiceDescription()-Invocation
- // additionally register() initCookie() and so on will be handled
+ // additionally register() initCookie() and so on will be handled
// (within ProducerImpl and PortletDriverImpl)
- getSimplePortletWindowSession(wsrpportlet,
+ getSimplePortletWindowSession(wsrpportlet,
portletInstanceKey,
user);
final PortletDescription desc = producer.getPortletDescription(portletHandle);
@@ -315,10 +314,10 @@
/**
* Checks the values of the <tt>portlet-key</tt> and the <tt>user</tt> for current portlet-instance<br/>
* After that all passed the <tt>getMarkup()</tt>-call will be initiated<br />
- *
+ *
* @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#streamContent(org.apache.cocoon.portal.om.CopletInstance, org.xml.sax.ContentHandler)
*/
- public void streamContent(CopletInstance coplet, ContentHandler contentHandler)
+ protected void streamContent(CopletInstance coplet, ContentHandler contentHandler)
throws SAXException {
try {
// set the coplet in the thread local variable to give other components access to
@@ -334,7 +333,7 @@
if ( user == null ) {
throw new SAXException("WSRP configuration is missing: user.");
}
-
+
final String portletInstanceKey = (String)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
// getMarkup()
@@ -378,10 +377,10 @@
this.setCurrentCopletInstanceData(null);
}
}
-
+
/**
* Releases all sessions (<tt>userSession, groupSession, portletSession</tt>)<br/>
- *
+ *
* @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#logout(org.apache.cocoon.portal.om.CopletInstance)
*/
public void logout(CopletInstance coplet) {
@@ -391,7 +390,7 @@
User user = (User)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_USER);
final String portletInstanceKey = (String)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
Producer producer = consumerEnvironment.getProducerRegistry().getProducer(portletKey.getProducerId());
-
+
// releaseSession()
try {
UserSession userSession = consumerEnvironment.getSessionHandler().getUserSession(portletKey.getProducerId(), user.getUserID());
@@ -401,29 +400,29 @@
SessionContext sessionContext = portletSession.getSessionContext();
WSRPPortlet wsrpportlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
PortletDriver portletDriver = consumerEnvironment.getPortletDriverRegistry().getPortletDriver(wsrpportlet);
-
+
if (sessionContext != null) {
String[] sessions = new String[1];
sessions[0] = new String (sessionContext.getSessionID());
portletDriver.releaseSessions(sessions, user.getUserID());
}
-
+
userSession.removeGroupSession(portletDescription.getGroupID());
} catch (WSRPException e) {
this.getLogger().error("session deregister()", e);
}
}
-
+
/**
* After getting the <tt>userSession</tt> and <tt>groupSession</tt> it performs the <tt>getServiceDescription()</tt>-call<br/>
- *
+ *
* @param portlet
* @param portletInstanceKey
* @param user
* @return SimplePortletWindowSession
* @throws WSRPException
*/
- public SimplePortletWindowSession getSimplePortletWindowSession(WSRPPortlet portlet,
+ public SimplePortletWindowSession getSimplePortletWindowSession(WSRPPortlet portlet,
String portletInstanceKey,
User user)
throws WSRPException {
@@ -473,18 +472,18 @@
/**
* Performs an blocking interaction with the given portlet and session.<br/>
* If the response to this call is a redirect URL's it won't be followed.<br/>
- *
+ *
* An optionally returned markup context is store in the window session<br/>
* and should be processed by the portlet driver instead of making a new<br/>
* getMarkup() call.<br/>
- *
+ *
* @param portlet The portlet on which this action should be performed
* @param windowSession The window session of the portlet on which the action should
* be performed
* @param user The user on which this action should be performed
* @param request The request with all required information for the call
**/
- protected void performBlockingInteraction(WSRPPortlet portlet,
+ protected void performBlockingInteraction(WSRPPortlet portlet,
SimplePortletWindowSession windowSession,
User user,
Request request) {
@@ -526,7 +525,7 @@
/**
* Retrieves the markup generated by the portlet.
- *
+ *
* @param portlet
* @param windowSession
* @param user
@@ -554,46 +553,46 @@
/**
* Creates a <tt>String</tt> consists of the producer-id_portlet-handle_coplet-id_user-name <br/>
- *
+ *
* @param key includes the essential values
* @param coplet current <tt>CopletInstanceData</tt>-object
* @param userName
- * @return the unique string which represents the portlet-instance
+ * @return the unique string which represents the portlet-instance
* */
- protected String getPortletInstanceKey(PortletKey key,
+ protected String getPortletInstanceKey(PortletKey key,
CopletInstance coplet,
String userName) {
final StringBuffer buffer = new StringBuffer(key.getProducerId());
buffer.append('_').append(key.getPortletHandle()).append('_');
buffer.append(coplet.getId()).append('_').append(userName);
- return buffer.toString();
+ return buffer.toString();
}
-
+
/**
- * Gets all required information like <tt>portletKey, portletInstanceKey, userName, portletModes, windowStates,
+ * Gets all required information like <tt>portletKey, portletInstanceKey, userName, portletModes, windowStates,
* interactionState</tt> and the <tt>navigationalStat</tt><br/>
- *
+ *
* After that it decides with the <tt>URL_TYPE</tt> to perform the <tt>performBlockingInteraction()</tt>-call or
* do some render- alternatively some resource-specific things<br/>
- *
+ *
* @see Receiver
*/
public void inform(WSRPEvent event) {
final CopletInstance coplet = event.getTarget();
this.setCurrentCopletInstanceData(coplet);
-
+
try {
PortletKey portletKey = (PortletKey)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_KEY);
final String portletInstanceKey = (String)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
WSRPPortlet wsrpPortlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
User user = (User) coplet.getTemporaryAttribute(ATTRIBUTE_NAME_USER);
-
+
final HttpServletRequest requestObject = this.portalService.getProcessInfoProvider().getRequest();
Request request = new RequestImpl();
String portletMode = requestObject.getParameter(Constants.PORTLET_MODE);
String windowState = requestObject.getParameter(Constants.WINDOW_STATE);
-
+
request.setInteractionState(requestObject.getParameter(Constants.INTERACTION_STATE));
SimplePortletWindowSession windowSession = getSimplePortletWindowSession(wsrpPortlet, portletInstanceKey, user);
windowSession.setNavigationalState(requestObject.getParameter(Constants.NAVIGATIONAL_STATE));
@@ -603,11 +602,11 @@
}
if (windowState != null) {
if ( !windowState.equals(windowSession.getWindowState()) ) {
-
+
final Layout rootLayout = this.portalService.getProfileManager().getLayout(null);
final Layout layout = LayoutFeatures.searchLayout(this.portalService, coplet.getId(), rootLayout);
final Layout fullScreenLayout = LayoutFeatures.getFullScreenInfo(this.portalService);
- if ( fullScreenLayout != null
+ if ( fullScreenLayout != null
&& fullScreenLayout.equals( layout )
&& !windowState.equals(WindowStates._maximized) ) {
Event e = new CopletInstanceSizingEvent( coplet, CopletInstance.SIZE_FULLSCREEN );
@@ -636,9 +635,9 @@
request.addFormParameter(parameter, requestObject.getParameter(parameter));
}
performBlockingInteraction(wsrpPortlet, windowSession, user, request);
-
+
}
-
+
} catch (WSRPException e) {
this.getLogger().error("Error during processing wsrp event.", e);
} finally {
@@ -655,7 +654,7 @@
/**
* Add a new producer<br/>
- *
+ *
* @param desc The producer description.
* @return Returns true if the producer could be added.
*/
@@ -665,7 +664,7 @@
/**
* This sets the current coplet instance data for the thread <br/>
- *
+ *
* @param coplet The coplet instance data or null to clear the information.
*/
public void setCurrentCopletInstanceData(CopletInstance coplet) {
@@ -674,7 +673,7 @@
/**
* Return the current coplet instance data<br/>
- *
+ *
* @return Returns the instance or null.
*/
public CopletInstance getCurrentCopletInstanceData() {
@@ -737,11 +736,9 @@
synchronized (this) {
if (! this.initialized ) {
this.initialized = true;
- SourceResolver resolver = null;
Source source = null;
try {
- resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(this.wsrpConfigLocation);
+ source = this.sourceResolver.resolveURI(this.wsrpConfigLocation);
DefaultConfigurationBuilder dcb = new DefaultConfigurationBuilder();
this.wsrpConfiguration = dcb.build(source.getInputStream());
} catch (ConfigurationException ce) {
@@ -750,14 +747,9 @@
this.getLogger().error("Unable to read wsrp configuration: " + this.wsrpConfigLocation, ioe);
} catch (SAXException sae) {
this.getLogger().error("Unable to read wsrp configuration: " + this.wsrpConfigLocation, sae);
- } catch (ServiceException se) {
- throw new RuntimeException("Unable to get source resolver.", se);
} finally {
- if ( resolver != null ) {
- resolver.release(source);
- }
- this.manager.release(resolver);
- }
+ this.sourceResolver.release(source);
+ }
}
}
}
@@ -774,8 +766,8 @@
/**
* Get the adapter configuration.
*/
- public Parameters getAdapterConfiguration() {
- return this.parameters;
+ public Properties getAdapterConfiguration() {
+ return this.properties;
}
/**
@@ -825,7 +817,7 @@
if ( pm == null ) {
pm = Modes._view;
}
- if ( !pm.equals(Modes._edit)
+ if ( !pm.equals(Modes._edit)
&& ArrayUtils.contains(supportedModes, Modes._edit) ) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
@@ -840,23 +832,23 @@
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
p.put(Constants.PORTLET_MODE, Modes._help);
- final String link = urlGenerator.getRenderURL(p);
+ final String link = urlGenerator.getRenderURL(p);
modes.add(new DecorationAction("help-uri", link));
- }
+ }
if ( !pm.equals(Modes._view)
&& ArrayUtils.contains(supportedModes, Modes._view) ) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
p.put(Constants.PORTLET_MODE, Modes._view);
- final String link = urlGenerator.getRenderURL(p);
+ final String link = urlGenerator.getRenderURL(p);
modes.add(new DecorationAction("view-uri", link));
- }
+ }
}
} catch (WSRPException ignore) {
// we ignore this
} finally {
- this.setCurrentCopletInstanceData(null);
+ this.setCurrentCopletInstanceData(null);
}
}
return modes;
@@ -886,7 +878,7 @@
ws = WindowStates._normal;
}
- if ( !ws.equals(WindowStates._minimized)
+ if ( !ws.equals(WindowStates._minimized)
&& ArrayUtils.contains(supportedWindowStates, WindowStates._minimized)) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
@@ -903,21 +895,21 @@
final String link = urlGenerator.getRenderURL(p);
states.add(new DecorationAction(DecorationAction.WINDOW_STATE_NORMAL, link));
- }
+ }
if ( !ws.equals(WindowStates._maximized)
&& ArrayUtils.contains(supportedWindowStates, WindowStates._maximized)) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
p.put(Constants.WINDOW_STATE, WindowStates._maximized);
- final String link = urlGenerator.getRenderURL(p);
+ final String link = urlGenerator.getRenderURL(p);
states.add(new DecorationAction(DecorationAction.WINDOW_STATE_MAXIMIZED, link));
}
}
} catch (WSRPException ignore) {
// we ignore this
} finally {
- this.setCurrentCopletInstanceData(null);
+ this.setCurrentCopletInstanceData(null);
}
}
return states;
@@ -940,5 +932,31 @@
title = copletInstanceData.getTitle();
}
return title;
+ }
+
+ /**
+ * @see org.apache.cocoon.portal.services.aspects.RequestProcessorAspect#process(org.apache.cocoon.portal.services.aspects.RequestProcessorAspectContext)
+ */
+ public void process(RequestProcessorAspectContext context) {
+ final org.apache.cocoon.environment.Request request = ObjectModelHelper.getRequest(context.getPortalService().getProcessInfoProvider().getObjectModel());
+ final String[] values = request.getParameterValues("cocoon-wsrpevent");
+ if ( values != null && values.length == 1 ) {
+ // create a wsrp event, first build map of parameters
+ final Map parameters = new HashMap();
+ final Enumeration parameterNames = request.getParameterNames();
+ while ( parameterNames.hasMoreElements() ) {
+ final String name = (String)parameterNames.nextElement();
+ if ( !REQUEST_PARAMETER_NAME.equals(name) ) {
+ final String value = request.getParameter(name);
+ parameters.put(name, value);
+ }
+ }
+ final String copletid = values[0];
+ final CopletInstance cid = context.getPortalService().getProfileManager().getCopletInstance(copletid);
+
+ final Event e = new WSRPEvent(cid, parameters);
+ context.getPortalService().getEventManager().send(e);
+ }
+ context.invokeNext();
}
}
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java Thu Mar 8 07:58:32 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -16,11 +16,12 @@
*/
package org.apache.cocoon.portal.wsrp.consumer;
+import java.util.Properties;
+
import oasis.names.tc.wsrp.v1.types.StateChange;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.om.CopletInstance;
import org.apache.cocoon.portal.wsrp.adapter.WSRPAdapter;
@@ -41,7 +42,7 @@
/**
* Implements the consumer environment interface. <br/>
- *
+ *
* @version $Id$
**/
public class ConsumerEnvironmentImpl
@@ -56,7 +57,7 @@
/**
* Initialize the consumer
- *
+ *
* @param service
* @param adapter
* @throws Exception
@@ -65,10 +66,10 @@
WSRPAdapter adapter)
throws Exception {
this.adapter = adapter;
- Parameters params = adapter.getAdapterConfiguration();
+ final Properties params = adapter.getAdapterConfiguration();
this.setConsumerAgent("not set");
- // To define the locales per end-user
+ // To define the locales per end-user
// the configuration must be set within UserContextProviderImpl
// the following lines define the global locales
String[] supportedLocales = new String[1];
@@ -92,27 +93,27 @@
// define portlet state change behaviour
this.setPortletStateChange(StateChange.readWrite);
- // define the mime types the consumer supports
+ // define the mime types the consumer supports
this.setMimeTypes(new String[] { Constants.MIME_TYPE_HTML });
- // define the character sets the consumer supports
+ // define the character sets the consumer supports
this.setCharacterEncodingSet(new String[] { Constants.UTF_8 });
// set the authentication method the consumer uses
this.setUserAuthentication(ConsumerConstants.NONE);
// THE ORDER IN WHICH THE FOLLOWING OBJECTS ARE INSTANCIATED IS IMPORTANT
- this.setUserRegistry((UserRegistry)adapter.createObject(params.getParameter("user-registry-class", UserRegistryImpl.class.getName())));
- this.setSessionHandler((SessionHandler)adapter.createObject(params.getParameter("session-handler-class", SessionHandlerImpl.class.getName())));
- this.setProducerRegistry((ProducerRegistry)adapter.createObject(params.getParameter("producer-registry-class", ProducerRegistryImpl.class.getName())));
- this.setPortletRegistry((PortletRegistry)adapter.createObject(params.getParameter("portlet-registry-class", PortletRegistryImpl.class.getName())));
+ this.setUserRegistry((UserRegistry)adapter.createObject(params.getProperty("user-registry-class", UserRegistryImpl.class.getName())));
+ this.setSessionHandler((SessionHandler)adapter.createObject(params.getProperty("session-handler-class", SessionHandlerImpl.class.getName())));
+ this.setProducerRegistry((ProducerRegistry)adapter.createObject(params.getProperty("producer-registry-class", ProducerRegistryImpl.class.getName())));
+ this.setPortletRegistry((PortletRegistry)adapter.createObject(params.getProperty("portlet-registry-class", PortletRegistryImpl.class.getName())));
- this.setTemplateComposer((URLTemplateComposer)adapter.createObject(params.getParameter("url-template-composer-class", URLTemplateComposerImpl.class.getName())));
- this.setURLRewriter((URLRewriter)adapter.createObject(params.getParameter("url-rewriter-class", URLRewriterImpl.class.getName())));
+ this.setTemplateComposer((URLTemplateComposer)adapter.createObject(params.getProperty("url-template-composer-class", URLTemplateComposerImpl.class.getName())));
+ this.setURLRewriter((URLRewriter)adapter.createObject(params.getProperty("url-rewriter-class", URLRewriterImpl.class.getName())));
- this.setPortletDriverRegistry((PortletDriverRegistry)adapter.createObject(params.getParameter("portlet-driver-registry-class", PortletDriverRegistryImpl.class.getName())));
+ this.setPortletDriverRegistry((PortletDriverRegistry)adapter.createObject(params.getProperty("portlet-driver-registry-class", PortletDriverRegistryImpl.class.getName())));
- this.urlGenerator = (URLGenerator)adapter.createObject(params.getParameter("url-generator-class", URLGeneratorImpl.class.getName()));
+ this.urlGenerator = (URLGenerator)adapter.createObject(params.getProperty("url-generator-class", URLGeneratorImpl.class.getName()));
this.getTemplateComposer().setURLGenerator(this.urlGenerator);
this.getURLRewriter().setURLGenerator(this.urlGenerator);
}
@@ -123,14 +124,14 @@
public URLGenerator getURLGenerator() {
return this.urlGenerator;
}
-
+
/**
* @see org.apache.wsrp4j.consumer.driver.GenericConsumerEnvironment#getSupportedLocales()
*/
public String[] getSupportedLocales() {
CopletInstance coplet = this.adapter.getCurrentCopletInstanceData();
User user = (User)coplet.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_USER);
-
+
return ((UserContextExtension)user.getUserContext()).getSupportedLocales();
}
@@ -140,7 +141,7 @@
public String getUserAuthentication() {
CopletInstance coplet = this.adapter.getCurrentCopletInstanceData();
User user = (User)coplet.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_USER);
-
+
return ((UserContextExtension)user.getUserContext()).getUserAuthentication();
}
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverRegistryImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverRegistryImpl.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverRegistryImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverRegistryImpl.java Thu Mar 8 07:58:32 2007
@@ -39,7 +39,7 @@
/** All portletDrivers the consumerEnvironment needs. */
protected final Hashtable portletDrivers = new Hashtable();
-
+
/** The consumer environment. */
protected ConsumerEnvironment consumerEnv;
@@ -63,9 +63,9 @@
/**
* Get an portlet driver for the given portlet. If there is no portlet driver
* object cached a new portlet driver will be created and returned.
- *
+ *
* @param portlet The portlet the returned portlet driver is bound to.
- *
+ *
* @return The portlet driver for this portlet.
**/
public PortletDriver getPortletDriver(WSRPPortlet portlet)
@@ -73,7 +73,7 @@
PortletDriver driver = null;
if ((driver = (PortletDriver)portletDrivers.get(portlet.getPortletKey().toString())) == null) {
- String driverClass = this.adapter.getAdapterConfiguration().getParameter("portlet-driver-class", PortletDriverImpl.class.getName());
+ String driverClass = this.adapter.getAdapterConfiguration().getProperty("portlet-driver-class", PortletDriverImpl.class.getName());
try {
driver = (PortletDriverImpl)this.adapter.createObject(driverClass);
} catch (Exception e) {
@@ -87,7 +87,7 @@
/**
* Get all cached portlet drivers.
- *
+ *
* @return Iterator with all portlet drivers in the registry.
**/
public Iterator getAllPortletDrivers() {
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/URLGeneratorImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/URLGeneratorImpl.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/URLGeneratorImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/URLGeneratorImpl.java Thu Mar 8 07:58:32 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -23,7 +23,6 @@
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.om.CopletInstance;
import org.apache.cocoon.portal.wsrp.adapter.WSRPAdapter;
-import org.apache.cocoon.portal.wsrp.adapter.WSRPRequestProcessorAspect;
import org.apache.wsrp4j.consumer.URLGenerator;
import org.apache.wsrp4j.util.Constants;
@@ -78,7 +77,7 @@
// we create a usual portal link first with
// all the infos
String portalLink = this.generateUrl(params);
-
+
// now we replace the portal pipeline with
// the resource pipeline
int linkEndPos = portalLink.indexOf('?');
@@ -88,7 +87,7 @@
buffer.append(portalLink.substring(0, pipelineStartPos+1));
buffer.append("wsrprsc");
buffer.append(portalLink.substring(linkEndPos));
- return buffer.toString();
+ return buffer.toString();
}
/**
@@ -102,7 +101,7 @@
/**
* Generate the url.<br/>
* We simply create a new wsrp event and use the portal link service.<br/>
- *
+ *
* @param params Url-parameters
* @return portal-url including all required attributes
*/
@@ -111,11 +110,11 @@
params = new HashMap();
}
Boolean secureLink = null;
- if ( "true".equalsIgnoreCase((String)params.get(Constants.SECURE_URL)) ) {
+ if ( "true".equalsIgnoreCase((String)params.get(Constants.SECURE_URL)) ) {
secureLink = Boolean.TRUE;
}
final CopletInstance coplet = this.adapter.getCurrentCopletInstanceData();
- params.put(WSRPRequestProcessorAspect.REQUEST_PARAMETER_NAME, coplet.getId());
+ params.put(WSRPAdapter.REQUEST_PARAMETER_NAME, coplet.getId());
final StringBuffer buffer = new StringBuffer(this.service.getLinkService().getRefreshLinkURI(secureLink));
boolean hasParams = buffer.indexOf("?") > 0;
Iterator i = params.entrySet().iterator();
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProvider.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProvider.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProvider.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProvider.java Thu Mar 8 07:58:32 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -21,18 +21,15 @@
* for a portal user.
* Cocoon uses an extension of the user context: {@link UserContextExtension}
* to store additional information about the user.
- *
+ *
* @version $Id$
*/
public interface UserContextProvider {
- /** The component role. */
- String ROLE = UserContextProvider.class.getName();
-
/**
* Delivers a <tt>UserContext</tt>-object for the given User-id <br />
* the data will be read out of an individual location <br />
- *
+ *
* @param userId
* @return UserContextExtension
*/
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProviderImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProviderImpl.java?view=diff&rev=516084&r1=516083&r2=516084
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProviderImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProviderImpl.java Thu Mar 8 07:58:32 2007
@@ -16,22 +16,21 @@
*/
package org.apache.cocoon.portal.wsrp.consumer;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.wsrp4j.consumer.util.ConsumerConstants;
-import org.apache.wsrp4j.util.Constants;
-
import oasis.names.tc.wsrp.v1.types.Contact;
import oasis.names.tc.wsrp.v1.types.EmployerInfo;
import oasis.names.tc.wsrp.v1.types.PersonName;
import oasis.names.tc.wsrp.v1.types.UserProfile;
+import org.apache.wsrp4j.consumer.util.ConsumerConstants;
+import org.apache.wsrp4j.util.Constants;
+
/**
* This is the default implementation just returning an empty
* user context.<br/>
- *
+ *
* @version $Id$
*/
-public class UserContextProviderImpl implements UserContextProvider, ThreadSafe {
+public class UserContextProviderImpl implements UserContextProvider {
/**
* @see org.apache.cocoon.portal.wsrp.consumer.UserContextProvider#createUserContext(java.lang.String)
@@ -54,11 +53,11 @@
this.setSupportedLocales(userContext);
return userContext;
}
-
+
/**
* Sets the supportedLocales out of an individual location
* This method can be overwritten in sub classes.<br/>
- *
+ *
* @param userContext
*/
protected void setSupportedLocales(UserContextExtension userContext) {
@@ -67,11 +66,11 @@
supportedLocales[1] = Constants.LOCALE_DE_DE;
userContext.setSupportedLocales(supportedLocales);
}
-
+
/**
* Fill the user profile.<br/>
* This method can be overwritten in sub classes.<br/
- *
+ *
* @param profile
* @param context
*/
@@ -84,7 +83,7 @@
/**
* Fill the name.<br/>
* This method can be overwritten in sub classes.<br/>
- *
+ *
* @param name
* @param context
*/