Skip navigation links

Package org.knime.base.node.util.exttool

Provides functionality for nodes that want to launch external programs.
The CommandExecution can be used to run the external program.

See: Description

Package org.knime.base.node.util.exttool Description

Provides functionality for nodes that want to launch external programs.
The CommandExecution can be used to run the external program. It will pick up its output (to standard out and to standard error out), log it to the log file, and keep the last 500 lines in two buffers. It will try to destroy the process if the user cancels (through the execution context). And it will return the exit code from the external program.
The two views provided display a text field and react to ViewUpdateNotice events. One is meant to display output to standard error, the other to standard output.
The provided NodeModel is meant to clue it all together, and here is how: Create your own NodeModel by extending ExtToolOutputNodeModel. In the execute method use the CommandExecution to execute the external program. Register your NodeModel as Observer with it, to see the output in the views during execution (addObserver). Provide the execution context you get in the parameter list. If the execution succeeds (and returns with an OK exit code) save the output through the #setExternalOutput(LinkedList) and #setExternalErrorOutput(LinkedList) methods. You get the output from the CommandExecution object. If the execution throws an Exception, or exists with an error exit code, save the output with the methods #setFailedExternalOutput(LinkedList) and #setFailedExternalErrorOutput(LinkedList). The NodeModel takes care of saving and loading these buffers when the workflow is saved/loaded (don't forget to call the super implementation if you override the save/load internals methods).
To provide views to display the output, in your NodeFactory create instances of ExtToolStdoutNodeView (for a view of the output to standard out) and/or ExtToolStderrNodeView (for a view of the output to standard error).
Skip navigation links

Copyright, 2003 - 2016. All rights reserved.
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.