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, NamedNode

public class TryDefinition
extends OutputDefinition<TryDefinition>

Represents an XML <try/> element

Version:

Field Summary
 
Fields inherited from class org.apache.camel.model.OutputDefinition
outputs
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler, log
 
Constructor Summary
TryDefinition()
           
 
Method Summary
 void addOutput(ProcessorDefinition<?> output)
          Adds the given definition as output to this block
protected  void checkInitialized()
          Checks whether or not this object has been initialized
 Processor createProcessor(RouteContext routeContext)
          Override this in definition class and implement logic to create the processor based on the definition model.
 TryDefinition doCatch(Class<? extends Throwable>... exceptionType)
          Handles the given exception(s)
 TryDefinition doCatch(Class<? extends Throwable> exceptionType)
          Handles the given exception
 TryDefinition doFinally()
          The finally block for a given handle
 List<CatchDefinition> getCatchClauses()
           
 FinallyDefinition getFinallyClause()
           
 String getLabel()
          Returns a label to describe this node such as the expression if some kind of expression node
 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)
          Deprecated. will be removed in Camel 3.0. Instead of using handled(false) you can re-throw the exception from a Processor or use the ProcessorDefinition.throwException(Exception)
 TryDefinition handled(Expression handled)
          Deprecated. will be removed in Camel 3.0. Instead of using handled(false) you can re-throw the exception from a Processor or use the ProcessorDefinition.throwException(Exception)
 TryDefinition handled(Predicate handled)
          Deprecated. will be removed in Camel 3.0. Instead of using handled(false) you can re-throw the exception from a Processor or use the ProcessorDefinition.throwException(Exception)
 TryDefinition onWhen(Predicate predicate)
          Sets an additional predicate that should be true before the onCatch is triggered.
protected  void preCreateProcessor()
          Strategy to execute any custom logic before the Processor is created.
 void setOutputs(List<ProcessorDefinition<?>> outputs)
           
 String toString()
           
 
Methods inherited from class org.apache.camel.model.OutputDefinition
getOutputs, isOutputSupported
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endParent, enrich, enrich, enrichRef, filter, filter, filter, filter, getInterceptStrategies, getNodeFactory, getOtherAttributes, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, loadBalance, loadBalance, log, log, log, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, placeholder, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, process, processRef, recipientList, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperty, resequence, resequence, resolveKnownConstantFields, resolvePropertyPlaceholders, rollback, rollback, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, sample, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setNodeFactory, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, stop, threads, threads, threads, threads, throttle, throttle, throwException, to, to, to, to, to, to, to, to, to, to, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getDescription, getDescriptionText, 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 OutputDefinition<TryDefinition>

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

Specified by:
getShortName in interface NamedNode
Overrides:
getShortName in class OutputDefinition<TryDefinition>
Returns:
defaults to "node" but derived nodes should overload this to provide a unique name

getLabel

public String getLabel()
Description copied from class: ProcessorDefinition
Returns a label to describe this node such as the expression if some kind of expression node

Overrides:
getLabel in class ProcessorDefinition<TryDefinition>

createProcessor

public Processor createProcessor(RouteContext routeContext)
                          throws Exception
Description copied from class: ProcessorDefinition
Override this in definition class and implement logic to create the processor based on the definition model.

Overrides:
createProcessor in class ProcessorDefinition<TryDefinition>
Throws:
Exception

doCatch

public TryDefinition doCatch(Class<? extends Throwable> exceptionType)
Handles the given exception

Parameters:
exceptionType - the exception
Returns:
the try builder

doCatch

public TryDefinition doCatch(Class<? extends Throwable>... 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

handled

@Deprecated
public TryDefinition handled(boolean handled)
Deprecated. will be removed in Camel 3.0. Instead of using handled(false) you can re-throw the exception from a Processor or use the ProcessorDefinition.throwException(Exception)

Sets whether the exchange should be marked as handled or not.

Parameters:
handled - handled or not
Returns:
the builder

handled

@Deprecated
public TryDefinition handled(Predicate handled)
Deprecated. will be removed in Camel 3.0. Instead of using handled(false) you can re-throw the exception from a Processor or use the ProcessorDefinition.throwException(Exception)

Sets whether the exchange should be marked as handled or not.

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

handled

@Deprecated
public TryDefinition handled(Expression handled)
Deprecated. will be removed in Camel 3.0. Instead of using handled(false) you can re-throw the exception from a Processor or use the ProcessorDefinition.throwException(Exception)

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)
Description copied from interface: Block
Adds the given definition as output to this block

Specified by:
addOutput in interface Block
Overrides:
addOutput in class ProcessorDefinition<TryDefinition>
Parameters:
output - the processor definition

preCreateProcessor

protected void preCreateProcessor()
Description copied from class: ProcessorDefinition
Strategy to execute any custom logic before the Processor is created.

Overrides:
preCreateProcessor in class ProcessorDefinition<TryDefinition>

checkInitialized

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



Apache CAMEL