Package org.smooks.engine.plugin
Class PayloadProcessor
- java.lang.Object
-
- org.smooks.engine.plugin.PayloadProcessor
-
public class PayloadProcessor extends Object
Processor class for an abstract payload type. This class can be used to ease Smooks integration with application containers (for example ESBs). It works out how to filter the supplied Object payload through Smooks, to produce the desiredresult type
. The "payload" object supplied to theprocess(Object, ExecutionContext)
method can be one of type:String
,Byte
array,Reader
,InputStream
,Source
,SourceResult
, or- any Java user type (gets wrapped in a
JavaSource
).
SourceResult
payload type allows full control over the filterSource
andResult
.- Author:
- Daniel Bevenius
-
-
Constructor Summary
Constructors Constructor Description PayloadProcessor(Smooks smooks, ResultType resultType)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
process(Object payload, ExecutionContext executionContext)
Process the supplied payload.void
setJavaResultBeanId(String javaResultBeanId)
Set the bean ID to be unpacked from aJavaResult
.
-
-
-
Constructor Detail
-
PayloadProcessor
public PayloadProcessor(Smooks smooks, ResultType resultType)
Public constructor.- Parameters:
smooks
- The Smooks instance to be used.resultType
- The required result type.
-
-
Method Detail
-
setJavaResultBeanId
public void setJavaResultBeanId(String javaResultBeanId)
Set the bean ID to be unpacked from aJavaResult
. Only relevant forResultType.JAVA
. If not specified, the completeresult Map
will be returned as the result of theprocess(Object, ExecutionContext)
method call.- Parameters:
javaResultBeanId
- The bean ID to be unpacked.
-
process
public final Object process(Object payload, ExecutionContext executionContext) throws SmooksException
Process the supplied payload. See class level javadoc.- Parameters:
payload
- The payload to be filtered. See class level javadoc for supported data types.- Returns:
- The filter result. Will be "unpacked" as per the
ResultType
supplied in theconstructor
. - Throws:
SmooksException
-
-