1   /*
2    * 
3    * $Revision: 1.3 $
4    * $Date: 2004/07/09 18:02:29 $
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   * 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  }