01: /*
02: * Copyright 1999-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import org.apache.commons.chain.Context;
19: import org.apache.commons.chain.Filter;
20:
21: /**
22: * <p>Implementation of {@link Filter} that logs its identifier and
23: * and returns <code>true</code>.</p>
24: *
25: * @author Craig R. McClanahan
26: * @version $Revision: 155403 $ $Date: 2005-02-26 12:52:46 +0000 (Sat, 26 Feb 2005) $
27: */
28:
29: public class NonDelegatingFilter extends NonDelegatingCommand implements
30: Filter {
31:
32: // ------------------------------------------------------------- Constructor
33:
34: public NonDelegatingFilter() {
35: this ("", "");
36: }
37:
38: // Construct an instance that will log the specified identifier
39: public NonDelegatingFilter(String id1, String id2) {
40: super (id1);
41: this .id2 = id2;
42: }
43:
44: // -------------------------------------------------------------- Properties
45:
46: protected String id2 = null;
47:
48: public String getId2() {
49: return (this .id2);
50: }
51:
52: public void setId2(String id2) {
53: this .id2 = id2;
54: }
55:
56: // --------------------------------------------------------- Command Methods
57:
58: // Execution method for this Command
59: public boolean execute(Context context) throws Exception {
60:
61: super .execute(context);
62: return (true);
63:
64: }
65:
66: // Postprocess method for this Filter
67: public boolean postprocess(Context context, Exception exception) {
68: log(context, id2);
69: return (false);
70: }
71:
72: }
|