KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > log4j > varia > DenyAllFilter


1 /*
2  * Copyright 1999-2005 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
17 package org.apache.log4j.varia;
18
19 import org.apache.log4j.spi.Filter;
20 import org.apache.log4j.spi.LoggingEvent;
21
22
23 /**
24    This filter drops all logging events.
25
26    <p>You can add this filter to the end of a filter chain to
27    switch from the default "accept all unless instructed otherwise"
28    filtering behaviour to a "deny all unless instructed otherwise"
29    behaviour.
30
31
32    @author Ceki G&uuml;lc&uuml;
33
34    @since 0.9.0 */

35 public class DenyAllFilter extends Filter {
36
37   /**
38      Returns <code>null</code> as there are no options.
39      
40      @deprecated We now use JavaBeans introspection to configure
41      components. Options strings are no longer needed.
42   */

43   public
44   String JavaDoc[] getOptionStrings() {
45     return null;
46   }
47
48   
49   /**
50      No options to set.
51      
52      @deprecated Use the setter method for the option directly instead
53      of the generic <code>setOption</code> method.
54   */

55   public
56   void setOption(String JavaDoc key, String JavaDoc value) {
57   }
58   
59   /**
60      Always returns the integer constant {@link Filter#DENY}
61      regardless of the {@link LoggingEvent} parameter.
62
63      @param event The LoggingEvent to filter.
64      @return Always returns {@link Filter#DENY}.
65   */

66   public
67   int decide(LoggingEvent event) {
68     return Filter.DENY;
69   }
70 }
71
72
Popular Tags