org.apache.camel.component.exec
Class ExecEndpoint

java.lang.Object
  extended by org.apache.camel.impl.DefaultEndpoint
      extended by org.apache.camel.component.exec.ExecEndpoint
All Implemented Interfaces:
CamelContextAware, Endpoint, IsSingleton

public class ExecEndpoint
extends DefaultEndpoint

The endpoint utilizes an ExecCommandExecutor to execute a system command when it receives message exchanges.

See Also:
ExecBinding, ExecCommandExecutor, ExecCommand, ExecResult

Field Summary
static long NO_TIMEOUT
          Indicates that no timeout is used.
 
Constructor Summary
ExecEndpoint(String uri, ExecComponent component)
           
 
Method Summary
 Consumer createConsumer(Processor processor)
           
 Producer createProducer()
           
 String getArgs()
          The arguments may be one or many whitespace-separated tokens, that can be quoted with ", e.g.
 ExecBinding getBinding()
           
 ExecCommandExecutor getCommandExecutor()
           
 String getExecutable()
           
 String getOutFile()
           
 long getTimeout()
           
 String getWorkingDir()
           
 boolean isSingleton()
           
 boolean isUseStderrOnEmptyStdout()
           
 void setArgs(String args)
          Sets the arguments of the executable application
 void setBinding(ExecBinding binding)
           
 void setCommandExecutor(ExecCommandExecutor commandExecutor)
          Sets a custom executor to execute commands.
 void setExecutable(String executable)
          Sets the executable to be executed.
 void setOutFile(String outFile)
           
 void setTimeout(long timeout)
          Sets the timeout.
 void setUseStderrOnEmptyStdout(boolean useStderrOnEmptyStdout)
           
 void setWorkingDir(String dir)
          Sets the working directory of the executable.
 
Methods inherited from class org.apache.camel.impl.DefaultEndpoint
configureProperties, createEndpointUri, createExchange, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExchangePattern, getExchangeType, hashCode, isLenientProperties, setCamelContext, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_TIMEOUT

public static final long NO_TIMEOUT
Indicates that no timeout is used.

See Also:
Constant Field Values
Constructor Detail

ExecEndpoint

public ExecEndpoint(String uri,
                    ExecComponent component)
Method Detail

createProducer

public Producer createProducer()
                        throws Exception
Throws:
Exception

createConsumer

public Consumer createConsumer(Processor processor)
                        throws Exception
Throws:
Exception

isSingleton

public boolean isSingleton()

getExecutable

public String getExecutable()
Returns:
the executable to be executed; that is the remaining part of the endpoint URI
See Also:
ExecBinding.EXEC_COMMAND_EXECUTABLE

setExecutable

public void setExecutable(String executable)
Sets the executable to be executed. The executable must not be empty or null.

Parameters:
executable - Sets the executable to be executed.

getArgs

public String getArgs()
The arguments may be one or many whitespace-separated tokens, that can be quoted with ", e.g. args="arg 1" arg2" will use two arguments arg 1 and arg2. To include the quotes use ""
, e.g. args=""arg 1"" arg2 will use the arguments "arg 1" and arg2.

Returns:
the arguments of the executable application, as configured from the endpoint URI.
See Also:
ExecBinding.EXEC_COMMAND_ARGS, ExecParseUtils.splitToWhiteSpaceSeparatedTokens(String)

setArgs

public void setArgs(String args)
Sets the arguments of the executable application

Parameters:
args - Returns null value if no arguments are configured in the endpoint URI
See Also:
getArgs(), ExecBinding.EXEC_COMMAND_ARGS

getWorkingDir

public String getWorkingDir()
Returns:
the working directory of the executable, or null is such is not set.
See Also:
ExecBinding.EXEC_COMMAND_WORKING_DIR

setWorkingDir

public void setWorkingDir(String dir)
Sets the working directory of the executable.

Parameters:
dir - the working directory of the executable. null values indicates that the current working directory will be used.

getTimeout

public long getTimeout()
Returns:
The returned value is always a positive long. The default value is NO_TIMEOUT
See Also:
ExecBinding.EXEC_COMMAND_TIMEOUT

setTimeout

public void setTimeout(long timeout)
Sets the timeout.

Parameters:
timeout - The timeout must be a positive long
See Also:
ExecBinding.EXEC_COMMAND_TIMEOUT

getOutFile

public String getOutFile()
Returns:
null if no out file is set, otherwise returns the value of the outFile
See Also:
ExecBinding.EXEC_COMMAND_OUT_FILE

setOutFile

public void setOutFile(String outFile)
Parameters:
outFile - a not-empty file path
See Also:
ExecBinding.EXEC_COMMAND_OUT_FILE

getCommandExecutor

public ExecCommandExecutor getCommandExecutor()
Returns:
The command executor used to execute commands. Defaults to DefaultExecCommandExecutor

setCommandExecutor

public void setCommandExecutor(ExecCommandExecutor commandExecutor)
Sets a custom executor to execute commands.

Parameters:
commandExecutor - a not-null instance of ExecCommandExecutor

getBinding

public ExecBinding getBinding()

setBinding

public void setBinding(ExecBinding binding)

isUseStderrOnEmptyStdout

public boolean isUseStderrOnEmptyStdout()

setUseStderrOnEmptyStdout

public void setUseStderrOnEmptyStdout(boolean useStderrOnEmptyStdout)


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