public override void Execute(IExecutionEntity execution) { ReadFields(execution); IList <string> argList = new List <string> { commandStr }; if (!(arg1Str is null)) { argList.Add(arg1Str); } if (!(arg2Str is null)) { argList.Add(arg2Str); } if (!(arg3Str is null)) { argList.Add(arg3Str); } if (!(arg4Str is null)) { argList.Add(arg4Str); } if (!(arg5Str is null)) { argList.Add(arg5Str); } ShellExecutorContext executorContext = new ShellExecutorContext(waitFlag, cleanEnvBoolean, redirectErrorFlag, directoryStr, resultVariableStr, errorCodeVariableStr, argList); ICommandExecutorFactory shellCommandExecutorFactory = CommandExecutorContext.ShellCommandExecutorFactory; ICommandExecutor commandExecutor; if (shellCommandExecutorFactory != null) { // if there is a ShellExecutorFactoryProvided // then it will be used to create a desired shell command executor. commandExecutor = shellCommandExecutorFactory.CreateExecutor(executorContext); } else { // default Shell executor (if the shell security is OFF) commandExecutor = new ShellCommandExecutor(executorContext); } try { commandExecutor.ExecuteCommand(execution); } catch (Exception e) { throw new ActivitiException("Could not execute shell command ", e); } Leave(execution); }
public Configuration CommandExecutorFactoryOf(ICommandExecutorFactory commandExecutorFactory) { CommandExecutorFactory = commandExecutorFactory; return this; }
/// <summary> /// 创建命令总线的一个实例 /// </summary> /// <param name="executorFactory">命令执行器工厂</param> public CommandBus(ICommandExecutorFactory executorFactory) { this.executorFactory = executorFactory; }
/// <summary> /// 创建命令总线的一个实例 /// </summary> /// <param name="executorFactory">命令执行器工厂</param> public CommandBus(IServiceProvider serviceProvider, ICommandExecutorFactory executorFactory) { _serviceProvider = serviceProvider; _executorFactory = executorFactory; }