You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by uk...@apache.org on 2007/06/14 09:41:45 UTC

svn commit: r547160 - in /portals/pluto/branches/1.1-286-COMPATIBILITY: pluto-container/src/main/java/org/apache/pluto/ pluto-container/src/main/java/org/apache/pluto/core/ pluto-container/src/main/java/org/apache/pluto/internal/impl/ pluto-descriptor-...

Author: ukuester
Date: Thu Jun 14 00:41:44 2007
New Revision: 547160

URL: http://svn.apache.org/viewvc?view=rev&rev=547160
Log:
[Pluto-267]: 1.1.-286-COMPATIBILITY This refactors fire_event, the implementation gets simplified.
A small bug for FileAssembler.java was fixed for assemble portlets.
This contains the work from Toumas Kivaho and Christian Raschka.
Thanks!

Modified:
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/EventContainer.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/jaxb.index
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/EventContainer.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/EventContainer.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/EventContainer.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/EventContainer.java Thu Jun 14 00:41:44 2007
@@ -22,7 +22,7 @@
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
+import javax.portlet.Event;
 
 /**
  * The publicized entry point into Pluto for firing events
@@ -43,7 +43,7 @@
      *                                   has trouble fulfilling the request
      */
 	public void fireEvent(HttpServletRequest request, HttpServletResponse response, 
-			PortletWindow window, QName eventName, int eventNumber) throws PortletException, IOException;
+			PortletWindow window, Event event) throws PortletException, IOException;
 	
 	public ServletContext getServletContext();
 }

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java Thu Jun 14 00:41:44 2007
@@ -28,7 +28,7 @@
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
+import javax.portlet.Event;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -246,6 +246,10 @@
         debugWithName("Portlet action processed for: "
         		+ portletWindow.getPortletName());
         
+        PortletURLProvider portletURLProvider = requiredContainerServices.getPortalCallbackService().getPortletURLProvider(request, internalPortletWindow);
+        saveChangedParameters(actionRequest, actionResponse, portletURLProvider);
+        portletURLProvider.savePortalURL(request);        
+        
         EventProvider provider = this.getRequiredContainerServices().getPortalCallbackService().
 			getEventProvider(request,response);
         provider.fireEvents(this);
@@ -261,8 +265,6 @@
             		.getPortalCallbackService()
             		.getPortletURLProvider(request, internalPortletWindow);
             
-            saveChangedParameters(actionRequest, actionResponse, redirectURL);
-            
             // Encode the redirect URL to a string.
             location = actionResponse.encodeRedirectURL(redirectURL.toString());
         }
@@ -373,7 +375,7 @@
      * @see {@link javax.portlet.EventPortlet#processEvent(javax.portlet.EventRequest, javax.portlet.EventResponse)
      */
     public void fireEvent(HttpServletRequest request, HttpServletResponse response,
-    		PortletWindow window, QName eventName, int eventNumber) 
+    		PortletWindow window, Event event) 
     		throws PortletException, IOException {
 
     	ensureInitialized();
@@ -384,13 +386,9 @@
     			+ window.getPortletName());
 
     	EventRequestImpl eventRequest = new EventRequestImpl(
-    			this, internalPortletWindow, request);
+    			this, internalPortletWindow, request, event);
     	EventResponseImpl eventResponse = new EventResponseImpl(
     			this, internalPortletWindow, request, response);
-    	
-    	// Save the name of the actual event to fire in the Request
-    	eventRequest.setAttribute(Constants.EVENT_NAME, eventName.toString());
-    	eventRequest.setAttribute(Constants.EVENT_NUMBER, new Integer(eventNumber).toString());
 
     	PortletInvoker invoker = new PortletInvoker(internalPortletWindow);
     	invoker.event(eventRequest, eventResponse);

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java Thu Jun 14 00:41:44 2007
@@ -56,15 +56,15 @@
 	 */
 	private PortletPreferences portletPreferences = null;
 	
-	private HttpServletRequest request = null; 
+	private Event event; 
 	
 	//	 Constructor -------------------------------------------------------------
     
     public EventRequestImpl(PortletContainer container,
                              InternalPortletWindow internalPortletWindow,
-                             HttpServletRequest servletRequest) {
+                             HttpServletRequest servletRequest, Event event) {
         super(container, internalPortletWindow, servletRequest);
-        this.request = servletRequest;
+        this.event = event;
         if (LOG.isDebugEnabled()) {
         	LOG.debug("Created Event request for: " + internalPortletWindow);
         }
@@ -75,10 +75,7 @@
     
     public Event getEvent(){
         EventProvider provider = 
-        	(EventProvider) request.getAttribute(Constants.PROVIDER);
-        String eventName = (String) this.getAttribute(Constants.EVENT_NAME);
-        int eventNumber = Integer.parseInt((String) this.getAttribute(Constants.EVENT_NUMBER));
-        Event event = provider.getEvent(eventName, eventNumber);
+        	(EventProvider) this.getRequest().getAttribute(Constants.PROVIDER);
 
         Object value = event.getValue();
         if (value instanceof XMLStreamReader) {

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java Thu Jun 14 00:41:44 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.pluto.internal.impl;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
@@ -29,7 +28,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import javax.portlet.Event;
 import javax.portlet.PortalContext;
 import javax.portlet.PortletException;
 import javax.portlet.PortletMode;
@@ -41,7 +39,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
-import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
@@ -51,14 +48,9 @@
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.SchemaFactoryLoader;
-
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.Constants;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
 import org.apache.pluto.descriptors.portlet.EventDefinitionDD;
@@ -70,9 +62,6 @@
 import org.apache.pluto.spi.PublicRenderParameterProvider;
 import org.apache.pluto.spi.ResourceURLProvider;
 import org.apache.pluto.util.StringUtils;
-import org.xml.sax.SAXException;
-
-import com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl;
 
 /**
  * Implementation of JSR-286 <code>StateAwareResponse</code>.
@@ -132,18 +121,16 @@
 			}
 			
 			ClassLoader loader = Thread.currentThread().getContextClassLoader();
-			Class clazz = loader.loadClass(eventDefinitionDD.getJavaClass());
+			Class clazz = loader.loadClass(eventDefinitionDD.getJavaClass());		
 
 			JAXBContext jc = JAXBContext.newInstance(clazz);
 
 			Marshaller marshaller  = jc.createMarshaller();
-			marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, 
-					Boolean.TRUE );
+//			marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, 
+//					Boolean.TRUE );
 
 			Writer out = new StringWriter();
-
-			marshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
-
+			
 			marshaller.marshal(new JAXBElement(
 					eventDefinitionDD.getName(),clazz,value), out);
 

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/jaxb.index
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/jaxb.index?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/jaxb.index (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/jaxb.index Thu Jun 14 00:41:44 2007
@@ -5,6 +5,6 @@
 PortletInfoDD
 PortletPreferenceDD
 PortletPreferencesDD
-SharedRenderParamDD
+PublicRenderParamDD
 SupportsDD
 ExpirationCacheDD

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java Thu Jun 14 00:41:44 2007
@@ -283,7 +283,7 @@
 			
 			Event eActual = getArbitraryEvent();
 
-        	List<String> portletNames = (eActual.getName() != null) ? portalEvts.get(eActual.getName().toString()) : null;
+        	List<String> portletNames = (eActual.getQName() != null) ? portalEvts.get(eActual.getQName().toString()) : null;
         	
         	Collection<PortletWindowConfig> portlets = getAllPortletsInPortal(driverConfig);
         	

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java Thu Jun 14 00:41:44 2007
@@ -26,6 +26,7 @@
 
 import org.apache.pluto.EventContainer;
 import org.apache.pluto.PortletWindow;
+import org.apache.pluto.driver.core.PortalServletRequest;
 
 public class PortletWindowThread extends Thread {
 	
@@ -60,12 +61,11 @@
 	public void run() {
 		super.run();
 		while (events.size() > 0) {
-			HttpServletRequest req = eventProvider.getRequest();
+			HttpServletRequest req = new PortalServletRequest(eventProvider.getRequest(), this.portletWindow);
 			HttpServletResponse res = eventProvider.getResponse();
 			try {
 				synchronized (this) {
-					eventContainer.fireEvent(req, res, portletWindow, events.get(0).getQName(),
-							eventProvider.getSavedEvents().getNumber(events.get(0)));
+					eventContainer.fireEvent(req, res, portletWindow, events.get(0));
 					//wait();
 					Thread.sleep(1);
 					events.remove(0);				

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java Thu Jun 14 00:41:44 2007
@@ -92,21 +92,6 @@
             }
         }
 
-        String id = portletWindow.getId().getStringId();
-        if (portletWindow.getId().getStringId().equals(id)) {
-            Enumeration params = super.getParameterNames();
-            while (params.hasMoreElements()) {
-                String name = params.nextElement().toString();
-                String[] values = super.getParameterValues(name);
-                if (portletParameters.containsKey(name)) {
-                    String[] temp = (String[]) portletParameters.get(name);
-                    String[] all = new String[values.length + temp.length];
-                    System.arraycopy(values, 0, all, 0, values.length);
-                    System.arraycopy(temp, 0, all, values.length, temp.length);
-                }
-                portletParameters.put(name, values);
-            }
-        }
     }
 
     /**

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java?view=diff&rev=547160&r1=547159&r2=547160
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java Thu Jun 14 00:41:44 2007
@@ -22,7 +22,7 @@
 import org.apache.pluto.descriptors.portlet.PortletDD;
 import org.apache.pluto.descriptors.services.PortletAppDescriptorService;
 import org.apache.pluto.descriptors.services.castor.EntityResolverImpl;
-import org.apache.pluto.descriptors.services.castor.PortletAppDescriptorServiceImpl;
+import org.apache.pluto.descriptors.services.jaxb.PortletAppDescriptorServiceImpl;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;