KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > http > util > accesslog > LogParser


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogParser.java,v 1.5 2004/02/13 03:46:14 sebb Exp $
2
/*
3  * Copyright 2003-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.protocol.http.util.accesslog;
20
21 /**
22  * Description:<br>
23  * <br>
24  * LogParser is the base interface for classes
25  * implementing concrete parse logic. For an
26  * example of how to use the interface, look
27  * at the Tomcat access log parser.<p>
28  * The original log parser was written in 2
29  * hours to parse access logs. Since then,
30  * the design and implementation has been
31  * rewritten from scratch several times to
32  * make it more generic and extensible. The
33  * first version was hard coded and written
34  * over the weekend.<p>
35  * @author Peter Lin<br>
36  * @version $Revision: 1.5 $ last updated $Date: 2004/02/13 03:46:14 $
37  * Created on: Jun 23, 2003<br>
38  */

39
40 public interface LogParser {
41
42     /**
43      * close the any streams or readers.
44      */

45     public void close();
46     
47     /**
48      * Concrete parsers need to have a generator
49      * to recieve the parsed result.
50      * @param generator
51      */

52     public void setGenerator(Generator generator);
53     
54     /**
55      * the method will parse the given number of
56      * lines. Pass "-1" to parse the entire file.
57      * @param count
58      * @return int
59      */

60     public int parse(int count);
61     
62     /**
63      * We allow for filters, so that users can
64      * simply point to an Access log without
65      * having to clean it up. This makes it
66      * significantly easier and reduces the
67      * amount of work. Plus I'm lazy, so going
68      * through a log file to clean it up is a
69      * bit tedious. One example of this is
70      * using the filter to exclude any log
71      * entry that has a 505 response code.
72      * @param filter
73      */

74     public void setFilter(Filter filter);
75     
76     /**
77      * The method is provided to make it easy to
78      * dynamically create new classes using
79      * Class.newInstance(). Then the access log
80      * file is set using this method.
81      * @param source
82      */

83     public void setSourceFile(String JavaDoc source);
84 }
85
Popular Tags