Class SystemCommandExecutorService

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, Service, StateManagedComponent

    @ComponentProfile(summary="Execute an arbitrary system command (DANGER!)",
                      tag="service")
    public class SystemCommandExecutorService
    extends ServiceImp
    Service that runs the specified system executable with the provided arguments, optionally capturing the output.

    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:

    • The exitcode is stored against the metadata key "SystemCommandExecutorService.ReturnValue" if the service does not throw an exception.
    • If a timeout occurs then a ServiceException is thrown, output that was captured before the timeout should still be available

    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.