Class DefaultObserver
java.lang.Object
org.exolab.adaptx.xslt.util.DefaultObserver
- All Implemented Interfaces:
ErrorObserver, MessageObserver
A simple implementation of MessageObserver and ErrorObserver.
This observer is cascading, which means you can add observers
to it, and it will cascade notifications.
- Version:
- $Revision: 3633 $ $Date: 2003-03-01 08:38:44 +0100 (Sat, 01 Mar 2003) $
- Author:
- Keith Visco
-
Field Summary
Fields inherited from interface ErrorObserver
FATAL, NORMAL, WARNING -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SimpleMessageObserver which will print messages to the console.DefaultObserver(boolean allErrorsFatal) Creates a new SimpleMessageObserver which will print messages to the console.DefaultObserver(Writer writer) Creates a new SimpleMessageObserver which will print messages to the console.DefaultObserver(Writer writer, boolean allErrorsFatal) Creates a new SimpleMessageObserver which will print messages to the console. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorObserver(ErrorObserver observer) Adds the given ErrorObserver to this DefaultObservervoidaddMessageObserver(MessageObserver observer) Adds the given MessageObserver to this DefaultObservervoidreceiveError(Exception exception) Signals an error with normal levelvoidreceiveError(Exception exception, int level) Signals an error with the given error levelvoidreceiveError(Exception exception, String message) Signals an error with normal levelvoidreceiveError(Exception exception, String message, int level) Signals an error with the given error levelvoidreceiveError(String message) Signals an error message with normal levelvoidreceiveError(String message, int level) Signals an error message with the given error levelvoidreceiveMessage(String message) Notifies this observer of a new messagevoidRemoves all the ErrorObservers from the cascading ErrorObserver listvoidRemoves all the MessageObservers from the cascading ErrorObserver listvoidremoveErrorObserver(ErrorObserver observer) Removes the given ErrorObserver from the cascading ErrorObserver listvoidremoveMessageObserver(MessageObserver observer) Removes the given MessageObserver from the cascading MessageObserver listvoidSets the Writer of this MessageObserver
-
Constructor Details
-
DefaultObserver
public DefaultObserver()Creates a new SimpleMessageObserver which will print messages to the console. A fatal error will cause a RuntimeException. -
DefaultObserver
public DefaultObserver(boolean allErrorsFatal) Creates a new SimpleMessageObserver which will print messages to the console. A fatal error will cause a RuntimeException.- Parameters:
allErrorsFatal- a boolean, when true will treat all errors as fatal errors (excludes warnings).
-
DefaultObserver
Creates a new SimpleMessageObserver which will print messages to the console. A fatal error will cause a RuntimeException.- Parameters:
writer- the Writer to print messages to. This writer may be null, to create a null sink.
-
DefaultObserver
Creates a new SimpleMessageObserver which will print messages to the console. A fatal error will cause a RuntimeException.- Parameters:
writer- the Writer to print messages to. This writer may be null, to create a null sink.allErrorsFatal- a boolean, when true will treat all errors as fatal errors (excludes warnings).
-
-
Method Details
-
addErrorObserver
Adds the given ErrorObserver to this DefaultObserver- Parameters:
observer- the ErrorObserver to add
-
addMessageObserver
Adds the given MessageObserver to this DefaultObserver- Parameters:
observer- the MessageObserver to add
-
receiveError
Signals an error with normal level- Specified by:
receiveErrorin interfaceErrorObserver- Parameters:
exception- the Exception that caused the error
-
receiveError
Signals an error with normal level- Specified by:
receiveErrorin interfaceErrorObserver- Parameters:
exception- the Exception that caused the errormessage- an option message, used when additional information can be provided.
-
receiveError
Signals an error with the given error level- Specified by:
receiveErrorin interfaceErrorObserver- Parameters:
exception- the Exception that caused the errorlevel- the error level
-
receiveError
Signals an error with the given error level- Specified by:
receiveErrorin interfaceErrorObserver- Parameters:
exception- the Exception that caused the errormessage- an option message, used when additional information can be provided.level- the error level
-
receiveError
Signals an error message with normal level- Specified by:
receiveErrorin interfaceErrorObserver- Parameters:
message- the error message
-
receiveError
Signals an error message with the given error level- Specified by:
receiveErrorin interfaceErrorObserver- Parameters:
message- the error messagelevel- the error level
-
receiveMessage
Notifies this observer of a new message- Specified by:
receiveMessagein interfaceMessageObserver- Parameters:
message- the message to observe
-
removeAllErrorObservers
public void removeAllErrorObservers()Removes all the ErrorObservers from the cascading ErrorObserver list -
removeAllMessageObservers
public void removeAllMessageObservers()Removes all the MessageObservers from the cascading ErrorObserver list -
removeErrorObserver
Removes the given ErrorObserver from the cascading ErrorObserver list- Parameters:
observer- the ErrorObserver to remove
-
removeMessageObserver
Removes the given MessageObserver from the cascading MessageObserver list- Parameters:
observer- the MessageObserver to remove
-
setWriter
Sets the Writer of this MessageObserver- Parameters:
writer- the Writer to print messages to
-