org.malai.error
Class ErrorCatcher

java.lang.Object
  extended by org.malai.error.ErrorCatcher

public final class ErrorCatcher
extends java.lang.Object

The singleton ErrorCatcher permits to Malai code to send errors to a gatherer. The ErrorCatcher then send the catched exception to an ErrorNotifier (if one is defined). This is useful to gather Malai errors into a third-part application. For instance, a develope can define his own error manager which implements the ErrorNotifier interface and which is registered to the ErrorCatcher in order to manage both the Malai exceptions and the third-part application errors.

This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN

Malai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

07/23/2011

Since:
0.2
Version:
0.2
Author:
Arnaud BLOUIN

Field Summary
static ErrorCatcher INSTANCE
          The singleton ErrorCatcher.
private  ErrorNotifier notifier
          The notifier object.
 
Constructor Summary
private ErrorCatcher()
          Creates the error catcher.
 
Method Summary
 ErrorNotifier getErrorNotifier()
           
 void reportError(java.lang.Exception exception)
          Gathers malai exceptions.
 void setNotifier(ErrorNotifier notifier)
          Sets the notifier that will be notified about Malai errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ErrorCatcher INSTANCE
The singleton ErrorCatcher.


notifier

private ErrorNotifier notifier
The notifier object.

Constructor Detail

ErrorCatcher

private ErrorCatcher()
Creates the error catcher.

Method Detail

setNotifier

public void setNotifier(ErrorNotifier notifier)
Sets the notifier that will be notified about Malai errors.

Parameters:
notifier - The notifier that will be notified about errors. Can be null.
Since:
0.2

getErrorNotifier

public ErrorNotifier getErrorNotifier()
Returns:
The notifier that is notified about errors.
Since:
0.2

reportError

public void reportError(java.lang.Exception exception)
Gathers malai exceptions.

Parameters:
exception - The errors to gather. Nothing is done if null or if no notifier is defined.
Since:
0.1