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 * This {@link Command.} is for testing the chain-conf framework. The {@link Command} always
33 * return true. It depends to a {@link CommandForTestFalse} object.
34 *
35 * @author <a href="mailto:wolff@struts-it.de">Manfred Wolff</a>
36 * @since JDK 1.4
37 * @version $Revision: 1.3 $
38 */
39 public class CommandForTestTrueDepend extends DependCommand {
40
41 /***
42 * <p>
43 * The logger for this class (commons-logging).
44 * </p>
45 */
46 private static Log log = LogFactory.getLog(CommandForTestTrueDepend.class);
47
48 /***
49 * Constructor.
50 */
51 public CommandForTestTrueDepend() {
52
53 super();
54 if (log.isTraceEnabled()) {
55 log.trace("CommandForTestTrue -> START");
56 }
57 if (log.isTraceEnabled()) {
58 log.trace("execute -> END");
59 }
60 }
61
62 /***
63 * Testigg a command that is returning true
64 *
65 * @param context The context.
66 * @return true or false.
67 * @throws ChainException if anything goes wrong.
68 */
69 public boolean execute(Context context) throws ChainException {
70
71
72 if (log.isTraceEnabled()) {
73 log.trace("execute -> START");
74 }
75 context.put("TestCommand", "execute CommandForTestTrue ok");
76 StringBuffer buffer = (StringBuffer) context.get("chainerg");
77 buffer.append("I am true -->");
78
79 if (log.isTraceEnabled()) {
80 log.trace("execute -> END");
81 }
82 return true;
83 }
84
85 /*** Registers the CommandForTestFalse as dependency
86 * @see org.strutsit.chain.DependCommand#doRegister()
87 */
88 public void doRegister() {
89 this.registerClassName("org.strutsit.chain.CommandForTestFalse");
90 }
91
92
93
94 }