1 package net.logAnalyzer.handlers;
2
3 import net.logAnalyzer.analysis.LAAnalyzer;
4 import net.logAnalyzer.converters.LAConverter;
5 import net.logAnalyzer.converters.UnknownOrLiteralConverterException;
6
7 /***
8 *
9 * @author Karim REFEYTON
10 *
11 */
12 public class EmptyLogHandler implements LALogHandler {
13 /***
14 * Analyzers to apply.
15 */
16 private LAAnalyzer[] analyzers = null;
17
18 /***
19 * Converters defined in the log4j pattern.
20 */
21 private LAConverter[] converters = null;
22
23 /***
24 * Last exception thrown by the parsing or analysis processes.
25 */
26 private Exception lastException = null;
27
28 /***
29 * <tt>true</tt> if the handler is currently parsing the log.
30 */
31 private boolean parsing = false;
32
33 /***
34 * Creates a new empty log handler.
35 */
36 public EmptyLogHandler() {
37 super();
38 analyzers = new LAAnalyzer[0];
39 converters = new LAConverter[0];
40 }
41
42
43
44
45 public void addLogHandlerListener(LALogHandlerListener listener) {
46 }
47
48
49
50
51 public void fireEndParsing() {
52 }
53
54
55
56
57 public void fireStartParsing() {
58 }
59
60
61
62
63 public LAAnalyzer[] getAnalyzers() {
64 return analyzers;
65 }
66
67
68
69
70 public LAConverter getConverter(int index) {
71 return null;
72 }
73
74
75
76
77 public LAConverter getConverter(String literal)
78 throws UnknownOrLiteralConverterException {
79 return null;
80 }
81
82
83
84
85 public int getConverterIndex(String literal)
86 throws UnknownOrLiteralConverterException {
87 return 0;
88 }
89
90
91
92
93 public LAConverter[] getConverters() {
94 return converters;
95 }
96
97
98
99
100 public Exception getLastException() {
101 return lastException;
102 }
103
104
105
106
107 public int getMaxRecords() {
108 return 0;
109 }
110
111
112
113
114 public LAMessage getMessage(int index) {
115 return null;
116 }
117
118
119
120
121 public LAConverter getMessageConverter() {
122 return null;
123 }
124
125
126
127
128 public LAMessage[] getMessages(int start, int end) {
129 return new LAMessage[0];
130 }
131
132
133
134
135 public int getPercentDone() {
136 return 100;
137 }
138
139
140
141
142 public int getSize() {
143 return 0;
144 }
145
146
147
148
149 public boolean isParsing() {
150 return parsing;
151 }
152
153 /***
154 * Do nothing expected sending
155 * {@link LALogHandlerListener#startParsing(LALogHandler)} and
156 * {@link LALogHandlerListener#endParsing(LALogHandler)} events.
157 *
158 * @see net.logAnalyzer.handlers.LALogHandler#parse()
159 */
160 public void parse() throws ParsingException {
161 fireStartParsing();
162 fireEndParsing();
163 }
164
165
166
167
168 public void removeLogHandlerListener(LALogHandlerListener listener) {
169 }
170
171
172
173
174
175
176 public void setAnalyzers(LAAnalyzer[] newAnalyzers) {
177 analyzers = newAnalyzers;
178 }
179
180
181
182
183
184
185 public void setMaxRecords(int maxRecords) {
186 }
187
188
189
190
191
192
193 public void run() {
194 try {
195 parsing = true;
196 parse();
197 } catch (ParsingException e) {
198 lastException = e;
199 } finally {
200 parsing = false;
201 }
202 }
203 }