cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r598794 - in /cocoon/trunk/blocks/cocoon-portal: cocoon-portal-api/src/main/java/org/apache/cocoon/portal/ cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/ cocoon-porta...
Date Tue, 27 Nov 2007 22:40:22 GMT
Author: cziegeler
Date: Tue Nov 27 14:40:20 2007
New Revision: 598794

URL: http://svn.apache.org/viewvc?rev=598794&view=rev
Log:
Create new spi interface to decouple portal implementation from cocoon and continue fixing
stuff.

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/RequestContext.java
      - copied, changed from r598782, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/RequestContext.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java
  (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java
  (with props)
Removed:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/RequestContext.java
Modified:
    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-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/InformationProviderServiceImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextProviderImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-portal-sitemap-components.xml

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/RequestContext.java
(from r598782, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/RequestContext.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/RequestContext.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/RequestContext.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/RequestContext.java&r1=598782&r2=598794&rev=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/RequestContext.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/RequestContext.java
Tue Nov 27 14:40:20 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.cocoon.portal;
 
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -37,4 +38,6 @@
       * @return true if this is an Ajax request
       */
      boolean isAjaxRequest();
+
+     ServletContext getServletContext();
 }

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java?rev=598794&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java
Tue Nov 27 14:40:20 2007
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.spi;
+
+import org.apache.cocoon.portal.RequestContext;
+
+/**
+ * This service provides the current request context.
+ *
+ * @version $Id$
+ */
+public interface RequestContextProvider {
+
+    RequestContext getCurrentRequestContext();
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-api/src/main/java/org/apache/cocoon/portal/spi/RequestContextProvider.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

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?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- 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
Tue Nov 27 14:40:20 2007
@@ -29,13 +29,16 @@
 import org.xml.sax.SAXException;
 
 /**
- * This is the adapter to use pipelines as coplets.
+ * This is the adapter to use uris through the java.net.* classes as coplets.
  *
+ * TODO - We should provide a configuration option to directly stream the output
+ *        into the resulting output stream like the portlet adapter does.
  * @version $Id$
  */
 public class URICopletAdapter
     extends AbstractCopletAdapter {
 
+    /** The parser for parsing the output and streaming it into the pipeline. */
     protected SAXParser parser;
 
     public void setParser(final SAXParser p) {

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?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- 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
Tue Nov 27 14:40:20 2007
@@ -24,8 +24,6 @@
 import java.util.Map;
 
 import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.configuration.Configurable;
@@ -35,7 +33,6 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ajax.AjaxHelper;
 import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.RequestContext;
@@ -52,7 +49,7 @@
 import org.apache.cocoon.portal.services.UserService;
 import org.apache.cocoon.portal.services.VariableResolver;
 import org.apache.cocoon.portal.services.VariableResolver.CompiledExpression;
-import org.apache.cocoon.processing.ProcessInfoProvider;
+import org.apache.cocoon.portal.spi.RequestContextProvider;
 import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
@@ -116,20 +113,20 @@
     /** The portal manager. */
     protected PortalManager portalManager;
 
-    /** The process info provider. */
-    protected ProcessInfoProvider processInfoProvider;
-
     /** The user service. */
     protected UserService userService;
 
+    /** The request context provider. */
+    protected RequestContextProvider requestContextProvider;
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager serviceManager) throws ServiceException {
         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");
+        this.requestContextProvider = (RequestContextProvider)this.manager.lookup(RequestContextProvider.class.getName());
     }
 
     /**
@@ -169,10 +166,10 @@
             this.eventManager = null;
             this.manager.release(this.portalManager);
             this.portalManager = null;
-            this.manager.release(this.processInfoProvider);
-            this.processInfoProvider = null;
             this.manager.release(this.userService);
             this.userService = null;
+            this.manager.release(this.requestContextProvider);
+            this.requestContextProvider = null;
             this.manager = null;
         }
     }
@@ -405,11 +402,10 @@
     }
 
     /**
-     * TODO - Remove dependency on ProcessInfoProvider!
      * @see org.apache.cocoon.portal.PortalService#getRequestContext()
      */
     public RequestContext getRequestContext() {
-        return new RequestContextImpl(this.processInfoProvider);
+        return this.requestContextProvider.getCurrentRequestContext();
     }
 
     /**
@@ -441,37 +437,6 @@
 
         public String resolve() {
             return this.expression;
-        }
-
-    }
-    public static final class RequestContextImpl implements RequestContext {
-
-        protected final ProcessInfoProvider provider;
-
-        public RequestContextImpl(ProcessInfoProvider prov) {
-            this.provider = prov;
-        }
-
-        /**
-         * @see org.apache.cocoon.portal.RequestContext#getRequest()
-         */
-        public HttpServletRequest getRequest() {
-            return this.provider.getRequest();
-        }
-
-        /**
-         * @see org.apache.cocoon.portal.RequestContext#getResponse()
-         */
-        public HttpServletResponse getResponse() {
-            return this.provider.getResponse();
-        }
-
-        /**
-         * @see org.apache.cocoon.portal.RequestContext#isAjaxRequest()
-         */
-        public boolean isAjaxRequest() {
-            final HttpServletRequest req = this.getRequest();
-            return req.getParameter(AjaxHelper.AJAX_REQUEST_PARAMETER) != null;
         }
 
     }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/InformationProviderServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/InformationProviderServiceImpl.java?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/InformationProviderServiceImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/InformationProviderServiceImpl.java
Tue Nov 27 14:40:20 2007
@@ -58,8 +58,8 @@
      */
     public StaticInformationProvider getStaticProvider() {
         if ( this.staticProvider == null ) {
-            this.staticProvider = new StaticInformationProviderImpl(this.getPortalContextProvider(),

-                    (PortletDefinitionRegistry)this.portletContainerEnvironment.getContainerService(PortletDefinitionRegistry.class));
           
+            this.staticProvider = new StaticInformationProviderImpl(this.getPortalContextProvider(),
+                    (PortletDefinitionRegistry)this.portletContainerEnvironment.getContainerService(PortletDefinitionRegistry.class));
         }
         return this.staticProvider;
     }
@@ -86,8 +86,8 @@
      */
     protected PortalContextProviderImpl getPortalContextProvider() {
         if ( this.provider == null ) {
-            this.provider = new PortalContextProviderImpl(this.portalService.getProcessInfoProvider().getObjectModel());
+            this.provider = new PortalContextProviderImpl(this.portalService.getRequestContext());
         }
-        return this.provider;        
+        return this.provider;
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextProviderImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextProviderImpl.java?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextProviderImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextProviderImpl.java
Tue Nov 27 14:40:20 2007
@@ -18,15 +18,14 @@
 
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Map;
 import java.util.Vector;
 
 import javax.portlet.PortletMode;
 import javax.portlet.WindowState;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.cocoon.Constants;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.portal.RequestContext;
 import org.apache.pluto.services.information.PortalContextProvider;
 
 /**
@@ -34,7 +33,7 @@
  *
  * @version $Id$
  */
-public class PortalContextProviderImpl 
+public class PortalContextProviderImpl
 implements PortalContextProvider {
 
     /** Portal information */
@@ -64,15 +63,15 @@
     /**
      * Constructor
      */
-    public PortalContextProviderImpl(Map objectModel) {        
-        // these are the minimum modes that the portal needs to support        
+    public PortalContextProviderImpl(RequestContext context) {
+        // these are the minimum modes that the portal needs to support
         this.modes = this.getDefaultModes();
-        // these are the minimum states that the portal needs to support        
-        this.states = this.getDefaultStates(); 
-        // set info       
+        // these are the minimum states that the portal needs to support
+        this.states = this.getDefaultStates();
+        // set info
         this.info = "Apache Cocoon/" + Constants.VERSION;
         this.properties = new HashMap();
-        this.init(objectModel);
+        this.init(context);
     }
 
     /**
@@ -144,8 +143,8 @@
     /**
      * Initialize some infos.
      */
-    protected void init(Map objectModel) {
-        final Request request = ObjectModelHelper.getRequest(objectModel);
+    protected void init(final RequestContext requestContext) {
+        final HttpServletRequest request = requestContext.getRequest();
         final String hostName   = request.getServerName();
         final String contextRoot = request.getContextPath();
         final int hostPortHTTP  = request.getServerPort();

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
Tue Nov 27 14:40:20 2007
@@ -56,7 +56,7 @@
  */
 public class TestProfileManager extends GroupBasedProfileManager {
 
-    protected ProfileHolder loadProfile() 
+    protected ProfileHolder loadProfile()
     throws ProfileException {
         final PortalUser user = this.portalService.getUserService().getUser();
         if ( user.getUserName().equals("test") ) {
@@ -65,7 +65,7 @@
                 // display the portlets specified with the parameter. Otherwise
                 // we show all portlets
                 final List portletNames = new ArrayList();
-                final HttpServletRequest r = this.portalService.getProcessInfoProvider().getRequest();
+                final HttpServletRequest r = this.portalService.getRequestContext().getRequest();
                 final String[] values = r.getParameterValues("portletName");
                 if ( values != null && values.length > 0 ) {
                     for(int i=0; i<values.length; i++) {
@@ -73,14 +73,14 @@
                     }
                 }
                 final ProfileHolder profile = new ProfileHolder();
-    
+
                 // first "load" the global coplet types
                 profile.setCopletTypes( this.getGlobalCopletTypes() );
                 profile.setCopletDefinitions( this.getGlobalCopletDefinitions( user, profile
) );
-    
+
                 // create root layout
                 CompositeLayout rootLayout = new CompositeLayout("root", "row");
-    
+
                 // create coplet instances and layouts
                 final List instances = new ArrayList();
                 final Iterator i = this.deployedCopletDefinitions.values().iterator();
@@ -103,7 +103,7 @@
                 }
                 profile.setCopletInstances(this.processCopletInstances(profile, instances));
                 profile.setRootLayout(this.processLayout(profile, rootLayout));
-    
+
                 this.storeUserProfile(profile);
                 return profile;
             } catch (ProfileException e) {
@@ -124,7 +124,7 @@
         if ( event instanceof UserIsAccessingEvent ) {
             if ( "test".equals(event.getPortalUser().getUserName()) ) {
                 final List portletNames = new ArrayList();
-                final HttpServletRequest r = this.portalService.getProcessInfoProvider().getRequest();
+                final HttpServletRequest r = this.portalService.getRequestContext().getRequest();
                 final String[] values = r.getParameterValues("portletName");
                 if ( values != null && values.length > 0 ) {
                     for(int i=0; i<values.length; i++) {

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java
Tue Nov 27 14:40:20 2007
@@ -66,7 +66,7 @@
  *
  * @version $Id$
  */
-public class PortletDefinitionRegistryImpl 
+public class PortletDefinitionRegistryImpl
     extends AbstractComponent
     implements PortletDefinitionRegistry, Receiver, Parameterizable, Runnable {
 
@@ -80,7 +80,7 @@
     /** The mapping */
     public static final String PORTLET_MAPPING = "resource://org/apache/cocoon/portal/pluto/om/portletdefinitionmapping.xml";
 
-    /** The mapping */    
+    /** The mapping */
     public static final String WEBXML_MAPPING = "resource://org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml";
 
     /** The portlet application entity list */
@@ -137,7 +137,7 @@
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
-    public void service(ServiceManager serviceManager) 
+    public void service(ServiceManager serviceManager)
     throws ServiceException {
         super.service(serviceManager);
         this.entityResolver = (EntityResolver) this.manager.lookup(EntityResolver.ROLE);
@@ -182,7 +182,7 @@
         }
         super.initialize();
 
-        this.servletContext = this.portalService.getProcessInfoProvider().getServletContext();
+        this.servletContext = this.portalService.getRequestContext().getServletContext();
 
         // get our context path
         String baseWMDir = this.servletContext.getRealPath("");
@@ -250,7 +250,7 @@
             }
         } finally {
             this.manager.release(resolver);
-        } 
+        }
 
         // now load existing webapps/portlets
         if ( this.scanOnStartup ) {
@@ -273,7 +273,7 @@
         try {
             if ( this.webAppDir == null ) {
                 if (this.getLogger().isWarnEnabled()) {
-                    this.getLogger().warn("Only local portlets are supported when deployed
as a war " 
+                    this.getLogger().warn("Only local portlets are supported when deployed
as a war "
                                         + "and 'webapp-directory' is not configured.");
                 }
                 this.contextName = "local";
@@ -300,7 +300,7 @@
         return (PortletDefinition)portletsKeyObjectId.get(id);
     }
 
-    protected void scanWebapps() 
+    protected void scanWebapps()
     throws Exception {
         File f = new File(this.webAppDir);
         String[] entries = f.list();
@@ -344,7 +344,7 @@
             InputSource copletSource = null;
             if ( url != null ) {
                 copletSource = new InputSource(url.openStream());
-                copletSource.setSystemId(url.toExternalForm());                
+                copletSource.setSystemId(url.toExternalForm());
             }
             this.load(portletSource, webSource, copletSource, this.contextName);
         }
@@ -374,7 +374,7 @@
                 entry = war.getEntry(COPLET_XML);
                 if ( entry != null ) {
                     copletSource = new InputSource(war.getInputStream(entry));
-                    copletSource.setSystemId("/" + COPLET_XML);                    
+                    copletSource.setSystemId("/" + COPLET_XML);
                 }
                 this.load(portletSource, webSource, copletSource, webModule);
             }
@@ -420,7 +420,7 @@
             InputSource copletSource = null;
             if ( copletXml.exists() ) {
                 copletSource = new InputSource(new FileInputStream(copletXml));
-                copletSource.setSystemId(copletXml.toURL().toExternalForm());    
+                copletSource.setSystemId(copletXml.toURL().toExternalForm());
             }
 
             this.load(portletSource, webSource, copletSource, webModule);
@@ -498,7 +498,7 @@
             if (this.contextName.equals(webModule)) {
                 ((PortletDefinitionImpl) portlet).setLocalPortlet(true);
             } else if ( portlet.getServletDefinition() == null ) {
-                throw new DeploymentException("Unable to deploy portlet '" + portlet.getId()
+ 
+                throw new DeploymentException("Unable to deploy portlet '" + portlet.getId()
+
                           "'. Servlet definition for '"+WebApplicationRewriter.CONTAINER+"'
not found in web.xml.");
             }
             ((PortletDefinitionImpl) portlet).setPortletClassLoader(Thread.currentThread()
@@ -544,7 +544,7 @@
             try {
                 File toFile = new File(this.webAppDir, fileName);
                 if ( Deployer.deploy(event.getDeploymentObject().getSource(),
-                                     toFile.getAbsolutePath(), 
+                                     toFile.getAbsolutePath(),
                                      this.stripLoggers,
                                      this.getLogger(), this.manager) ) {
                     // let's wait some seconds to give the web container time to

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
Tue Nov 27 14:40:20 2007
@@ -73,7 +73,7 @@
  * @see Factory
  * @version $Id$
  */
-public class FactoryManagerServiceImpl 
+public class FactoryManagerServiceImpl
     extends AbstractComponent
     implements FactoryManagerService, Parameterizable {
 
@@ -124,7 +124,7 @@
         public String getServletName() {
             return this.servletContext.getServletContextName();
         }
-        
+
     }
     /**
      * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
@@ -139,11 +139,11 @@
     public void initialize()
     throws Exception {
         super.initialize();
-        final ServletContext servletContext = this.portalService.getProcessInfoProvider().getServletContext();
+        final ServletContext servletContext = this.portalService.getRequestContext().getServletContext();
         this.servletConfig = new PortalServletConfig(servletContext);
         final Map factories = new HashMap();
 
-        factories.put(ActionRequest.class.getName(), 
+        factories.put(ActionRequest.class.getName(),
                       this.parameters.getParameter("action-request-factory", ActionRequestFactoryImpl.class.getName()));
         factories.put(RenderRequest.class.getName(),
                       this.parameters.getParameter("render-request-factory", RenderRequestFactoryImpl.class.getName()));

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java?rev=598794&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java
Tue Nov 27 14:40:20 2007
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.sitemap.impl;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cocoon.ajax.AjaxHelper;
+import org.apache.cocoon.portal.RequestContext;
+import org.apache.cocoon.portal.spi.RequestContextProvider;
+import org.apache.cocoon.processing.ProcessInfoProvider;
+
+/**
+ * This service provides the current request context.
+ *
+ * @version $Id$
+ */
+public class CocoonRequestContextProvider implements RequestContextProvider {
+
+    /** The process info provider. */
+    protected ProcessInfoProvider processInfoProvider;
+
+    public void setProcessInfoProvider(final ProcessInfoProvider p) {
+        this.processInfoProvider = p;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.spi.RequestContextProvider#getCurrentRequestContext()
+     */
+    public RequestContext getCurrentRequestContext() {
+        // TODO Should we cache the object creation?
+        return new RequestContextImpl(this.processInfoProvider);
+    }
+
+    public static final class RequestContextImpl implements RequestContext {
+
+        protected final ProcessInfoProvider provider;
+
+        public RequestContextImpl(ProcessInfoProvider prov) {
+            this.provider = prov;
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.RequestContext#getRequest()
+         */
+        public HttpServletRequest getRequest() {
+            return this.provider.getRequest();
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.RequestContext#getResponse()
+         */
+        public HttpServletResponse getResponse() {
+            return this.provider.getResponse();
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.RequestContext#isAjaxRequest()
+         */
+        public boolean isAjaxRequest() {
+            final HttpServletRequest req = this.getRequest();
+            return req.getParameter(AjaxHelper.AJAX_REQUEST_PARAMETER) != null;
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.RequestContext#getServletContext()
+         */
+        public ServletContext getServletContext() {
+            return this.provider.getServletContext();
+        }
+
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/sitemap/impl/CocoonRequestContextProvider.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-portal-sitemap-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-portal-sitemap-components.xml?rev=598794&r1=598793&r2=598794&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-portal-sitemap-components.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-portal-sitemap-components.xml
Tue Nov 27 14:40:20 2007
@@ -31,6 +31,14 @@
                            http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
 
   <!--+
+      | SPI Implementations
+      +-->
+    <bean name="org.apache.cocoon.portal.spi.RequestContextProvider"
+          class="org.apache.cocoon.portal.sitemap.impl.CocoonRequestContextProvider">
+      <property name="processInfoProvider" ref="org.apache.cocoon.processing.ProcessInfoProvider"/>
+    </bean>
+    
+  <!--+
       | Coplet Adapters
       |
       +-->



Mime
View raw message