1 package org.apache.pluto.driver.container;
2
3 import javax.portlet.PortalContext;
4
5 import org.apache.pluto.container.CCPPProfileService;
6 import org.apache.pluto.container.EventCoordinationService;
7 import org.apache.pluto.container.FilterManagerService;
8 import org.apache.pluto.container.NamespaceMapper;
9 import org.apache.pluto.container.PortletEnvironmentService;
10 import org.apache.pluto.container.PortletInvokerService;
11 import org.apache.pluto.container.PortletPreferencesService;
12 import org.apache.pluto.container.PortletRequestContextService;
13 import org.apache.pluto.container.PortletURLListenerService;
14 import org.apache.pluto.container.RequestDispatcherService;
15 import org.apache.pluto.container.UserInfoService;
16 import org.apache.pluto.container.driver.OptionalContainerServices;
17 import org.apache.pluto.container.driver.PortalAdministrationService;
18 import org.apache.pluto.container.driver.PortalDriverServices;
19 import org.apache.pluto.container.driver.PortletContextService;
20 import org.apache.pluto.container.driver.PortletRegistryService;
21 import org.apache.pluto.container.driver.RequiredContainerServices;
22 import org.apache.pluto.container.impl.PortletEnvironmentServiceImpl;
23 import org.apache.pluto.container.impl.RequestDispatcherServiceImpl;
24 import org.apache.pluto.container.impl.PortletAppDescriptorServiceImpl;
25
26
27 public class PortalDriverServicesImpl implements RequiredContainerServices, OptionalContainerServices, PortalDriverServices
28 {
29
30
31
32 private PortalContext context;
33 private EventCoordinationService eventCoordinationService;
34 private PortletRequestContextService portletRequestContextService;
35 private CCPPProfileService ccppProfileService;
36 private FilterManagerService filterManagerService;
37 private PortletURLListenerService portletURLListenerService;
38
39
40
41
42 private PortletPreferencesService portletPreferencesService;
43 private PortletInvokerService portletInvokerService;
44 private PortletEnvironmentService portletEnvironmentService;
45 private UserInfoService userInfoService;
46 private NamespaceMapper namespaceMapper;
47 private RequestDispatcherService rdService;
48
49
50
51
52 private PortletContextService portletContextService;
53 private PortletRegistryService portletRegistryService;
54 private PortalAdministrationService portalAdministrationService;
55
56
57
58
59
60
61
62
63
64 public PortalDriverServicesImpl(PortalContext context,
65 PortletRequestContextService portletRequestContextService,
66 EventCoordinationService eventCoordinationService,
67 FilterManagerService filterManagerService,
68 PortletURLListenerService portletURLListenerService)
69 {
70 this(context, portletRequestContextService, eventCoordinationService,
71 filterManagerService, portletURLListenerService, null);
72 }
73
74
75
76
77
78
79
80
81
82
83 public PortalDriverServicesImpl(PortalContext context,
84 PortletRequestContextService portletRequestContextService,
85 EventCoordinationService eventCoordinationService,
86 FilterManagerService filterManagerService,
87 PortletURLListenerService portletURLListenerService,
88 OptionalContainerServices optionalServices)
89 {
90 this(context, portletRequestContextService, eventCoordinationService,
91 filterManagerService, portletURLListenerService, optionalServices, null, null, null);
92 }
93
94
95
96
97
98
99
100
101
102
103 public PortalDriverServicesImpl(PortalContext context,
104 PortletRequestContextService portletRequestContextService,
105 EventCoordinationService eventCoordinationService,
106 FilterManagerService filterManagerService,
107 PortletURLListenerService portletURLListenerService,
108 OptionalContainerServices optionalServices,
109 PortletContextService portletContextService,
110 PortletRegistryService portletRegistryService,
111 PortalAdministrationService portalAdministrationService)
112 {
113
114 this.context = context;
115 this.eventCoordinationService = eventCoordinationService;
116 this.portletRequestContextService = portletRequestContextService;
117 this.filterManagerService = filterManagerService;
118 this.portletURLListenerService = portletURLListenerService;
119
120
121 if ( optionalServices != null ) {
122 ccppProfileService = optionalServices.getCCPPProfileService();
123 portletPreferencesService = optionalServices.getPortletPreferencesService();
124 portletInvokerService = optionalServices.getPortletInvokerService();
125 portletEnvironmentService = optionalServices.getPortletEnvironmentService();
126 userInfoService = optionalServices.getUserInfoService();
127 namespaceMapper = optionalServices.getNamespaceMapper();
128 rdService = optionalServices.getRequestDispatcherService();
129 }
130
131
132 this.portletContextService = portletContextService;
133 this.portletRegistryService = portletRegistryService;
134 this.portalAdministrationService = portalAdministrationService;
135
136 createDefaultServicesIfNeeded();
137 }
138
139
140
141
142
143
144 public PortalDriverServicesImpl(RequiredContainerServices required, OptionalContainerServices optional) {
145 this(required.getPortalContext(), required.getPortletRequestContextService(),
146 required.getEventCoordinationService(), required.getFilterManagerService(),
147 required.getPortletURLListenerService(), optional);
148 }
149
150
151
152
153
154
155 public PortalDriverServicesImpl(RequiredContainerServices required, OptionalContainerServices optional,PortletContextService portletContextService ) {
156 this(required.getPortalContext(), required.getPortletRequestContextService(),
157 required.getEventCoordinationService(), required.getFilterManagerService(),
158 required.getPortletURLListenerService(), optional);
159 this.portletContextService = portletContextService;
160 }
161
162 protected void createDefaultServicesIfNeeded()
163 {
164 rdService = rdService == null ? new RequestDispatcherServiceImpl() : rdService;
165 portletRegistryService = portletRegistryService == null ? new PortletContextManager(rdService, new PortletAppDescriptorServiceImpl()) : portletRegistryService;
166 portletContextService = portletContextService == null ? (PortletContextManager)portletRegistryService : portletContextService;
167 portalAdministrationService = portalAdministrationService == null ? new DefaultPortalAdministrationService() : portalAdministrationService;
168 ccppProfileService = ccppProfileService == null ? new DummyCCPPProfileServiceImpl() : ccppProfileService;
169 portletPreferencesService = portletPreferencesService == null ? new DefaultPortletPreferencesService() : portletPreferencesService;
170 portletInvokerService = portletInvokerService == null ? new DefaultPortletInvokerService(portletContextService) : portletInvokerService;
171 portletEnvironmentService = portletEnvironmentService == null ? new PortletEnvironmentServiceImpl() : portletEnvironmentService;
172 userInfoService = userInfoService == null ? new DefaultUserInfoService() : userInfoService;
173 namespaceMapper = namespaceMapper == null ? new DefaultNamespaceMapper() : namespaceMapper;
174 }
175
176
177
178
179 public PortalContext getPortalContext()
180 {
181 return context;
182 }
183
184
185
186
187
188
189 public PortletPreferencesService getPortletPreferencesService()
190 {
191 return this.portletPreferencesService;
192 }
193
194
195
196
197 public PortletRegistryService getPortletRegistryService()
198 {
199 return this.portletRegistryService;
200 }
201
202 public PortletContextService getPortletContextService()
203 {
204 return this.portletContextService;
205 }
206
207 public void setPortletContextService(PortletContextService portletContextService)
208 {
209 this.portletContextService = portletContextService;
210 portletInvokerService = new DefaultPortletInvokerService(portletContextService);
211 }
212
213 public PortletRequestContextService getPortletRequestContextService()
214 {
215 return this.portletRequestContextService;
216 }
217
218 public PortletEnvironmentService getPortletEnvironmentService()
219 {
220 return this.portletEnvironmentService;
221 }
222
223 public PortletInvokerService getPortletInvokerService()
224 {
225 return this.portletInvokerService;
226 }
227
228 public CCPPProfileService getCCPPProfileService()
229 {
230 return ccppProfileService;
231 }
232
233 public PortalAdministrationService getPortalAdministrationService()
234 {
235 return this.portalAdministrationService;
236 }
237
238 public UserInfoService getUserInfoService()
239 {
240 return this.userInfoService;
241 }
242
243 public NamespaceMapper getNamespaceMapper()
244 {
245 return this.namespaceMapper;
246 }
247
248 public CCPPProfileService getCcppProfileService()
249 {
250 return ccppProfileService;
251 }
252
253 public EventCoordinationService getEventCoordinationService()
254 {
255 return eventCoordinationService;
256 }
257
258 public FilterManagerService getFilterManagerService()
259 {
260 return filterManagerService;
261 }
262
263 public PortletURLListenerService getPortletURLListenerService()
264 {
265 return portletURLListenerService;
266 }
267
268 public RequestDispatcherService getRequestDispatcherService()
269 {
270 return rdService;
271 }
272
273
274 }