|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knime.core.node.Node
public final class Node
Implementation of a node as basic processing unit within the workflow. A Node
object is the place where the data flow starts, ends, or intersects. Thus a
Node can be connected with predecessors and successors through its input and
output ports, NodeInPort and
NodeOutPort, respectively. There are
data ports for exchanging data tables, and prediction model ports for
transferring computed data models.
A node must contain a NodeModel and may contain NodeViews
and a NodeDialogPane implementing the Model-View-Controller paradigm.
The node manages the interactions between these components and handles all
internal and external data flows. Incoming data is passed to the
NodeModel and forwarded from there to the node's ports.
The Node is the part within a workflow holding and managing
the user specific NodeModel, NodeDialogPane, and possibly
NodeView, thus, it is not intended to extend this class. A
NodeFactory is used to bundle model, view and dialog. This factory is
passed to the node constructor to create a node of that specific type.
| Nested Class Summary | |
|---|---|
(package private) static class |
Node.Input
Keeps information about incoming connectors (type and name). |
static class |
Node.LoopRole
|
(package private) static class |
Node.Output
Keeps outgoing information (specs, objects, HiLiteHandlers...). |
(package private) static class |
Node.SettingsLoaderAndWriter
|
| Field Summary | |
|---|---|
static String |
CFG_MISC_SETTINGS
Config for node (and node container) settings which are shown in the dialog. |
static String |
CFG_MODEL
The sub settings entry where the model can save its setup. |
static String |
CFG_VARIABLES
The sub settings entry containing the flow variable settings. |
| Constructor Summary | |
|---|---|
Node(NodeFactory<NodeModel> nodeFactory)
Creates a new node by retrieving the model, dialog, and views, from the specified NodeFactory. |
|
Node(NodeFactory<NodeModel> nodeFactory,
NodeCreationContext context)
|
|
| Method Summary | |
|---|---|
void |
addMessageListener(NodeMessageListener listener)
Adds a state listener to this node. |
void |
addToTemporaryTables(Set<ContainerTable> tempTables)
Adds the argument set of tables to the set of temporary tables in this node. |
boolean |
areSettingsValid(NodeSettingsRO settings)
Validates the argument settings. |
void |
cleanOutPorts()
|
void |
cleanup()
Deletes any temporary resources associated with this node. |
void |
clearLoopContext()
|
void |
closeAllViews()
Closes all views. |
boolean |
configure(PortObjectSpec[] inSpecs)
Sets all (new) incoming DataTableSpec elements in the
model, calls the model to create output table specs and propagates these
new specs to the connected successors. |
boolean |
configure(PortObjectSpec[] rawInSpecs,
NodePostConfigure postConfigure)
Allows passing an object that may modify the specs created by the NodeModel, for example in case the node is wrapped and the
output is modified. |
static boolean |
containsInactiveObjects(PortObject[] ins)
Iterates the argument array and returns true if any element is instance of InactiveBranchPortObject. |
static PortObject |
copyPortObject(PortObject portObject,
ExecutionMonitor exec)
Copies the PortObject so that the copy can be given to the node model implementation (and potentially modified). |
CopyNodePersistor |
createCopyPersistor()
Create a persistor that is used to paste a copy of this node into the same or a different workflow. |
NodeExecutionResult |
createNodeExecutionResult(ExecutionMonitor exec)
Creates an execution result containing all calculated values in a execution. |
void |
ensureOutputDataIsRead()
Ensures that any port object is read for later saving with a newer version. |
boolean |
execute(PortObject[] rawData,
ExecutionContext exec)
Starts executing this node. |
CredentialsProvider |
getCredentialsProvider()
|
NodeDialogPane |
getDialogPane()
Get reference to the node dialog instance. |
NodeDialogPane |
getDialogPaneWithSettings(PortObjectSpec[] inSpecs,
NodeSettingsRO settings,
boolean isWriteProtected)
|
NodeFactory<NodeModel> |
getFactory()
Deprecated. don't use the factory directly - all calls should be delegated through this class (the node). |
FlowObjectStack |
getFlowObjectStack()
|
String |
getInportDescriptionName(int index)
Return the name of the port as specified by the node factory (which takes it from the node description). |
String |
getInportName(int index)
Return name of input connector. |
PortType |
getInputType(int index)
Return type of input connector. |
BufferedDataTable[] |
getInternalHeldTables()
Get the current set of tables internally held by a NodeModel that implements BufferedDataTableHolder. |
static HashMap<Integer,ContainerTable> |
getLocalTableRepositoryFromContext(ExecutionContext c)
Delegate method to allow access to the (package scope) method ExecutionContext.getLocalTableRepository(). |
FlowLoopContext |
getLoopContext()
|
Node.LoopRole |
getLoopRole()
|
String |
getName()
Returns the name for this node. |
NodeModel |
getNodeModel()
|
int |
getNrInPorts()
|
int |
getNrOutPorts()
|
int |
getNrViews()
|
FlowObjectStack |
getOutgoingFlowObjectStack()
Get list of flow variables that are added by NodeModel implementation. |
String |
getOutportDescriptionName(int index)
Return the name of the port as specified by the node factory (which takes it from the node description). |
String |
getOutportName(int index)
Return name of output connector. |
HiLiteHandler |
getOutputHiLiteHandler(int index)
|
PortObject |
getOutputObject(int index)
|
String |
getOutputObjectSummary(int index)
|
PortObjectSpec |
getOutputSpec(int index)
|
PortType |
getOutputType(int index)
Return type of output connector. |
boolean |
getPauseLoopExecution()
|
NodeFactory.NodeType |
getType()
Returns the type for this node. |
AbstractNodeView<?> |
getView(int viewIndex,
String title)
Return a new instance of the node's view (without opening it). |
String |
getViewName(int viewIndex)
Returns the name for this node's view at the given index. |
String |
getWarningMessageFromModel()
Getter for the currently set node warning message in the corresponding NodeModel. |
Element |
getXMLDescription()
The XML description can be used with the NodeFactoryHTMLCreator in order to get a converted HTML
description of it, which fits the overall KNIME HTML style. |
(package private) boolean |
hasContent()
Delegate method to node model. |
boolean |
hasDialog()
Returns true if this node can show a dialog. |
static void |
invokeCloseView(AbstractNodeView<?> view)
Widens scope of AbstractNodeView.closeView() method so it
can be called from UI framework components. |
static void |
invokeEnsureOpen(BufferedDataTable table)
Exposes BufferedDataTable.ensureOpen() as public method. |
static void |
invokeOpenView(AbstractNodeView<?> view,
String title)
Widens scope of AbstractNodeView.openView(String) method so it
can be called from UI framework components. |
boolean |
isInactive()
|
boolean |
isInactiveBranchConsumer()
Returns true if the contained model is an instance of InactiveBranchConsumer. |
boolean |
isInterruptible()
|
(package private) void |
load(NodePersistor loader,
ExecutionMonitor exec,
WorkflowPersistor.LoadResult loadResult)
Load settings and data + internals from a loader instance. |
void |
loadDataAndInternals(NodeContentPersistor loader,
ExecutionMonitor exec,
WorkflowPersistor.LoadResult loadResult)
Loads data from an argument persistor. |
(package private) void |
loadInternals(File internDir,
ExecutionMonitor exec)
|
void |
loadSettingsFrom(NodeSettingsRO settings)
Loads the settings (but not the data) from the given settings object. |
void |
putOutputTablesIntoGlobalRepository(HashMap<Integer,ContainerTable> rep)
Enumerates the output tables and puts them into the global workflow repository of tables. |
void |
removeMessageListener(NodeMessageListener listener)
Removes a state listener from this node. |
int |
removeOutputTablesFromGlobalRepository(HashMap<Integer,ContainerTable> rep)
Reverse operation to putOutputTablesIntoGlobalRepository(HashMap). |
void |
reset()
Resets this node without re-configuring it. |
boolean |
resetAndConfigureLoopBody()
|
(package private) void |
saveInternals(File internDir,
ExecutionMonitor exec)
|
void |
saveSettingsTo(NodeSettingsWO settings)
Saves the settings (but not the data). |
void |
setCredentialsProvider(CredentialsProvider provider)
Sets credentials in model. |
void |
setFlowObjectStack(FlowObjectStack scsc,
FlowObjectStack outgoingFlowObjectStack)
|
void |
setInHiLiteHandler(int index,
HiLiteHandler hdl)
|
void |
setLoopEndNode(Node tail)
|
void |
setLoopStartNode(Node head)
|
void |
setName(String nodeName)
Sets a new name for this node. |
void |
setPauseLoopExecution(boolean ple)
|
String |
toString()
Returns a string summary of this node. |
void |
warningChanged(String warningMessage)
Is called, when a warning message is set in the NodeModel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String CFG_MISC_SETTINGS
public static final String CFG_MODEL
public static final String CFG_VARIABLES
| Constructor Detail |
|---|
public Node(NodeFactory<NodeModel> nodeFactory)
NodeFactory. Also initializes the input and output
ports for the given number of data and model port. This node is
configured after initialization.
nodeFactory - the node's factory for the creation of model, view,
and dialog
IllegalArgumentException - If the nodeFactory is
null.
public Node(NodeFactory<NodeModel> nodeFactory,
NodeCreationContext context)
| Method Detail |
|---|
public CopyNodePersistor createCopyPersistor()
void load(NodePersistor loader,
ExecutionMonitor exec,
WorkflowPersistor.LoadResult loadResult)
throws CanceledExecutionException
loader - To load fromexec - For progress information/cancelationloadResult - Where to report errors/warnings to
CanceledExecutionException - If canceled.
public NodeExecutionResult createNodeExecutionResult(ExecutionMonitor exec)
throws CanceledExecutionException
#loadDataAndInternals(
NodeContentPersistor, ExecutionMonitor, LoadResult).
If this node is not executed, it will assign null values to the fields
in the returned execution result.
exec - For progress information.
CanceledExecutionException - If canceled
public void loadDataAndInternals(NodeContentPersistor loader,
ExecutionMonitor exec,
WorkflowPersistor.LoadResult loadResult)
loader - To load from.exec - For progress.loadResult - to add errors and warnings to (if any)
public void loadSettingsFrom(NodeSettingsRO settings)
throws InvalidSettingsException
settings - a settings object
InvalidSettingsException - if an expected setting is missingpublic boolean areSettingsValid(NodeSettingsRO settings)
settings - a settings object
public String getName()
public NodeFactory.NodeType getType()
public Element getXMLDescription()
NodeFactoryHTMLCreator in order to get a converted HTML
description of it, which fits the overall KNIME HTML style.
NodeFactory.getXMLDescription()public void setName(String nodeName)
nodeName - The node's new name.
NullPointerException - If the name is null.public int getNrInPorts()
public int getNrOutPorts()
public String getInportName(int index)
index - of the connector
IndexOutOfBoundsException - If argument is out of range.public String getInportDescriptionName(int index)
index - the port index
public PortType getInputType(int index)
index - of the connector
IndexOutOfBoundsException - If argument is out of range.public String getOutportName(int index)
index - of the connector
IndexOutOfBoundsException - If argument is out of range.public String getOutportDescriptionName(int index)
index - the port index
public PortType getOutputType(int index)
index - of the connector
IndexOutOfBoundsException - If argument is out of range.public PortObjectSpec getOutputSpec(int index)
public PortObject getOutputObject(int index)
public String getOutputObjectSummary(int index)
public HiLiteHandler getOutputHiLiteHandler(int index)
public BufferedDataTable[] getInternalHeldTables()
BufferedDataTableHolder. It may be null or contain
null elements. This array is modified upon load, execute and reset.
public void setInHiLiteHandler(int index,
HiLiteHandler hdl)
boolean hasContent()
NodeModel.hasContent()public boolean isInactive()
InactiveBranchPortObjectSpecpublic boolean isInactiveBranchConsumer()
InactiveBranchConsumer.
public static boolean containsInactiveObjects(PortObject[] ins)
InactiveBranchPortObject.
ins - The input data
public boolean execute(PortObject[] rawData,
ExecutionContext exec)
true.
Otherwise, the procedure starts executing all predecessor nodes connected
to an input port (which in turn recursively trigger their predecessors)
and calls the function #execute() in the model after all
connected nodes return successfully. If a port is not connected this
function returns false without executing itself (it may have executed
some predecessor nodes though). If a predecessor node returns false this
method also returns false without executing this node or any further
connected node.
rawData - the data from the predecessor.exec - The execution monitor.
true if execution was successful otherwise
false.NodeModel.execute(BufferedDataTable[],ExecutionContext)
public static PortObject copyPortObject(PortObject portObject,
ExecutionMonitor exec)
throws IOException,
CanceledExecutionException
Note that this method is meant to be used by the framework only.
portObject - The object to be copied.exec - For progress/cancel
IOException - In case of exceptions while accessing the stream or
if the argument is an instance of BufferedDataTable.
CanceledExecutionException - If canceled.public void warningChanged(String warningMessage)
NodeModel.
Forwards it to registered NodeMessageListeners.
warningChanged in interface NodeModelWarningListenerwarningMessage - the new message in the node model.public String getWarningMessageFromModel()
public void reset()
public void cleanOutPorts()
public void addToTemporaryTables(Set<ContainerTable> tempTables)
tempTables - Tables to add, not null.public void putOutputTablesIntoGlobalRepository(HashMap<Integer,ContainerTable> rep)
rep - The global repository.public int removeOutputTablesFromGlobalRepository(HashMap<Integer,ContainerTable> rep)
putOutputTablesIntoGlobalRepository(HashMap). It will remove
all output tables and its delegates from the global table repository.
rep - The global table rep.
public static HashMap<Integer,ContainerTable> getLocalTableRepositoryFromContext(ExecutionContext c)
ExecutionContext.getLocalTableRepository(). Called after
execution has finished to clean up temporary tables.
c - To access.
public void cleanup()
public boolean configure(PortObjectSpec[] inSpecs)
DataTableSpec elements in the
model, calls the model to create output table specs and propagates these
new specs to the connected successors.
inSpecs - the tablespecs from the predecessors
public boolean configure(PortObjectSpec[] rawInSpecs,
NodePostConfigure postConfigure)
NodeModel, for example in case the node is wrapped and the
output is modified.
rawInSpecs - table specs from the predecessorspostConfigure - object called after node model calculated output
specs
public int getNrViews()
public String getViewName(int viewIndex)
viewIndex - The view index.
ArrayIndexOutOfBoundsException - If the view index is out of range.
public AbstractNodeView<?> getView(int viewIndex,
String title)
viewIndex - The view's index to show up.title - the displayed view title.
ArrayIndexOutOfBoundsException - If the view index is out of range.public void closeAllViews()
public boolean hasDialog()
true if a dialog is available.
public NodeDialogPane getDialogPaneWithSettings(PortObjectSpec[] inSpecs,
NodeSettingsRO settings,
boolean isWriteProtected)
throws NotConfigurableException
inSpecs - The input specs, which will be forwarded to the dialog's
NodeDialogPane.loadSettingsFrom(NodeSettingsRO,
PortObjectSpec[]).settings - The current settings of this node. The settings object
will also contain the settings of the outer SNC.isWriteProtected - Whether write protected, see
WorkflowManager.isWriteProtected().
NotConfigurableException - if the dialog cannot be opened because
of real invalid settings or if any preconditions are not
fulfilled, e.g. no predecessor node, no nominal column in
input table, etc.
IllegalStateException - If node has no dialog.hasDialog()public NodeDialogPane getDialogPane()
#getDialogPaneWithSettings(PortObjectSpec[], NodeSettingsRO)
IllegalStateException - If node has no dialog.hasDialog()public void saveSettingsTo(NodeSettingsWO settings)
settings - a settings object
void saveInternals(File internDir,
ExecutionMonitor exec)
throws CanceledExecutionException
CanceledExecutionException
void loadInternals(File internDir,
ExecutionMonitor exec)
throws CanceledExecutionException
CanceledExecutionExceptionpublic void addMessageListener(NodeMessageListener listener)
listener - The listener to add.public void removeMessageListener(NodeMessageListener listener)
listener - The listener to remove.public String toString()
toString in class Object@Deprecated public NodeFactory<NodeModel> getFactory()
NodeFactory that constructed this node.public NodeModel getNodeModel()
public boolean isInterruptible()
public void ensureOutputDataIsRead()
public static void invokeEnsureOpen(BufferedDataTable table)
BufferedDataTable.ensureOpen() as public method. This
method has been added here in order to keep the scope of the above method
at a minimum.
table - To invoke this method on.
public static void invokeOpenView(AbstractNodeView<?> view,
String title)
AbstractNodeView.openView(String) method so it
can be called from UI framework components. This method is not meant for
public use and may change in future versions.
view - The view to call the method on.title - The title for the view (method argument).public static void invokeCloseView(AbstractNodeView<?> view)
AbstractNodeView.closeView() method so it
can be called from UI framework components. This method is not meant for
public use and may change in future versions.
view - The view to call the method on.
public void setFlowObjectStack(FlowObjectStack scsc,
FlowObjectStack outgoingFlowObjectStack)
public FlowObjectStack getFlowObjectStack()
public FlowObjectStack getOutgoingFlowObjectStack()
public void clearLoopContext()
public FlowLoopContext getLoopContext()
public boolean getPauseLoopExecution()
public void setPauseLoopExecution(boolean ple)
public final Node.LoopRole getLoopRole()
public void setLoopEndNode(Node tail)
public void setLoopStartNode(Node head)
public boolean resetAndConfigureLoopBody()
NodeModel.resetAndConfigureLoopBody()public void setCredentialsProvider(CredentialsProvider provider)
provider - provider to set.public CredentialsProvider getCredentialsProvider()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||