org.jboss.soa.esb.listeners.message
Class ActionProcessingPipeline

java.lang.Object
  extended by java.util.Observable
      extended by org.jboss.soa.esb.listeners.message.ActionProcessingPipeline
All Implemented Interfaces:
java.lang.Runnable

public class ActionProcessingPipeline
extends java.util.Observable
implements java.lang.Runnable

Action Processing Pipeline.

Runs a list of action classes on a message

Since:
Version 4.0
Author:
schifest@heuristica.com.ar

Field Summary
protected  ConfigTree[] _actionList
           
protected  ConfigTree _config
           
protected  java.lang.String _currentAction
           
protected  java.lang.Class _currentClass
           
protected  int _currentIndex
           
protected  java.lang.Object _currentProcessor
           
protected  org.apache.log4j.Logger _logger
           
protected  Message _message
           
 
Constructor Summary
ActionProcessingPipeline(Message message, ConfigTree config)
          public constructor
 
Method Summary
protected  void actionClassException(ConfigTree tree, Message msg, java.lang.Throwable thrown)
          If 'current' action step was configured with a 'exceptionMethod' attribute that method will be called with a single argument of type Exception
protected  void actionClassFinishedOk(ConfigTree tree, Message msg)
          If 'current' action step was configured with an 'okMethod' attribute that method will be called with no arguments
protected  java.lang.String[] getActionNames()
           
 Message getMessage()
           
 boolean isProcessingComplete()
           
protected  java.lang.String prematureTermination(java.lang.String s)
           
 void run()
          Implement Runnable Interface

Uses reflection to instantiate action classes that must have a public constructor that takes a single ConfigTree as argument

Requires each action class to have a public method that takes a Message and returns a Message
Default name for it is 'process' but can optionally be defined in the 'process' attribute of the corresponding <action> element of the ConfigTree

Each <action> element can optionally define a method (taking a Message argument) to be called upon successful completion of the action class (that step of the chain)
Default name for it is 'process' but can optionally be defined in the 'process' attribute

See actionClassException and actionClassFinishedOk

 void waitUntilComplete()
          Wait until processing is complete.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_actionList

protected ConfigTree[] _actionList

_currentIndex

protected int _currentIndex

_currentAction

protected java.lang.String _currentAction

_currentClass

protected java.lang.Class _currentClass

_currentProcessor

protected java.lang.Object _currentProcessor

_message

protected Message _message

_config

protected ConfigTree _config

_logger

protected org.apache.log4j.Logger _logger
Constructor Detail

ActionProcessingPipeline

public ActionProcessingPipeline(Message message,
                                ConfigTree config)
                         throws ConfigurationException
public constructor

Parameters:
message - Message - The initial message to be run through the whole action class chain
Throws:
ConfigurationException
Method Detail

getMessage

public Message getMessage()
Returns:
Message - current Message of this action chain processor

run

public void run()
Implement Runnable Interface

Uses reflection to instantiate action classes that must have a public constructor that takes a single ConfigTree as argument

Requires each action class to have a public method that takes a Message and returns a Message
Default name for it is 'process' but can optionally be defined in the 'process' attribute of the corresponding <action> element of the ConfigTree

Each <action> element can optionally define a method (taking a Message argument) to be called upon successful completion of the action class (that step of the chain)
Default name for it is 'process' but can optionally be defined in the 'process' attribute

See actionClassException and actionClassFinishedOk

Specified by:
run in interface java.lang.Runnable

prematureTermination

protected java.lang.String prematureTermination(java.lang.String s)

actionClassException

protected void actionClassException(ConfigTree tree,
                                    Message msg,
                                    java.lang.Throwable thrown)
If 'current' action step was configured with a 'exceptionMethod' attribute that method will be called with a single argument of type Exception

Parameters:
tree - ConfigTree - where to look for the exceptionMetod attribute
thrown - Exception - to be used in invocation to method (if found)

actionClassFinishedOk

protected void actionClassFinishedOk(ConfigTree tree,
                                     Message msg)
If 'current' action step was configured with an 'okMethod' attribute that method will be called with no arguments

Parameters:
tree - ConfigTree - where to look for the okMetod attribute

getActionNames

protected java.lang.String[] getActionNames()

isProcessingComplete

public boolean isProcessingComplete()
Returns:
Returns the processingComplete.

waitUntilComplete

public void waitUntilComplete()
Wait until processing is complete.