KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > factory > PortletObjectAccess


1 /*
2  * Copyright 2003,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17
18  */

19
20 package org.apache.pluto.factory;
21
22 import javax.portlet.ActionRequest;
23 import javax.portlet.ActionResponse;
24 import javax.portlet.PortalContext;
25 import javax.portlet.PortletConfig;
26 import javax.portlet.PortletContext;
27 import javax.portlet.PortletPreferences;
28 import javax.portlet.PortletSession;
29 import javax.portlet.PortletURL;
30 import javax.portlet.RenderRequest;
31 import javax.portlet.RenderResponse;
32
33 import org.apache.pluto.om.entity.PortletEntity;
34 import org.apache.pluto.om.portlet.PortletApplicationDefinition;
35 import org.apache.pluto.om.portlet.PortletDefinition;
36 import org.apache.pluto.om.window.PortletWindow;
37 import org.apache.pluto.services.factory.FactoryManager;
38
39 public class PortletObjectAccess {
40
41     public static RenderRequest getRenderRequest(PortletWindow portletWindow,
42                                                  javax.servlet.http.HttpServletRequest JavaDoc servletRequest,
43                                                  javax.servlet.http.HttpServletResponse JavaDoc servletResponse)
44     {
45         return getRequestFactory().getRenderRequest(portletWindow,
46                                                     servletRequest,
47                                                     servletResponse);
48     }
49
50     public static RenderResponse getRenderResponse(PortletWindow portletWindow,
51                                                    javax.servlet.http.HttpServletRequest JavaDoc servletRequest,
52                                                    javax.servlet.http.HttpServletResponse JavaDoc servletResponse)
53     {
54         return getResponseFactory().getRenderResponse(portletWindow,
55                                                       servletRequest,
56                                                       servletResponse);
57     }
58
59     public static PortletSession getPortletSession(PortletWindow portletWindow,
60                                                    javax.servlet.http.HttpSession JavaDoc httpSession)
61     {
62         return getSessionFactory().getPortletSession(portletWindow,
63                                                      httpSession);
64     }
65
66     public static PortletConfig getPortletConfig(javax.servlet.ServletConfig JavaDoc servletConfig,
67                                                  PortletContext portletContext,
68                                                  PortletDefinition portletDefinition)
69     {
70         return getConfigFactory().getPortletConfig(servletConfig,
71                                                    portletContext,
72                                                    portletDefinition);
73     }
74
75     public static PortletContext getPortletContext(javax.servlet.ServletContext JavaDoc servletContext,
76                                                    PortletApplicationDefinition portletApplicationDefinition)
77     {
78         return getContextFactory().getPortletContext(servletContext,
79                                                      portletApplicationDefinition);
80     }
81
82     public static ActionRequest getActionRequest(PortletWindow portletWindow,
83                                                  javax.servlet.http.HttpServletRequest JavaDoc servletRequest,
84                                                  javax.servlet.http.HttpServletResponse JavaDoc servletResponse)
85     {
86         return getActionRequestFactory().getActionRequest(portletWindow,
87                                                           servletRequest,
88                                                           servletResponse);
89     }
90
91     public static ActionResponse getActionResponse(PortletWindow portletWindow,
92                                                    javax.servlet.http.HttpServletRequest JavaDoc servletRequest,
93                                                    javax.servlet.http.HttpServletResponse JavaDoc servletResponse)
94     {
95         return getActionResponseFactory().getActionResponse(portletWindow,
96                                                             servletRequest,
97                                                             servletResponse);
98     }
99
100     public static PortletURL getPortletURL(PortletWindow portletWindow,
101                                            javax.servlet.http.HttpServletRequest JavaDoc servletRequest,
102                                            javax.servlet.http.HttpServletResponse JavaDoc servletResponse)
103     {
104         return getPortletURL(portletWindow, servletRequest, servletResponse, false);
105     }
106
107     public static PortletURL getPortletURL(PortletWindow portletWindow,
108                                            javax.servlet.http.HttpServletRequest JavaDoc servletRequest,
109                                            javax.servlet.http.HttpServletResponse JavaDoc servletResponse,
110                                            boolean isAction)
111     {
112         return getPortletURLFactory().getPortletURL(portletWindow,
113                                                     servletRequest,
114                                                     servletResponse,
115                                                     isAction);
116     }
117
118     public static PortalContext getPortalContext()
119     {
120         return getPortalContextFactory().getPortalContext();
121     }
122
123     public static PortletPreferences getPortletPreferences(Integer JavaDoc methodId, PortletEntity portletEntity)
124     {
125         return getPortletPreferencesFactory().getPortletPreferences(methodId, portletEntity);
126     }
127
128     public static PortletPreferences getPortletPreferences(Integer JavaDoc methodId, PortletDefinition portletDefinition)
129     {
130         return getPortletPreferencesFactory().getPortletPreferences(methodId, portletDefinition);
131     }
132
133     private static RenderRequestFactory getRequestFactory()
134     {
135         return (RenderRequestFactory)FactoryManager.getFactory(javax.portlet.RenderRequest.class);
136     }
137
138     private static RenderResponseFactory getResponseFactory()
139     {
140         return (RenderResponseFactory)FactoryManager.getFactory(javax.portlet.RenderResponse.class);
141     }
142
143     private static PortletSessionFactory getSessionFactory()
144     {
145         return (PortletSessionFactory)FactoryManager.getFactory(javax.portlet.PortletSession.class);
146     }
147
148     private static PortletConfigFactory getConfigFactory()
149     {
150         return (PortletConfigFactory)FactoryManager.getFactory(javax.portlet.PortletConfig.class);
151     }
152
153     private static PortletContextFactory getContextFactory()
154     {
155         return (PortletContextFactory)FactoryManager.getFactory(javax.portlet.PortletContext.class);
156     }
157
158     private static ActionRequestFactory getActionRequestFactory()
159     {
160         return (ActionRequestFactory)FactoryManager.getFactory(javax.portlet.ActionRequest.class);
161     }
162
163     private static ActionResponseFactory getActionResponseFactory()
164     {
165         return (ActionResponseFactory)FactoryManager.getFactory(javax.portlet.ActionResponse.class);
166     }
167
168     private static PortletURLFactory getPortletURLFactory()
169     {
170         return (PortletURLFactory)FactoryManager.getFactory(javax.portlet.PortletURL.class);
171     }
172
173     private static PortalContextFactory getPortalContextFactory()
174     {
175         return (PortalContextFactory)FactoryManager.getFactory(javax.portlet.PortalContext.class);
176     }
177
178     private static PortletPreferencesFactory getPortletPreferencesFactory()
179     {
180         return (PortletPreferencesFactory)FactoryManager.getFactory(javax.portlet.PortletPreferences.class);
181     }
182 }
183
Popular Tags