You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by jw...@apache.org on 2006/12/05 02:02:55 UTC

svn commit: r482451 [1/5] - in /incubator/adffaces/branches/jwaldman-portal/trinidad: trinidad-api/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ trinidad-api/src/main/jav...

Author: jwaldman
Date: Mon Dec  4 18:02:50 2006
New Revision: 482451

URL: http://svn.apache.org/viewvc?view=rev&rev=482451
Log:
ADFFACES-234 Filter logic for Portlets (applied to jwaldman-portal branch for Scott O'Bryan)

Added:
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/Configurator.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GenericConfigurator.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GlobalConfigurator.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/AbstractAttributeMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/EnumerationIterator.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ModifiableAbstractAttributeMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/NullEnumeration.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletApplicationMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletExternalContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletInitParameterMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderValuesMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterValuesMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletSessionMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletApplicationMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletCookieMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletExternalContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletInitParameterMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletRequestHeaderMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletRequestHeaderValuesMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletRequestMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletRequestParameterMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletRequestParameterValuesMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletSessionMap.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/TrinidadFacesContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/TrinidadListener.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/ActionRequestWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/ActionResponseWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/PortletContextWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/PortletRequestDispatcherWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/PortletRequestWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/PortletResponseWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/RenderRequestWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/wrappers/RenderResponseWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/ConfigParser.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/LazyValueBinding.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchRenderResponse.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchResponseConfiguratorImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchServletResponse.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/PortletUploadedExternalContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/ServletUploadedExternalContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/UploadRequestWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/UploadedFileImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/UploadedFileProcessorImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/UploadedFiles.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadListenerImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/resources/META-INF/services/org.apache.myfaces.trinidad.config.GlobalConfigurator
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/test/resources/META-INF/services/org.apache.myfaces.trinidad.config.GlobalConfigurator
Modified:
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/pom.xml
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContextFactory.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UploadedFileProcessor.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-demo/src/main/webapp/WEB-INF/trinidad-config.xml
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-demo/src/main/webapp/WEB-INF/web.xml
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/pom.xml
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/FacesContextFactoryImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextFactoryImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/TrinidadPhaseListener.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputFileRenderer.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/util/MultipartFormHandler.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/ConfigParser.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/LazyValueBinding.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/UploadRequestWrapper.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/UploadedFileImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/UploadedFileProcessorImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/UploadedFiles.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/pom.xml?view=diff&rev=482451&r1=482450&r2=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/pom.xml (original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/pom.xml Mon Dec  4 18:02:50 2006
@@ -132,6 +132,13 @@
     </dependency>
 
     <dependency>
+      <groupId>portlet-api</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-api</artifactId>
     </dependency>

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/Configurator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/Configurator.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/Configurator.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/Configurator.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,132 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.config;
+
+import javax.faces.context.ExternalContext;
+
+/**
+ * This defines an interface for the Configurator. Classes implementing
+ * this interface should be listed in the jar's /META-INF/services folder
+ * inside of a text file named "org.apache.trinidad.GlobalConfigurator".
+ * These services will then be run by Trinidad's global configurator.
+ *
+ * This interface allows Trinidad and various renderkits to move some of
+ * their initialization and request/response wrapping code into a configurator
+ * so that they may be handled in a container agnostic fashion supporting
+ * both Portlets and Servlets. This allows Trinidad and its various
+ * renderkits to offload some of their filter logic such as multi-part
+ * request handling (file uploads), skin initialization, and other tasks.
+ *
+ * Depending on the container,these methods may be called at different times
+ * during the actual request.  The only thing guaranteed to Configurator
+ * developers are the constraints listed below in the following methods.
+ *
+ * Use of this interface is encouraged, where possible, instead of using
+ * Trinidad filter services.  While configurators and filter services should
+ * be able to coexist, any services provided by the filter service will not
+ * run in a portal and should therefore be considered optional to the run of
+ * the renderkit or application if Portal compatibility is important.
+ *
+ * @author Scott O'Bryan (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public interface Configurator
+{
+  /**
+   * Initializes the Configurator.  This method is guaranteed to run before
+   * any other method within this Configurator and will be called by the
+   * GlobalConfigurator only once per webapp context.  This init is
+   * guaranteed to be executed before completion of the first call to the
+   * {@link javax.faces.FacesContextFactory#getFacesContext#getFacesContext(Object, Object, Object,javax.faces.lifecycle.Lifecycle)}
+   * is completed.
+   *
+   * Note:the ExternalContext provided to this method may not
+   * contain any of the Request/Response functionality within the external
+   * context and will NOT contain any ExternalContext wrapping provided by
+   * the {@link #getExternalContext(ExternalContext)} method.  This object
+   * is intended only to be used as a container abstraction to the native
+   * Context object.
+   *
+   * @param externalContext a mocked up external context providing access
+   *                        to the native context object.
+   */
+  void init(ExternalContext externalContext);
+
+  /**
+   * Cleans up the Configurator.  This method is guaranteed to run at some
+   * point after the Servlet or Portlet context falls out of scope although
+   * the exact time of it's execution is not guaranteed and will typically
+   * be determined by the garbage collector.
+   */
+  void destroy();
+
+  /**
+   * This is called at the beginning of each "physical" request, sometime
+   * before {@link #getExternalContext(ExternalContext)} or
+   * {@link #endRequestRequest(ExternalContext)}.  When using the
+   * TrinidadFilter, this will be called during filter execution, but
+   * is not guaranteed to happen until just before the creation of the
+   * Trinidad FacesContext wrapper.  In a portlet environment this will
+   * be called at the beginning of each request where the current portlet
+   * is the acting portlet.
+   *
+   * All Configurator services will have thier beginRequest() methods
+   * called before any calls to getExternalContext().  So any context
+   * wrapping done by this method will not happen until after the
+   * beginRequest() is called.
+   *
+   * It is also important to note that the ExternalContext provided
+   * may or may not be the same as the ExternalContext provided to
+   * getExternalContext().  But it will have a valid request and response
+   * object.
+   *
+   * @param externalContext a mocked up or life externalContext providing
+   *                        access to the native request, response, and context
+   *                        objects.
+   */
+  void beginRequest(ExternalContext externalContext);
+
+  /**
+   * Returns an ExternalContext wrapper based on the provided ExternalContext.
+   * This method is executed durring the creation of the FacesContext when using
+   * Trinidad's FacesContextFactory.  The ExternalContext returned from this
+   * method will be a part of the FacesContext that is returned from this factory
+   * but may also be wrapped be externalContext's from other services.  Especially
+   * in Portlet environments, this method may be executed multiple times after a
+   * call to {@link #beginRequest(ExternalContext)}.
+   *
+   * Please note that it is important that this method returns a wrapper of
+   * the original context, or the behavior provided by other services and by
+   * Trinidad may well not function
+   *
+   * @param externalContext the ExternalContext to wrap
+   * @return a wrapper of the ExternalContext
+   */
+  ExternalContext getExternalContext(ExternalContext externalContext);
+
+  /**
+   * Executed at the end of each "physical" request.  There will be a call to
+   * endRequest after each call to {@link #beginRequest(ExternalContext)}.
+   *
+   * It is also important to note that the ExternalContext provided
+   * may or may not be the same as the ExternalContext provided to
+   * getExternalContext().  But it will have a valid request and response
+   * object.
+   *
+   * @param externalContext the external context
+   */
+  void endRequest(ExternalContext externalContext);
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GenericConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GenericConfigurator.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GenericConfigurator.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GenericConfigurator.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.config;
+
+import javax.faces.context.ExternalContext;
+
+/**
+ * This is an implementation of the {@link Configurator} interface.
+ * Subclasses need only override methods they wish provide functionality
+ * for.
+ *
+ * @author Scott O'Bryan (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class GenericConfigurator implements Configurator
+{
+    /* (non-Javadoc)
+     * @see org.apache.myfaces.trinidad.config.Configurator#beginRequest(javax.faces.context.ExternalContext)
+     */
+    public void beginRequest(ExternalContext externalContext)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.myfaces.trinidad.config.Configurator#destroy()
+     */
+    public void destroy()
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.myfaces.trinidad.config.Configurator#endRequest(javax.faces.context.ExternalContext)
+     */
+    public void endRequest(ExternalContext externalContext)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.myfaces.trinidad.config.Configurator#getExternalContext(javax.faces.context.ExternalContext)
+     */
+    public ExternalContext getExternalContext(ExternalContext externalContext)
+    {
+        return externalContext;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.myfaces.trinidad.config.Configurator#init(javax.faces.context.ExternalContext)
+     */
+    public void init(ExternalContext externalContext)
+    {
+    }
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GlobalConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GlobalConfigurator.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GlobalConfigurator.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/GlobalConfigurator.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
+/**
+ * This is Trinidad's GlobalConfigurator.  It is a special configurator 
+ * that is designed to provide access to all the other configuratiors in 
+ * the system as well as provide some utilities which should allow
+ * Configurators to manage state.  
+ *
+ * @author Scott O'Bryan (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public abstract class GlobalConfigurator implements Configurator
+{
+  /**
+   * Returns a GlobalConfigurator instance for the current context's class loader.
+   * 
+   * @return a GlobalConfigurator or <code>null</code> is one was unable to be obtained.
+   */
+  public static GlobalConfigurator getInstance()
+  {
+    ClassLoader loader = Thread.currentThread().getContextClassLoader();
+    
+    if (loader == null)
+      _LOG.severe("Could not find context class loader.");
+    else
+    {
+      synchronized(_configurators)
+      {
+        GlobalConfigurator config = _configurators.get(loader);
+        if(config == null)
+        {
+          try
+          {
+            Class<?> proxiedClass = loader.loadClass("org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl");
+            config = (GlobalConfigurator) proxiedClass.newInstance();
+            _configurators.put(loader, config);
+          }
+          catch (ClassNotFoundException cnfe)
+          {
+            _LOG.severe(cnfe);
+          }
+          catch (IllegalAccessException iae)
+          {
+            _LOG.severe(iae);
+          }
+          catch (InstantiationException ie)
+          {
+            _LOG.severe(ie);
+          }
+          catch (RuntimeException e)
+          {
+            // OC4J was not reporting these errors properly:
+            _LOG.severe(e);
+            throw e;
+          }
+        }
+        return config;
+      }
+    } 
+    return null;
+  }
+  
+  /**
+   * Tells whether or not the GlobalConfigurator has been initialized or not.
+   * 
+   * @return a boolean indicating <code>true</code> if the GlobalConfigurator has
+   *         been initialized or <code>false</code> it it has not.
+   */
+  public abstract boolean isInitialized();
+      
+  static private final Map<ClassLoader, GlobalConfigurator> _configurators = new HashMap<ClassLoader, GlobalConfigurator>();
+  static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(GlobalConfigurator.class);
+}

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContextFactory.java?view=diff&rev=482451&r1=482450&r2=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContextFactory.java (original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContextFactory.java Mon Dec  4 18:02:50 2006
@@ -18,6 +18,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.faces.context.ExternalContext;
+
 /**
  * Factory for creating RequestContext objects.
  * 
@@ -56,11 +58,8 @@
 
   /**
    * Create a RequestContext.
-   * @todo do we need to pass the servlet objects, or can we rely
-   * on their being available via the FacesContext?
    */
-  abstract public RequestContext createContext(Object context,
-                                                Object request);
+  abstract public RequestContext createContext(ExternalContext context);
 
   static private ClassLoader _getClassLoader()
   {

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/AbstractAttributeMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/AbstractAttributeMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/AbstractAttributeMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/AbstractAttributeMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,338 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * Helper Map implementation for use with different Attribute Maps.
+ * This was origionally taken from MyFaces.
+ *
+ * @author Anton Koinov 
+ * @author Scott O'Bryan  (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+abstract class AbstractAttributeMap<K, V> implements Map<K, V>
+{
+  public void clear()
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public boolean containsKey(final Object key)
+  {
+    return getAttribute(key) != null;
+  }
+
+  public boolean containsValue(final Object findValue)
+  {
+    if (findValue == null)
+    {
+      return false;
+    }
+
+    for (final Enumeration e = getAttributeNames(); e.hasMoreElements();)
+    {
+      final Object value = getAttribute(e.nextElement());
+      if (findValue.equals(value))
+      {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  public Set<Map.Entry<K, V>> entrySet()
+  {
+    return _entrySet != null ? _entrySet : (_entrySet = new EntrySet());
+  }
+
+  public V get(final Object key)
+  {
+    return getAttribute(key.toString());
+  }
+
+  public boolean isEmpty()
+  {
+    return !getAttributeNames().hasMoreElements();
+  }
+
+  public Set<K> keySet()
+  {
+    return _keySet != null ? _keySet : (_keySet = new KeySet());
+  }
+
+  public V put(final K key, final V value)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public void putAll(final Map<? extends K, ? extends V> t)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public V remove(final Object key)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public int size()
+  {
+    int size = 0;
+    for (final Enumeration e = getAttributeNames(); e.hasMoreElements();)
+    {
+      size++;
+      e.nextElement();
+    }
+    return size;
+  }
+
+  public Collection<V> values()
+  {
+    return _values != null ? _values : (_values = new Values());
+  }
+
+  abstract protected V getAttribute(Object key);
+
+  abstract protected Enumeration<K> getAttributeNames();
+
+  private Set<Map.Entry<K, V>> _entrySet;
+
+  private Set<K>               _keySet;
+
+  private Collection<V>        _values;
+
+  private abstract class BaseAbstractIterator<T> implements Iterator<T>
+  {
+    public boolean hasNext()
+    {
+      return _e.hasMoreElements();
+    }
+
+    public void remove()
+    {
+      // remove() may cause ConcurrentModificationException.
+      // We could throw an exception here, but not throwing an exception
+      //   allows one call to remove() to succeed
+      if (_currentKey == null)
+      {
+        throw new NoSuchElementException("You must call next() at least once");
+      }
+      AbstractAttributeMap.this.remove(_currentKey);
+    }
+
+    protected void advance()
+    {
+      _currentKey = _e.nextElement();
+    }
+
+    protected K                    _currentKey;
+
+    protected final Enumeration<K> _e = getAttributeNames();
+  }
+
+  private abstract class BaseAbstractSet<T> extends AbstractSet<T>
+  {
+    @Override
+    public void clear()
+    {
+      AbstractAttributeMap.this.clear();
+    }
+
+    @Override
+    public boolean isEmpty()
+    {
+      return AbstractAttributeMap.this.isEmpty();
+    }
+
+    @Override
+    public int size()
+    {
+      return AbstractAttributeMap.this.size();
+    }
+  }
+
+  /**
+   * Not very efficient since it generates a new instance of <code>Entry</code>
+   * for each element and still internaly uses the <code>KeyIterator</code>.
+   * It is more efficient to use the <code>KeyIterator</code> directly.
+   */
+  private class EntryIterator extends BaseAbstractIterator<Map.Entry<K, V>>
+  {
+    public Map.Entry<K, V> next()
+    {
+      advance();
+      // Must create new Entry every time--value of the entry must stay
+      // linked to the same attribute name
+      return new EntrySetEntry(_currentKey);
+    }
+  }
+
+  private class EntrySet extends BaseAbstractSet<Map.Entry<K, V>>
+  {
+    @Override
+    public boolean contains(final Object o)
+    {
+      if (!(o instanceof Entry))
+      {
+        return false;
+      }
+
+      final Entry entry = (Entry) o;
+      final Object key = entry.getKey();
+      final Object value = entry.getValue();
+      if (key == null || value == null)
+      {
+        return false;
+      }
+
+      return value.equals(AbstractAttributeMap.this.get(key));
+    }
+
+    @Override
+    public Iterator<Map.Entry<K, V>> iterator()
+    {
+      return new EntryIterator();
+    }
+
+    @Override
+    public boolean remove(final Object o)
+    {
+      if (!(o instanceof Entry))
+      {
+        return false;
+      }
+
+      final Entry entry = (Entry) o;
+      final Object key = entry.getKey();
+      final Object value = entry.getValue();
+      if (key == null || value == null || !value.equals(AbstractAttributeMap.this.get(key)))
+      {
+        return false;
+      }
+
+      return AbstractAttributeMap.this.remove(((Entry) o).getKey()) != null;
+    }
+  }
+
+  private class EntrySetEntry implements Map.Entry<K, V>
+  {
+    public EntrySetEntry(final K currentKey)
+    {
+      _currentKey = currentKey;
+    }
+
+    public K getKey()
+    {
+      return _currentKey;
+    }
+
+    public V getValue()
+    {
+      return AbstractAttributeMap.this.get(_currentKey);
+    }
+
+    public V setValue(final V value)
+    {
+      return AbstractAttributeMap.this.put(_currentKey, value);
+    }
+
+    private final K _currentKey;
+  }
+
+  private class KeyIterator extends BaseAbstractIterator<K>
+  {
+    public K next()
+    {
+      advance();
+      return _currentKey;
+    }
+  }
+
+  private class KeySet extends BaseAbstractSet<K>
+  {
+    @Override
+    public boolean contains(final Object o)
+    {
+      return AbstractAttributeMap.this.containsKey(o);
+    }
+
+    @Override
+    public Iterator<K> iterator()
+    {
+      return new KeyIterator();
+    }
+
+    @Override
+    public boolean remove(final Object o)
+    {
+      return AbstractAttributeMap.this.remove(o) != null;
+    }
+
+  }
+
+  private class Values extends BaseAbstractSet<V>
+  {
+    @Override
+    public boolean contains(final Object o)
+    {
+      return AbstractAttributeMap.this.containsValue(o);
+    }
+
+    @Override
+    public Iterator<V> iterator()
+    {
+      return new ValuesIterator();
+    }
+
+    @Override
+    public boolean remove(final Object o)
+    {
+      if (o == null)
+      {
+        return false;
+      }
+
+      for (final Iterator it = iterator(); it.hasNext();)
+      {
+        if (o.equals(it.next()))
+        {
+          it.remove();
+          return true;
+        }
+      }
+
+      return false;
+    }
+  }
+
+  private class ValuesIterator extends BaseAbstractIterator<V>
+  {
+    public V next()
+    {
+      advance();
+      return AbstractAttributeMap.this.get(_currentKey);
+    }
+  }
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/EnumerationIterator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/EnumerationIterator.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/EnumerationIterator.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/EnumerationIterator.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * This was origionally taken from MyFaces
+ * 
+ * @author Manfred Geiler
+ * @author Scott O'Bryan (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+class EnumerationIterator<T> implements Iterator<T>
+{
+  EnumerationIterator(final Enumeration<T> enumeration)
+  {
+    _enumeration = enumeration;
+  }
+
+  public boolean hasNext()
+  {
+    return _enumeration.hasMoreElements();
+  }
+
+  public T next()
+  {
+    return _enumeration.nextElement();
+  }
+
+  public void remove()
+  {
+    throw new UnsupportedOperationException(this.getClass().getName()
+        + " UnsupportedOperationException");
+  }
+
+  private Enumeration<T> _enumeration;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ModifiableAbstractAttributeMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ModifiableAbstractAttributeMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ModifiableAbstractAttributeMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ModifiableAbstractAttributeMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,80 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Helper Map implementation for use with different modifiable
+ * Attribute Maps.
+ * This was origionally taken from MyFaces.
+ * 
+ * @author Scott O'Bryan (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+abstract class ModifiableAbstractAttributeMap<K, V> extends AbstractAttributeMap<K, V>
+{
+  @Override
+  public void clear()
+  {
+    final List<K> names = new ArrayList<K>();
+
+    for (final Enumeration<K> e = getAttributeNames(); e.hasMoreElements();)
+    {
+      names.add(e.nextElement());
+    }
+
+    for (final K val : names)
+    {
+      removeAttribute(val);
+    }
+  }
+
+  @Override
+  public V put(final K key, final V value)
+  {
+    final V retval = getAttribute(key);
+    setAttribute(key, value);
+    return retval;
+  }
+
+  @Override
+  @SuppressWarnings("unchecked")
+  public void putAll(final Map<? extends K, ? extends V> t)
+  {
+
+    for (final Map.Entry entry : t.entrySet())
+    {
+      setAttribute((K) entry.getKey(), (V) entry.getValue());
+    }
+  }
+
+  @Override
+  public V remove(final Object key)
+  {
+    final V retval = getAttribute(key);
+    removeAttribute(key);
+    return retval;
+  }
+
+  protected abstract void removeAttribute(Object arg0);
+
+  protected abstract void setAttribute(K arg0, V arg1);
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/NullEnumeration.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/NullEnumeration.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/NullEnumeration.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/NullEnumeration.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+/**
+ * Enumeration without elements. This was origionally taken from MyFaces.
+ * 
+ * @author Anton Koinov
+ * @author Scott O'Bryan (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+final class NullEnumeration implements Enumeration
+{
+  static final NullEnumeration instance()
+  {
+    return s_nullEnumeration;
+  }
+
+  public boolean hasMoreElements()
+  {
+    return false;
+  }
+
+  public Object nextElement()
+  {
+    throw new UnsupportedOperationException("NullEnumeration has no elements");
+  }
+
+  private static final NullEnumeration s_nullEnumeration = new NullEnumeration();
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletApplicationMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletApplicationMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletApplicationMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletApplicationMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletContext;
+
+
+/**
+ * PortletContext attributes as a Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: oros $)
+ * @version $Revision: 278654 $ $Date: 2005-09-04 18:32:35 -0600 (Sun, 04 Sep 2005) $
+ */
+public class PortletApplicationMap extends ModifiableAbstractAttributeMap<String, Object>
+{
+  public PortletApplicationMap(final PortletContext portletContext)
+  {
+    _portletContext = portletContext;
+  }
+
+  @Override
+  protected Object getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _portletContext.getAttribute(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    final Enumeration<String> attributeNames = _portletContext.getAttributeNames();
+
+    return attributeNames;
+  }
+
+  @Override
+  protected void removeAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      _portletContext.removeAttribute(key.toString());
+    }
+  }
+
+  @Override
+  protected void setAttribute(final String key, final Object value)
+  {
+    _portletContext.setAttribute(key, value);
+  }
+
+  final PortletContext _portletContext;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletExternalContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletExternalContext.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletExternalContext.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletExternalContext.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,527 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.ExternalContext;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
+/**
+ * An ExternalContext implementation for JSF applications that run inside a a Portlet.
+ * 
+ * @author Stan Silvert (latest modification by $Author: mmarinschek $)
+ * @version $Revision: 359796 $ $Date: 2005-12-29 07:04:07 -0700 (Thu, 29 Dec 2005) $
+ */
+public class PortletExternalContext extends ExternalContext
+{
+  public static boolean isCorrectContext(final Object context)
+  {
+    return context instanceof PortletContext;
+  }
+
+  /** Creates a new instance of PortletFacesContextImpl */
+  public PortletExternalContext(final Object portletContext, final Object portletRequest,
+      final Object portletResponse)
+  {
+    _checkNull(portletContext, "PortletContext");
+    assert (portletContext != null);
+    
+    _portletContext = (PortletContext) portletContext;
+    _portletRequest = (PortletRequest) portletRequest;
+    _portletResponse = (PortletResponse) portletResponse;
+
+    if (portletRequest != null && portletRequest instanceof ActionRequest)
+    {
+      _actionRequest = (ActionRequest) portletRequest;
+      _actionResponse = (ActionResponse) portletResponse;
+      // try to set character encoding as described in section 2.5.2.2 of JSF 1.1 spec
+      try
+      {
+        final String contentType = _portletRequest.getProperty("Content-Type");
+
+        String characterEncoding = _lookupCharacterEncoding(contentType);
+        if (characterEncoding == null)
+        {
+          final PortletSession session = _portletRequest.getPortletSession(false);
+
+          if (session != null)
+          {
+            characterEncoding = (String) session.getAttribute(ViewHandler.CHARACTER_ENCODING_KEY,
+                PortletSession.PORTLET_SCOPE);
+          }
+
+          if (characterEncoding != null)
+          {
+            _actionRequest.setCharacterEncoding(characterEncoding);
+          }
+        }
+      }
+      catch (final Exception e)
+      {
+        if (_LOG.isWarning())
+        {
+          _LOG.warning("Failed to set character encoding ", e);
+        }
+      }
+    }
+    else
+    {
+      _renderRequest = (RenderRequest) portletRequest;
+      _renderResponse = (RenderResponse) portletResponse;
+    }
+  }
+
+  @Override
+  public void dispatch(final String path) throws IOException
+  {
+    _checkRequest();
+
+    if (_actionRequest != null)
+    { // dispatch only allowed for RenderRequest
+      final String msg = "Can not call dispatch() during a portlet ActionRequest";
+      throw new IllegalStateException(msg);
+    }
+
+    final PortletRequestDispatcher requestDispatcher = _portletContext.getRequestDispatcher(path); 
+    try
+    {
+      requestDispatcher.include(_renderRequest, _renderResponse);
+    }
+    catch (final PortletException e)
+    {
+      if (e.getMessage() != null)
+      {
+        throw new FacesException(e.getMessage(), e);
+      }
+      else
+      {
+        throw new FacesException(e);
+      }
+    }
+  }
+
+  @Override
+  public String encodeActionURL(final String url)
+  {
+    _checkRequest();
+    _checkNull(url, "url");
+    return _portletResponse.encodeURL(url);
+  }
+
+  @Override
+  public String encodeNamespace(final String name)
+  {
+    _checkRequest();
+    if (_actionRequest != null)
+    { // encodeNamespace only allowed for RenderRequest
+      final String msg = "Can not call encodeNamespace() during a portlet ActionRequest";
+      throw new IllegalStateException(msg);
+    }
+
+    // we render out the name and then the namespace as
+    // e.g. for JSF-ids, it is important to keep the _id prefix
+    // to know that id creation has happened automatically
+    return name + _renderResponse.getNamespace();
+  }
+
+  @Override
+  public String encodeResourceURL(final String url)
+  {
+    _checkRequest();
+    _checkNull(url, "url");
+    return _portletResponse.encodeURL(url);
+  }
+
+  @Override
+  public Map<String, Object> getApplicationMap()
+  {
+    if (_applicationMap == null)
+    {
+      _applicationMap = new PortletApplicationMap(_portletContext);
+    }
+    return _applicationMap;
+  }
+
+  @Override
+  public String getAuthType()
+  {
+    _checkRequest();
+    return _portletRequest.getAuthType();
+  }
+
+  @Override
+  public Object getContext()
+  {
+    return _portletContext;
+  }
+
+  @Override
+  public String getInitParameter(final String name)
+  {
+    return _portletContext.getInitParameter(name);
+  }
+
+  @Override
+  public Map getInitParameterMap()
+  {
+    if (_initParameterMap == null)
+    {
+      // We cache it as an attribute in PortletContext itself (is this circular reference a
+      // problem?)
+      if ((_initParameterMap = (Map) _portletContext.getAttribute(_INIT_PARAMETER_MAP_ATTRIBUTE)) == null)
+      {
+        _initParameterMap = new PortletInitParameterMap(_portletContext);
+        _portletContext.setAttribute(_INIT_PARAMETER_MAP_ATTRIBUTE, _initParameterMap);
+      }
+    }
+    return _initParameterMap;
+  }
+
+  @Override
+  public String getRemoteUser()
+  {
+    _checkRequest();
+    return _portletRequest.getRemoteUser();
+  }
+
+  @Override
+  public Object getRequest()
+  {
+    return _portletRequest;
+  }
+
+  @Override
+  public String getRequestContextPath()
+  {
+    _checkRequest();
+    return _portletRequest.getContextPath();
+  }
+
+  @Override
+  @SuppressWarnings("unchecked")
+  public Map<String, Object> getRequestCookieMap()
+  {
+    return _EMPTY_UNMODIFIABLE_MAP;
+  }
+
+  @Override
+  public Map<String, String> getRequestHeaderMap()
+  {
+    _checkRequest();
+    if (_requestHeaderMap == null)
+    {
+      _requestHeaderMap = new PortletRequestHeaderMap(_portletRequest);
+    }
+    return _requestHeaderMap;
+  }
+
+  @Override
+  public Map<String, String[]> getRequestHeaderValuesMap()
+  {
+    _checkRequest();
+    if (_requestHeaderValuesMap == null)
+    {
+      _requestHeaderValuesMap = new PortletRequestHeaderValuesMap(_portletRequest);
+    }
+    return _requestHeaderValuesMap;
+  }
+
+  @Override
+  public Locale getRequestLocale()
+  {
+    _checkRequest();
+    return _portletRequest.getLocale();
+  }
+
+  @Override
+  public Iterator<Locale> getRequestLocales()
+  {    
+    _checkRequest();
+    @SuppressWarnings("unchecked")
+    Enumeration<Locale> locales = _portletRequest.getLocales();
+    return new EnumerationIterator<Locale>(locales);
+  }
+
+  @Override
+  public Map<String, Object> getRequestMap()
+  {
+    _checkRequest();
+    if (_requestMap == null)
+    {
+      _requestMap = new PortletRequestMap(_portletRequest);
+    }
+    return _requestMap;
+  }
+
+  @Override
+  public Map<String, String> getRequestParameterMap()
+  {
+    _checkRequest();
+    if (_requestParameterMap == null)
+    {
+      _requestParameterMap = new PortletRequestParameterMap(_portletRequest);
+    }
+    return _requestParameterMap;
+  }
+
+  @Override
+  public Iterator<String> getRequestParameterNames()
+  {
+    _checkRequest();
+    @SuppressWarnings("unchecked")
+    Enumeration<String> parameterNames = _portletRequest.getParameterNames();
+    return new EnumerationIterator<String>(parameterNames);
+  }
+
+  @Override
+  public Map<String, String[]> getRequestParameterValuesMap()
+  {
+    _checkRequest();
+    if (_requestParameterValuesMap == null)
+    {
+      _requestParameterValuesMap = new PortletRequestParameterValuesMap(_portletRequest);
+    }
+    return _requestParameterValuesMap;
+  }
+
+  @Override
+  public String getRequestPathInfo()
+  {
+    return null; // must return null
+  }
+
+  @Override
+  public String getRequestServletPath()
+  {
+    return null; // must return null
+  }
+
+  @Override
+  public URL getResource(final String path) throws MalformedURLException
+  {
+    _checkNull(path, "path");
+    return _portletContext.getResource(path);
+  }
+
+  @Override
+  public InputStream getResourceAsStream(final String path)
+  {
+    _checkNull(path, "path");
+    return _portletContext.getResourceAsStream(path);
+  }
+
+  @Override
+  public Set getResourcePaths(final String path)
+  {
+    _checkNull(path, "path");
+    return _portletContext.getResourcePaths(path);
+  }
+
+  @Override
+  public Object getResponse()
+  {
+    return _portletResponse;
+  }
+
+  @Override
+  public Object getSession(final boolean create)
+  {
+    _checkRequest();
+    return _portletRequest.getPortletSession(create);
+  }
+
+  @Override
+  public Map<String, Object> getSessionMap()
+  {
+    _checkRequest();
+    if (_sessionMap == null)
+    {
+      _sessionMap = new PortletSessionMap(_portletRequest);
+    }
+    return _sessionMap;
+  }
+
+  @Override
+  public Principal getUserPrincipal()
+  {
+    _checkRequest();
+    return _portletRequest.getUserPrincipal();
+  }
+
+  @Override
+  public boolean isUserInRole(final String role)
+  {
+    _checkRequest();
+    _checkNull(role, "role");
+    return _portletRequest.isUserInRole(role);
+  }
+
+  @Override
+  public void log(final String message)
+  {
+    _checkRequest();
+    _checkNull(message, "message");
+    _portletContext.log(message);
+  }
+
+  @Override
+  public void log(final String message, final Throwable exception)
+  {
+    _checkNull(message, "message");
+    _checkNull(exception, "exception");
+
+    _portletContext.log(message, exception);
+  }
+
+  @Override
+  public void redirect(final String url) throws IOException
+  {
+    _checkRequest();
+    if (_actionResponse != null)
+    {
+      _actionResponse.sendRedirect(url);
+    }
+    else
+    {
+      throw new IllegalArgumentException("Only ActionResponse supported");
+    }
+  }
+
+  public void release()
+  {
+    _portletContext = null;
+    _portletRequest = null;
+    _portletResponse = null;
+    _actionRequest = null;
+    _actionResponse = null;
+    _renderRequest = null;
+    _renderResponse = null;
+    _applicationMap = null;
+    _sessionMap = null;
+    _requestMap = null;
+    _requestParameterMap = null;
+    _requestParameterValuesMap = null;
+    _requestHeaderMap = null;
+    _requestHeaderValuesMap = null;
+    _initParameterMap = null;
+  }
+
+  private void _checkNull(final Object o, final String param)
+  {
+    if (o == null)
+    {
+      throw new NullPointerException(param + " can not be null.");
+    }
+  }
+  
+  private void _checkRequest()
+  {
+    if(_portletRequest == null)
+    {
+      throw new UnsupportedOperationException("Request and Response is null on this context.");
+    }
+  }
+
+  private String _lookupCharacterEncoding(final String contentType)
+  {
+    String characterEncoding = null;
+
+    if (contentType != null)
+    {
+      final int charsetFind = contentType.indexOf("charset=");
+      if (charsetFind != -1)
+      {
+        if (charsetFind == 0)
+        {
+          // charset at beginning of Content-Type, curious
+          characterEncoding = contentType.substring(8);
+        }
+        else
+        {
+          final char charBefore = contentType.charAt(charsetFind - 1);
+          if (charBefore == ';' || Character.isWhitespace(charBefore))
+          {
+            // Correct charset after mime type
+            characterEncoding = contentType.substring(charsetFind + 8);
+          }
+        }
+        if (_LOG.isFine())
+        {
+          _LOG.fine("Incoming request has Content-Type header with character encoding "
+              + characterEncoding);
+        }
+      }
+      else
+      {
+        if (_LOG.isFine())
+        {
+          _LOG.fine("Incoming request has Content-Type header without character encoding: "
+              + contentType);
+        }
+      }
+    }
+    return characterEncoding;
+  }
+
+  private ActionRequest               _actionRequest;
+  private ActionResponse              _actionResponse;
+  private Map<String, Object>         _applicationMap;
+  private Map                         _initParameterMap;
+  private PortletContext              _portletContext;
+  private PortletRequest              _portletRequest;
+  private PortletResponse             _portletResponse;
+  private RenderRequest               _renderRequest;
+  private RenderResponse              _renderResponse;
+  private Map<String, String>         _requestHeaderMap;
+  private Map<String, String[]>       _requestHeaderValuesMap;
+  private Map<String, Object>         _requestMap;
+  private Map<String, String>         _requestParameterMap;
+  private Map<String, String[]>       _requestParameterValuesMap;
+  private Map<String, Object>         _sessionMap;
+  
+  @SuppressWarnings("unchecked")
+  private static final Map            _EMPTY_UNMODIFIABLE_MAP       = Collections
+                                                                        .unmodifiableMap(Collections.EMPTY_MAP);
+  
+  private static final String         _INIT_PARAMETER_MAP_ATTRIBUTE = ServletInitParameterMap.class
+                                                                        .getName();
+  private static final TrinidadLogger _LOG                          = TrinidadLogger
+                                                                        .createTrinidadLogger(ServletExternalContext.class);
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletInitParameterMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletInitParameterMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletInitParameterMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletInitParameterMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+import javax.portlet.PortletContext;
+
+/**
+ * portletContext init parameters as Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: oros $)
+ * @version $Revision: 278654 $ $Date: 2005-09-04 18:32:35 -0600 (Sun, 04 Sep 2005) $
+ */
+public class PortletInitParameterMap extends AbstractAttributeMap
+{
+  public PortletInitParameterMap(final PortletContext portletContext)
+  {
+    _portletContext = portletContext;
+  }
+
+  @Override
+  protected Object getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _portletContext.getInitParameter(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration getAttributeNames()
+  {
+    return _portletContext.getInitParameterNames();
+  }
+
+  final PortletContext _portletContext;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+
+/**
+ * PortletRequest headers as Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: oros $)
+ * @version $Revision: 278654 $ $Date: 2005-09-04 18:32:35 -0600 (Sun, 04 Sep 2005) $
+ */
+public class PortletRequestHeaderMap extends AbstractAttributeMap<String, String>
+{
+  public PortletRequestHeaderMap(final PortletRequest portletRequest)
+  {
+    _portletRequest = portletRequest;
+  }
+
+  @Override
+  protected String getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _portletRequest.getProperty(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    final Enumeration<String> headerNames = _portletRequest.getPropertyNames();
+    return headerNames;
+  }
+
+  private final PortletRequest _portletRequest;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderValuesMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderValuesMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderValuesMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestHeaderValuesMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.PortletRequest;
+
+
+/**
+ * HttpServletRequest header values (multi-value headers) as Map of String[].
+ * 
+ * @author Anton Koinov (latest modification by $Author: matze $)
+ * @version $Revision: 167257 $ $Date: 2004-10-13 05:51:02 -0600 (Wed, 13 Oct 2004) $
+ */
+public class PortletRequestHeaderValuesMap extends AbstractAttributeMap<String, String[]>
+{
+  public PortletRequestHeaderValuesMap(final PortletRequest portletRequest)
+  {
+    _portletRequest = portletRequest;
+  }
+
+  @Override
+  protected String[] getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      final String k = key.toString();
+      String[] ret = _valueCache.get(k);
+      if (ret == null)
+      {
+        @SuppressWarnings("unchecked")
+        final Enumeration<String> headers = _portletRequest.getProperties(k);
+        ret = _toArray(headers);
+        _valueCache.put(k, ret);
+      }
+
+      return ret;
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    Enumeration<String> headerNames = _portletRequest.getPropertyNames();
+    return headerNames;
+  }
+
+  private String[] _toArray(final Enumeration<String> e)
+  {
+    final List<String> ret = new ArrayList<String>();
+
+    while (e.hasMoreElements())
+    {
+      ret.add(e.nextElement());
+    }
+
+    return ret.toArray(new String[ret.size()]);
+  }
+
+  private final PortletRequest    _portletRequest;
+  private final Map<String, String[]> _valueCache = new HashMap<String, String[]>();
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+
+
+/**
+ * PortletRequest attributes Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: oros $)
+ * @version $Revision: 278654 $ $Date: 2005-09-04 18:32:35 -0600 (Sun, 04 Sep 2005) $
+ */
+public class PortletRequestMap extends ModifiableAbstractAttributeMap<String, Object>
+{
+  public PortletRequestMap(final PortletRequest portletRequest)
+  {
+    _portletRequest = portletRequest;
+  }
+
+  @Override
+  protected Object getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _portletRequest.getAttribute(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    Enumeration<String> attributeNames = _portletRequest.getAttributeNames();
+    return attributeNames;
+  }
+
+  @Override
+  protected void removeAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      _portletRequest.removeAttribute(key.toString());
+    }
+  }
+
+  @Override
+  protected void setAttribute(final String key, final Object value)
+  {
+    _portletRequest.setAttribute(key, value);
+  }
+
+  final PortletRequest _portletRequest;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+
+/**
+ * PortletRequest parameters as Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: grantsmith $)
+ * @version $Revision: 169649 $ $Date: 2005-05-11 09:47:12 -0600 (Wed, 11 May 2005) $
+ */
+public class PortletRequestParameterMap extends AbstractAttributeMap<String, String>
+{
+  public PortletRequestParameterMap(final PortletRequest portletRequest)
+  {
+    _portletRequest = portletRequest;
+  }
+
+  @Override
+  protected String getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _portletRequest.getParameter(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    Enumeration<String> parameterNames = _portletRequest.getParameterNames();
+    return parameterNames;
+  }
+
+  private final PortletRequest _portletRequest;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterValuesMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterValuesMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterValuesMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletRequestParameterValuesMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+import javax.portlet.PortletRequest;
+
+/**
+ * PortletRequest multi-value parameters as Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: grantsmith $)
+ * @version $Revision: 169649 $ $Date: 2005-05-11 09:47:12 -0600 (Wed, 11 May 2005) $
+ */
+public class PortletRequestParameterValuesMap extends AbstractAttributeMap<String, String[]>
+{
+  public PortletRequestParameterValuesMap(final PortletRequest portletRequest)
+  {
+    _portletRequest = portletRequest;
+  }
+
+  @Override
+  protected String[] getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _portletRequest.getParameterValues(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    Enumeration<String> parameterNames = _portletRequest.getParameterNames();
+    return parameterNames;
+  }
+
+  private final PortletRequest _portletRequest;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletSessionMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletSessionMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletSessionMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/PortletSessionMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+
+
+/**
+ * Portlet scope PortletSession attibutes as Map.
+ *
+ * @author  Stan Silvert (latest modification by $Author: schof $)
+ * @version $Revision: 382015 $ $Date: 2006-03-01 06:47:11 -0700 (Wed, 01 Mar 2006) $
+ */
+public class PortletSessionMap extends ModifiableAbstractAttributeMap<String, Object>
+{
+  public PortletSessionMap(final PortletRequest portletRequest)
+  {
+    _portletRequest = portletRequest;
+  }
+
+  @Override
+  protected Object getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      final PortletSession portletSession = _getSession();
+      return portletSession == null ? null : portletSession.getAttribute(key.toString());
+    }
+
+    return null;
+  }
+
+  @Override
+  @SuppressWarnings("unchecked")
+  protected Enumeration getAttributeNames()
+  {
+    final PortletSession portletSession = _getSession();
+    return portletSession == null ? NullEnumeration.instance() : portletSession.getAttributeNames();
+  }
+
+  @Override
+  protected void removeAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      final PortletSession portletSession = _getSession();
+      if (portletSession != null)
+      {
+        portletSession.removeAttribute(key.toString());
+      }
+    }
+  }
+
+  @Override
+  protected void setAttribute(final String key, final Object value)
+  {
+    _portletRequest.getPortletSession(true).setAttribute(key, value);
+  }
+
+  private PortletSession _getSession()
+  {
+    return _portletRequest.getPortletSession(false);
+  }
+
+  private final PortletRequest _portletRequest;
+}

Added: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletApplicationMap.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletApplicationMap.java?view=auto&rev=482451
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletApplicationMap.java (added)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/external/ServletApplicationMap.java Mon Dec  4 18:02:50 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.context.external;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+
+
+/**
+ * ServletContext attributes as a Map.
+ *
+ * @author Anton Koinov (latest modification by $Author: oros $)
+ * @version $Revision: 278654 $ $Date: 2005-09-04 18:32:35 -0600 (Sun, 04 Sep 2005) $
+ */
+public class ServletApplicationMap extends ModifiableAbstractAttributeMap<String, Object>
+{
+  public ServletApplicationMap(final ServletContext servletContext)
+  {
+    _servletContext = servletContext;
+  }
+
+  @Override
+  protected Object getAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      return _servletContext.getAttribute(key.toString());
+    }
+    return null;
+  }
+
+  @Override
+  protected Enumeration<String> getAttributeNames()
+  {
+    @SuppressWarnings("unchecked")
+    final Enumeration<String> attributeNames = _servletContext.getAttributeNames();
+
+    return attributeNames;
+  }
+
+  @Override
+  protected void removeAttribute(final Object key)
+  {
+    if (key.toString().equals(key))
+    {
+      _servletContext.removeAttribute(key.toString());
+    }
+  }
+
+  @Override
+  protected void setAttribute(final String key, final Object value)
+  {
+    _servletContext.setAttribute(key, value);
+  }
+
+  final ServletContext _servletContext;
+}