@ComponentProfile(summary="Execute an arbitrary system command (DANGER!)", tag="service") public class SystemCommandExecutorService extends ServiceImp
Note that no checking is peformed on the command to be executed; it will be executed as-is. If used in combination with
DynamicServiceExecutor
or DynamicServiceLocator
then you might have a large security hole if it is improperly
configured or validated.
The following behaviour is non-configurable:
In the adapter configuration file this class is aliased as system-command-executor which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMMAND_RETURN_VALUE_METADATA_KEY |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
SystemCommandExecutorService() |
SystemCommandExecutorService(CommandBuilder builder,
CommandOutputCapture capture) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Invokes the command line executable
|
CommandBuilder |
getCommandBuilder() |
CommandOutputCapture |
getOutputCapture() |
TimeInterval |
getTimeout() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setCommandBuilder(CommandBuilder builder)
Set the command builder.
|
void |
setOutputCapture(CommandOutputCapture outputCapture) |
void |
setTimeout(TimeInterval t)
Specifies a maximum time for the executable to run, after which it will be terminated.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public static final java.lang.String COMMAND_RETURN_VALUE_METADATA_KEY
public SystemCommandExecutorService()
public SystemCommandExecutorService(CommandBuilder builder, CommandOutputCapture capture)
public void doService(AdaptrisMessage msg) throws ServiceException
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
sService.doService(com.adaptris.core.AdaptrisMessage)
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public CommandBuilder getCommandBuilder()
public void setCommandBuilder(CommandBuilder builder)
builder
- the CommandBuilder
implementationDefaultCommandBuilder
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public void setTimeout(TimeInterval t)
t
- the timeout; default if not configured is 30 seconds.public TimeInterval getTimeout()
public CommandOutputCapture getOutputCapture()
public void setOutputCapture(CommandOutputCapture outputCapture)