KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > chain > impl > ExceptionFilter


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 throws an Exception.</p>
26  *
27  * @author Craig R. McClanahan
28  * @version $Revision: 1.6 $ $Date: 2004/02/25 00:01:05 $
29  */

30 public class ExceptionFilter extends ExceptionCommand implements Filter {
31
32
33     // ------------------------------------------------------------- Constructor
34

35
36     public ExceptionFilter() {
37     this("", "");
38     }
39
40
41     // Construct an instance that will log the specified identifier
42
public ExceptionFilter(String JavaDoc id1, String JavaDoc id2) {
43         super(id1);
44         this.id2 = id2;
45     }
46
47
48     // -------------------------------------------------------------- Properties
49

50     protected String JavaDoc id2 = null;
51     public String JavaDoc getId2() {
52     return (this.id2);
53     }
54     public void setId2(String JavaDoc id2) {
55     this.id2 = id2;
56     }
57
58
59     // --------------------------------------------------------- Command Methods
60

61
62     // Postprocess command for this Filter
63
public boolean postprocess(Context context, Exception JavaDoc exception) {
64         log(context, id2);
65         return (false);
66     }
67
68
69 }
70
Popular Tags