LibreOffice Module framework (master) 1
|
implements a job component which can be used to execute system shell commands. More...
#include <shelljob.hxx>
Public Member Functions | |
ShellJob (css::uno::Reference< css::uno::XComponentContext > xContext) | |
create new instance of this class. More... | |
virtual | ~ShellJob () override |
does nothing real ... More... | |
virtual OUString SAL_CALL | getImplementationName () override |
virtual sal_Bool SAL_CALL | supportsService (const OUString &sServiceName) override |
virtual css::uno::Sequence< OUString > SAL_CALL | getSupportedServiceNames () override |
virtual css::uno::Any SAL_CALL | execute (const css::uno::Sequence< css::beans::NamedValue > &lArguments) override |
Private Member Functions | |
OUString | impl_substituteCommandVariables (const OUString &sCommand) |
substitute all might existing placeholder variables within the configured command. More... | |
bool | impl_execute (const OUString &sCommand, const css::uno::Sequence< OUString > &lArguments, bool bCheckExitCode) |
executes the command. More... | |
Static Private Member Functions | |
static css::uno::Any | impl_generateAnswer4Deactivation () |
generate a return value for method execute() which will force deactivation of this job for further requests. More... | |
Private Attributes | |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
reference to a uno service manager. More... | |
implements a job component which can be used to execute system shell commands.
@descr Because the job will be implemented generic it can be bound to any event where jobs can be registered for. Further there is a generic way to configure the shell command and it's list of arguments.
Definition at line 39 of file shelljob.hxx.
framework::ShellJob::ShellJob | ( | css::uno::Reference< css::uno::XComponentContext > | xContext | ) |
create new instance of this class.
xContext | reference to the uno service manager, which created this instance. Can be used later to create own needed uno resources on demand. |
Definition at line 59 of file shelljob.cxx.
|
overridevirtual |
does nothing real ...
@descr But it should exists as virtual function, so this class can't make trouble related to inline/symbols etcpp.!
Definition at line 64 of file shelljob.cxx.
|
overridevirtual |
address job configuration inside argument set provided on method execute().
Definition at line 68 of file shelljob.cxx.
References comphelper::SequenceAsHashMap::getUnpackedValueOrDefault(), impl_execute(), impl_generateAnswer4Deactivation(), and impl_substituteCommandVariables().
|
overridevirtual |
Definition at line 43 of file shelljob.cxx.
|
overridevirtual |
Definition at line 53 of file shelljob.cxx.
References framework::SERVICENAME_JOB.
|
private |
executes the command.
sCommand | the absolute command as URL or system path (without any argument !). |
lArguments | the complete list of arguments configured for these job. |
bCheckExitCode | bind the execution result to the exit code of the started process. If it's set to false we return false only in case executable couldn't be found or couldn't be started. |
Definition at line 125 of file shelljob.cxx.
Referenced by execute().
|
staticprivate |
generate a return value for method execute() which will force deactivation of this job for further requests.
Definition at line 103 of file shelljob.cxx.
References framework::JobConst::ANSWER_DEACTIVATE_JOB.
Referenced by execute().
|
private |
substitute all might existing placeholder variables within the configured command.
The command is part of the job configuration. These will make changes more easy (no code changes required). Further the command can use placeholder as they are supported by the global substitution service (e.g. etcpp)
sCommand | the command containing placeholder variables. |
Definition at line 109 of file shelljob.cxx.
References m_xContext.
Referenced by execute().
|
overridevirtual |
Definition at line 48 of file shelljob.cxx.
References sServiceName, and cppu::supportsService().
|
private |
reference to a uno service manager.
Definition at line 46 of file shelljob.hxx.
Referenced by impl_substituteCommandVariables().