KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > logging > jdk14 > TestHandler


1 /*
2  * Copyright 2001-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.logging.jdk14;
17
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.Iterator JavaDoc;
21 import java.util.List JavaDoc;
22 import java.util.logging.Handler JavaDoc;
23 import java.util.logging.LogRecord JavaDoc;
24
25
26 /**
27  * <p>Test implementation of <code>java.util.logging.Handler</code>.</p>
28  *
29  * @author Craig R. McClanahan
30  * @version $Revision: 1.4 $ $Date: 2004/02/28 21:46:45 $
31  */

32
33 public class TestHandler extends Handler JavaDoc {
34
35
36
37     // ----------------------------------------------------- Instance Variables
38

39
40     // The set of logged records for this handler
41
private List JavaDoc records = new ArrayList JavaDoc();
42
43
44     // --------------------------------------------------------- Public Methods
45

46
47     public Iterator JavaDoc records() {
48         return (records.iterator());
49     }
50
51
52     // -------------------------------------------------------- Handler Methods
53

54
55     public void close() {
56     }
57
58
59     public void flush() {
60         records.clear();
61     }
62
63
64     public void publish(LogRecord JavaDoc record) {
65         records.add(record);
66     }
67
68
69 }
70
Popular Tags