portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlest...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces AbstractAttributeMap.java NullEnumeration.java PortletExternalContextImpl.java RequestMap.java FacesContextFactoryImpl.java RequestParameterMap.java PortletViewHandlerImpl.java RequestParameterValuesMap.java SessionMap.java InitParameterMap.java PortletFacesContextImpl.java ApplicationMap.java FacesPortlet.java
Date Sat, 11 Sep 2004 18:43:26 GMT
dlestrat    2004/09/11 11:43:26

  Modified:    portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces
                        PortletExternalContextImpl.java RequestMap.java
                        FacesContextFactoryImpl.java
                        RequestParameterMap.java
                        PortletViewHandlerImpl.java
                        RequestParameterValuesMap.java SessionMap.java
                        InitParameterMap.java PortletFacesContextImpl.java
                        ApplicationMap.java FacesPortlet.java
  Added:       portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces
                        AbstractAttributeMap.java NullEnumeration.java
  Log:
  MyFaces bridge fixes to support MyFaces 1.0.6.  Also start work on adding
  an example for MyFaces tree component.  The tree component is not currently displaying.  Ideas why are
  welcome.
  Default dependency remains at 1.0.7
  
  Revision  Changes    Path
  1.2       +187 -32   jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletExternalContextImpl.java
  
  Index: PortletExternalContextImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletExternalContextImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletExternalContextImpl.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ PortletExternalContextImpl.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -21,6 +21,7 @@
   import java.net.URL;
   import java.security.Principal;
   import java.util.Enumeration;
  +import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Locale;
   import java.util.Map;
  @@ -43,34 +44,71 @@
   import org.apache.commons.logging.Log;
   
   /**
  - * <p>JSF 1.0 PRD2, 6.1.1</p>
  + * <p>
  + * JSF 1.0 PRD2, 6.1.1
  + * </p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
  - * @author <a href="dlestrat@apache.org">David Le Strat</a>
  + * @author <a href="dlestrat@apache.org">David Le Strat </a>
    */
   public class PortletExternalContextImpl extends ExternalContext
   {
  -	private static final Log log = LogFactory.getLog(PortletExternalContextImpl.class);
  -	
  -	private static final String INIT_PARAMETER_MAP_ATTRIBUTE = InitParameterMap.class.getName();
  -    
  +    private static final Log log = LogFactory.getLog(PortletExternalContextImpl.class);
  +
  +    /** The init parameter map attribute. */
  +    private static final String INIT_PARAMETER_MAP_ATTRIBUTE = InitParameterMap.class.getName();
  +
  +    /** The portlet context. */
       private PortletContext portletContext;
  +
  +    /** The portlet request. */
       private PortletRequest portletRequest;
  +
  +    /** The portlet response. */
       private PortletResponse portletResponse;
  +
  +    /** The application map. */
       private Map applicationMap;
  +
  +    /** The session map. */
       private Map sessionMap;
  +
  +    /** The request map. */
       private Map requestMap;
  +
  +    /** The request parameter map. */
       private Map requestParameterMap;
  +
  +    /** The request parameter values map. */
       private Map requestParameterValuesMap;
  +
  +    /** The request header map. */
       private Map requestHeaderMap;
  +
  +    /** The request header values map. */
       private Map requestHeaderValuesMap;
  +
  +    /** The request cookie map. */
       private Map requestCookieMap;
  +
  +    /** The init parameter map. */
       private Map initParameterMap;
  +
  +    /** The request path info. */
       private String requestPathInfo;
  +
  +    /** The request servlet path. */
       private String requestServletPath;
  -    
  -    public PortletExternalContextImpl(PortletContext portletContext,
  -    								  PortletRequest portletRequest,
  -    								  PortletResponse portletResponse)
  +
  +    /**
  +     * @param portletContext The {@link PortletContext}.
  +     * @param portletRequest The {@link PortletRequest}.
  +     * @param portletResponse The {@link PortletResponse}.
  +     */
  +    public PortletExternalContextImpl(PortletContext portletContext, PortletRequest portletRequest,
  +            PortletResponse portletResponse)
       {
           this.portletContext = portletContext;
           this.portletRequest = portletRequest;
  @@ -88,6 +126,11 @@
           this.requestServletPath = null;
       }
   
  +    /**
  +     * <p>
  +     * Reset the member variables.
  +     * </p>
  +     */
       public void release()
       {
           this.portletContext = null;
  @@ -106,27 +149,41 @@
           this.requestServletPath = null;
       }
   
  -
  +    /**
  +     * @see javax.faces.context.ExternalContext#getSession(boolean)
  +     */
       public Object getSession(boolean create)
       {
           return this.portletRequest.getPortletSession(create);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getContext()
  +     */
       public Object getContext()
       {
           return this.portletContext;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequest()
  +     */
       public Object getRequest()
       {
           return this.portletRequest;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getResponse()
  +     */
       public Object getResponse()
       {
           return this.portletResponse;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getApplicationMap()
  +     */
       public Map getApplicationMap()
       {
           if (this.applicationMap == null)
  @@ -136,6 +193,9 @@
           return this.applicationMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getSessionMap()
  +     */
       public Map getSessionMap()
       {
           if (this.sessionMap == null)
  @@ -145,6 +205,9 @@
           return this.sessionMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestMap()
  +     */
       public Map getRequestMap()
       {
           if (this.requestMap == null)
  @@ -154,6 +217,9 @@
           return this.requestMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestParameterMap()
  +     */
       public Map getRequestParameterMap()
       {
           if (this.requestParameterMap == null)
  @@ -163,6 +229,9 @@
           return this.requestParameterMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestParameterValuesMap()
  +     */
       public Map getRequestParameterValuesMap()
       {
           if (this.requestParameterValuesMap == null)
  @@ -172,65 +241,101 @@
           return this.requestParameterValuesMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestParameterNames()
  +     */
       public Iterator getRequestParameterNames()
       {
           final Enumeration enum = this.portletRequest.getParameterNames();
           Iterator it = new Iterator()
           {
  -            public boolean hasNext() {
  +            public boolean hasNext()
  +            {
                   return enum.hasMoreElements();
               }
   
  -            public Object next() {
  +            public Object next()
  +            {
                   return enum.nextElement();
               }
   
  -            public void remove() {
  +            public void remove()
  +            {
                   throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException");
               }
           };
           return it;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestHeaderMap()
  +     */
       public Map getRequestHeaderMap()
       {
  -        return null;
  +        // TODO Hack to fix issue with MyFaces 1.0.6
  +        if (this.requestHeaderMap == null)
  +        {
  +            requestHeaderMap = new HashMap();
  +            requestHeaderMap.put("Content-Type", portletRequest.getResponseContentType());
  +        }
  +        return requestHeaderMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestHeaderValuesMap()
  +     */
       public Map getRequestHeaderValuesMap()
       {
  -        return null;
  +        return requestHeaderValuesMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestCookieMap()
  +     */
       public Map getRequestCookieMap()
       {
           return null;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestLocale()
  +     */
       public Locale getRequestLocale()
       {
           return this.portletRequest.getLocale();
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestPathInfo()
  +     */
       public String getRequestPathInfo()
       {
  -    	if (null == this.requestPathInfo)
  -    	{
  -        	this.requestPathInfo = (String) this.portletRequest.getAttribute("javax.servlet.include.path_info");
  -    	}
  -    	return  this.requestPathInfo;
  +        if (null == this.requestPathInfo)
  +        {
  +            this.requestPathInfo = (String) this.portletRequest.getAttribute("javax.servlet.include.path_info");
  +        }
  +        return this.requestPathInfo;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestContextPath()
  +     */
       public String getRequestContextPath()
       {
           return this.portletRequest.getContextPath();
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getInitParameter(java.lang.String)
  +     */
       public String getInitParameter(String s)
       {
           return this.portletContext.getInitParameter(s);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getInitParameterMap()
  +     */
       public Map getInitParameterMap()
       {
           if (this.initParameterMap == null)
  @@ -244,50 +349,68 @@
           return this.initParameterMap;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getResourcePaths(java.lang.String)
  +     */
       public Set getResourcePaths(String s)
       {
           return this.portletContext.getResourcePaths(s);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getResourceAsStream(java.lang.String)
  +     */
       public InputStream getResourceAsStream(String s)
       {
           return this.portletContext.getResourceAsStream(s);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#encodeActionURL(java.lang.String)
  +     */
       public String encodeActionURL(String s)
       {
  -    	return this.portletResponse.encodeURL(s);
  +        return this.portletResponse.encodeURL(s);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#encodeResourceURL(java.lang.String)
  +     */
       public String encodeResourceURL(String s)
       {
           return this.portletResponse.encodeURL(s);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#encodeNamespace(java.lang.String)
  +     */
       public String encodeNamespace(String s)
       {
           return s;
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#dispatch(java.lang.String)
  +     */
       public void dispatch(String requestURI) throws IOException, FacesException
       {
           if (!(this.portletResponse instanceof RenderResponse))
           {
  -        	throw new IllegalArgumentException("Only RenderResponse can be dispatched");
  +            throw new IllegalArgumentException("Only RenderResponse can be dispatched");
           }
           if (!(this.portletRequest instanceof RenderRequest))
           {
  -        	throw new IllegalArgumentException("Only RenderRequest can be dispatched");
  +            throw new IllegalArgumentException("Only RenderRequest can be dispatched");
           }
  -    	PortletRequestDispatcher portletRequestDispatcher
  -            = this.portletContext.getRequestDispatcher(requestURI);
  +        PortletRequestDispatcher portletRequestDispatcher = this.portletContext.getRequestDispatcher(requestURI);
           try
           {
  -        	portletRequestDispatcher.include((RenderRequest) this.portletRequest, (RenderResponse) this.portletResponse);
  +            portletRequestDispatcher
  +                    .include((RenderRequest) this.portletRequest, (RenderResponse) this.portletResponse);
           }
           catch (PortletException e)
           {
  -        	if (e.getMessage() != null)
  +            if (e.getMessage() != null)
               {
                   throw new FacesException(e.getMessage(), e);
               }
  @@ -298,50 +421,82 @@
           }
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestServletPath()
  +     */
       public String getRequestServletPath()
       {
           return (String) this.portletRequest.getAttribute(FacesPortlet.VIEW_ID);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getAuthType()
  +     */
       public String getAuthType()
       {
           return this.portletRequest.getAuthType();
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRemoteUser()
  +     */
       public String getRemoteUser()
       {
           return this.portletRequest.getRemoteUser();
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#isUserInRole(java.lang.String)
  +     */
       public boolean isUserInRole(String role)
       {
           return this.portletRequest.isUserInRole(role);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getUserPrincipal()
  +     */
       public Principal getUserPrincipal()
       {
           return this.portletRequest.getUserPrincipal();
       }
   
  -    public void log(String message) {
  +    /**
  +     * @see javax.faces.context.ExternalContext#log(java.lang.String)
  +     */
  +    public void log(String message)
  +    {
           this.portletContext.log(message);
       }
   
  -    public void log(String message, Throwable t) {
  -    	this.portletContext.log(message, t);
  +    /**
  +     * @see javax.faces.context.ExternalContext#log(java.lang.String, java.lang.Throwable)
  +     */
  +    public void log(String message, Throwable t)
  +    {
  +        this.portletContext.log(message, t);
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#redirect(java.lang.String)
  +     */
       public void redirect(String url) throws IOException
       {
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getRequestLocales()
  +     */
       public Iterator getRequestLocales()
       {
           return new EnumerationIterator(this.portletRequest.getLocales());
       }
   
  +    /**
  +     * @see javax.faces.context.ExternalContext#getResource(java.lang.String)
  +     */
       public URL getResource(String s) throws MalformedURLException
       {
           return this.portletContext.getResource(s);
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +19 -2     jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/RequestMap.java
  
  Index: RequestMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/RequestMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestMap.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ RequestMap.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -20,11 +20,13 @@
   import javax.portlet.PortletContext;
   import javax.portlet.PortletRequest;
   
  -import net.sourceforge.myfaces.context.AbstractAttributeMap;
  -
  +import org.apache.portals.bridges.myfaces.AbstractAttributeMap;
   
   /**
    * <p>{@link PortletRequest} attributes Map.</p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
    * @author <a href="dlestrat@apache.org">David Le Strat</a>
    */
  @@ -35,6 +37,9 @@
   	/** The {@link PortletContext}. */
   	private final PortletRequest portletRequest;
   
  +    /**
  +     * @param request The request.
  +     */
       public RequestMap(Object request)
       {
           if (request instanceof PortletRequest)
  @@ -47,6 +52,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttribute(java.lang.String)
  +     */
       public Object getAttribute(String key)
       {
           if (null != this.portletRequest)
  @@ -59,6 +67,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#setAttribute(java.lang.String, java.lang.Object)
  +     */
       public void setAttribute(String key, Object value)
       {
       	if (null != this.portletRequest)
  @@ -67,6 +78,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#removeAttribute(java.lang.String)
  +     */
       public void removeAttribute(String key)
       {
       	if (null != this.portletRequest)
  @@ -75,6 +89,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttributeNames()
  +     */
       public Enumeration getAttributeNames()
       {
       	if (null != this.portletRequest)
  
  
  
  1.2       +14 -11    jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/FacesContextFactoryImpl.java
  
  Index: FacesContextFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/FacesContextFactoryImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FacesContextFactoryImpl.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ FacesContextFactoryImpl.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -25,26 +25,29 @@
   import javax.portlet.PortletResponse;
   
   /**
  - * <p>Loads the {@link PortletFacesContextImpl}</p>
  - * @author <a href="dlestrat@apache.org">David Le Strat</a>
  + * <p>
  + * Loads the {@link PortletFacesContextImpl}
  + * </p>
  + * 
  + * @author <a href="dlestrat@apache.org">David Le Strat </a>
    */
   public class FacesContextFactoryImpl extends FacesContextFactory
   {
  -    public FacesContext getFacesContext(Object context,
  -                                        Object request,
  -                                        Object response,
  -                                        Lifecycle lifecycle)
  -    	throws FacesException
  +    /**
  +     * @see javax.faces.context.FacesContextFactory#getFacesContext(java.lang.Object,
  +     *      java.lang.Object, java.lang.Object, javax.faces.lifecycle.Lifecycle)
  +     */
  +    public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle)
  +            throws FacesException
       {
           if (context instanceof PortletContext)
           {
  -            return new PortletFacesContextImpl((PortletContext)context,
  -                                               (PortletRequest)request,
  -                                               (PortletResponse)response);
  +            return new PortletFacesContextImpl((PortletContext) context, (PortletRequest) request,
  +                    (PortletResponse) response);
           }
           else
           {
               throw new FacesException("Unsupported context type " + context.getClass().getName());
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +19 -1     jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/RequestParameterMap.java
  
  Index: RequestParameterMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/RequestParameterMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestParameterMap.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ RequestParameterMap.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -19,10 +19,13 @@
   
   import javax.portlet.PortletRequest;
   
  -import net.sourceforge.myfaces.context.AbstractAttributeMap;
  +import org.apache.portals.bridges.myfaces.AbstractAttributeMap;
   
   /**
    * <p>{@link PortletRequest} parameters as Map.</p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
    * @author <a href="dlestrat@apache.org">David Le Strat</a>
    */
  @@ -33,6 +36,9 @@
   	/** The {@link PortletRequest}. */
   	private final PortletRequest portletRequest;
   
  +    /**
  +     * @param request The request.
  +     */
       public RequestParameterMap(Object request)
       {
           if (request instanceof PortletRequest)
  @@ -45,6 +51,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttribute(java.lang.String)
  +     */
       public Object getAttribute(String key)
       {
           if (null != this.portletRequest)
  @@ -57,16 +66,25 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#setAttribute(java.lang.String, java.lang.Object)
  +     */
       public void setAttribute(String key, Object value)
       {
           throw new UnsupportedOperationException("Cannot set PortletRequest Parameter");
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#removeAttribute(java.lang.String)
  +     */
       public void removeAttribute(String key)
       {
           throw new UnsupportedOperationException("Cannot remove PortletRequest Parameter");
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttributeNames()
  +     */
       public Enumeration getAttributeNames()
       {
           if (null != this.portletRequest)
  
  
  
  1.2       +43 -8     jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletViewHandlerImpl.java
  
  Index: PortletViewHandlerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletViewHandlerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletViewHandlerImpl.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ PortletViewHandlerImpl.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -30,7 +30,11 @@
   import org.apache.commons.logging.LogFactory;
   
   /**
  - * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
  + * <p>
  + * View handler for JSF portlet bridge.
  + * </p>
  + * 
  + * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
    */
   public class PortletViewHandlerImpl extends ViewHandler
   {
  @@ -41,7 +45,8 @@
       private ViewHandler handler;
   
       /**
  -     * <p>Construct a new <code>ViewHandler</code> instance that delegates
  +     * <p>
  +     * Construct a new <code>ViewHandler</code> instance that delegates
        * non-portlet-specific behavior to the specified implementation.
        * 
        * @param handler The <code>ViewHandler</code> instance
  @@ -54,51 +59,81 @@
           }
           this.handler = handler;
       }
  -    
  +
  +    /**
  +     * @see javax.faces.application.ViewHandler#calculateLocale(javax.faces.context.FacesContext)
  +     */
       public Locale calculateLocale(FacesContext facesContext)
       {
           return handler.calculateLocale(facesContext);
       }
   
  +    /**
  +     * @see javax.faces.application.ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext)
  +     */
       public String calculateRenderKitId(FacesContext facesContext)
       {
           return handler.calculateRenderKitId(facesContext);
       }
   
  +    /**
  +     * @see javax.faces.application.ViewHandler#createView(javax.faces.context.FacesContext,
  +     *      java.lang.String)
  +     */
       public UIViewRoot createView(FacesContext facesContext, String viewId)
       {
           return handler.createView(facesContext, viewId);
       }
   
  +    /**
  +     * @see javax.faces.application.ViewHandler#getActionURL(javax.faces.context.FacesContext,
  +     *      java.lang.String)
  +     */
       public String getActionURL(FacesContext facesContext, String viewId)
       {
           Object response = facesContext.getExternalContext().getResponse();
  -        if (!(response instanceof RenderResponse)) {
  +        if (!(response instanceof RenderResponse))
  +        {
               throw new IllegalStateException("Must be a RenderResponse");
           }
           RenderResponse renderResponse = (RenderResponse) response;
           PortletURL actionURL = renderResponse.createActionURL();
           return (actionURL.toString());
       }
  -    
  +
  +    /**
  +     * @see javax.faces.application.ViewHandler#getResourceURL(javax.faces.context.FacesContext,
  +     *      java.lang.String)
  +     */
       public String getResourceURL(FacesContext facesContext, String path)
       {
           return handler.getResourceURL(facesContext, path);
       }
  -    
  +
  +    /**
  +     * @see javax.faces.application.ViewHandler#renderView(javax.faces.context.FacesContext,
  +     *      javax.faces.component.UIViewRoot)
  +     */
       public void renderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException, FacesException
       {
           handler.renderView(facesContext, viewToRender);
       }
  -    
  +
  +    /**
  +     * @see javax.faces.application.ViewHandler#restoreView(javax.faces.context.FacesContext,
  +     *      java.lang.String)
  +     */
       public UIViewRoot restoreView(FacesContext facesContext, String viewId)
       {
           return handler.restoreView(facesContext, viewId);
       }
   
  +    /**
  +     * @see javax.faces.application.ViewHandler#writeState(javax.faces.context.FacesContext)
  +     */
       public void writeState(FacesContext facesContext) throws IOException
       {
           handler.writeState(facesContext);
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +19 -1     jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/RequestParameterValuesMap.java
  
  Index: RequestParameterValuesMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/RequestParameterValuesMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestParameterValuesMap.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ RequestParameterValuesMap.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -19,10 +19,13 @@
   
   import javax.portlet.PortletRequest;
   
  -import net.sourceforge.myfaces.context.AbstractAttributeMap;
  +import org.apache.portals.bridges.myfaces.AbstractAttributeMap;
   
   /**
    * <p>{@link PortletRequest} multi-value parameters as Map.</p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
    * @author <a href="dlestrat@apache.org">David Le Strat</a>
    */
  @@ -33,6 +36,9 @@
   	/** The {@link PortletRequest}. */
   	private final PortletRequest portletRequest;
   
  +    /**
  +     * @param request The request.
  +     */
       public RequestParameterValuesMap(Object request)
       {
           if (request instanceof PortletRequest)
  @@ -45,6 +51,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttribute(java.lang.String)
  +     */
       public Object getAttribute(String key)
       {
           if (null != this.portletRequest)
  @@ -57,16 +66,25 @@
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#setAttribute(java.lang.String, java.lang.Object)
  +     */
       public void setAttribute(String key, Object value)
       {
           throw new UnsupportedOperationException("Cannot set PortletRequest ParameterValues");
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#removeAttribute(java.lang.String)
  +     */
       public void removeAttribute(String key)
       {
           throw new UnsupportedOperationException("Cannot remove PortletRequest ParameterValues");
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttributeNames()
  +     */
       public Enumeration getAttributeNames()
       {
       	if (null != this.portletRequest)
  
  
  
  1.2       +54 -34    jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/SessionMap.java
  
  Index: SessionMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/SessionMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionMap.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ SessionMap.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -20,80 +20,100 @@
   import javax.portlet.PortletRequest;
   import javax.portlet.PortletSession;
   
  -import net.sourceforge.myfaces.context.AbstractAttributeMap;
  -import net.sourceforge.myfaces.util.NullEnumeration;
  +import org.apache.portals.bridges.myfaces.AbstractAttributeMap;
  +import org.apache.portals.bridges.myfaces.NullEnumeration;
   
   /**
  - * HttpSession attibutes as Map.
  + * <p>
  + * Session attibutes as Map.
  + * </p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
  - * @author Anton Koinov (latest modification by $Author$)<br>
  - *         Refactored to support Portlets by <a href="dlestrat@apache.org">David Le Strat</a>
  + * @author <a href="dlestrat@apache.org">David Le Strat </a>
    */
   public class SessionMap extends AbstractAttributeMap
   {
  -	/** Illegal argument exception message. */
  -	final private static String ILLEGAL_ARGUMENT = "Only PortletContext supported";
  -	/** The {@link PortletRequest}. */
  -	private final PortletRequest portletRequest;
  +    /** Illegal argument exception message. */
  +    final private static String ILLEGAL_ARGUMENT = "Only PortletContext supported";
   
  +    /** The {@link PortletRequest}. */
  +    private final PortletRequest portletRequest;
  +
  +    /**
  +     * @param request The request.
  +     */
       public SessionMap(Object request)
       {
           if (request instanceof PortletRequest)
           {
  -        	this.portletRequest = (PortletRequest) request;
  +            this.portletRequest = (PortletRequest) request;
           }
           else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttribute(java.lang.String)
  +     */
       protected Object getAttribute(String key)
       {
           if (null != this.portletRequest)
           {
  -        	PortletSession portletSession = this.portletRequest.getPortletSession(false);
  -        	return (portletSession == null) 
  -        		? null : portletSession.getAttribute(key.toString());
  +            PortletSession portletSession = this.portletRequest.getPortletSession(false);
  +            return (portletSession == null) ? null : portletSession.getAttribute(key.toString());
           }
           else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#setAttribute(java.lang.String,
  +     *      java.lang.Object)
  +     */
       protected void setAttribute(String key, Object value)
       {
  -    	if (null != this.portletRequest)
  +        if (null != this.portletRequest)
           {
  -    		this.portletRequest.getPortletSession(true).setAttribute(key, value);
  +            this.portletRequest.getPortletSession(true).setAttribute(key, value);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#removeAttribute(java.lang.String)
  +     */
       protected void removeAttribute(String key)
       {
  -    	if (null != this.portletRequest)
  -    	{
  -    		PortletSession portletSession = this.portletRequest.getPortletSession(false);;
  -    		if (null != portletSession)
  -    		{
  -    			portletSession.removeAttribute(key);
  -    		}
  -    	}
  +        if (null != this.portletRequest)
  +        {
  +            PortletSession portletSession = this.portletRequest.getPortletSession(false);
  +            ;
  +            if (null != portletSession)
  +            {
  +                portletSession.removeAttribute(key);
  +            }
  +        }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttributeNames()
  +     */
       protected Enumeration getAttributeNames()
       {
  -    	if (null != this.portletRequest)
  -    	{
  -    		PortletSession portletSession = this.portletRequest.getPortletSession(false);;
  -    		return (portletSession == null)
  -            	? NullEnumeration.instance()
  -                : portletSession.getAttributeNames();
  -    	}
  -    	else
  +        if (null != this.portletRequest)
  +        {
  +            PortletSession portletSession = this.portletRequest.getPortletSession(false);
  +            ;
  +            return (portletSession == null) ? NullEnumeration.instance() : portletSession.getAttributeNames();
  +        }
  +        else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
   
  
  
  
  1.2       +38 -16    jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/InitParameterMap.java
  
  Index: InitParameterMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/InitParameterMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InitParameterMap.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ InitParameterMap.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -19,63 +19,85 @@
   
   import javax.portlet.PortletContext;
   
  -import net.sourceforge.myfaces.context.AbstractAttributeMap;
  +import org.apache.portals.bridges.myfaces.AbstractAttributeMap;
   
   /**
  - * <p>{@link PortletContext} init parameters as Map.</p>
  + * <p>
  + * {@link PortletContext}init parameters as Map.
  + * </p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
  - * @author <a href="dlestrat@apache.org">David Le Strat</a>
  + * @author <a href="dlestrat@apache.org">David Le Strat </a>
    */
   public class InitParameterMap extends AbstractAttributeMap
   {
  -	/** Illegal argument exception message. */
  -	final private static String ILLEGAL_ARGUMENT = "Only PortletContext supported";
  -	/** The {@link PortletContext}. */
  -	final private PortletContext portletContext;
  +    /** Illegal argument exception message. */
  +    final private static String ILLEGAL_ARGUMENT = "Only PortletContext supported";
   
  +    /** The {@link PortletContext}. */
  +    final private PortletContext portletContext;
  +
  +    /**
  +     * @param context The context.
  +     */
       public InitParameterMap(Object context)
       {
           if (context instanceof PortletContext)
           {
  -        	this.portletContext = (PortletContext) context;
  +            this.portletContext = (PortletContext) context;
           }
           else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttribute(java.lang.String)
  +     */
       public Object getAttribute(String key)
       {
           if (null != this.portletContext)
           {
  -        	return this.portletContext.getInitParameter(key);
  +            return this.portletContext.getInitParameter(key);
           }
           else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#setAttribute(java.lang.String,
  +     *      java.lang.Object)
  +     */
       public void setAttribute(String key, Object value)
       {
           throw new UnsupportedOperationException("Cannot set PortletContext InitParameter");
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#removeAttribute(java.lang.String)
  +     */
       public void removeAttribute(String key)
       {
           throw new UnsupportedOperationException("Cannot remove PortletContext InitParameter");
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttributeNames()
  +     */
       public Enumeration getAttributeNames()
       {
  -    	if (null != this.portletContext)
  +        if (null != this.portletContext)
           {
  -    		return this.portletContext.getInitParameterNames();
  +            return this.portletContext.getInitParameterNames();
           }
  -    	else
  +        else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +118 -32   jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletFacesContextImpl.java
  
  Index: PortletFacesContextImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletFacesContextImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletFacesContextImpl.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ PortletFacesContextImpl.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -40,64 +40,105 @@
   import net.sourceforge.myfaces.util.NullIterator;
   
   /**
  - * TODO There should be a base class shared with ServletFacesContextImpl.
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
  + * <p>
  + * TODO There should be a base class shared with the MyFaces
  + * ServletFacesContextImpl.
  + * </p>
    * 
  - * @see Also {@link net.sourceforge.myfaces.context.servlet.ServletFacesContextImpl}
  - * @author <a href="dlestrat@apache.org">David Le Strat</a>
  - *
  + * @author <a href="dlestrat@apache.org">David Le Strat </a>
  + *  
    */
   public class PortletFacesContextImpl extends FacesContext
   {
  -	//~ Static fields/initializers -----------------------------------------------------------------
  -	protected static final Object NULL_DUMMY = new Object();
  +    protected static final Object NULL_DUMMY = new Object();
   
  -	//~ Instance fields ----------------------------------------------------------------------------
  +    /** The message client ids. */
       private List messageClientIds = null;
  +
  +    /** The mesages. */
       private List messages = null;
  +
  +    /** The application. */
       private Application application;
  +
  +    /** The portlet external context. */
       private PortletExternalContextImpl externalContext;
  +
  +    /** The response stream. */
       private ResponseStream responseStream = null;
  +
  +    /** The response writer. */
       private ResponseWriter responseWriter = null;
  +
  +    /** The severity. */
       private FacesMessage.Severity maximumSeverity = FacesMessage.SEVERITY_INFO;
  +
  +    /** The view root. */
       private UIViewRoot viewRoot;
  +
  +    /** The render response. */
       private boolean renderResponse = false;
  +
  +    /** Whether the response is complete. */
       private boolean responseComplete = false;
  +
  +    /** The render kit factory. */
       private RenderKitFactory renderKitFactory;
   
  -    //~ Constructors -------------------------------------------------------------------------------
  -    public PortletFacesContextImpl(PortletContext portletContext,
  -                                   PortletRequest portletRequest,
  -                                   PortletResponse portletResponse)
  +    /**
  +     * @param portletContext The {@link PortletContext}.
  +     * @param portletRequest The {@link PortletRequest}.
  +     * @param portletResponse The {@link PortletResponse}.
  +     */
  +    public PortletFacesContextImpl(PortletContext portletContext, PortletRequest portletRequest,
  +            PortletResponse portletResponse)
       {
  -        this.application = ((ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY))
  -                            .getApplication();
  +        this.application = ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY))
  +                .getApplication();
           this.renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
  -        this.externalContext = new PortletExternalContextImpl(portletContext,
  -                                                          	  portletRequest,
  -                                                              portletResponse);
  -        FacesContext.setCurrentInstance(this);  //protected method, therefore must be called from here
  +        this.externalContext = new PortletExternalContextImpl(portletContext, portletRequest, portletResponse);
  +        FacesContext.setCurrentInstance(this); //protected method, therefore
  +                                               // must be called from here
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getExternalContext()
  +     */
       public ExternalContext getExternalContext()
       {
           return this.externalContext;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getMaximumSeverity()
  +     */
       public FacesMessage.Severity getMaximumSeverity()
       {
           return this.maximumSeverity;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getMessages()
  +     */
       public Iterator getMessages()
       {
           return (this.messages != null) ? this.messages.iterator() : Collections.EMPTY_LIST.iterator();
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getApplication()
  +     */
       public Application getApplication()
       {
           return this.application;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getClientIdsWithMessages()
  +     */
       public Iterator getClientIdsWithMessages()
       {
           if (this.messages == null || this.messages.isEmpty())
  @@ -107,23 +148,24 @@
   
           return new Iterator()
           {
  -        	private int next;
  +            private int next;
  +
               boolean nextFound;
   
               public void remove()
               {
  -            	throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException");
  +                throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException");
               }
   
               public boolean hasNext()
               {
  -            	if (!nextFound)
  +                if (!nextFound)
                   {
  -                	for (int len = messageClientIds.size(); next < len; next++)
  +                    for (int len = messageClientIds.size(); next < len; next++)
                       {
  -                		if (messageClientIds.get(next) != NULL_DUMMY)
  +                        if (messageClientIds.get(next) != NULL_DUMMY)
                           {
  -                        	nextFound = true;
  +                            nextFound = true;
                               break;
                           }
                       }
  @@ -133,16 +175,19 @@
   
               public Object next()
               {
  -            	if (hasNext())
  +                if (hasNext())
                   {
  -            		nextFound = false;
  +                    nextFound = false;
                       return messageClientIds.get(next++);
                   }
  -            	throw new NoSuchElementException();
  +                throw new NoSuchElementException();
               }
           };
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getMessages(java.lang.String)
  +     */
       public Iterator getMessages(String clientId)
       {
           if (this.messages == null)
  @@ -156,25 +201,30 @@
               Object savedClientId = this.messageClientIds.get(i);
               if (clientId == null)
               {
  -                if (savedClientId == NULL_DUMMY) lst.add(this.messages.get(i));
  +                if (savedClientId == NULL_DUMMY)
  +                    lst.add(this.messages.get(i));
               }
               else
               {
  -                if (clientId.equals(savedClientId)) lst.add(this.messages.get(i));
  +                if (clientId.equals(savedClientId))
  +                    lst.add(this.messages.get(i));
               }
           }
           return lst.iterator();
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getRenderKit()
  +     */
       public RenderKit getRenderKit()
       {
  -    	if (getViewRoot() == null)
  +        if (getViewRoot() == null)
           {
               return null;
           }
   
           String renderKitId = getViewRoot().getRenderKitId();
  -       
  +
           if (renderKitId == null)
           {
               return null;
  @@ -183,16 +233,25 @@
           return this.renderKitFactory.getRenderKit(this, renderKitId);
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getRenderResponse()
  +     */
       public boolean getRenderResponse()
       {
           return this.renderResponse;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getResponseComplete()
  +     */
       public boolean getResponseComplete()
       {
           return this.responseComplete;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#setResponseStream(javax.faces.context.ResponseStream)
  +     */
       public void setResponseStream(ResponseStream responseStream)
       {
           if (responseStream == null)
  @@ -202,11 +261,17 @@
           this.responseStream = responseStream;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getResponseStream()
  +     */
       public ResponseStream getResponseStream()
       {
           return this.responseStream;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#setResponseWriter(javax.faces.context.ResponseWriter)
  +     */
       public void setResponseWriter(ResponseWriter responseWriter)
       {
           if (responseWriter == null)
  @@ -216,11 +281,17 @@
           this.responseWriter = responseWriter;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getResponseWriter()
  +     */
       public ResponseWriter getResponseWriter()
       {
           return this.responseWriter;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#setViewRoot(javax.faces.component.UIViewRoot)
  +     */
       public void setViewRoot(UIViewRoot viewRoot)
       {
           if (viewRoot == null)
  @@ -230,11 +301,17 @@
           this.viewRoot = viewRoot;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#getViewRoot()
  +     */
       public UIViewRoot getViewRoot()
       {
           return this.viewRoot;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#addMessage(java.lang.String, javax.faces.application.FacesMessage)
  +     */
       public void addMessage(String clientId, FacesMessage message)
       {
           if (message == null)
  @@ -249,13 +326,16 @@
           }
           this.messages.add(message);
           this.messageClientIds.add((clientId != null) ? clientId : NULL_DUMMY);
  -        FacesMessage.Severity serSeverity =  message.getSeverity();
  +        FacesMessage.Severity serSeverity = message.getSeverity();
           if (serSeverity != null && serSeverity.compareTo(this.maximumSeverity) > 0)
           {
               this.maximumSeverity = message.getSeverity();
           }
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#release()
  +     */
       public void release()
       {
           if (this.externalContext != null)
  @@ -274,13 +354,19 @@
           FacesContext.setCurrentInstance(null);
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#renderResponse()
  +     */
       public void renderResponse()
       {
           this.renderResponse = true;
       }
   
  +    /**
  +     * @see javax.faces.context.FacesContext#responseComplete()
  +     */
       public void responseComplete()
       {
           this.responseComplete = true;
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +46 -24    jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/ApplicationMap.java
  
  Index: ApplicationMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/ApplicationMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplicationMap.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ ApplicationMap.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -19,69 +19,91 @@
   
   import javax.portlet.PortletContext;
   
  -import net.sourceforge.myfaces.context.servlet.AbstractAttributeMap;
  +import org.apache.portals.bridges.myfaces.AbstractAttributeMap;
   
   /**
  - * <p>{@link PortletContext} attributes as a Map.</p>
  + * <p>
  + * {@link PortletContext}attributes as a Map.
  + * </p>
  + * <p>
  + * See MyFaces project for servlet implementation.
  + * </p>
    * 
  - * @author <a href="dlestrat@apache.org">David Le Strat</a>
  + * @author <a href="dlestrat@apache.org">David Le Strat </a>
    */
   public class ApplicationMap extends AbstractAttributeMap
   {
       /** Illegal argument exception message. */
  -	final private static String ILLEGAL_ARGUMENT = "Only PortletContext supported";
  -	/** The {@link PortletContext}. */
  -	final private PortletContext portletContext;
  +    final private static String ILLEGAL_ARGUMENT = "Only PortletContext supported";
   
  +    /** The {@link PortletContext}. */
  +    final private PortletContext portletContext;
  +
  +    /**
  +     * @param context The context.
  +     */
       public ApplicationMap(Object context)
       {
           if (context instanceof PortletContext)
           {
  -        	this.portletContext = (PortletContext) context;
  +            this.portletContext = (PortletContext) context;
           }
           else
           {
  -        	throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttribute(java.lang.String)
  +     */
       public Object getAttribute(String key)
       {
           if (null != this.portletContext)
           {
  -        	return this.portletContext.getAttribute(key);
  +            return this.portletContext.getAttribute(key);
  +        }
  +        else
  +        {
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
  -    	else
  -    	{
  -    		throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  -    	}
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#setAttribute(java.lang.String,
  +     *      java.lang.Object)
  +     */
       public void setAttribute(String key, Object value)
       {
  -    	if (null != this.portletContext)
  +        if (null != this.portletContext)
           {
  -    		this.portletContext.setAttribute(key, value);
  +            this.portletContext.setAttribute(key, value);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#removeAttribute(java.lang.String)
  +     */
       public void removeAttribute(String key)
       {
  -    	if (null != this.portletContext)
  +        if (null != this.portletContext)
           {
  -    		this.portletContext.removeAttribute(key);
  +            this.portletContext.removeAttribute(key);
           }
       }
   
  +    /**
  +     * @see org.apache.portals.bridges.myfaces.AbstractAttributeMap#getAttributeNames()
  +     */
       public Enumeration getAttributeNames()
       {
  -    	if (null != this.portletContext)
  +        if (null != this.portletContext)
  +        {
  +            return this.portletContext.getAttributeNames();
  +        }
  +        else
           {
  -    		return this.portletContext.getAttributeNames();
  +            throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
           }
  -    	else
  -    	{
  -    		throw new IllegalArgumentException(ILLEGAL_ARGUMENT);
  -    	}
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +60 -26    jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/FacesPortlet.java
  
  Index: FacesPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/FacesPortlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FacesPortlet.java	17 Aug 2004 19:56:15 -0000	1.1
  +++ FacesPortlet.java	11 Sep 2004 18:43:26 -0000	1.2
  @@ -42,12 +42,14 @@
   import org.apache.commons.logging.LogFactory;
   
   /**
  - * <p>FacesPortlet utilizes Java Server Faces to create the user interface in a
  - * portlet environment.</p>
  + * <p>
  + * FacesPortlet utilizes Java Server Faces to create the user interface in a
  + * portlet environment.
  + * </p>
    * 
    * @author <a href="mailto:dlestrat@yahoo.com">David Le Strat </a>
    */
  -public final class FacesPortlet extends GenericPortlet
  +public class FacesPortlet extends GenericPortlet
   {
   
       /** The Log instance for this class. */
  @@ -101,8 +103,6 @@
       /** Default URL for the view page. */
       private String defaultViewPage = null;
   
  -    // ------------------------------------------------------ Manifest Constants
  -
       /**
        * <p>
        * Context initialization parameter name for the lifecycle identifier of the
  @@ -111,8 +111,6 @@
        */
       private static final String LIFECYCLE_ID_ATTR = FacesServlet.LIFECYCLE_ID_ATTR;
   
  -    // ------------------------------------------------------ Instance Variables
  -
       /**
        * <p>
        * The {@link Application}instance for this web application.
  @@ -141,10 +139,10 @@
        */
       private PortletConfig portletConfig = null;
   
  -    // ---------------------------------------------------------- Public Methods
  -
       /**
  -     * <p>Release all resources acquired at startup time.</p>
  +     * <p>
  +     * Release all resources acquired at startup time.
  +     * </p>
        */
       public void destroy()
       {
  @@ -164,13 +162,14 @@
       }
   
       /**
  -     * <p>Acquire the factory instance we will require.</p>
  +     * <p>
  +     * Acquire the factory instance we will require.
  +     * </p>
        * 
  -     * @exception PortletException
  -     *                if, for any reason, the startp of this Faces application
  -     *                failed. This includes errors in the config file that is
  -     *                parsed before or during the processing of this
  -     *                <code>init()</code> method.
  +     * @exception PortletException if, for any reason, the startp of this Faces
  +     *                application failed. This includes errors in the config
  +     *                file that is parsed before or during the processing of
  +     *                this <code>init()</code> method.
        */
       public void init(PortletConfig portletConfig) throws PortletException
       {
  @@ -215,33 +214,57 @@
           }
       }
   
  +    /**
  +     * @see javax.portlet.GenericPortlet#doEdit(javax.portlet.RenderRequest,
  +     *      javax.portlet.RenderResponse)
  +     */
       public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException
       {
           process(request, response, defaultEditPage, FacesPortlet.EDIT_REQUEST);
       }
   
  +    /**
  +     * @see javax.portlet.GenericPortlet#doHelp(javax.portlet.RenderRequest,
  +     *      javax.portlet.RenderResponse)
  +     */
       public void doHelp(RenderRequest request, RenderResponse response) throws PortletException, IOException
       {
           process(request, response, defaultHelpPage, FacesPortlet.HELP_REQUEST);
       }
   
  +    /**
  +     * @param request The {@link RenderRequest}.
  +     * @param response The {@link RenderResponse}.
  +     * @throws PortletException Throws a {@link PortletException}.
  +     * @throws IOException Throws a {@link IOException}.
  +     */
       public void doCustom(RenderRequest request, RenderResponse response) throws PortletException, IOException
       {
           process(request, response, defaultCustomPage, FacesPortlet.CUSTOM_REQUEST);
       }
   
  +    /**
  +     * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest,
  +     *      javax.portlet.RenderResponse)
  +     */
       public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
       {
           process(request, response, defaultViewPage, FacesPortlet.VIEW_REQUEST);
       }
   
  +    /**
  +     * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest,
  +     *      javax.portlet.ActionResponse)
  +     */
       public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException
       {
           process(request, response, defaultActionPage, FacesPortlet.ACTION_REQUEST);
       }
   
       /**
  -     * <p>Gets the {@link FacesContextFactory}.</p>
  +     * <p>
  +     * Gets the {@link FacesContextFactory}.
  +     * </p>
        * 
        * @return The {@link FacesContextFactory}.
        * @throws PortletException Throws a {@link PortletException}.
  @@ -276,7 +299,9 @@
       }
   
       /**
  -     * <p>Get the faces life cycle.</p>
  +     * <p>
  +     * Get the faces life cycle.
  +     * </p>
        * 
        * @return The {@link Lifecycle}.
        * @throws PortletException Throws a {@link PortletException}.
  @@ -326,7 +351,9 @@
       }
   
       /**
  -     * <p>Processes the request.</p>
  +     * <p>
  +     * Processes the request.
  +     * </p>
        * 
        * @param request The {@link PortletRequest}.
        * @param response The {@link PortletResponse}.
  @@ -415,30 +442,37 @@
       }
   
       /**
  -     * <p>Set the view identifier to a default page.</p>
  +     * <p>
  +     * Set the view identifier to a default page.
  +     * </p>
        * 
  -     * @param context The {@link FacesContext} for the current request.
  +     * @param context The {@link FacesContext}for the current request.
        * @param defaultView The default view identifier.
        */
       private void setDefaultView(FacesContext facesContext, String defaultView)
       {
  -        // Need to be able to transport viewId between actionRequest and renderRequest.
  -        // If actionRequest, the view id is obtained from the navigation, we need to be able to keep that
  -        // value and not have it overwritten by the default view id.  Putting that value in the portletRequest does not
  +        // Need to be able to transport viewId between actionRequest and
  +        // renderRequest.
  +        // If actionRequest, the view id is obtained from the navigation, we
  +        // need to be able to keep that
  +        // value and not have it overwritten by the default view id. Putting
  +        // that value in the portletRequest does not
           // work. Need to use actionResponse.setRenderParameter...
           PortletRequest portletRequest = (PortletRequest) facesContext.getExternalContext().getRequest();
           if (portletRequest instanceof ActionRequest)
           {
               if ((null != facesContext.getViewRoot()) && (null != facesContext.getViewRoot().getViewId()))
               {
  -                ((ActionResponse) facesContext.getExternalContext().getResponse()).setRenderParameter(FacesPortlet.VIEW_ID, facesContext.getViewRoot().getViewId());
  +                ((ActionResponse) facesContext.getExternalContext().getResponse()).setRenderParameter(
  +                        FacesPortlet.VIEW_ID, facesContext.getViewRoot().getViewId());
               }
           }
           if ((portletRequest instanceof RenderRequest) && (null != portletRequest.getParameter(FacesPortlet.VIEW_ID)))
           {
               defaultView = portletRequest.getParameter(FacesPortlet.VIEW_ID);
           }
  -        if ((null != portletRequest.getAttribute(FacesPortlet.VIEW_ID)) && (!portletRequest.getAttribute(FacesPortlet.VIEW_ID).equals(defaultView)))
  +        if ((null != portletRequest.getAttribute(FacesPortlet.VIEW_ID))
  +                && (!portletRequest.getAttribute(FacesPortlet.VIEW_ID).equals(defaultView)))
           {
               return;
           }
  
  
  
  1.1                  jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/AbstractAttributeMap.java
  
  Index: AbstractAttributeMap.java
  ===================================================================
  /*
   * 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.portals.bridges.myfaces;
  
  import java.util.AbstractSet;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Enumeration;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.NoSuchElementException;
  import java.util.Set;
  
  /**
   * <p>
   * Helper Map implementation for use with different Attribute Maps.
   * </p>
   * <p>
   * See MyFaces project for servlet implementation.
   * </p>
   * 
   * @author <a href="dlestrat@apache.org">David Le Strat </a>
   *  
   */
  public abstract class AbstractAttributeMap implements Map
  {
      private Set keySet;
  
      private Collection values;
  
      private Set entrySet;
  
      /**
       * @see java.util.Map#clear()
       */
      public void clear()
      {
          List names = new ArrayList();
          for (Enumeration e = getAttributeNames(); e.hasMoreElements();)
          {
              names.add(e.nextElement());
          }
  
          for (Iterator it = names.iterator(); it.hasNext();)
          {
              removeAttribute((String) it.next());
          }
      }
  
      /**
       * @see java.util.Map#containsKey(java.lang.Object)
       */
      public boolean containsKey(Object key)
      {
          return getAttribute(key.toString()) != null;
      }
  
      /**
       * @see java.util.Map#containsValue(java.lang.Object)
       */
      public boolean containsValue(Object findValue)
      {
          if (findValue == null)
          {
              return false;
          }
  
          for (Enumeration e = getAttributeNames(); e.hasMoreElements();)
          {
              Object value = getAttribute((String) e.nextElement());
              if (findValue.equals(value))
              {
                  return true;
              }
          }
  
          return false;
      }
  
      /**
       * @see java.util.Map#entrySet()
       */
      public Set entrySet()
      {
          return (entrySet != null) ? entrySet : (entrySet = new EntrySet());
      }
  
      /**
       * @see java.util.Map#get(java.lang.Object)
       */
      public Object get(Object key)
      {
          return getAttribute(key.toString());
      }
  
      /**
       * @see java.util.Map#isEmpty()
       */
      public boolean isEmpty()
      {
          return !getAttributeNames().hasMoreElements();
      }
  
      /**
       * @see java.util.Map#keySet()
       */
      public Set keySet()
      {
          return (keySet != null) ? keySet : (keySet = new KeySet());
      }
  
      /**
       * @see java.util.Map#put(java.lang.Object, java.lang.Object)
       */
      public Object put(Object key, Object value)
      {
          String localKey = key.toString();
          Object retval = getAttribute(localKey);
          setAttribute(localKey, value);
          return retval;
      }
  
      /**
       * @see java.util.Map#putAll(java.util.Map)
       */
      public void putAll(Map t)
      {
          for (Iterator it = t.entrySet().iterator(); it.hasNext();)
          {
              Entry entry = (Entry) it.next();
              setAttribute(entry.getKey().toString(), entry.getValue());
          }
      }
  
      /**
       * @see java.util.Map#remove(java.lang.Object)
       */
      public Object remove(Object key)
      {
          String localKey = key.toString();
          Object retval = getAttribute(localKey);
          removeAttribute(localKey);
          return retval;
      }
  
      /**
       * @see java.util.Map#size()
       */
      public int size()
      {
          int size = 0;
          for (Enumeration e = getAttributeNames(); e.hasMoreElements();)
          {
              size++;
              e.nextElement();
          }
          return size;
      }
  
      /**
       * @see java.util.Map#values()
       */
      public Collection values()
      {
          return (values != null) ? values : (values = new Values());
      }
  
      /**
       * <p>
       * Gets an attribute given a key.
       * </p>
       * 
       * @param key The key.
       * @return The attribute.
       */
      abstract protected Object getAttribute(String key);
  
      /**
       * <p>
       * Sets an attribute given a key/value.
       * </p>
       * 
       * @param key The key.
       * @param value The value.
       */
      abstract protected void setAttribute(String key, Object value);
  
      /**
       * <p>
       * Removes an attribute.
       * </p>
       * 
       * @param key The key.
       */
      abstract protected void removeAttribute(String key);
  
      /**
       * <p>
       * Gets the attributes names.
       * </p>
       * 
       * @return An enumeration of attributes names.
       */
      abstract protected Enumeration getAttributeNames();
  
      private class KeySet extends AbstractSet
      {
          public Iterator iterator()
          {
              return new KeyIterator();
          }
  
          public boolean isEmpty()
          {
              return AbstractAttributeMap.this.isEmpty();
          }
  
          public int size()
          {
              return AbstractAttributeMap.this.size();
          }
  
          public boolean contains(Object o)
          {
              return AbstractAttributeMap.this.containsKey(o);
          }
  
          public boolean remove(Object o)
          {
              return AbstractAttributeMap.this.remove(o) != null;
          }
  
          public void clear()
          {
              AbstractAttributeMap.this.clear();
          }
      }
  
      private class KeyIterator implements Iterator
      {
          protected final Enumeration _e = getAttributeNames();
  
          protected Object _currentKey;
  
          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);
          }
  
          public boolean hasNext()
          {
              return _e.hasMoreElements();
          }
  
          public Object next()
          {
              return _currentKey = _e.nextElement();
          }
      }
  
      private class Values extends KeySet
      {
          public Iterator iterator()
          {
              return new ValuesIterator();
          }
  
          public boolean contains(Object o)
          {
              return AbstractAttributeMap.this.containsValue(o);
          }
  
          public boolean remove(Object o)
          {
              if (o == null)
              {
                  return false;
              }
  
              for (Iterator it = iterator(); it.hasNext();)
              {
                  if (o.equals(it.next()))
                  {
                      it.remove();
                      return true;
                  }
              }
  
              return false;
          }
      }
  
      private class ValuesIterator extends KeyIterator
      {
          public Object next()
          {
              super.next();
              return AbstractAttributeMap.this.get(_currentKey);
          }
      }
  
      private class EntrySet extends KeySet
      {
          public Iterator iterator()
          {
              return new EntryIterator();
          }
  
          public boolean contains(Object o)
          {
              if (!(o instanceof Entry))
              {
                  return false;
              }
  
              Entry entry = (Entry) o;
              Object key = entry.getKey();
              Object value = entry.getValue();
              if (key == null || value == null)
              {
                  return false;
              }
  
              return value.equals(AbstractAttributeMap.this.get(key));
          }
  
          public boolean remove(Object o)
          {
              if (!(o instanceof Entry))
              {
                  return false;
              }
  
              Entry entry = (Entry) o;
              Object key = entry.getKey();
              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;
          }
      }
  
      /**
       * 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 KeyIterator
      {
          public Object next()
          {
              super.next();
              // Must create new Entry every time--value of the entry must stay
              // linked to the same attribute name
              return new EntrySetEntry(_currentKey);
          }
      }
  
      private class EntrySetEntry implements Entry
      {
          private final Object _currentKey;
  
          public EntrySetEntry(Object currentKey)
          {
              _currentKey = currentKey;
          }
  
          public Object getKey()
          {
              return _currentKey;
          }
  
          public Object getValue()
          {
              return AbstractAttributeMap.this.get(_currentKey);
          }
  
          public Object setValue(Object value)
          {
              return AbstractAttributeMap.this.put(_currentKey, value);
          }
      }
  }
  
  
  1.1                  jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/NullEnumeration.java
  
  Index: NullEnumeration.java
  ===================================================================
  /*
   * 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.portals.bridges.myfaces;
  
  import java.util.Enumeration;
  
  /**
   * <p>
   * Enumeration without elements
   * </p>
   * <p>
   * Code provided by MyFaces project.
   * </p>
   * 
   * @author <a href="dlestrat@apache.org">David Le Strat </a>
   */
  public final class NullEnumeration implements Enumeration
  {
      /** Null enumeration. */
      private static final NullEnumeration nullEnumeration = new NullEnumeration();
  
      /**
       * @return An instance of the enumeration.
       */
      public static final NullEnumeration instance()
      {
          return nullEnumeration;
      }
  
      /**
       * @see java.util.Enumeration#hasMoreElements()
       */
      public boolean hasMoreElements()
      {
          return false;
      }
  
      /**
       * @see java.util.Enumeration#nextElement()
       */
      public Object nextElement()
      {
          throw new UnsupportedOperationException("NullEnumeration has no elements");
      }
  }
  
  

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


Mime
View raw message