Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.exception
Class AbstractExceptionListener

    java.lang.Object
      org.mule.processor.AbstractMessageProcessorOwner
          org.mule.exception.AbstractExceptionListener

All Implemented Interfaces:
  FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable

Direct Known Subclasses:
  AbstractMessagingExceptionStrategy, DefaultSystemExceptionStrategy

    public abstract class AbstractExceptionListener

extends AbstractMessageProcessorOwner

`AbstractExceptionListener` is a base implementation that custom Exception Listeners can override. It provides template methods for handling the for base types of exceptions plus allows multimple targets to be associated with this exception listener and provides an implementation for dispatching exception events from this Listener.

Field Summary
`protected WildcardFilter` | `commitTxFilter`
`protected boolean` | `enableNotifications`
`protected AtomicBoolean` | `initialised`
`protected Log` | `logger` logger used by this class
`protected List<MessageProcessor>` | `messageProcessors`
`protected WildcardFilter` | `rollbackTxFilter`

Fields inherited from class org.mule.processor.AbstractMessageProcessorOwner
`flowConstruct, muleContext`

Fields inherited from interface org.mule.api.lifecycle.Initialisable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Startable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Stoppable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`AbstractExceptionListener()`

Method Summary
`void` | `addEndpoint(MessageProcessor processor)`
`protected void` | `closeStream(MuleMessage message)`
`protected OutboundRouter` | `createOutboundRouter()`
`protected void` | `doInitialise(MuleContext muleContext)`
`protected void` | `fireNotification(ExceptionNotification notification)` Fires a server notification to all registered `ExceptionNotificationListener` eventManager.
`WildcardFilter` | `getCommitTxFilter()`
`protected Throwable` | `getExceptionType(Throwable t, Class exceptionType)`
`List<MessageProcessor>` | `getMessageProcessors()`
`protected List<MessageProcessor>` | `getMessageProcessors(Throwable t)` Returns an endpoint for the given exception.
`protected List<MessageProcessor>` | `getOwnedMessageProcessors()`
`WildcardFilter` | `getRollbackTxFilter()`
`protected void` | `handleTransaction(Throwable t)` If there is a current transaction this method will mark it for rollback This method should not be called if an event is routed from this exception handler to an endpoint that should take part in the current transaction
`void` | `initialise()` The initialise method is call every time the Exception stategy is assigned to a service or connector.
`boolean` | `isEnableNotifications()`
`boolean` | `isInitialised()`
`protected void` | `logException(Throwable t)` Used to log the error passed into this Exception Listener
`protected void` | `logFatal(MuleMessage message, Throwable t)` Logs a fatal error message to the logging system.
`boolean` | `removeMessageProcessor(MessageProcessor processor)`
`protected void` | `rollbackTransaction()`
`protected void` | `routeException(MuleMessage message, MessageProcessor target, Throwable t)` Routes the current exception to an error endpoint such as a Dead Letter Queue (jms) This method is only invoked if there is a MuleMessage available to dispatch.
`void` | `setCommitTxFilter(WildcardFilter commitTxFilter)`
`void` | `setEnableNotifications(boolean enableNotifications)`
`void` | `setMessageProcessors(List<MessageProcessor> processors)`
`void` | `setRollbackTxFilter(WildcardFilter rollbackTxFilter)`

Methods inherited from class org.mule.processor.AbstractMessageProcessorOwner
`dispose, setFlowConstruct, setMuleContext, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    protected transient Log logger

  logger used by this class

### messageProcessors

    protected List<MessageProcessor> messageProcessors

### initialised

    protected AtomicBoolean initialised

### rollbackTxFilter

    protected WildcardFilter rollbackTxFilter

### commitTxFilter

    protected WildcardFilter commitTxFilter

### enableNotifications

    protected boolean enableNotifications

Constructor Detail

### AbstractExceptionListener

    public AbstractExceptionListener()

Method Detail

### getMessageProcessors

    public List<MessageProcessor> getMessageProcessors()

### setMessageProcessors

    public void setMessageProcessors(List<MessageProcessor> processors)

### addEndpoint

    public void addEndpoint(MessageProcessor processor)

### removeMessageProcessor

    public boolean removeMessageProcessor(MessageProcessor processor)

### getExceptionType

    protected Throwable getExceptionType(Throwable t,
                                         Class exceptionType)

### initialise

    public final void initialise()
                          throws InitialisationException

  The initialise method is call every time the Exception stategy is assigned to a service or connector. This implementation ensures that initialise is called only once. The actual initialisation code is contained in the `doInitialise()` method.

  Specified by:
    `initialise` in interface `Initialisable`
  Overrides:
    `initialise` in class `AbstractMessageProcessorOwner`
  Throws:
    `InitialisationException`
    `RecoverableException` - if an error occurs that can be recovered from

### doInitialise

    protected void doInitialise(MuleContext muleContext)
                         throws InitialisationException

  Throws:
    `InitialisationException`

### handleTransaction

    protected void handleTransaction(Throwable t)

  If there is a current transaction this method will mark it for rollback This method should not be called if an event is routed from this exception handler to an endpoint that should take part in the current transaction

### rollbackTransaction

    protected void rollbackTransaction()

### routeException

    protected void routeException(MuleMessage message,
                                  MessageProcessor target,
                                  Throwable t)

  Routes the current exception to an error endpoint such as a Dead Letter Queue (jms) This method is only invoked if there is a MuleMessage available to dispatch. The message dispatched from this method will be an `ExceptionMessage` which contains the exception thrown the MuleMessage and any context information.

  Parameters:
    `message` - the MuleMessage being processed when the exception occurred
    `target` - optional; the endpoint being dispatched or received on when the error occurred. This is NOT the endpoint that the message will be disptched on and is only supplied to this method for logging purposes
    `t` - the exception thrown. This will be sent with the ExceptionMessage
  See Also:
    `ExceptionMessage`

### createOutboundRouter

    protected OutboundRouter createOutboundRouter()
                                           throws MuleException

  Throws:
    `MuleException`

### closeStream

    protected void closeStream(MuleMessage message)

### getMessageProcessors

    protected List<MessageProcessor> getMessageProcessors(Throwable t)

  Returns an endpoint for the given exception. ExceptionListeners can have multiple targets registered on them. This methods allows custom implementations to control which endpoint is used based on the exception thrown. This implementation simply returns the first endpoint in the list.

  Parameters:
    `t` - the exception thrown
  Returns:
    The endpoint used to dispatch an exception message on or null if there are no targets registered

### logException

    protected void logException(Throwable t)

  Used to log the error passed into this Exception Listener

  Parameters:
    `t` - the exception thrown

### logFatal

    protected void logFatal(MuleMessage message,
                            Throwable t)

  Logs a fatal error message to the logging system. This should be used mostly if an error occurs in the exception listener itself. This implementation logs the the message itself to the logs if it is not null

  Parameters:
    `message` - The MuleMessage currently being processed
    `t` - the fatal exception to log

### isInitialised

    public boolean isInitialised()

### fireNotification

    protected void fireNotification(ExceptionNotification notification)

  Fires a server notification to all registered `ExceptionNotificationListener` eventManager.

  Parameters:
    `notification` - the notification to fire.

### getCommitTxFilter

    public WildcardFilter getCommitTxFilter()

### setCommitTxFilter

    public void setCommitTxFilter(WildcardFilter commitTxFilter)

### isEnableNotifications

    public boolean isEnableNotifications()

### setEnableNotifications

    public void setEnableNotifications(boolean enableNotifications)

### getRollbackTxFilter

    public WildcardFilter getRollbackTxFilter()

### setRollbackTxFilter

    public void setRollbackTxFilter(WildcardFilter rollbackTxFilter)

### getOwnedMessageProcessors

    protected List<MessageProcessor> getOwnedMessageProcessors()

  Specified by:
    `getOwnedMessageProcessors` in class `AbstractMessageProcessorOwner`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.