01: /*
02: * MockHandler.java
03: *
04: * Created on 19. Januar 2003, 17:34
05: */
06:
07: package org.jzonic.jlo.handler;
08:
09: import org.jzonic.jlo.LogRecord;
10:
11: import java.util.Map;
12: import java.util.Vector;
13:
14: /**
15: *
16: * @author Administrator
17: */
18: public class MockHandler extends AbstractHandler {
19:
20: private Vector entries;
21: private Vector messages;
22:
23: public MockHandler(String configurationName) {
24: super (configurationName);
25: clear();
26: }
27:
28: public void clear() {
29: entries = new Vector();
30: messages = new Vector();
31: }
32:
33: public Vector getLogRecords() {
34: return entries;
35: }
36:
37: public Vector getMessages() {
38: return messages;
39: }
40:
41: /** This method takes a <code>LogRecord</code> and then
42: * processes the request. It is called when no <code>Formatter</code>
43: * it defined inside the <code>Generator</code>. The specific handler
44: * is responsible for formatting the message itself.
45: *
46: * @param lr The <code>LogRecord</code> that contains all informations
47: * for the logging-request
48: *
49: */
50: public void publish(LogRecord lr) {
51: entries.add(lr);
52: }
53:
54: /** This method takes a log-message as <code>String</code>
55: * and processes this message. This method is called when
56: * a <code>Formatter</code> is defined for a <code>Generator</code>.
57: *
58: * @param msg The log-message
59: *
60: */
61: public void publish(String msg) {
62: messages.add(msg);
63: }
64:
65: /** This method takes a <code>Hashtable</code> with
66: * parameters that are defined for a handler
67: *
68: * @param parameters all parameters that are defined inside the generator block
69: *
70: */
71: public void setParameter(Map parameters) {
72: }
73:
74: }
|