Search in sources :

Example 1 with CommandSender

use of nl.nn.adapterframework.senders.CommandSender in project iaf by ibissource.

the class FlowDiagram method runCommandSender.

private void runCommandSender(File dotFile, File outFile) throws SenderException, ConfigurationException, TimeOutException {
    CommandSender commandSender = null;
    try {
        commandSender = new CommandSender();
        commandSender.setCommand(url);
        commandSender.setCommandWithArguments(true);
        commandSender.setTimeOut(10);
        Parameter p = new Parameter();
        p.setName("arg1");
        p.setValue("-T" + format);
        commandSender.addParameter(p);
        p = new Parameter();
        p.setName("arg2");
        p.setValue(dotFile.getPath());
        commandSender.addParameter(p);
        p = new Parameter();
        p.setName("arg3");
        p.setValue("-o");
        commandSender.addParameter(p);
        p = new Parameter();
        p.setName("arg4");
        p.setValue(outFile.getPath());
        commandSender.addParameter(p);
        commandSender.configure();
        commandSender.open();
        ParameterResolutionContext prc = new ParameterResolutionContext("dummy", new PipeLineSessionBase());
        String result = commandSender.sendMessage(null, "", prc);
    } finally {
        if (commandSender != null) {
            commandSender.close();
        }
    }
}
Also used : Parameter(nl.nn.adapterframework.parameters.Parameter) CommandSender(nl.nn.adapterframework.senders.CommandSender) ParameterResolutionContext(nl.nn.adapterframework.parameters.ParameterResolutionContext) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Aggregations

PipeLineSessionBase (nl.nn.adapterframework.core.PipeLineSessionBase)1 Parameter (nl.nn.adapterframework.parameters.Parameter)1 ParameterResolutionContext (nl.nn.adapterframework.parameters.ParameterResolutionContext)1 CommandSender (nl.nn.adapterframework.senders.CommandSender)1