Interface ChainExecutionPathTreeVisitor
- All Known Implementing Classes:
BaseChainExecutionPathTreeVisitor
ChainExecutionPathTree with its
ChainExecutionPathTree.accept(ChainExecutionPathTreeVisitor) method not coupled to its internal structure.
For each item of interest in the ChainExecutionPathTree being navigated, a method from this visitor will be called. The
order of the called methods is consistent and depends on the definition of the chain. It is up to implementations to keep the
proper context for backtracking after an inner chain or an error handler is finished.
Implementations need not be tread-safe.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after a component that will always interrupt the execution flow of a chain prematurely and with an error.voiderrorHandlerCouldBeInvoked(ChainExecutionPathTree errorHandler, org.mule.runtime.api.message.ErrorType errorType) Called after an operation is found that may raise an error that would incur in the invocation of the .voidCalled after the last component in an#ERROR_HANDLER.voidCalled after the last component in an#ERROR_HANDLERif the error has finished to be propagated to other error handlers.booleanThis method will be called before starting the traversal of an error handler.voidfinishReferencedOperation(ChainExecutionPathTree operation) Called after a reference was traversed, to mark that the referencedChainExecutionPathTreehas finished.voidinnerRouteFinished(ChainExecutionPathTree innerChain) Called after the last component in a#ROUTEwithin a#ROUTER.booleaninnerRouteStarted(ChainExecutionPathTree innerChain) Called when a#ROUTEwithin a#ROUTERis found in the execution tree.voidrouterFinished(ChainExecutionPathTree router) Called after the last#ROUTEwithin a#ROUTERwas visited.voidCalled after the#ROUTE/#CHAINwithin a#SCOPEwas visited.voidvisitReferencedOperation(ChainExecutionPathTree operation) Called when an#OPERATIONthat references to another operation in the execution tree.booleanvisitRouter(ChainExecutionPathTree router) Called when a#ROUTERis found in the execution tree.booleanvisitScope(ChainExecutionPathTree scope) Called when a#SCOPEis found in the execution tree.voidvisitSimpleOperation(ChainExecutionPathTree operation) Called when a simple#OPERATIONis found in the execution tree.voidvisitSource(ChainExecutionPathTree source) Called when a#SOURCEis found in the execution tree.
-
Method Details
-
visitSource
Called when a#SOURCEis found in the execution tree.If the chain is a
#FLOWwith a#SOURCE, this will be the first method called when visiting the chain.- Parameters:
source- the tree representing visited source
-
visitSimpleOperation
Called when a simple#OPERATIONis found in the execution tree.A simple
#OPERATIONis any operation within a chain that is not a#SCOPEor#ROUTER.- Parameters:
operation- the visited simple operation.
-
visitReferencedOperation
Called when an#OPERATIONthat references to another operation in the execution tree.This could be the case of a Flow Reference Operation.
- Parameters:
operation- the visited reference operation.
-
finishReferencedOperation
Called after a reference was traversed, to mark that the referencedChainExecutionPathTreehas finished.- Parameters:
operation-
-
visitScope
Called when a#SCOPEis found in the execution tree.After this method is called, if it returns
trueit will proceed to visit its inner components. After that,scopeFinished(ChainExecutionPathTree)will be called and then the method for the component right after the scope the last call to that method. IfvisitScope(ChainExecutionPathTree)returnedfalse, this method won't be called.- Parameters:
scope- the visited scope.- Returns:
trueif the visitor should visit the inner components of the#SCOPE, orfalseif it should just skip to the next element. If it istrue, then every inner component of this particular#SCOPEwill be visited.
-
scopeFinished
Called after the#ROUTE/#CHAINwithin a#SCOPEwas visited.This is a delimiter call. This will only be called after
visitScope(ChainExecutionPathTree)and will be referred to the last call to that method. -
visitRouter
Called when a#ROUTERis found in the execution tree.After this method is called, if it returns {@link true}, for each of its inner chains
innerRouteStarted(ChainExecutionPathTree)(ComponentAst)} followed by the calls that correspond to its inner components, and thenrouterFinished(ChainExecutionPathTree)will be called. After all inner chains have been navigated,routerFinished(ChainExecutionPathTree)will be called with the sameComponentAstof this#ROUTER, and the method for the component right after the scope will be called.- Parameters:
router- the visited router.- Returns:
trueif the visitor should visit the inner components of the#ROUTER, orfalseif it should just skip to the next element.
-
innerRouteStarted
Called when a#ROUTEwithin a#ROUTERis found in the execution tree.This is a delimiter call. The finish of the innerChain started here will be notified by a call to
innerRouteFinished(ChainExecutionPathTree). This wil only be called ifvisitRouter(ChainExecutionPathTree)returned true.- Parameters:
innerChain- the visited innerChain.- Returns:
- true if this particular route is required to be started.
-
innerRouteFinished
Called after the last component in a#ROUTEwithin a#ROUTER.This is a delimiter call. This will only be called after
innerRouteStarted(ChainExecutionPathTree)and will apply to the innerChain indicated in the last call to that method.- Parameters:
innerChain- the visited innerChain
-
routerFinished
Called after the last#ROUTEwithin a#ROUTERwas visited.This is a delimiter call. This will only be called after
visitRouter(ChainExecutionPathTree)and will be referred to the last call to that method. IfvisitRouter(ChainExecutionPathTree)returnedfalse, this method won't be called. -
errorHandlerCouldBeInvoked
void errorHandlerCouldBeInvoked(ChainExecutionPathTree errorHandler, org.mule.runtime.api.message.ErrorType errorType) Called after an operation is found that may raise an error that would incur in the invocation of the . This also includes the case of an OnErrorPropagate, which in the end propagates as well to this error handler. The visitor must consider that this method may be called for the same error handler for every error that may occur and this matches.- Parameters:
errorHandler- theChainExecutionPathTreecorresponding to the error handler that could be invoked.errorType- theErrorTypeof the error that the operation may raise.
-
errorHandlerStarted
This method will be called before starting the traversal of an error handler. This will be called after the entire chain of the owner of this ErrorHandler has been traversed, which will allow to retrieve all the potential calls to this, which are modeled with#errorHandlerCouldBeInvoked(ChainExecutionPathTree).If there is the need to continue the propagation (i.e. this is an on error propagate handler), it will as well invoke
#errorHandlerCouldBeInvoked(ChainExecutionPathTree)after the propagation of this one is finished.- Parameters:
handler- the visited error handler- Returns:
trueif the visitor should travers this error handler (errorHandlerFinished(ChainExecutionPathTree)won't be invoked if this returnsfalse).
-
errorHandlerFinished
Called after the last component in an#ERROR_HANDLER.This is a delimiter call. This will only be called after
errorHandlerStarted(ChainExecutionPathTree).- Parameters:
handler- the visited error handler.
-
errorHandlerPropagationComplete
Called after the last component in an#ERROR_HANDLERif the error has finished to be propagated to other error handlers. This is, for example, if the current is an on-error-continue, or if we reached the last level of error handling to be able to handle the error (e.g. the main flow). This method will be called for every that the originating component may throw, as far as there is at least an error handler to handle it.This is a delimiter call. The finish of the error handler started here will be notified by a call to
errorHandlerFinished(ChainExecutionPathTree), including for this last , to then call this method.- Parameters:
handler- the visited error handler
-
chainInterruptedWithError
Called after a component that will always interrupt the execution flow of a chain prematurely and with an error.This represents a situation in which, if there are other nodes after this one, they will never be executed.
- Parameters:
chain- the interrupted chain.- Since:
- 1.5
-