001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     * 
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */ 
017    package org.apache.commons.logging.jdk14;
018    
019    
020    import java.util.ArrayList;
021    import java.util.Iterator;
022    import java.util.List;
023    import java.util.logging.Handler;
024    import java.util.logging.LogRecord;
025    
026    
027    /**
028     * <p>Test implementation of <code>java.util.logging.Handler</code>.</p>
029     *
030     * @author Craig R. McClanahan
031     * @version $Revision: 424108 $ $Date: 2006-07-21 01:19:55 +0200 (fr, 21 jul 2006) $
032     */
033    
034    public class TestHandler extends Handler {
035    
036    
037    
038        // ----------------------------------------------------- Instance Variables
039    
040    
041        // The set of logged records for this handler
042        private List records = new ArrayList();
043    
044    
045        // --------------------------------------------------------- Public Methods
046    
047    
048        public Iterator records() {
049            return (records.iterator());
050        }
051    
052    
053        // -------------------------------------------------------- Handler Methods
054    
055    
056        public void close() {
057        }
058    
059    
060        public void flush() {
061            records.clear();
062        }
063    
064    
065        public void publish(LogRecord record) {
066            records.add(record);
067        }
068    
069    
070    }