01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.pluto.factory;
18:
19: import javax.portlet.ActionRequest;
20: import javax.servlet.http.HttpServletRequest;
21: import javax.servlet.http.HttpServletResponse;
22:
23: import org.apache.avalon.framework.activity.Disposable;
24: import org.apache.avalon.framework.service.ServiceException;
25: import org.apache.avalon.framework.service.ServiceManager;
26: import org.apache.avalon.framework.service.Serviceable;
27: import org.apache.cocoon.portal.PortalService;
28: import org.apache.pluto.factory.ActionRequestFactory;
29: import org.apache.pluto.om.window.PortletWindow;
30:
31: /**
32: * Implementation for the render request factory.
33: *
34: * @version $Id: ActionRequestFactoryImpl.java 433543 2006-08-22 06:22:54Z crossley $
35: */
36: public class ActionRequestFactoryImpl extends AbstractFactory implements
37: ActionRequestFactory, Serviceable, Disposable {
38:
39: /** The service manager. */
40: protected ServiceManager manager;
41:
42: /** The portal service. */
43: protected PortalService portalService;
44:
45: /**
46: * @see org.apache.avalon.framework.activity.Disposable#dispose()
47: */
48: public void dispose() {
49: if (this .manager != null) {
50: this .manager.release(this .portalService);
51: this .portalService = null;
52: this .manager = null;
53: }
54: }
55:
56: /**
57: * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
58: */
59: public void service(ServiceManager manager) throws ServiceException {
60: this .manager = manager;
61: this .portalService = (PortalService) this .manager
62: .lookup(PortalService.ROLE);
63: }
64:
65: /**
66: * @see org.apache.pluto.factory.ActionRequestFactory#getActionRequest(org.apache.pluto.om.window.PortletWindow, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
67: */
68: public ActionRequest getActionRequest(PortletWindow portletWindow,
69: HttpServletRequest servletRequest,
70: HttpServletResponse servletResponse) {
71: ActionRequest actionRequest = new ActionRequestImpl(
72: portletWindow, servletRequest, this.portalService
73: .getComponentManager().getProfileManager()
74: .getUser());
75: return actionRequest;
76: }
77: }
|