01: /*
02: * Coefficient - facilitates project based collaboration
03: * Copyright (C) 2003, Dylan Etkin, CSIR icomtek
04: * PO Box 395
05: * Pretoria 0001, RSA
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19:
20: package za.org.coefficient.modules.error;
21:
22: import za.org.coefficient.interfaces.CoefficientContext;
23: import za.org.coefficient.modules.BaseModule;
24: import za.org.coefficient.util.ejb.VelocityScreenUtil;
25:
26: import java.util.HashMap;
27:
28: /**
29: * @pojo2ejb.class
30: * name="Error"
31: * jndi-prefix="za/org/coefficient/orphan/"
32: * interface-extends="za.org.coefficient.interfaces.Module"
33: * interface-local-extends="za.org.coefficient.interfaces.ModuleLocal"
34: *
35: * @web.resource-env-ref
36: * name="za/org/coefficient/default/Error"
37: * type="za.org.coefficient.modules.error.Error"
38: * @web.resource-env-ref
39: * name="Error"
40: * type="za.org.coefficient.modules.error.Error"
41: */
42: public class Error extends BaseModule {
43: //~ Methods ================================================================
44:
45: public String getMainMethod() {
46: return "view";
47: }
48:
49: public String getModuleDescription() {
50: return "Module that is used to display simple error messages from a forward.";
51: }
52:
53: public String getModuleDisplayName() {
54: return "Error";
55: }
56:
57: public CoefficientContext view(CoefficientContext ctx)
58: throws Exception {
59: HashMap map = new HashMap();
60: String errorMsg = ctx.getParameter("errorMsg");
61: map.put("errorMsg", errorMsg);
62: StringBuffer sb = VelocityScreenUtil.getProcessedScreen(
63: "error.vm", map);
64:
65: // Set the html into the context
66: ctx.setModuleContent(sb.toString(), getModuleDisplayName());
67: return ctx;
68: }
69: }
|