@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 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| 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, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stoppublic 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 ExceptionsService.doService(com.adaptris.core.AdaptrisMessage)protected void initService()
throws CoreException
initService in class ServiceImpCoreExceptionprotected void closeService()
closeService in class ServiceImppublic CommandBuilder getCommandBuilder()
public void setCommandBuilder(CommandBuilder builder)
builder - the CommandBuilder implementationDefaultCommandBuilderpublic void prepare()
throws CoreException
ComponentLifecycleExtensionCoreExceptionpublic 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)