portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r758134 [4/5] - in /portals/jetspeed-2/portal/trunk: applications/jetspeed/src/main/webapp/WEB-INF/templates/layout/html/solo/ applications/jetspeed/src/main/webapp/decorations/layout/blueocean/ applications/jetspeed/src/main/webapp/decorat...
Date Wed, 25 Mar 2009 03:25:00 GMT
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java?rev=758134&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java Wed Mar 25 03:24:47 2009
@@ -0,0 +1,514 @@
+/*
+ * 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.jetspeed.container.state;
+
+import java.security.Principal;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.aggregator.ContentDispatcher;
+import org.apache.jetspeed.capabilities.CapabilityMap;
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.om.portlet.Language;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.pipeline.Pipeline;
+import org.apache.jetspeed.profiler.Profiler;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.window.MockPortletWindow;
+
+/**
+ * @version $Id$
+ *
+ */
+public class MockRequestContext implements RequestContext
+{
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getActionWindow()
+     */
+    public PortletWindow getActionWindow()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getAttribute(java.lang.String)
+     */
+    public Object getAttribute(String key)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getCapabilityMap()
+     */
+    public CapabilityMap getCapabilityMap()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getCharacterEncoding()
+     */
+    public String getCharacterEncoding()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getConfig()
+     */
+    public ServletConfig getConfig()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getContentDispatcher()
+     */
+    public ContentDispatcher getContentDispatcher()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getCurrentPortletWindow()
+     */
+    public PortletWindow getCurrentPortletWindow()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getLocale()
+     */
+    public Locale getLocale()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getMediaType()
+     */
+    public String getMediaType()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getMimeType()
+     */
+    public String getMimeType()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getObjects()
+     */
+    public Map<String, Object> getObjects()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPage()
+     */
+    public ContentPage getPage()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getParameterMap()
+     */
+    public Map getParameterMap()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPath()
+     */
+    public String getPath()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPipeline()
+     */
+    public Pipeline getPipeline()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPortalURL()
+     */
+    public PortalURL getPortalURL()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPortletWindow(java.lang.String)
+     */
+    public PortletWindow getPortletWindow(String windowId)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPortletWindow(org.apache.jetspeed.om.page.ContentFragment)
+     */
+    public PortletWindow getPortletWindow(ContentFragment fragment)
+    {
+        return new MockPortletWindow(fragment.getId());
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getPreferedLanguage(org.apache.jetspeed.om.portlet.PortletDefinition)
+     */
+    public Language getPreferedLanguage(PortletDefinition portlet)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getProfileLocators()
+     */
+    public Map getProfileLocators()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getRequest()
+     */
+    public HttpServletRequest getRequest()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getRequestForWindow(org.apache.jetspeed.container.PortletWindow)
+     */
+    public HttpServletRequest getRequestForWindow(PortletWindow window)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getRequestParameter(java.lang.String)
+     */
+    public String getRequestParameter(String key)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getResponse()
+     */
+    public HttpServletResponse getResponse()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getResponseForWindow(org.apache.jetspeed.container.PortletWindow)
+     */
+    public HttpServletResponse getResponseForWindow(PortletWindow window)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getSessionAttribute(java.lang.String)
+     */
+    public Object getSessionAttribute(String key)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getSubject()
+     */
+    public Subject getSubject()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getUserInfoMap(java.lang.String)
+     */
+    public Map<String, String> getUserInfoMap(String appName)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getUserPrincipal()
+     */
+    public Principal getUserPrincipal()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#locatePage(org.apache.jetspeed.profiler.Profiler, java.lang.String)
+     */
+    public ContentPage locatePage(Profiler profiler, String nonProfiledPath)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#popActionFailure(org.apache.jetspeed.container.PortletWindow)
+     */
+    public Throwable popActionFailure(PortletWindow window)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setActionFailure(org.apache.jetspeed.container.PortletWindow, java.lang.Throwable)
+     */
+    public void setActionFailure(PortletWindow window, Throwable actionFailure)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setActionWindow(org.apache.jetspeed.container.PortletWindow)
+     */
+    public void setActionWindow(PortletWindow window)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setAttribute(String key, Object value)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setCapabilityMap(org.apache.jetspeed.capabilities.CapabilityMap)
+     */
+    public void setCapabilityMap(CapabilityMap map)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setCharacterEncoding(java.lang.String)
+     */
+    public void setCharacterEncoding(String enc)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setContentDispatcher(org.apache.jetspeed.aggregator.ContentDispatcher)
+     */
+    public void setContentDispatcher(ContentDispatcher dispatcher)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setLocale(java.util.Locale)
+     */
+    public void setLocale(Locale locale)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setMediaType(java.lang.String)
+     */
+    public void setMediaType(String mediaType)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setMimeType(java.lang.String)
+     */
+    public void setMimeType(String mimeType)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setPage(org.apache.jetspeed.om.page.ContentPage)
+     */
+    public void setPage(ContentPage page)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setPath(java.lang.String)
+     */
+    public void setPath(String path)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setPipeline(org.apache.jetspeed.pipeline.Pipeline)
+     */
+    public void setPipeline(Pipeline pipeline)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setPortalURL(org.apache.jetspeed.container.url.PortalURL)
+     */
+    public void setPortalURL(PortalURL portalUrl)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setProfileLocators(java.util.Map)
+     */
+    public void setProfileLocators(Map locators)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setRequest(javax.servlet.http.HttpServletRequest)
+     */
+    public void setRequest(HttpServletRequest request)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setResponse(javax.servlet.http.HttpServletResponse)
+     */
+    public void setResponse(HttpServletResponse response)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setSessionAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setSessionAttribute(String key, Object value)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#setSubject(javax.security.auth.Subject)
+     */
+    public void setSubject(Subject subject)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getInstantlyCreatedPortletWindow(java.lang.String)
+     */
+    public PortletWindow getInstantlyCreatedPortletWindow(String windowId)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#registerInstantlyCreatedPortletWindow(org.apache.jetspeed.container.PortletWindow)
+     */
+    public void registerInstantlyCreatedPortletWindow(PortletWindow portletWindow)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#resolvePortletWindow(java.lang.String)
+     */
+    public PortletWindow resolvePortletWindow(String windowId)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#clearThreadContext()
+     */
+    public void clearThreadContext()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#ensureThreadContext()
+     */
+    public boolean ensureThreadContext()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }   
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/MockRequestContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java Wed Mar 25 03:24:47 2009
@@ -17,7 +17,7 @@
 package org.apache.jetspeed.container.state;
 
 import java.util.HashMap;
-import java.util.Iterator;
+import java.util.Map;
 
 import javax.portlet.PortletMode;
 import javax.portlet.WindowState;
@@ -36,21 +36,11 @@
 import org.apache.jetspeed.container.url.impl.AbstractPortalURL;
 import org.apache.jetspeed.container.url.impl.PathInfoEncodingPortalURL;
 import org.apache.jetspeed.container.url.impl.QueryStringEncodingPortalURL;
-import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.jetspeed.engine.Engine;
-import org.apache.jetspeed.factory.PortletFactory;
-import org.apache.jetspeed.om.portlet.PortletApplication;
-import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
 import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
-import org.apache.jetspeed.container.PortletEntity;
-import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.window.MockPortletWindow;
 import org.apache.jetspeed.container.PortletWindow;
-import org.jmock.Mock;
-import org.jmock.core.matcher.AnyArgumentsMatcher;
-import org.jmock.core.matcher.NoArgumentsMatcher;
-import org.jmock.core.stub.ReturnStub;
-import org.jmock.core.stub.VoidStub;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpSession;
@@ -98,23 +88,6 @@
         engineHelper = new SpringEngineHelper(context);
         engineHelper.setUp(getBaseDir());
         engine = (Engine) context.get(SpringEngineHelper.ENGINE_ATTR);
-        // mock test PortletWindow, PortletEntity, PortletDefinition and PortletApplication
-        Mock entityMock = new Mock(PortletEntity.class);        
-        Mock portletDefinitionMock = new Mock(PortletDefinition.class);
-        Mock portletApplicationMock = new Mock(PortletApplication.class);
-        portletDefinitionMock.expects(new AnyArgumentsMatcher()).method("getApplication").withNoArguments().will(new ReturnStub(portletApplicationMock.proxy()));
-        portletApplicationMock.expects(new NoArgumentsMatcher()).method("getName").withNoArguments().will(new ReturnStub("app1"));
-        entityMock.expects(new AnyArgumentsMatcher()).method("getPortletDefinition").withNoArguments().will(new ReturnStub(portletDefinitionMock.proxy()));
-        entityMock.expects(new AnyArgumentsMatcher()).method("setPortletWindow").withAnyArguments().will(new VoidStub());
-        PortletWindowAccessor accessor = (PortletWindowAccessor) engine.getComponentManager().getComponent(PortletWindowAccessor.class);        
-        accessor.createPortletWindow((PortletEntity)entityMock.proxy(), "111");
-        accessor.createPortletWindow((PortletEntity)entityMock.proxy(), "222");
-        accessor.createPortletWindow((PortletEntity)entityMock.proxy(), "333");
-        
-        // register mocked PortletApplication in PortletFactory so the PortletWindowAccessor check for it won't break the tests
-        PortletFactory portletFactory = (PortletFactory)engine.getComponentManager().getComponent("portletFactory");
-        portletFactory.registerPortletApplication((PortletApplication)portletApplicationMock.proxy(),Thread.currentThread().getContextClassLoader());
-        
         codec = (NavigationalStateCodec) engine.getComponentManager().getComponent("NavigationalStateCodec");
         portalContext = (PortalContext) engine.getComponentManager().getComponent("PortalContext");  
         cache = (JetspeedContentCache) engine.getComponentManager().getComponent("portletContentCache");
@@ -174,13 +147,14 @@
 
         portalURL.setRequest(request);
         portalURL.setCharacterEncoding("UTF-8");
+        portalURL.getNavigationalState().sync(new MockRequestContext());
 
-        PortletWindow window = new PortletWindowImpl("111");
+        PortletWindow window = new MockPortletWindow("111");
 
-        HashMap parameters = new HashMap();
+        HashMap<String,String[]> parameters = new HashMap<String, String[]>();
         parameters.put("test",new String[]{"one","two","three"});
 
-        String portletURL = portalURL.createPortletURL(window,parameters,PortletMode.EDIT,WindowState.MAXIMIZED,true,false);
+        String portletURL = portalURL.createPortletURL(window,parameters,PortletMode.EDIT,WindowState.MAXIMIZED,PortalURL.URLType.ACTION,false);
         
         String navStateParameterName = engine.getContext().getConfigurationProperty("portalurl.navigationalstate.parameter.name", AbstractPortalURL.DEFAULT_NAV_STATE_PARAMETER); 
 
@@ -201,7 +175,7 @@
       portalURL.setRequest(request);
       portalURL.setCharacterEncoding("UTF-8");
       
-      PortletWindow window = new PortletWindowImpl("111");
+      PortletWindow window = new MockPortletWindow("111");
       NavigationalState nav = portalURL.getNavigationalState();
 
       // Check that they come out correctly
@@ -215,18 +189,14 @@
       assertNotNull("maximized window is null", maximizedWindow);
       assertEquals("maximized window should equal window 111", maximizedWindow.getId().getStringId(), "111");
 
-      Iterator iter = nav.getParameterNames(target);
-      assertTrue("There should be one parameter",iter.hasNext());
-      while ( iter.hasNext() ) {
-          assertEquals("parameter name should equals \"test\"", (String)iter.next(), "test");
-          String[] values = nav.getParameterValues(target,"test");
-          assertNotNull("parameter name has no values", values);
-          assertEquals("parameter test should have 3 values", values.length, 3);
-          assertEquals("parameter test[0] should be \"one\"", values[0], "one");
-          assertEquals("parameter test[1] should be \"two\"", values[1], "two");
-          assertEquals("parameter test[2] should be \"three\"", values[2], "three");
-      }
-        
+      Map<String,String[]> parameters = nav.getParameterMap(target);
+      assertTrue("There should be one parameter",parameters.size()==1);
+      String[] values = parameters.get("test");
+      assertNotNull("parameter name has no values", values);
+      assertEquals("parameter test should have 3 values", values.length, 3);
+      assertEquals("parameter test[0] should be \"one\"", values[0], "one");
+      assertEquals("parameter test[1] should be \"two\"", values[1], "two");
+      assertEquals("parameter test[2] should be \"three\"", values[2], "three");
     }
 
 

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java Wed Mar 25 03:24:47 2009
@@ -28,9 +28,6 @@
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.AbstractRequestContextTestCase;
-import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
-import org.apache.jetspeed.container.PortletEntity;
-import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.jetspeed.deployment.impl.StandardDeploymentManager;
 import org.apache.jetspeed.factory.PortletFactory;
 import org.apache.jetspeed.om.portlet.PortletApplication;
@@ -60,7 +57,6 @@
     protected String testDb;
     protected File webAppsDirFile;
     protected File copyFrom;
-    protected PortletWindowAccessor windowAccess;
     protected PortletFactory portletFactory;
     protected ApplicationServerManager manager;
  
@@ -308,15 +304,7 @@
         
         PortletApplication app = portletRegistry.getPortletApplication(TEST_PORTLET_APP_NAME);
         
-        PortletDefinition portlet = (PortletDefinition) app.getPortlets().iterator().next();
-        
-        PortletEntity entity = entityAccess.newPortletEntityInstance(portlet);
-        entity.setId("testEnity");
-        
-        entityAccess.storePortletEntity(entity);
-        
-        
-        
+        PortletDefinition portlet = app.getPortlets().iterator().next();
     }
 
     /**
@@ -373,7 +361,6 @@
 //            testDb = new File("src/test/db/hsql/Registry").getCanonicalPath();           
             
             copyDeployables();
-//            windowAccess = new PortletWindowAccessorImpl(entityAccess, true);  
         }
         catch (Exception e)
         {

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/TestSpringEngine.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/TestSpringEngine.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/TestSpringEngine.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/TestSpringEngine.java Wed Mar 25 03:24:47 2009
@@ -31,9 +31,7 @@
 import org.apache.jetspeed.aggregator.PortletAggregator;
 import org.apache.jetspeed.aggregator.PortletRenderer;
 import org.apache.jetspeed.capabilities.Capabilities;
-import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
-import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.profiler.Profiler;
 import org.apache.jetspeed.request.RequestContextComponent;
@@ -61,10 +59,10 @@
     public TestSpringEngine()
     {        
         keysToCheck = new Object[] {"IdGenerator", "DecorationLocator", "TemplateLocator", "IdGenerator", "PageFileCache", PageManager.class, 
-                                     PortletRegistry.class, PortletEntityAccessComponent.class, "PortalServices",
+                                     PortletRegistry.class, "PortalServices",
                                      Profiler.class, Capabilities.class, UserManager.class,
                                      GroupManager.class, RoleManager.class, PermissionManager.class, RdbmsPolicy.class,
-                                     UserInfoManager.class, RequestContextComponent.class, PortletWindowAccessor.class,
+                                     UserInfoManager.class, RequestContextComponent.class, 
                                      PortletRenderer.class, PageAggregator.class, PortletAggregator.class, "PAM",
                                      "deploymentManager", "portletFactory", ServletConfig.class, 
                                       "NavigationalStateCodec", "PortalURL", "NavigationalStateComponent"};

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java?rev=758134&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java Wed Mar 25 03:24:47 2009
@@ -0,0 +1,231 @@
+/*
+ * 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.jetspeed.window;
+
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.WindowState;
+
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.PortletWindowID;
+import org.apache.jetspeed.factory.PortletInstance;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.container.PortletEntity;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
+
+/**
+ * @version $Id$
+ *
+ */
+public class MockPortletWindow implements PortletWindow
+{
+    private static final long serialVersionUID = 6391120828720160018L;
+    
+    private String id;
+    
+    public MockPortletWindow(String id)
+    {
+        this.id = id;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getAttributes()
+     */
+    public Map<String, Object> getAttributes()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getAttribute(java.lang.String)
+     */
+    public Object getAttribute(String name)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#removeAttribute(java.lang.String)
+     */
+    public void removeAttribute(String name)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#setAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setAttribute(String name, Object value)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getFragment()
+     */
+    public ContentFragment getFragment()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getId()
+     */
+    public PortletWindowID getId()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletDefinition()
+     */
+    public PortletDefinition getPortletDefinition()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletEntityId()
+     */
+    public String getPortletEntityId()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getWindowId()
+     */
+    public String getWindowId()
+    {
+        // TODO Auto-generated method stub
+        return id;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#isInstantlyRendered()
+     */
+    public boolean isInstantlyRendered()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.pluto.container.PortletWindow#getPortletEntity()
+     */
+    public PortletEntity getPortletEntity()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.pluto.container.PortletWindow#getPortletMode()
+     */
+    public PortletMode getPortletMode()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.pluto.container.PortletWindow#getWindowState()
+     */
+    public WindowState getWindowState()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getAction()
+     */
+    public Action getAction()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletInstance()
+     */
+    public PortletInstance getPortletInstance()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletRequest()
+     */
+    public PortletRequest getPortletRequest()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletRequestContext()
+     */
+    public PortletRequestContext getPortletRequestContext()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletResponse()
+     */
+    public PortletResponse getPortletResponse()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getPortletResponseContext()
+     */
+    public PortletResponseContext getPortletResponseContext()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.container.PortletWindow#getRequestContext()
+     */
+    public RequestContext getRequestContext()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/MockPortletWindow.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml Wed Mar 25 03:24:47 2009
@@ -92,7 +92,6 @@
     
     <js:services>
     	<js:service name='PortletRegistryComponent' />
-    	<js:service name='PortletEntityAccessComponent'/>		
     </js:services>
     
     <js:user-attribute-ref>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java Wed Mar 25 03:24:47 2009
@@ -21,7 +21,6 @@
 import java.util.Iterator;
 
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
-import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
@@ -29,7 +28,6 @@
 import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.query.QueryFactory;
 import org.apache.jetspeed.container.PortletEntity;
-import org.apache.jetspeed.container.PortletWindow;
 import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
 
 /**
@@ -49,7 +47,6 @@
             PortletEntityAccessComponent
 {
     private PortletRegistry registry;
-    private PortletWindowAccessor windowAccessor = null;
     
     // 2006-08-22: by default, do not merge preferences from the shared preferences area 
     // up until this point, all preferences were shared. With JS2-449, preferences are now
@@ -257,15 +254,6 @@
     
     public void removeFromCache(PortletEntity entity)
     {
-        if (windowAccessor != null)
-        {
-            String windowId = entity.getId().toString();
-            PortletWindow window = windowAccessor.getPortletWindow(windowId);
-            if (window != null)
-            {
-                windowAccessor.removeWindow(window);
-            }
-        }
     }
 
     public void removePortletEntities( PortletDefinition portletDefinition ) throws PortletEntityNotDeletedException

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java Wed Mar 25 03:24:47 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.jetspeed.components.portletentity;
 
-import org.apache.jetspeed.aggregator.RenderTrackable;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.container.PortletEntity;
 import org.apache.jetspeed.container.PortletWindow;
@@ -31,7 +30,7 @@
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
  * @version $Id: PortletEntityImpl.java,v 1.9 2005/04/29 13:59:08 weaver Exp $
  */
-public class PortletEntityImpl implements PortletEntity, RenderTrackable
+public class PortletEntityImpl implements PortletEntity
 {   
     private static PortletRegistry registry;
 
@@ -43,9 +42,6 @@
     protected String appName;
     private Fragment fragment;
     
-    protected transient int timeoutCount = 0;
-    protected transient long expiration = 0;
-    
     public PortletEntityImpl(Fragment fragment)
     {
         setFragment(fragment);
@@ -154,36 +150,6 @@
         this.fragment = fragment;
     }
 
-    public int getRenderTimeoutCount()
-    {
-        return timeoutCount;
-    }
-    
-    public synchronized void incrementRenderTimeoutCount()
-    {
-        timeoutCount++;
-    }
-    
-    public synchronized void setExpiration(long expiration)
-    {
-        this.expiration = expiration;
-    }
-    
-    public long getExpiration()
-    {
-        return this.expiration;
-    }
-    
-    public void success()
-    {
-        timeoutCount = 0;
-    }
-    
-    public void setRenderTimeoutCount(int timeoutCount)
-    {
-        this.timeoutCount = timeoutCount;
-    }
-
     protected String getEntityFragmentKey()
     {
         String entityId = (this.getId() == null) ? "-unknown-entity" : this.getId().toString();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java Wed Mar 25 03:24:47 2009
@@ -28,7 +28,6 @@
 import javax.portlet.ValidatorException;
 
 import org.apache.jetspeed.JetspeedActions;
-import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.cache.CacheElement;
 import org.apache.jetspeed.cache.JetspeedCache;
 import org.apache.jetspeed.container.PortletWindow;
@@ -37,7 +36,6 @@
 import org.apache.jetspeed.om.portlet.Preference;
 import org.apache.jetspeed.om.portlet.Preferences;
 import org.apache.jetspeed.om.preference.FragmentPreference;
-import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.security.SubjectHelper;
 import org.apache.jetspeed.security.User;
 import org.apache.ojb.broker.query.Criteria;
@@ -114,8 +112,8 @@
             throws PortletContainerException
     {
         PortletWindow window = (PortletWindow)pw;
-        org.apache.jetspeed.om.portlet.PortletDefinition pd = window.getPortletEntity().getPortletDefinition();
-        String entityId = window.getPortletEntity().getId();
+        org.apache.jetspeed.om.portlet.PortletDefinition pd = window.getPortletDefinition();
+        String entityId = window.getPortletEntityId();
         Map<String, PortletPreference> defaultsMap = this.getDefaultPreferences(pd);
         // retrieve entity preferences
         if (useEntityPreferences)
@@ -131,7 +129,7 @@
             }            
             else
             {
-                List<FragmentPreference> fragmentPrefs = window.getPortletEntity().getFragment().getPreferences();
+                List<FragmentPreference> fragmentPrefs = window.getFragment().getPreferences();
                 if (fragmentPrefs.size() > 0)
                 {
                     entityMap = new JetspeedPreferencesMap();                 
@@ -173,14 +171,13 @@
         {
             return retrieveEntityPreferences(window, request);
         }
-        String appName = window.getPortletEntity().getPortletDefinition().getApplication().getName();
-        String portletName = window.getPortletEntity().getPortletDefinition().getPortletName();
-        String entityId = window.getPortletEntity().getId();
+        String appName = window.getPortletDefinition().getApplication().getName();
+        String portletName = window.getPortletDefinition().getPortletName();
+        String entityId = window.getPortletEntityId();
         String userName = request.getUserPrincipal() != null ? request.getUserPrincipal().getName() : null;
         if (userName == null)
         {
-            RequestContext rc = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
-            userName = SubjectHelper.getPrincipal(rc.getSubject(), User.class).getName();
+            userName = SubjectHelper.getPrincipal(window.getRequestContext().getSubject(), User.class).getName();
         }
         String cacheKey = getUserPreferenceKey(appName, portletName, entityId, userName);
         // first search in cache        
@@ -221,14 +218,13 @@
             storeEntityPreferences(window, request, map);
             return;
         }        
-        String appName = window.getPortletEntity().getPortletDefinition().getApplication().getName();
-        String portletName = window.getPortletEntity().getPortletDefinition().getPortletName();
-        String entityId = window.getPortletEntity().getId();
+        String appName = window.getPortletDefinition().getApplication().getName();
+        String portletName = window.getPortletDefinition().getPortletName();
+        String entityId = window.getPortletEntityId();
         String userName = request.getUserPrincipal() != null ? request.getUserPrincipal().getName() : null;
         if (userName == null)
         {
-            RequestContext rc = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
-            userName = SubjectHelper.getPrincipal(rc.getSubject(), User.class).getName();
+            userName = SubjectHelper.getPrincipal(window.getRequestContext().getSubject(), User.class).getName();
         }
         // always read in to get a fresh copy for merge
         Criteria c = new Criteria();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/util/RegistrySupportedTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/util/RegistrySupportedTestCase.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/util/RegistrySupportedTestCase.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/util/RegistrySupportedTestCase.java Wed Mar 25 03:24:47 2009
@@ -26,7 +26,6 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 
 /**
@@ -37,7 +36,6 @@
 {
 
     protected PortletRegistry portletRegistry;
-    protected PortletEntityAccessComponent entityAccess;
 
     /* (non-Javadoc)
      * @see junit.framework.TestCase#setUp()
@@ -46,7 +44,6 @@
     {       
         super.setUp();
         portletRegistry = (PortletRegistry) scm.getComponent("portletRegistry");
-        entityAccess = (PortletEntityAccessComponent) scm.getComponent("portletEntityAccess");
     }   
     
     protected String[] getConfigurations()

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java Wed Mar 25 03:24:47 2009
@@ -17,16 +17,24 @@
 package org.apache.jetspeed.om.window.impl;
 
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
 import javax.portlet.WindowState;
 
-import org.apache.jetspeed.Jetspeed;
-import org.apache.jetspeed.container.PortletEntity;
+import org.apache.jetspeed.aggregator.RenderTrackable;
+import org.apache.pluto.container.PortletEntity;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
 import org.apache.jetspeed.container.PortletWindow;
 import org.apache.jetspeed.container.PortletWindowID;
-import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.factory.PortletInstance;
+import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.request.RequestContext;
 
 /**
  * <P>
@@ -38,26 +46,41 @@
  * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
  * @version $Id$
  **/
-public class PortletWindowImpl implements PortletWindow, PortletWindowID, Serializable
+public class PortletWindowImpl implements PortletWindow, PortletEntity, PortletWindowID, RenderTrackable, Serializable
 {
     private static final long serialVersionUID = 6578938580906866201L;
     
-    private transient PortletEntity portletEntity = null;
     private String id;
-    private PortletMode portletMode;
-    private WindowState windowState;
+    private transient ContentFragment fragment;
+    private transient Map<String, Object> attributes;
     
-    private boolean instantlyRendered;
-
-    public PortletWindowImpl(String id)
+    protected transient int timeoutCount = 0;
+    protected transient long expiration = 0;
+    
+    private transient PortletDefinition pd;
+    
+    private transient RequestContext requestContext;
+    
+    // PortletWindow invocation state
+    
+    private transient Action action;
+    private transient PortletRequest portletRequest;
+    private transient PortletResponseContext portletResponseContext;
+    private transient PortletRequestContext portletRequestContext;
+    private transient PortletResponse portletResponse;
+    private transient PortletInstance portletInstance;
+    
+    public PortletWindowImpl(RequestContext requestContext, ContentFragment fragment, PortletDefinition pd)
     {
-        this.id = id;
+        this.requestContext = requestContext;
+        this.id = fragment.getId();
+        this.pd = pd;
     }
 
-    public PortletWindowImpl()
+    public String getWindowId()
     {
-        super();
-    }    
+        return id;
+    }
 
     /**
     * Returns the identifier of this portlet instance window as object id
@@ -68,6 +91,11 @@
     {
         return this;
     }
+    
+    public String getPortletEntityId()
+    {
+        return id;
+    }
 
     public String toString()
     {
@@ -80,72 +108,167 @@
     }
     
     /**
-     * Returns the portlet entity
+     * Returns the portlet definition
      *
-     * @return the portlet entity
+     * @return the portlet definition
      **/
+    public PortletDefinition getPortletDefinition()
+    {
+        return pd;
+    }
+    
+    public ContentFragment getFragment()
+    {
+        return fragment;
+    }
+    
     public PortletEntity getPortletEntity()
     {
-        return portletEntity;
+        return pd != null ? this : null;
     }
 
-    // controller impl
     /**
-     * binds an identifier to this portlet window
-     *
-     * @param id the new identifier
+     * Checks if the content is instantly rendered from JPT.
      */
-    public void setId(String id)
+    public boolean isInstantlyRendered()
+    {
+        return fragment.isInstantlyRendered();
+    }
+    
+    public RequestContext getRequestContext()
     {
-        this.id = id;
+        return requestContext;
     }
 
-    /**
-     * binds a portlet instance to this portlet window
-     * 
-     * @param portletEntity a portlet entity object
-     **/
-    public void setPortletEntity(PortletEntity portletEntity)
+    public PortletMode getPortletMode()
     {
-        this.portletEntity = portletEntity;
-        this.portletEntity.setPortletWindow(this);
+        return requestContext.getPortalURL().getNavigationalState().getMode(this);
+    }
+
+    public WindowState getWindowState()
+    {
+        return requestContext.getPortalURL().getNavigationalState().getState(this);
+    }
+
+    public Map<String,Object> getAttributes()
+    {
+        if (attributes == null)
+        {
+            attributes = new HashMap<String,Object>();
+        }
+        return attributes;
     }
     
-    /**
-     * Sets flag that the content is instantly rendered from JPT.
-     */
-    public void setInstantlyRendered(boolean instantlyRendered)
+    public Object getAttribute(String name)
     {
-        this.instantlyRendered = instantlyRendered;
+        return getAttributes().get(name);
     }
     
-    /**
-     * Checks if the content is instantly rendered from JPT.
-     */
-    public boolean isInstantlyRendered()
+    public void setAttribute(String name, Object value)
+    {
+        if (name == null)
+        {
+            throw new IllegalArgumentException("name parameter is required");
+        }
+        if (value == null)
+        {
+            getAttributes().remove(name);
+        }
+        else
+        {
+            getAttributes().put(name, value);
+        }            
+    }
+    
+    public void removeAttribute(String name)
     {
-        return this.instantlyRendered;
+        setAttribute(name, null);
     }
 
-    public PortletMode getPortletMode()
+    // --- RenderTrackable implementation
+    
+    public int getRenderTimeoutCount()
+    {
+        return timeoutCount;
+    }
+    
+    public synchronized void incrementRenderTimeoutCount()
+    {
+        timeoutCount++;
+    }
+    
+    public synchronized void setExpiration(long expiration)
+    {
+        this.expiration = expiration;
+    }
+    
+    public long getExpiration()
+    {
+        return this.expiration;
+    }
+    
+    public void success()
     {
-        // TODO: 2.2 this works, but we might want to better wire things in
-        return Jetspeed.getCurrentRequestContext().getPortalURL().getNavigationalState().getMode(this);
+        timeoutCount = 0;
+    }
+    
+    public void setRenderTimeoutCount(int timeoutCount)
+    {
+        this.timeoutCount = timeoutCount;
+    }
+    
+    // PortletWindow invocation state
+    public void setInvocationState(Action action, 
+                                   PortletRequestContext portletRequestContext,
+                                   PortletResponseContext portletResponseContext,
+                                   PortletRequest portletRequest, PortletResponse portletResponse, 
+                                   PortletInstance portletInstance)
+    {
+        this.action = action;
+        this.portletRequest = portletRequest;
+        this.portletResponseContext = portletResponseContext;
+        this.portletRequestContext = portletRequestContext;
+        this.portletResponse = portletResponse;
+        this.portletInstance = portletInstance;
+    }
+    
+    public void clearInvocationState()
+    {
+        this.action = null;
+        this.portletRequest = null;
+        this.portletResponseContext = null;
+        this.portletRequestContext = null;
+        this.portletResponse = null;
+        this.portletInstance = null;
     }
 
-    public void setPortletMode(PortletMode portletMode)
+    public Action getAction()
     {
-        this.portletMode = portletMode;
+        return action;
     }
 
-    public WindowState getWindowState()
+    public PortletRequest getPortletRequest()
+    {
+        return portletRequest;
+    }
+
+    public PortletResponseContext getPortletResponseContext()
+    {
+        return portletResponseContext;
+    }
+
+    public PortletRequestContext getPortletRequestContext()
+    {
+        return portletRequestContext;
+    }
+
+    public PortletResponse getPortletResponse()
     {
-        // TODO: 2.2 this works, but we might want to better wire things in
-        return Jetspeed.getCurrentRequestContext().getPortalURL().getNavigationalState().getState(this);
+        return portletResponse;
     }
 
-    public void setWindowState(WindowState windowState)
+    public PortletInstance getPortletInstance()
     {
-        this.windowState = windowState;
+        return portletInstance;
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/request/MockRequestContextComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/request/MockRequestContextComponent.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/request/MockRequestContextComponent.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/request/MockRequestContextComponent.java Wed Mar 25 03:24:47 2009
@@ -20,8 +20,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
-import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.userinfo.UserInfoManager;
 
 /**
@@ -36,33 +35,22 @@
         return null;
     }
 
-    public RequestContext getRequestContext(HttpServletRequest request)
-    {
-        return null;
-    }
-
     public RequestContext getRequestContext()
     {
         return null;
     }
 
-    public void release(RequestContext context)
-    {
-    }
-
-    public ServletRequestFactory getServletRequestFactory()
+    public void setRequestContext(RequestContext context)
     {
-        return null;
     }
 
-    public ServletResponseFactory getServletResponseFactory()
+    public UserInfoManager getUserInfoManager()
     {
         return null;
     }
 
-    public UserInfoManager getUserInfoManager()
+    public PortletRegistry getPortletRegistry()
     {
         return null;
     }
-    
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java Wed Mar 25 03:24:47 2009
@@ -16,12 +16,6 @@
  */
 package org.apache.jetspeed.aggregator;
 
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.container.PortletWindow;
-
 /**
  * <p>The ContentDispatcher control interface used for updating the content of
  *    a ContentDispatcher</p>
@@ -31,24 +25,4 @@
  */
 public interface ContentDispatcherCtrl extends ContentDispatcher
 {
-    /**
-     * Return the HttpServletResponse to use for a given PortletWindow
-     * in order to be able to capture parallel rendering portlets
-     */
-    public HttpServletResponse getResponseForWindow(PortletWindow window, RequestContext request);
-    
-    /**
-     * 
-     * <p>
-     * getResponseForFragment
-     * </p>
-     * <p>
-     *  Return the HttpServletResponse to use for a given Fragment
-     *  in order to be able to capture parallel rendering portlets
-     * </p>
-     * @param fragment
-     * @param request
-     * @return
-     */
-    public HttpServletResponse getResponseForFragment( Fragment fragment, RequestContext request );
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/PortletRenderer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/PortletRenderer.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/PortletRenderer.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/PortletRenderer.java Wed Mar 25 03:24:47 2009
@@ -21,7 +21,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.jetspeed.container.window.FailedToRetrievePortletWindow;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.container.PortletWindow;
@@ -43,17 +42,25 @@
         Render the specified Page fragment.
         Result is returned in the PortletResponse.
      * @throws FailedToRenderFragmentException
-     * @throws FailedToRetrievePortletWindow
      * @throws UnknownPortletDefinitionException
      * @throws PortletAccessDeniedException
      */
     public void renderNow(ContentFragment fragment, RequestContext request) ;
 
     /**
+     * Render the specified Page fragment in a separate Thread from the current (rendering) Thread
+     * Result is returned in the PortletResponse.
+     * @throws FailedToRenderFragmentException
+     * @throws UnknownPortletDefinitionException
+     * @throws PortletAccessDeniedException
+    */
+    public void renderNow(ContentFragment fragment, RequestContext request, boolean spawned) ;
+
+
+    /**
         Render the specified Page fragment.
         Result is returned in the PortletResponse.
      * @throws FailedToRenderFragmentException
-     * @throws FailedToRetrievePortletWindow
      * @throws UnknownPortletDefinitionException
      * @throws PortletAccessDeniedException
      */
@@ -74,7 +81,6 @@
      * Create a rendering job for the specified Page fragment.
      * The method returns a rendering job which should be passed to 'processRenderingJob(RenderingJob job)' method.
      * @return portlet rendering job to pass to render(RenderingJob job) method
-     * @throws FailedToRetrievePortletWindow
      * @throws UnknownPortletDefinitionException
      * @throws PortletAccessDeniedException
      */

Added: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java?rev=758134&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java (added)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java Wed Mar 25 03:24:47 2009
@@ -0,0 +1,26 @@
+/*
+ * 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.jetspeed.container;
+
+/**
+ * @version $Id$
+ *
+ */
+public interface FilterManager extends org.apache.pluto.container.FilterManager
+{
+}

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/FilterManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindow.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindow.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindow.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindow.java Wed Mar 25 03:24:47 2009
@@ -18,9 +18,17 @@
 package org.apache.jetspeed.container;
 
 import java.io.Serializable;
+import java.util.Map;
 
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.jetspeed.factory.PortletInstance;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
 
 /**
  * @version $Id$
@@ -29,9 +37,26 @@
 public interface PortletWindow extends org.apache.pluto.container.PortletWindow, Serializable
 {
     PortletWindowID getId();
-    void setId(String id);
-    PortletEntity getPortletEntity();
-    void setPortletEntity(PortletEntity entity);
-    void setPortletMode(PortletMode mode);
-    void setWindowState(WindowState state);
+    String getWindowId();
+    String getPortletEntityId();
+    PortletDefinition getPortletDefinition();
+    ContentFragment getFragment();
+    boolean isInstantlyRendered();
+    Map<String, Object> getAttributes();
+    Object getAttribute(String name);
+    void setAttribute(String name, Object value);
+    void removeAttribute(String name);
+    
+    RequestContext getRequestContext();
+    
+    // PortletWindow invocation support: may only be used / accessed during invocation
+    
+    enum Action { NOOP, LOAD, ACTION, EVENT, RESOURCE, RENDER };
+    
+    Action getAction();
+    PortletRequest getPortletRequest();
+    PortletResponse getPortletResponse();
+    PortletRequestContext getPortletRequestContext();
+    PortletResponseContext getPortletResponseContext();
+    PortletInstance getPortletInstance();
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java Wed Mar 25 03:24:47 2009
@@ -39,7 +39,24 @@
  */
 public interface PortalURL
 {
-    enum URLType { ACTION, RESOURCE, RENDER }
+    enum URLType
+    { 
+        ACTION("action"), 
+        RESOURCE("resource"), 
+        RENDER("render"); 
+        
+        private final String name;
+        
+        private URLType(String name)
+        {
+            this.name = name;
+        }
+        
+        public String toString()
+        {
+            return name;
+        }
+    }
 
     /** HTTP protocol. */
     public static final String HTTP = "http";

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/JetspeedPowerTool.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/JetspeedPowerTool.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/JetspeedPowerTool.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/JetspeedPowerTool.java Wed Mar 25 03:24:47 2009
@@ -27,7 +27,7 @@
 import org.apache.jetspeed.locator.TemplateLocatorException;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Page;
-import org.apache.jetspeed.container.PortletEntity;
+import org.apache.jetspeed.container.PortletWindow;
 
 /**
  * JetspeedPowerTool
@@ -121,20 +121,13 @@
 
     /**
      * 
-     * @return
-     * @throws Exception
-     */
-    PortletEntity getCurrentPortletEntity() throws Exception;
-
-    /**
-     * 
      * @param f
-     *                  Fragment whose <code>PortletEntity</code> we want to
-     *                  retreive.
-     * @return The PortletEntity represented by the current fragment.
+     *                  Fragment whose <code>PortletWindow</code> we want to
+     *                  retrieve.
+     * @return The PortletWindow represented by the current fragment.
      * @throws Exception
      */
-    PortletEntity getPortletEntity(ContentFragment f) throws Exception;
+    PortletWindow getPortletWindow(ContentFragment f) throws Exception;
 
     /**
      * Checks the the visibilty of this fragment with respect to the current
@@ -215,10 +208,10 @@
      * </p>
      * Returns the appropriate for the title based on locale prferences
      * 
-     * @param entity
+     * @param f
      * @return
      */
-    String getTitle(PortletEntity entity, ContentFragment f);
+    String getTitle(ContentFragment f);
 
     /**
      * 
@@ -227,10 +220,9 @@
      * </p>
      * Returns the appropriate for the title based on locale prferences
      * 
-     * @param entity
      * @return
      */
-    String getTitle(PortletEntity entity);
+    String getTitle();
 
     Object getComponent(String name);
 
@@ -244,5 +236,5 @@
 
     String getPageBasePath();    
     
-    String renderPortletEntity(String entityId, String portletId);
+    String renderPortletWindow(String windowId, String portletId);
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java Wed Mar 25 03:24:47 2009
@@ -31,6 +31,7 @@
 import org.apache.jetspeed.container.state.NavigationalState;
 import org.apache.jetspeed.container.url.PortalURL;
 import org.apache.jetspeed.mockobjects.MockHttpServletRequest;
+import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.portlet.Language;
 import org.apache.jetspeed.pipeline.Pipeline;
@@ -38,7 +39,6 @@
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
-import org.apache.jetspeed.container.PortletWindowRequestContext;
 
 
 
@@ -566,12 +566,62 @@
     {
         this.objects = objects;
     }
+    
+    public PortletWindow getCurrentPortletWindow()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public PortletWindow getPortletWindow(ContentFragment fragment)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public PortletWindow getPortletWindow(String windowId)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getInstantlyCreatedPortletWindow(java.lang.String)
+     */
+    public PortletWindow getInstantlyCreatedPortletWindow(String windowId)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#registerInstantlyCreatedPortletWindow(org.apache.jetspeed.container.PortletWindow)
+     */
+    public void registerInstantlyCreatedPortletWindow(PortletWindow portletWindow)
+    {
+        // TODO Auto-generated method stub
+        
+    }
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.request.RequestContext#getCurrentPortletWindowRequestContext()
+     * @see org.apache.jetspeed.request.RequestContext#resolvePortletWindow(java.lang.String)
      */
-    public PortletWindowRequestContext getCurrentPortletWindowRequestContext()
+    public PortletWindow resolvePortletWindow(String windowId)
     {
         // TODO Auto-generated method stub
         return null;
     }
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#clearThreadContext()
+     */
+    public void clearThreadContext()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#ensureThreadContext()
+     */
+    public boolean ensureThreadContext()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java Wed Mar 25 03:24:47 2009
@@ -29,13 +29,13 @@
 import org.apache.jetspeed.aggregator.ContentDispatcher;
 import org.apache.jetspeed.capabilities.CapabilityMap;
 import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.pipeline.Pipeline;
 import org.apache.jetspeed.profiler.Profiler;
 import org.apache.jetspeed.om.portlet.Language;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
-import org.apache.jetspeed.container.PortletWindowRequestContext;
 
 /**
  * Portal Request Context is associated with each request
@@ -220,47 +220,14 @@
      */
     public void setCharacterEncoding(String enc);
 
-
-    public PortletWindowRequestContext getCurrentPortletWindowRequestContext();
+    public PortletWindow getPortletWindow(String windowId);
+    public PortletWindow getPortletWindow(ContentFragment fragment);
+    public PortletWindow getInstantlyCreatedPortletWindow(String windowId);
+    public PortletWindow resolvePortletWindow(String windowId);
+    public void registerInstantlyCreatedPortletWindow(PortletWindow portletWindow);
+    public PortletWindow getCurrentPortletWindow();
     
     /**
-     *
-     * <p>
-     * getRequestForWindow
-     * </p>
-     *
-     * Takes a PortletWindow and generates a HttpServletRequest that
-     * accurately represents that PortletWindow's request parameters
-     *
-     *
-     * @param window PortletWindow that we are build a request for
-     * @return HttpServletRequest that wraps the existing servlet
-     * container's request that can interpret encoded portlet information
-     * for this PortletWindow
-     *
-     */
-    HttpServletRequest getRequestForWindow(PortletWindow window);
-
-    /**
-     *
-     * <p>
-     * getResponseForWindow
-     * </p>
-     *
-     * Takes a PortletWindow and generates a HttpServletResponse that
-     * accurately represents that PortletWindow's request parameters.
-     *
-     *
-     * @param window PortletWindow that we are build a response for
-     * @return HttpServletRequest that wraps the existing servlet
-     * container's request that can interpret encoded portlet information
-     * for this PortletWindow
-     *
-     *
-     */
-    HttpServletResponse getResponseForWindow(PortletWindow window);
-
-    /**
      * Gets the subject associated with the authorized entity.
      * This subject can be used to provide credentials and principals.
      *
@@ -450,5 +417,25 @@
      * @since 2.1.2
      */
     Map<String, Object> getObjects();
+    
+    /**
+     * The RequestContext itself is kept in a ThreadLocal, calling this method from another (parallel)
+     * thread ensures its ThreadLocal instance will be synchronized with this instance as well.
+     * <p>
+     * This method will return true if this thread its ThreadLocal didn't yet have <em>this</em>
+     * RequestContext value set. In that case the calling code block, preferably in a finally
+     * statement should call clearThreadContext() to ensure the reference to this instance
+     * is removed again from its ThreadLocal instance as Thread Pool solutions might reuse
+     * threads.
+     * </p>
+     * @return true if the current thread didn't have this request context set
+     *         <em>or</em> contained a different (stale/left over?) request context 
+     */
+    boolean ensureThreadContext();
+    
+    /**
+     * Clears the request context from the current thread
+     */
+    void clearThreadContext();
 }
 

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContextComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContextComponent.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContextComponent.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContextComponent.java Wed Mar 25 03:24:47 2009
@@ -20,8 +20,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
-import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.userinfo.UserInfoManager;
 
 
@@ -34,7 +33,7 @@
 public interface RequestContextComponent 
 {
     /**
-     * Creates a request context for the given servlet request.
+     * Creates a request context for the given servlet request and stores it on the current thread
      * 
      * @param req
      * @param resp
@@ -44,25 +43,20 @@
     RequestContext create(HttpServletRequest req, HttpServletResponse resp, ServletConfig config);
 
     /**
-     * Release a request context back to the context pool.
-     * 
-     * @param context
+     * Get the request context on the current thread
+     * @return
      */
-    void release(RequestContext context);
+    RequestContext getRequestContext();
     
     /**
-     * The servlet request can always get you back to the Request Context if you need it
-     * This static accessor provides this capability
-     *
-     * @param request
-     * @return RequestContext
+     * Set a new request context on the current (possibly spawned) thread
+     * Note: providing a null value effectively clears the request context from the current thread.
+     * 
+     * @param requestContext
      */
-    RequestContext getRequestContext(HttpServletRequest request);    
-    RequestContext getRequestContext();    
-    
+    void setRequestContext(RequestContext requestContext);
     
-    ServletRequestFactory getServletRequestFactory();
-    ServletResponseFactory getServletResponseFactory();
     UserInfoManager getUserInfoManager();
+    PortletRegistry getPortletRegistry();
     
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java?rev=758134&r1=758133&r2=758134&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java Wed Mar 25 03:24:47 2009
@@ -224,45 +224,45 @@
         {
             return;
         }
-        PortletWindowRequestContext pwrc = rc.getCurrentPortletWindowRequestContext();
-        if (pwrc == null)
+        PortletWindow window = rc.getCurrentPortletWindow();
+        if (window == null)
         {
             return;
         }
         
-        if (PortletWindowRequestContext.Action.NOOP.equals(pwrc.getAction()))
+        if (PortletWindow.Action.NOOP.equals(window.getAction()))
         {
             return;
         }
                         
         try
         {
-            pwrc.getPortletRequestContext().init(pwrc.getPortletInstance().getConfig(), getServletContext(), request, response);
-            pwrc.getPortletResponseContext().init(request, response);
+            window.getPortletRequestContext().init(window.getPortletInstance().getConfig(), getServletContext(), request, response);
+            window.getPortletResponseContext().init(request, response);
 
-            if (PortletWindowRequestContext.Action.ACTION.equals(pwrc.getAction()))
+            if (PortletWindow.Action.ACTION.equals(window.getAction()))
             {
-                ActionRequest actionRequest = (ActionRequest)pwrc.getPortletRequest();
-                ActionResponse actionResponse = (ActionResponse)pwrc.getPortletResponse();
-                pwrc.getPortletInstance().processAction(actionRequest, actionResponse);
+                ActionRequest actionRequest = (ActionRequest)window.getPortletRequest();
+                ActionResponse actionResponse = (ActionResponse)window.getPortletResponse();
+                window.getPortletInstance().processAction(actionRequest, actionResponse);
             }
-            else if (PortletWindowRequestContext.Action.RENDER.equals(pwrc.getAction()))
+            else if (PortletWindow.Action.RENDER.equals(window.getAction()))
             {
-                RenderRequest renderRequest = (RenderRequest)pwrc.getPortletRequest();
-                RenderResponse renderResponse =  (RenderResponse)pwrc.getPortletResponse();
-                pwrc.getPortletInstance().render(renderRequest, renderResponse);
+                RenderRequest renderRequest = (RenderRequest)window.getPortletRequest();
+                RenderResponse renderResponse =  (RenderResponse)window.getPortletResponse();
+                window.getPortletInstance().render(renderRequest, renderResponse);
             }
-            else if (PortletWindowRequestContext.Action.EVENT.equals(pwrc.getAction()))
+            else if (PortletWindow.Action.EVENT.equals(window.getAction()))
             {
-                EventRequest eventRequest = (EventRequest)pwrc.getPortletRequest();
-                EventResponse eventResponse =  (EventResponse)pwrc.getPortletResponse();
-                pwrc.getPortletInstance().processEvent(eventRequest, eventResponse);
+                EventRequest eventRequest = (EventRequest)window.getPortletRequest();
+                EventResponse eventResponse =  (EventResponse)window.getPortletResponse();
+                window.getPortletInstance().processEvent(eventRequest, eventResponse);
             }
-            else if (PortletWindowRequestContext.Action.RESOURCE.equals(pwrc.getAction()))
+            else if (PortletWindow.Action.RESOURCE.equals(window.getAction()))
             {
-                ResourceRequest resourceRequest = (ResourceRequest)pwrc.getPortletRequest();
-                ResourceResponse resourceResponse = (ResourceResponse)pwrc.getPortletResponse();
-                pwrc.getPortletInstance().serveResource(resourceRequest, resourceResponse);
+                ResourceRequest resourceRequest = (ResourceRequest)window.getPortletRequest();
+                ResourceResponse resourceResponse = (ResourceResponse)window.getPortletResponse();
+                window.getPortletInstance().serveResource(resourceRequest, resourceResponse);
             }
 
             // if we get this far we are home free
@@ -276,10 +276,10 @@
                 destroyPortlet = true;
             }
             
-            if (PortletWindowRequestContext.Action.ACTION.equals(pwrc.getAction()))
+            if (PortletWindow.Action.ACTION.equals(window.getAction()))
             {
                 ServletContext context = getServletContext();
-                context.log(JCS + "Error rendering portlet \"" + pwrc.getPortletWindow().getPortletEntity().getPortletUniqueName() + "\": " + t.toString(), t);
+                context.log(JCS + "Error rendering portlet \"" + window.getPortletDefinition().getUniqueName() + "\": " + t.toString(), t);
                 try
                 {
                     String errorTemplate = getInitParameter("portal.error.page");
@@ -298,12 +298,12 @@
                     }
                     else
                     {
-                        displayPortletNotAvailableMessage(t, response, pwrc.getPortletWindow().getPortletEntity().getPortletUniqueName());
+                        displayPortletNotAvailableMessage(t, response, window.getPortletDefinition().getUniqueName());
                     }
                 }
                 catch (Throwable e)
                 {
-                    displayPortletNotAvailableMessage(t, response, pwrc.getPortletWindow().getPortletEntity().getPortletUniqueName());
+                    displayPortletNotAvailableMessage(t, response, window.getPortletDefinition().getUniqueName());
                 }
                 finally
                 {
@@ -337,7 +337,7 @@
                 // portlet threw UnavailableException: take it out of service
                 try
                 {
-                    pwrc.getPortletInstance().destroy();
+                    window.getPortletInstance().destroy();
                 }
                 catch (Exception e)
                 {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message