01: /*****************************************************************************
02: * Java Plug-in Framework (JPF)
03: * Copyright (C) 2004-2005 Dmitry Olshansky
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *****************************************************************************/package org.java.plugin.boot;
19:
20: import org.java.plugin.registry.IntegrityCheckReport;
21:
22: /**
23: * Console out based error handler implementation, most suites good for
24: * non-interactive service-style applications.
25: *
26: * @version $Id$
27: */
28: public class BootErrorHandlerConsole implements BootErrorHandler {
29: /**
30: * Prints given message to the "standard" error output.
31: * @see org.java.plugin.boot.BootErrorHandler#handleFatalError(
32: * java.lang.String)
33: */
34: public void handleFatalError(final String message) {
35: System.err.println(message);
36: }
37:
38: /**
39: * Prints given message and error stack trace to the "standard" error
40: * output.
41: *
42: * @see org.java.plugin.boot.BootErrorHandler#handleFatalError(
43: * java.lang.String, java.lang.Throwable)
44: */
45: public void handleFatalError(final String message, final Throwable t) {
46: System.err.println(message);
47: t.printStackTrace();
48: }
49:
50: /**
51: * Does the same as {@link #handleFatalError(String, Throwable)} always
52: * returns <code>false</code>.
53: *
54: * @see org.java.plugin.boot.BootErrorHandler#handleError(java.lang.String,
55: * java.lang.Exception)
56: */
57: public boolean handleError(final String message, final Exception e) {
58: handleFatalError(message, e);
59: return false;
60: }
61:
62: /**
63: * Does the same as {@link #handleFatalError(String)} always returns
64: * <code>false</code>.
65: *
66: * @see org.java.plugin.boot.BootErrorHandler#handleError(java.lang.String,
67: * org.java.plugin.registry.IntegrityCheckReport)
68: */
69: public boolean handleError(final String message,
70: final IntegrityCheckReport report) {
71: System.err.println(message);
72: return false;
73: }
74: }
|