001    // Copyright 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.portlet;
016    
017    import javax.portlet.ActionRequest;
018    import javax.portlet.ActionResponse;
019    import javax.portlet.PortletRequest;
020    import javax.portlet.RenderRequest;
021    import javax.portlet.RenderResponse;
022    
023    /**
024     * Implementation of the tapestry.portlet.PortletRequestGlobals service, which
025     * uses the threaded service lifecycle model.
026     * 
027     * @author Howard M. Lewis Ship
028     * @since 4.0
029     */
030    public class PortletRequestGlobalsImpl implements PortletRequestGlobals
031    {
032    
033        private ActionRequest _actionRequest;
034    
035        private ActionResponse _actionResponse;
036    
037        private RenderResponse _renderResponse;
038    
039        private RenderRequest _renderRequest;
040    
041        private PortletRequest _portletRequest;
042    
043        public void store(ActionRequest request, ActionResponse response)
044        {
045            _actionRequest = request;
046            _portletRequest = request;
047    
048            _actionResponse = response;
049        }
050    
051        public void store(RenderRequest request, RenderResponse response)
052        {
053            _renderRequest = request;
054            _portletRequest = request;
055    
056            _renderResponse = response;
057        }
058    
059        public ActionRequest getActionRequest()
060        {
061            return _actionRequest;
062        }
063    
064        public ActionResponse getActionResponse()
065        {
066            return _actionResponse;
067        }
068    
069        public RenderRequest getRenderRequest()
070        {
071            return _renderRequest;
072        }
073    
074        public RenderResponse getRenderResponse()
075        {
076            return _renderResponse;
077        }
078    
079        public boolean isRenderRequest()
080        {
081            return _renderRequest != null;
082        }
083    
084        public PortletRequest getPortletRequest()
085        {
086            return _portletRequest;
087        }
088    }