01: /*
02: * (C) Copyright 2004 Nabh Information Systems, Inc.
03: *
04: * All copyright notices regarding Nabh's products MUST remain
05: * intact in the scripts and in the outputted HTML.
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: */
21: package com.nabhinc.portlet.mvcportlet.core;
22:
23: import java.io.IOException;
24:
25: import javax.portlet.ActionRequest;
26: import javax.portlet.ActionResponse;
27: import javax.portlet.PortletException;
28:
29: /**
30: * <p>An <strong>ActionProcessor</strong> is a handler that implements business logic
31: * for a specific action type. In each "processAction" invocation, ControllerPortlet
32: * will select associated ActionProcessor object and will invoke <code>process</code>
33: * on it.</p>
34: *
35: * <p>ActionProcessors must be programmed in a thread-safe manner, because the
36: * controller will share the same instance for multiple simultaneous
37: * requests. This means you should design with the following items in mind:
38: * </p>
39: * <ul>
40: * <li>Instance and static variables MUST NOT be used to store information
41: * related to the state of a particular request. They MAY be used to
42: * share global resources across requests for the same action.</li>
43: * <li>Access to other resources (JavaBeans, session variables, etc.) MUST
44: * be synchronized if those resources require protection. If needed action
45: * processors can store session data under portlet scope.</li>
46: * </ul>
47: *
48: * <p>When an <code>ActionProcessor</code> instance is first created, the controller
49: * portlet calls <code>init</code> method with an XML element defining initialization
50: * parameters for the ActionProcessor.
51: * When the controller portlet is to destroyed, it calls <code>destroy</code> method
52: * on all registered ActionProcessors. This method can be used to clean up all resources
53: * used by the ActionProcessor.</p>
54: *
55: * @author Padmanabh Dabke
56: * © 2004 Nabh Information Systems, Inc. All Rights Reserved.
57: */
58:
59: public interface ActionProcessor extends RequestProcessor {
60:
61: /**
62: * The main method that defines the business logic for an action type.
63: * @param request ActionRequest
64: * @param response ActionResponse
65: * @param actionConfig Configuration for the action type that invoked this method.
66: * @return A result string that indicates the type of follow up action.
67: * @throws PortletException
68: * @throws IOException
69: */
70: String process(ActionRequest request, ActionResponse response,
71: ActionConfig actionConfig) throws PortletException,
72: IOException;
73: }
|