1   /*
2    * Copyright 1999-2004 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.chain.impl;
17  
18  
19  import org.apache.commons.chain.Context;
20  import org.apache.commons.chain.Filter;
21  
22  
23  /***
24   * <p>Implementation of {@link Filter} that logs its identifier and
25   * and returns <code>true</code>.</p>
26   *
27   * @author Craig R. McClanahan
28   * @version $Revision: 1.6 $ $Date: 2004/02/25 00:01:05 $
29   */
30  
31  public class NonDelegatingFilter extends NonDelegatingCommand
32      implements Filter {
33  
34  
35      // ------------------------------------------------------------- Constructor
36  
37  
38      public NonDelegatingFilter() {
39      this("", "");
40      }
41  
42  
43      // Construct an instance that will log the specified identifier
44      public NonDelegatingFilter(String id1, String id2) {
45          super(id1);
46          this.id2 = id2;
47      }
48  
49  
50      // -------------------------------------------------------------- Properties
51  
52  
53      protected String id2 = null;
54      public String getId2() {
55      return (this.id2);
56      }
57      public void setId2(String id2) {
58      this.id2 = id2;
59      }
60  
61  
62      // --------------------------------------------------------- Command Methods
63  
64  
65      // Execution method for this Command
66      public boolean execute(Context context) throws Exception {
67  
68          super.execute(context);
69          return (true);
70  
71      }
72  
73  
74      // Postprocess method for this Filter
75      public boolean postprocess(Context context, Exception exception) {
76          log(context, id2);
77          return (false);
78      }
79  
80  
81  }