KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > java > plugin > boot > BootErrorHandlerConsole


1 /*****************************************************************************
2  * Java Plug-in Framework (JPF)
3  * Copyright (C) 2004-2005 Dmitry Olshansky
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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  *****************************************************************************/

19 package org.java.plugin.boot;
20
21 import org.java.plugin.registry.IntegrityCheckReport;
22
23 /**
24  * Console out based error handler implementation, most suites good for
25  * non-interactive service-style applications.
26  *
27  * @version $Id: BootErrorHandlerConsole.java,v 1.1 2005/10/22 15:22:24 ddimon Exp $
28  */

29 public class BootErrorHandlerConsole implements BootErrorHandler {
30     /**
31      * Prints given message to the "standard" error output.
32      * @see org.java.plugin.boot.BootErrorHandler#handleFatalError(
33      * java.lang.String)
34      */

35     public void handleFatalError(final String JavaDoc message) {
36         System.err.println(message);
37     }
38
39     /**
40      * Prints given message and error stack trace to the "standard" error
41      * output.
42      *
43      * @see org.java.plugin.boot.BootErrorHandler#handleFatalError(
44      * java.lang.String, java.lang.Throwable)
45      */

46     public void handleFatalError(final String JavaDoc message, final Throwable JavaDoc t) {
47         System.err.println(message);
48         t.printStackTrace();
49     }
50
51     /**
52      * Does the same as {@link #handleFatalError(String, Throwable)} always
53      * returns <code>false</code>.
54      *
55      * @see org.java.plugin.boot.BootErrorHandler#handleError(java.lang.String,
56      * java.lang.Exception)
57      */

58     public boolean handleError(final String JavaDoc message, final Exception JavaDoc e) {
59         handleFatalError(message, e);
60         return false;
61     }
62
63     /**
64      * Does the same as {@link #handleFatalError(String)} always returns
65      * <code>false</code>.
66      *
67      * @see org.java.plugin.boot.BootErrorHandler#handleError(java.lang.String,
68      * org.java.plugin.registry.IntegrityCheckReport)
69      */

70     public boolean handleError(final String JavaDoc message,
71             final IntegrityCheckReport report) {
72         System.err.println(message);
73         return false;
74     }
75 }
76
Popular Tags