org.apache.camel.component.exec.impl
Class DefaultExecBinding

java.lang.Object
  extended by org.apache.camel.component.exec.impl.DefaultExecBinding
All Implemented Interfaces:
ExecBinding

public class DefaultExecBinding
extends Object
implements ExecBinding

Default implementation of ExecBinding.

See Also:
writeOutputInMessage(Message, ExecResult)

Field Summary
 
Fields inherited from interface org.apache.camel.component.exec.ExecBinding
EXEC_COMMAND_ARGS, EXEC_COMMAND_EXECUTABLE, EXEC_COMMAND_OUT_FILE, EXEC_COMMAND_TIMEOUT, EXEC_COMMAND_WORKING_DIR, EXEC_EXIT_VALUE, EXEC_STDERR, EXEC_USE_STDERR_ON_EMPTY_STDOUT
 
Constructor Summary
DefaultExecBinding()
           
 
Method Summary
protected
<T> T
getAndRemoveHeader(Message message, String headerName, T defaultValue, Class<T> headerType)
          Gets and removes the headerName header form the input message (the header will not be propagated)
 ExecCommand readInput(Exchange exchange, ExecEndpoint endpoint)
          Creates a ExecCommand from the headers in the exchange and the settings of the endpoint.
 void writeOutput(Exchange exchange, ExecResult result)
          Populates the exchange form the ExecResult.
protected  void writeOutputInMessage(Message message, ExecResult result)
          Write the ExecResult in the message body.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExecBinding

public DefaultExecBinding()
Method Detail

readInput

public ExecCommand readInput(Exchange exchange,
                             ExecEndpoint endpoint)
Description copied from interface: ExecBinding
Creates a ExecCommand from the headers in the exchange and the settings of the endpoint.

Specified by:
readInput in interface ExecBinding
Parameters:
exchange - a Camel Exchange
endpoint - an ExecEndpoint instance
Returns:
an ExecCommand object
See Also:
ExecCommandExecutor

writeOutput

public void writeOutput(Exchange exchange,
                        ExecResult result)
Description copied from interface: ExecBinding
Populates the exchange form the ExecResult.

Specified by:
writeOutput in interface ExecBinding
Parameters:
exchange - a Camel Exchange, in which to write the result
result - the result of a command execution
See Also:
ExecCommandExecutor

writeOutputInMessage

protected void writeOutputInMessage(Message message,
                                    ExecResult result)
Write the ExecResult in the message body. Write the stderr and the exit value for convenience in the message headers.
The stdout and/or resultFile should be accessible using a converter or using the result object directly.

Parameters:
message - a Camel message
result - an ExecResult instance

getAndRemoveHeader

protected <T> T getAndRemoveHeader(Message message,
                                   String headerName,
                                   T defaultValue,
                                   Class<T> headerType)
Gets and removes the headerName header form the input message (the header will not be propagated)



Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.