KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > container > struts > PicoRequestProcessor


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: PicoRequestProcessor.java,v $
31  * Revision 1.4 2005/04/22 09:35:23 colinmacleod
32  * Added setup action interface so that
33  * the hibernate action can reset/delete all
34  * actions when the container is reloaded.
35  *
36  * Revision 1.3 2005/04/10 20:09:46 colinmacleod
37  * Added new themes.
38  * Changed id type to String.
39  * Changed i tag to em and b tag to strong.
40  * Improved PicoContainerFactory with NanoContainer scripts.
41  *
42  * Revision 1.2 2005/04/09 17:19:50 colinmacleod
43  * Changed copyright text to GPL v2 explicitly.
44  *
45  * Revision 1.1.1.1 2005/03/10 17:49:54 colinmacleod
46  * Restructured ivata op around Hibernate/PicoContainer.
47  * Renamed ivata groupware.
48  *
49  * Revision 1.2 2004/12/31 18:51:27 colinmacleod
50  * Added ivata masks form initialization.
51  *
52  * Revision 1.1 2004/12/29 14:09:32 colinmacleod
53  * Changed subproject name from masks to mask
54  *
55  * Revision 1.3 2004/12/23 21:01:29 colinmacleod
56  * Updated Struts to v1.2.4.
57  * Changed base classes to use ivata masks.
58  *
59  * Revision 1.2 2004/11/12 15:46:37 colinmacleod
60  * Moved from security subproject to masks.
61  *
62  * Revision 1.1 2004/09/30 15:16:00 colinmacleod
63  * Split off addressbook elements into security subproject.
64  *
65  * Revision 1.1 2004/07/13 19:41:15 colinmacleod
66  * Moved project to POJOs from EJBs.
67  * Applied PicoContainer to services layer (replacing session EJBs).
68  * Applied Hibernate to persistence layer (replacing entity EJBs).
69  * -----------------------------------------------------------------------------
70  * -----------------------------------------------------------------------------
71  */

72 package com.ivata.groupware.container.struts;
73
74 import java.io.IOException JavaDoc;
75
76 import javax.servlet.http.HttpServletRequest JavaDoc;
77 import javax.servlet.http.HttpServletResponse JavaDoc;
78
79 import org.apache.struts.action.Action;
80 import org.apache.struts.action.ActionMapping;
81
82 import com.ivata.groupware.container.PicoContainerFactory;
83 import com.ivata.groupware.struts.SetupAction;
84 import com.ivata.mask.util.SystemException;
85 import com.ivata.mask.web.struts.MaskRequestProcessor;
86
87 /**
88  * <p>
89  * This Struts request processor extends the standard class to instantiate
90  * actions and action forms in a <strong>PicoContainer</strong> friendly way.
91  * </p>
92  *
93  * @author Colin MacLeod
94  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
95  * @since Apr 14, 2004
96  * @version $Revision: 1.4 $
97  */

98 public class PicoRequestProcessor extends MaskRequestProcessor {
99     public PicoRequestProcessor() throws SystemException {
100         super(PicoContainerFactory.getInstance().getMaskFactory(),
101                 PicoRequestProcessorImplementation.getPersistenceManager());
102         setImplementation(PicoRequestProcessorImplementation
103                 .getRequestProcessorImplementation());
104     }
105     /**
106      * <p>
107      * Overridden to watch out for the setup action and pass the actions to it
108      * so they can be cleared when the setup is finished.
109      * </p>
110      * <p>
111      * (This is drastic but I could not see another way to reset the actions in
112      * <strong>Struts</strong>.)
113      * </p>
114      *
115      * @param request The servlet request we are processing
116      * @param response The servlet response we are creating
117      * @param mapping The mapping we are using
118      *
119      * @exception IOException if an input/output error occurs
120      */

121     protected Action processActionCreate(final HttpServletRequest JavaDoc request,
122             final HttpServletResponse JavaDoc response,
123             final ActionMapping mapping) throws IOException JavaDoc {
124         Action action = super.processActionCreate(request,
125                 response,
126                 mapping);
127         if (action instanceof SetupAction) {
128             SetupAction setupAction = (SetupAction) action;
129             setupAction.setActions(actions);
130         }
131         return action;
132     }
133 }
134
Popular Tags