org.apache.camel.model
Class TryDefinition

java.lang.Object
  extended by org.apache.camel.model.OptionalIdentifiedDefinition<Type>
      extended by org.apache.camel.model.ProcessorDefinition<Type>
          extended by org.apache.camel.model.OutputDefinition<TryDefinition>
              extended by org.apache.camel.model.TryDefinition
All Implemented Interfaces:
Block

public class TryDefinition
extends OutputDefinition<TryDefinition>

Represents an XML <try/> element

Version:
$Revision: 785285 $

Field Summary
 
Fields inherited from class org.apache.camel.model.OutputDefinition
outputs
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
log
 
Constructor Summary
TryDefinition()
           
 
Method Summary
 void addOutput(ProcessorDefinition output)
           
protected  void checkInitialized()
          Checks whether or not this object has been initialized
 Processor createProcessor(RouteContext routeContext)
           
 TryDefinition doCatch(Class... exceptionType)
          Handles the given exception(s)
 TryDefinition doFinally()
          The finally block for a given handle
 List<CatchDefinition> getCatchClauses()
           
 FinallyDefinition getFinallyClause()
           
 List<ProcessorDefinition> getOutputsWithoutCatches()
           
 String getShortName()
          Returns a short name for this node which can be useful for ID generation or referring to related resources like images
 TryDefinition handled(boolean handled)
          Sets whether the exchange should be marked as handled or not.
 TryDefinition handled(Expression handled)
          Sets whether the exchange should be marked as handled or not.
 TryDefinition handled(Predicate handled)
          Sets whether the exchange should be marked as handled or not.
 ExpressionClause<TryDefinition> onWhen()
          Creates an expression to configure an additional predicate that should be true before the onCatch is triggered.
 TryDefinition onWhen(Predicate predicate)
          Sets an additional predicate that should be true before the onCatch is triggered.
 void setOutputs(List<ProcessorDefinition> outputs)
           
 String toString()
           
 
Methods inherited from class org.apache.camel.model.OutputDefinition
getOutputs
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addRoutes, aggregate, aggregate, aggregate, aggregate, aggregate, aop, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createCompositeProcessor, createErrorHandlerBuilder, createOutputsProcessor, createOutputsProcessor, delay, delay, delay, doTry, end, enrich, enrich, errorHandler, filter, filter, filter, filter, getErrorHandlerBuilder, getErrorHandlerRef, getInterceptStrategies, getLabel, getNodeFactory, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, loadBalance, loadBalance, loop, loop, loop, makeProcessor, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, process, processRef, recipientList, recipientList, removeFaultHeader, removeHeader, removeProperty, resequence, resequence, resequence, resequencer, rollback, rollback, routingSlip, routingSlip, setBody, setBody, setErrorHandlerBuilder, setErrorHandlerBuilderIfNull, setErrorHandlerRef, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setNodeFactory, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sortBody, sortBody, split, split, split, stop, threads, threads, throttle, throwException, to, to, to, to, to, to, to, to, to, to, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, wireTap, wireTap, wireTap, wrapChannel, wrapProcessor
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getDescription, getId, hasCustomIdAssigned, idOrCreate, setDescription, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TryDefinition

public TryDefinition()
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getShortName

public String getShortName()
Description copied from class: OptionalIdentifiedDefinition
Returns a short name for this node which can be useful for ID generation or referring to related resources like images

Overrides:
getShortName in class OptionalIdentifiedDefinition<TryDefinition>
Returns:
defaults to "node" but derived nodes should overload this to provide a unique name

createProcessor

public Processor createProcessor(RouteContext routeContext)
                          throws Exception
Overrides:
createProcessor in class ProcessorDefinition<TryDefinition>
Throws:
Exception

doCatch

public TryDefinition doCatch(Class... exceptionType)
Handles the given exception(s)

Parameters:
exceptionType - the exception(s)
Returns:
the try builder

doFinally

public TryDefinition doFinally()
The finally block for a given handle

Returns:
the try builder

onWhen

public TryDefinition onWhen(Predicate predicate)
Sets an additional predicate that should be true before the onCatch is triggered.

To be used for fine grained controlling whether a thrown exception should be intercepted by this exception type or not.

Parameters:
predicate - predicate that determines true or false
Returns:
the builder

onWhen

public ExpressionClause<TryDefinition> onWhen()
Creates an expression to configure an additional predicate that should be true before the onCatch is triggered.

To be used for fine grained controlling whether a thrown exception should be intercepted by this exception type or not.

Returns:
the expression clause to configure

handled

public TryDefinition handled(boolean handled)
Sets whether the exchange should be marked as handled or not.

Parameters:
handled - handled or not
Returns:
the builder

handled

public TryDefinition handled(Predicate handled)
Sets whether the exchange should be marked as handled or not.

Parameters:
handled - predicate that determines true or false
Returns:
the builder

handled

public TryDefinition handled(Expression handled)
Sets whether the exchange should be marked as handled or not.

Parameters:
handled - expression that determines true or false
Returns:
the builder

getCatchClauses

public List<CatchDefinition> getCatchClauses()

getFinallyClause

public FinallyDefinition getFinallyClause()

getOutputsWithoutCatches

public List<ProcessorDefinition> getOutputsWithoutCatches()

setOutputs

public void setOutputs(List<ProcessorDefinition> outputs)
Overrides:
setOutputs in class OutputDefinition<TryDefinition>

addOutput

public void addOutput(ProcessorDefinition output)
Specified by:
addOutput in interface Block
Overrides:
addOutput in class ProcessorDefinition<TryDefinition>

checkInitialized

protected void checkInitialized()
Checks whether or not this object has been initialized



Apache CAMEL