KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jzonic > jlo > handler > MockHandler


1 /*
2  * MockHandler.java
3  *
4  * Created on 19. Januar 2003, 17:34
5  */

6
7 package org.jzonic.jlo.handler;
8
9 import org.jzonic.jlo.LogRecord;
10
11 import java.util.Map JavaDoc;
12 import java.util.Vector JavaDoc;
13 /**
14  *
15  * @author Administrator
16  */

17 public class MockHandler extends AbstractHandler {
18     
19     private Vector JavaDoc entries;
20     private Vector JavaDoc messages;
21     
22     public MockHandler(String JavaDoc configurationName) {
23         super(configurationName);
24         clear();
25     }
26     
27     public void clear() {
28         entries = new Vector JavaDoc();
29         messages = new Vector JavaDoc();
30     }
31         
32     public Vector JavaDoc getLogRecords() {
33         return entries;
34     }
35     
36     public Vector JavaDoc getMessages() {
37         return messages;
38     }
39     /** This method takes a <code>LogRecord</code> and then
40      * processes the request. It is called when no <code>Formatter</code>
41      * it defined inside the <code>Generator</code>. The specific handler
42      * is responsible for formatting the message itself.
43      *
44      * @param lr The <code>LogRecord</code> that contains all informations
45      * for the logging-request
46      *
47      */

48     public void publish(LogRecord lr) {
49         entries.add(lr);
50     }
51     
52     /** This method takes a log-message as <code>String</code>
53      * and processes this message. This method is called when
54      * a <code>Formatter</code> is defined for a <code>Generator</code>.
55      *
56      * @param msg The log-message
57      *
58      */

59     public void publish(String JavaDoc msg) {
60         messages.add(msg);
61     }
62     
63     /** This method takes a <code>Hashtable</code> with
64      * parameters that are defined for a handler
65      *
66      * @param parameters all parameters that are defined inside the generator block
67      *
68      */

69     public void setParameter(Map JavaDoc parameters) {
70     }
71     
72 }
73
Popular Tags