1   /*
2    * 
3    * $Revision: 1.2 $
4    * $Date: 2004/06/20 12:18:40 $
5    *
6    * ====================================================================
7    * struts-it
8    * Copyright (C) 2004 - strutsit community
9    * 
10   * Licensed under the Apache License, Version 2.0 (the "License");
11   * you may not use this file except in compliance with the License.
12   * You may obtain a copy of the License at
13   * 
14   *      http://www.apache.org/licenses/LICENSE-2.0
15   * 
16   * Unless required by applicable law or agreed to in writing, software
17   * distributed under the License is distributed on an "AS IS" BASIS,
18   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   * See the License for the specific language governing permissions and
20   * limitations under the License.
21   *
22   * created: 2004-06-05  Manfred Wolff
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 CommandForTestFalse implements Command {
39  
40      /***
41       * <p>
42       * The logger for this class (commons-logging).
43       * </p>
44       */
45      private static Log log = LogFactory.getLog(CommandForTestFalse.class);
46  
47      /***
48       * Constructor.
49       */
50      public CommandForTestFalse() {
51  
52          super();
53          if (log.isTraceEnabled()) {
54              log.trace("execute -> START");
55          }
56          if (log.isTraceEnabled()) {
57              log.trace("CommandForTestFalse -> END");
58          }
59      }
60      
61      /***
62       * Testomg a command that is returning false
63       * 
64       * @param context The context.
65       * @return true or false
66       * @throws ChainException if anything goes wrong.
67       */
68      public boolean execute(Context context) throws ChainException {
69  
70          if (log.isTraceEnabled()) {
71              log.trace("execute -> START");
72          }
73          context.put("TestCommand", "execute CommandForTestFalse           ok");
74          StringBuffer buffer = (StringBuffer) context.get("chainerg");
75          buffer.append("I am false -->");
76          if (log.isTraceEnabled()) {
77              log.trace("execute -> END");
78          }
79          return false;
80      }
81  
82  }