1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.strutsit.chain;
25
26 import org.apache.commons.chain.Command;
27 import org.apache.commons.chain.Context;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30
31 /***
32 * Testcommand for executing a simple command.
33 *
34 * @author <a href="mailto:wolff@struts-it.de">Manfred Wolff</a>
35 * @since JDK 1.4
36 * @version $Revision: 1.2 $
37 */
38 public class CommandForTestTrue implements Command {
39
40 /***
41 * <p>
42 * The logger for this class (commons-logging).
43 * </p>
44 */
45 private static Log log = LogFactory.getLog(CommandForTestTrue.class);
46
47 /***
48 * Constructor.
49 */
50 public CommandForTestTrue() {
51 super();
52 if (log.isTraceEnabled()) {
53 log.trace("CommandForTestTrue -> START");
54 }
55 if (log.isTraceEnabled()) {
56 log.trace("execute -> END");
57 }
58 }
59
60 /***
61 * Testomg a command that is returning true
62 *
63 * @param context The context.
64 * @return true or false
65 * @throws ChainException if anything goes wrong.
66 */
67 public boolean execute(Context context) throws ChainException {
68
69 if (log.isTraceEnabled()) {
70 log.trace("execute -> START");
71 }
72 context.put("TestCommand", "execute CommandForTestTrue ok");
73 StringBuffer buffer = (StringBuffer) context.get("chainerg");
74 buffer.append("I am true -->");
75
76 if (log.isTraceEnabled()) {
77 log.trace("execute -> END");
78 }
79 return true;
80 }
81
82 }