cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r430282 [2/2] - in /cocoon/trunk: blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/ blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/ blocks/cocoon-portal/cocoon-portal-impl...
Date Thu, 10 Aug 2006 06:33:59 GMT
Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
Wed Aug  9 23:33:57 2006
@@ -33,6 +33,9 @@
  */
 public class DefaultLinkRenderer extends AbstractRenderer {
 
+    /**
+     * @see org.apache.cocoon.portal.layout.renderer.impl.AbstractRenderer#process(org.apache.cocoon.portal.layout.Layout,
org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
+     */
     public void process(Layout layout, PortalService service, ContentHandler handler)
     throws SAXException {
         if (layout instanceof LinkLayout) {

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/RegistrationBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/RegistrationBeanPostProcessor.java?rev=430282&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/RegistrationBeanPostProcessor.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/RegistrationBeanPostProcessor.java
Wed Aug  9 23:33:57 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.spring;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.layout.renderer.Renderer;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+
+/**
+ * This is a Spring bean post processor for registering portal
+ * components to the {@link PortalService}.
+ *
+ * @version $Id$
+ */
+public class RegistrationBeanPostProcessor
+    implements BeanPostProcessor, BeanFactoryAware {
+
+    protected BeanFactory beanFactory;
+
+    protected static String RENDERER_ROLE_PREFIX = Renderer.ROLE + '/';
+
+    /**
+     * @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
+     */
+    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+        this.beanFactory = beanFactory;
+    }
+
+    /**
+     * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object,
java.lang.String)
+     */
+    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
{
+        if ( bean instanceof Renderer ) {
+            String name = beanName;
+            if ( name.startsWith(RENDERER_ROLE_PREFIX) ) {
+                name = name.substring(RENDERER_ROLE_PREFIX.length());
+            }
+            ((PortalService)this.beanFactory.getBean(PortalService.ROLE)).register(name,
(Renderer)bean);
+        }
+        return bean;
+    }
+
+    /**
+     * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object,
java.lang.String)
+     */
+    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
{
+        // nothing to do
+        return bean;
+    }
+}

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

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/RegistrationBeanPostProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Id

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?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- 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
Wed Aug  9 23:33:57 2006
@@ -20,6 +20,8 @@
       +-->
     <role name="org.apache.cocoon.portal.spring.ReceiverBeanPostProcessor"
           default-class="org.apache.cocoon.portal.spring.ReceiverBeanPostProcessor"/>
+    <role name="org.apache.cocoon.portal.spring.RegistrationBeanPostProcessor"
+          default-class="org.apache.cocoon.portal.spring.RegistrationBeanPostProcessor"/>
 
   <!--+ 
       | Event Aspects

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=430282&r1=430281&r2=430282&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
Wed Aug  9 23:33:57 2006
@@ -19,8 +19,8 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletDefinition;
 import org.apache.cocoon.portal.coplet.CopletInstance;
@@ -65,7 +65,7 @@
             // display the portlets specified with the parameter. Otherwise
             // we show all portlets
             final List portletNames = new ArrayList();
-            final Request r = ObjectModelHelper.getRequest(this.portalService.getObjectModel());
+            final HttpServletRequest r = this.portalService.getProcessInfoProvider().getRequest();
             final String[] values = r.getParameterValues("portletName");
             if ( values != null && values.length > 0 ) {
                 for(int i=0; i<values.length; i++) {
@@ -125,7 +125,7 @@
         if ( event instanceof UserIsAccessingEvent ) {
             if ( "test".equals(event.getPortalUser().getUserName()) ) {
                 final List portletNames = new ArrayList();
-                final Request r = ObjectModelHelper.getRequest(this.portalService.getObjectModel());
+                final HttpServletRequest r = this.portalService.getProcessInfoProvider().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/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?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- 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
Wed Aug  9 23:33:57 2006
@@ -373,7 +373,7 @@
 
         // do we already have an environment?
         // if not, create one
-        final Map objectModel = aspectContext.getObjectModel();
+        final Map objectModel = service.getProcessInfoProvider().getObjectModel();
 
         PortletURLProviderImpl event = (PortletURLProviderImpl) objectModel.get("portlet-event");
         if ( event != null ) {
@@ -405,7 +405,7 @@
                        ContentHandler ch,
                        Properties properties)
     throws SAXException {
-        final Map objectModel = aspectContext.getObjectModel();
+        final Map objectModel = service.getProcessInfoProvider().getObjectModel();
 
         // don't generate a response, if we issued a redirect
         if (objectModel.remove("portlet-event") == null) {

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java
Wed Aug  9 23:33:57 2006
@@ -15,10 +15,11 @@
  */
 package org.apache.cocoon.portal.coplets.basket;
 
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameters;
+import java.util.Properties;
+
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.portal.PortalException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstance;
 import org.apache.cocoon.portal.coplets.basket.events.AddItemEvent;
@@ -100,11 +101,11 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
+     * @see org.apache.cocoon.portal.layout.renderer.aspect.impl.AbstractAspect#prepareConfiguration(java.util.Properties)
      */
-    public Object prepareConfiguration(Parameters configuration)
-    throws ParameterException {
-        if ( configuration.getParameter("use-store", "basket").equalsIgnoreCase("basket")
) {
+    public Object prepareConfiguration(Properties configuration)
+    throws PortalException {
+        if ( configuration.getProperty("use-store", "basket").equalsIgnoreCase("basket")
) {
             return Boolean.TRUE;
         }
         return Boolean.FALSE;

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?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- 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
Wed Aug  9 23:33:57 2006
@@ -23,6 +23,9 @@
 import java.util.Map;
 import java.util.Properties;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
 import oasis.names.tc.wsrp.v1.types.BlockingInteractionResponse;
 import oasis.names.tc.wsrp.v1.types.LocalizedString;
 import oasis.names.tc.wsrp.v1.types.MarkupContext;
@@ -43,8 +46,6 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.environment.wrapper.RequestParameters;
 import org.apache.cocoon.portal.PortalManagerAspect;
 import org.apache.cocoon.portal.PortalManagerAspectPrepareContext;
@@ -284,7 +285,7 @@
             }
         }
         coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_KEY, portletKey);
-        final Session session = ObjectModelHelper.getRequest(this.portalService.getObjectModel()).getSession();
+        final HttpSession session = this.portalService.getProcessInfoProvider().getRequest().getSession();
         final String portletInstanceKey = this.getPortletInstanceKey(portletKey, coplet,
session.getId());
         coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY, portletInstanceKey);
 
@@ -600,8 +601,7 @@
             WSRPPortlet wsrpPortlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
             User user = (User) coplet.getTemporaryAttribute(ATTRIBUTE_NAME_USER);
             
-            org.apache.cocoon.environment.Request requestObject = ObjectModelHelper.getRequest(service.getObjectModel());
-            java.util.Enumeration formParameter = requestObject.getParameterNames();
+            final HttpServletRequest requestObject = service.getProcessInfoProvider().getRequest();
 
             Request request = new RequestImpl();
             String portletMode = requestObject.getParameter(Constants.PORTLET_MODE);
@@ -642,10 +642,10 @@
                 }
             }
             if (requestObject.getParameter(Constants.URL_TYPE).equals(Constants.URL_TYPE_BLOCKINGACTION))
{
-            // performBlockingInteraction()
-                String parameter;
+                // performBlockingInteraction()
+                final Enumeration formParameter = requestObject.getParameterNames();
                 while (formParameter.hasMoreElements()) {
-                    parameter = (String) formParameter.nextElement();
+                    final String parameter = (String) formParameter.nextElement();
                     request.addFormParameter(parameter, requestObject.getParameter(parameter));
                 }
                 performBlockingInteraction(wsrpPortlet, windowSession, user, request);

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.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/WSRPEventAspect.java?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java
Wed Aug  9 23:33:57 2006
@@ -41,7 +41,7 @@
      * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext,
org.apache.cocoon.portal.PortalService)
      */
     public void process(EventAspectContext context, PortalService service) {
-        final Request request = ObjectModelHelper.getRequest(context.getObjectModel());
+        final Request request = ObjectModelHelper.getRequest(service.getProcessInfoProvider().getObjectModel());
         final String[] values = request.getParameterValues("cocoon-wsrpevent");
         if ( values != null && values.length == 1 ) {
             // create a wsrp event, first build map of parameters

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
Wed Aug  9 23:33:57 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.cocoon.processing;
 
+import java.util.Map;
+
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -28,9 +30,13 @@
  */
 public interface ProcessInfoProvider {
 
+    String ROLE = ProcessInfoProvider.class.getName();
+
     HttpServletRequest getRequest();
 
     HttpServletResponse getResponse();
 
     ServletContext getServletContext();
+
+    Map getObjectModel();
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java?rev=430282&r1=430281&r2=430282&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
Wed Aug  9 23:33:57 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.cocoon.processing.impl;
 
+import java.util.Map;
+
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -70,5 +72,12 @@
      */
     public ServletContext getServletContext() {
         return this.servletContext;
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getObjectModel()
+     */
+    public Map getObjectModel() {
+        return ContextHelper.getObjectModel(this.context);
     }
 }



Mime
View raw message