01: /*
02: * Jacareto Copyright (c) 2002-2005
03: * Applied Computer Science Research Group, Darmstadt University of
04: * Technology, Institute of Mathematics & Computer Science,
05: * Ludwigsburg University of Education, and Computer Based
06: * Learning Research Group, Aachen University. All rights reserved.
07: *
08: * Jacareto is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * Jacareto is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public
19: * License along with Jacareto; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: *
22: */
23:
24: package jacareto.catching;
25:
26: import jacareto.comp.Components;
27: import jacareto.eventmask.AllEventsMask;
28: import jacareto.system.Environment;
29:
30: import org.apache.log4j.Logger;
31:
32: import java.util.EventObject;
33:
34: /**
35: * Prints all events to the logger instance with DEBUG level.
36: *
37: * @author Thomas Leonhardt
38: * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a> (Version 1.1)
39: * @version 1.11
40: */
41: public class EventDebugger extends Catcher {
42: /** The logger. */
43: private Logger logger;
44:
45: /**
46: * Creates a new event debugger.
47: *
48: * @param env the environment
49: * @param components the instance which knows the components
50: */
51: public EventDebugger(Environment env, Components components) {
52: super (env, new AllEventsMask(env));
53: this .logger = env.getLogger();
54: }
55:
56: /**
57: * Prints the event with the logger instance in logger level Level.DEBUG
58: *
59: * @param event the event
60: *
61: * @return DOCUMENT ME!
62: */
63: public boolean handleEvent(EventObject event) {
64: logger.debug(event.getClass().toString() + "; "
65: + event.getSource().getClass().toString());
66:
67: return true;
68: }
69:
70: /**
71: * Handles all semantic events.
72: *
73: * @param event DOCUMENT ME!
74: *
75: * @return DOCUMENT ME!
76: */
77: public boolean handlesSemanticEvent(EventObject event) {
78: return true;
79: }
80: }
|