|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.workflow.NodeContainer
public abstract class NodeContainer
Abstract super class for containers holding node or just structural information of a meta node. Also stores additional (optional) information such as coordinates on a workflow layout.
Nested Class Summary | |
---|---|
static class |
NodeContainer.NodeContainerSettings
Helper class that defines load/save routines for general NodeContainer properties. |
static class |
NodeContainer.State
possible status values of a NodeContainer. |
Field Summary | |
---|---|
protected Object |
m_nodeMutex
semaphore to make sure never try to work on inconsistent internal node states. |
Constructor Summary | |
---|---|
NodeContainer(WorkflowManager parent,
NodeID id)
Create new NodeContainer with IDLE state. |
|
NodeContainer(WorkflowManager parent,
NodeID id,
NodeContainerMetaPersistor persistor)
|
Method Summary | |
---|---|
boolean |
addJobManagerChangedListener(JobManagerChangedListener l)
|
boolean |
addNodeMessageListener(NodeMessageListener listener)
|
boolean |
addNodeStateChangeListener(NodeStateChangeListener listener)
|
boolean |
addProgressListener(NodeProgressListener listener)
|
void |
addUIInformationListener(NodeUIInformationListener l)
|
void |
addWaitingLoop(FlowLoopContext slc)
add a loop to the list of waiting loops. |
void |
applySettingsFromDialog()
Take settings from the node's dialog and apply them to the model. |
abstract boolean |
areDialogAndNodeSettingsEqual()
|
boolean |
areDialogSettingsValid()
|
(package private) boolean |
areSettingsValid(NodeSettingsRO settings)
|
(package private) abstract void |
cancelExecution()
Cancel execution of a marked, queued, or executing node. |
(package private) void |
cleanup()
Method that's called when the node is discarded. |
void |
clearWaitingLoopList()
clears the list of waiting loops. |
protected void |
closeAllJobManagerViews()
|
(package private) void |
continueExecutionOnLoad(PortObject[] inData,
NodeSettingsRO settings)
Called upon load when the node has been saved as remotely executing. |
abstract NodeContainerExecutionResult |
createExecutionResult(ExecutionMonitor exec)
Saves all internals that are necessary to mimic the computed result into a new execution result object. |
NodeExecutionJobManager |
findJobManager()
|
protected abstract NodeContainerPersistor |
getCopyPersistor(HashMap<Integer,ContainerTable> tableRep,
boolean preserveDeletableFlags)
Get a new persistor that is used to copy this node (copy&paste action). |
String |
getCustomDescription()
|
String |
getCustomName()
|
(package private) abstract NodeDialogPane |
getDialogPane()
|
NodeDialogPane |
getDialogPaneWithSettings()
Return a NodeDialogPane for a node which can be embedded into a JFrame oder another GUI element. |
(package private) abstract NodeDialogPane |
getDialogPaneWithSettings(PortObjectSpec[] inSpecs)
|
String |
getDisplayLabel()
|
(package private) NodeExecutionJob |
getExecutionJob()
|
abstract URL |
getIcon()
|
NodeID |
getID()
|
abstract NodeInPort |
getInPort(int index)
|
NodeExecutionJobManager |
getJobManager()
|
abstract String |
getName()
|
String |
getNameWithID()
|
protected ReferencedFile |
getNodeContainerDirectory()
|
NodeMessage |
getNodeMessage()
Get the message to be displayed to the user. |
abstract AbstractNodeView<NodeModel> |
getNodeView(int i)
Return the view with the specified index provided by the node. |
abstract String |
getNodeViewName(int i)
|
abstract int |
getNrInPorts()
|
abstract int |
getNrNodeViews()
Returns the number of views provided by the node implementation. |
abstract int |
getNrOutPorts()
|
int |
getNrViews()
|
abstract NodeOutPort |
getOutPort(int index)
|
WorkflowManager |
getParent()
|
(package private) NodeProgressMonitor |
getProgressMonitor()
|
(package private) NodeContainer.NodeContainerSettings.SplitType |
getSplitType()
|
NodeContainer.State |
getState()
|
abstract NodeFactory.NodeType |
getType()
|
UIInformation |
getUIInformation()
Returns the UI information. |
AbstractNodeView<NodeModel> |
getView(int i)
|
String |
getViewName(int i)
|
List<FlowLoopContext> |
getWaitingLoops()
|
abstract boolean |
hasDialog()
|
boolean |
isDeletable()
|
boolean |
isDirty()
|
protected abstract boolean |
isLocalWFM()
Is this node a to be locally executed workflow. |
(package private) abstract boolean |
isResetable()
|
(package private) abstract NodeID[] |
loadContent(NodeContainerPersistor persistor,
Map<Integer,BufferedDataTable> tblRep,
FlowObjectStack inStack,
ExecutionMonitor exec,
WorkflowPersistor.LoadResult loadResult,
boolean preserveNodeMessage)
Restore content from persistor. |
void |
loadExecutionResult(NodeContainerExecutionResult result,
ExecutionMonitor exec,
WorkflowPersistor.LoadResult loadResult)
Load information from execution result. |
(package private) void |
loadSettings(NodeSettingsRO settings)
|
(package private) abstract void |
markForExecution(boolean flag)
Enable (or disable) queuing of underlying node for execution. |
(package private) abstract void |
mimicRemoteExecuted(NodeContainerExecutionStatus status)
Put this node into either the NodeContainer.State.EXECUTED or
NodeContainer.State.IDLE state depending on the argument. |
(package private) abstract void |
mimicRemoteExecuting()
Marks this node as remotely executing. |
(package private) abstract void |
mimicRemotePostExecute()
Puts this node (and all its children) into the NodeContainer.State.POSTEXECUTE
state. |
(package private) abstract void |
mimicRemotePreExecute()
Puts this node (and all its children) into the NodeContainer.State.PREEXECUTE
state. |
protected void |
notifyJobManagerChangedListener()
|
protected void |
notifyMessageListeners(NodeMessageEvent e)
Notifies all registered NodeMessageListener s about the new
message. |
(package private) void |
notifyParentExecuteFinished(NodeContainerExecutionStatus status)
Called immediately after the execution took place in the job executor. |
(package private) void |
notifyParentExecuteStart()
Invoked by the job executor immediately before the execution is triggered. |
(package private) void |
notifyParentPostExecuteStart()
Invoked by job manager when the execution is finishing. |
(package private) boolean |
notifyParentPreExecuteStart()
Invoked by job manager when the execution starts. |
protected void |
notifyProgressListeners(NodeProgressEvent e)
Notifies all registered NodeProgressListener s about the new
progress. |
protected void |
notifyStateChangeListeners(NodeStateEvent e)
Notifies all registered NodeStateChangeListener s about the new
state. |
protected void |
notifyUIListeners(NodeUIInformationEvent evt)
|
void |
openDialogInJFrame()
Launch a node dialog in its own JFrame (a JDialog). |
(package private) abstract void |
performShutdown()
Called when the workflow is to be disposed. |
(package private) abstract void |
performStateTransitionEXECUTED(NodeContainerExecutionStatus status)
This should be used to change the nodes states correctly (and likely needs to be synchronized with other changes visible to successors of this node as well!) AFTER the actual execution. |
(package private) abstract void |
performStateTransitionEXECUTING()
This should be used to change the nodes states correctly (and likely needs to be synchronized with other changes visible to successors of this node as well!) BEFORE the actual execution. |
(package private) abstract void |
performStateTransitionPOSTEXECUTE()
Called when the state of a node should switch from NodeContainer.State.EXECUTING (or NodeContainer.State.EXECUTINGREMOTELY ) to
NodeContainer.State.POSTEXECUTE . |
(package private) abstract boolean |
performStateTransitionPREEXECUTE()
Called when the state of a node should switch from NodeContainer.State.QUEUED to NodeContainer.State.PREEXECUTE . |
void |
progressChanged(NodeProgressEvent pe)
Invoked when the progress has changed. |
(package private) void |
queue(PortObject[] inData)
Change state of marked (for execution) node to queued once it has been assigned to a NodeExecutionJobManager. |
boolean |
removeJobManagerChangedListener(JobManagerChangedListener l)
|
boolean |
removeNodeMessageListener(NodeMessageListener listener)
|
boolean |
removeNodeProgressListener(NodeProgressListener listener)
|
boolean |
removeNodeStateChangeListener(NodeStateChangeListener listener)
|
void |
removeUIInformationListener(NodeUIInformationListener l)
|
void |
removeWaitingLoopHeadNode(FlowObject so)
Remove element from list of waiting loops. |
protected void |
resetJobManagerViews()
Must be called when the node is reset. |
protected void |
saveExecutionResult(NodeContainerExecutionResult result)
Saves all information that is held in this abstract NodeContainer into the argument. |
(package private) void |
saveNodeExecutionJobReconnectInfo(NodeSettingsWO settings)
|
(package private) void |
saveSettings(NodeSettingsWO settings)
|
void |
setCustomDescription(String customDescription)
|
void |
setCustomName(String customName)
|
void |
setDirty()
Mark this node container to be changed, that is, it needs to be saved. |
(package private) void |
setExecutionJob(NodeExecutionJob executionJob)
|
(package private) void |
setJobManager(NodeExecutionJobManager je)
Set a new NodeExecutionJobManager for this node. |
protected void |
setNodeContainerDirectory(ReferencedFile directory)
|
void |
setNodeMessage(NodeMessage newMessage)
|
protected void |
setState(NodeContainer.State state)
Set new status and notify listeners. |
protected boolean |
setState(NodeContainer.State state,
boolean setDirty)
Set new status and notify listeners. |
void |
setUIInformation(UIInformation uiInformation)
|
protected void |
throwIllegalStateException()
Throws a new IllegalStateException with a meaningful error message containing node name, current state and method name. |
String |
toString()
|
(package private) void |
unsetDirty()
Called from persistor when node has been saved. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Object m_nodeMutex
Constructor Detail |
---|
NodeContainer(WorkflowManager parent, NodeID id)
parent
- the workflowmanager holding this nodeid
- the nodes identifierNodeContainer(WorkflowManager parent, NodeID id, NodeContainerMetaPersistor persistor)
Method Detail |
---|
public final WorkflowManager getParent()
void setJobManager(NodeExecutionJobManager je)
je
- the new job manager.public final NodeExecutionJobManager getJobManager()
findJobManager()
public final NodeExecutionJobManager findJobManager()
void setExecutionJob(NodeExecutionJob executionJob)
executionJob
- the executionJob to setNodeExecutionJob getExecutionJob()
public boolean addJobManagerChangedListener(JobManagerChangedListener l)
public boolean removeJobManagerChangedListener(JobManagerChangedListener l)
protected void notifyJobManagerChangedListener()
abstract boolean isResetable()
abstract void markForExecution(boolean flag)
flag
- determines if node is marked or unmarked for execution
IllegalStateException
- in case of illegal entry state.void queue(PortObject[] inData)
inData
- the incoming data for the execution
IllegalStateException
- in case of illegal entry state.abstract void mimicRemoteExecuting()
IllegalStateException
- In case of an illegal state transition.abstract void mimicRemotePreExecute()
NodeContainer.State.PREEXECUTE
state. This method is used when a workflow is executed remotely.
IllegalStateException
- In case of an illegal state (e.g. a node
is already executing).abstract void mimicRemotePostExecute()
NodeContainer.State.POSTEXECUTE
state. This method is used when a workflow is executed remotely.
IllegalStateException
- In case of an illegal state.abstract void mimicRemoteExecuted(NodeContainerExecutionStatus status)
NodeContainer.State.EXECUTED
or
NodeContainer.State.IDLE
state depending on the argument. This method is
applied recursively on all of this node's children (if a meta node).
status
- Where to get the success flag from.
IllegalStateException
- In case of an illegal state.void continueExecutionOnLoad(PortObject[] inData, NodeSettingsRO settings) throws InvalidSettingsException, NodeExecutionJobReconnectException
inData
- The input data for continued execution.settings
- the reconnect settings.
InvalidSettingsException
- If the settings are invalid
NodeExecutionJobReconnectException
- If that fails for any reason.abstract void performShutdown()
abstract void cancelExecution()
IllegalStateException
void saveNodeExecutionJobReconnectInfo(NodeSettingsWO settings)
boolean notifyParentPreExecuteStart()
WorkflowManager.doBeforePreExecution(NodeContainer)
method in
this node's parent. It will then call back on
performStateTransitionPREEXECUTE()
to allow for a synchronized
state transition.
void notifyParentExecuteStart()
IllegalFlowObjectStackException
- in case of wrongly connected
loops, for instance.void notifyParentPostExecuteStart()
WorkflowManager.doBeforePostExecution(NodeContainer)
method in this node's parent. It will then call back on
performStateTransitionPOSTEXECUTE()
to allow for a synchronized
state transition.
final void notifyParentExecuteFinished(NodeContainerExecutionStatus status)
status
- Whether the execution was successful.abstract boolean performStateTransitionPREEXECUTE()
NodeContainer.State.QUEUED
to NodeContainer.State.PREEXECUTE
. The method is to be
called from the node's parent in a synchronized environment.
abstract void performStateTransitionEXECUTING()
abstract void performStateTransitionPOSTEXECUTE()
NodeContainer.State.EXECUTING
(or NodeContainer.State.EXECUTINGREMOTELY
) to
NodeContainer.State.POSTEXECUTE
. The method is to be called from the node's
parent in a synchronized environment.
abstract void performStateTransitionEXECUTED(NodeContainerExecutionStatus status)
status
- indicates if execution was successfulpublic void addWaitingLoop(FlowLoopContext slc)
slc
- FlowLoopContext object of the loop.public List<FlowLoopContext> getWaitingLoops()
public void clearWaitingLoopList()
public void removeWaitingLoopHeadNode(FlowObject so)
so
- loop to be removed.NodeProgressMonitor getProgressMonitor()
public void progressChanged(NodeProgressEvent pe)
progressChanged
in interface NodeProgressListener
pe
- The progress event holding the progress information.public boolean addProgressListener(NodeProgressListener listener)
listener
- listener to the node progress
public boolean removeNodeProgressListener(NodeProgressListener listener)
listener
- existing listener to the node progress
protected void notifyProgressListeners(NodeProgressEvent e)
NodeProgressListener
s about the new
progress.
e
- the new progress eventpublic boolean addNodeMessageListener(NodeMessageListener listener)
listener
- listener to the node messages (warnings and errors)
public boolean removeNodeMessageListener(NodeMessageListener listener)
listener
- listener to the node messages
public final NodeMessage getNodeMessage()
public final void setNodeMessage(NodeMessage newMessage)
newMessage
- the nodeMessage to setprotected final void notifyMessageListeners(NodeMessageEvent e)
NodeMessageListener
s about the new
message.
e
- the new message eventpublic void addUIInformationListener(NodeUIInformationListener l)
public void removeUIInformationListener(NodeUIInformationListener l)
protected void notifyUIListeners(NodeUIInformationEvent evt)
public UIInformation getUIInformation()
public void setUIInformation(UIInformation uiInformation)
uiInformation
- new user interface information of the node such as
coordinates on workbench and custom name.protected void notifyStateChangeListeners(NodeStateEvent e)
NodeStateChangeListener
s about the new
state.
e
- the new state change eventpublic boolean addNodeStateChangeListener(NodeStateChangeListener listener)
listener
- listener to the node's state
public boolean removeNodeStateChangeListener(NodeStateChangeListener listener)
listener
- listener to the node's state.
public NodeContainer.State getState()
protected void setState(NodeContainer.State state)
state
- the new stateprotected boolean setState(NodeContainer.State state, boolean setDirty)
state
- the new statesetDirty
- whether to set this node "dirty" (needs save).
protected void throwIllegalStateException()
SingleNodeContainer
and WorkflowManager
.
public NodeDialogPane getDialogPaneWithSettings() throws NotConfigurableException
NotConfigurableException
- if node can not be configuredpublic void openDialogInJFrame() throws NotConfigurableException
NotConfigurableException
- if node can not be configuredpublic void applySettingsFromDialog() throws InvalidSettingsException
InvalidSettingsException
- if settings are not applicable.public boolean areDialogSettingsValid()
public abstract boolean hasDialog()
abstract NodeDialogPane getDialogPaneWithSettings(PortObjectSpec[] inSpecs) throws NotConfigurableException
NotConfigurableException
abstract NodeDialogPane getDialogPane()
public abstract boolean areDialogAndNodeSettingsEqual()
void loadSettings(NodeSettingsRO settings) throws InvalidSettingsException
InvalidSettingsException
void saveSettings(NodeSettingsWO settings)
boolean areSettingsValid(NodeSettingsRO settings)
NodeContainer.NodeContainerSettings.SplitType getSplitType()
public abstract int getNrInPorts()
public abstract NodeInPort getInPort(int index)
public abstract NodeOutPort getOutPort(int index)
public abstract int getNrOutPorts()
public int getNrViews()
public abstract int getNrNodeViews()
public String getViewName(int i)
public abstract String getNodeViewName(int i)
public AbstractNodeView<NodeModel> getView(int i)
public abstract AbstractNodeView<NodeModel> getNodeView(int i)
i
- the view to create
protected void resetJobManagerViews()
protected void closeAllJobManagerViews()
public abstract URL getIcon()
public abstract NodeFactory.NodeType getType()
public final NodeID getID()
public abstract String getName()
public final String getNameWithID()
public String toString()
toString
in class Object
public String getDisplayLabel()
NodeView
, OutPortView
and
NodeDialog
public String getCustomName()
public void setCustomName(String customName)
public String getCustomDescription()
public void setCustomDescription(String customDescription)
protected abstract boolean isLocalWFM()
This method returns false for all single node container.
public boolean isDeletable()
void cleanup()
public final boolean isDirty()
public void setDirty()
void unsetDirty()
protected abstract NodeContainerPersistor getCopyPersistor(HashMap<Integer,ContainerTable> tableRep, boolean preserveDeletableFlags)
tableRep
- Table repository of the destination.preserveDeletableFlags
- Whether the "isdeleteable" annotation
should be copied also (false when individual nodes are copied
but true when an entire meta node is copied).
protected final void setNodeContainerDirectory(ReferencedFile directory)
directory
- the nodeContainerDirectory to setprotected final ReferencedFile getNodeContainerDirectory()
abstract NodeID[] loadContent(NodeContainerPersistor persistor, Map<Integer,BufferedDataTable> tblRep, FlowObjectStack inStack, ExecutionMonitor exec, WorkflowPersistor.LoadResult loadResult, boolean preserveNodeMessage) throws CanceledExecutionException
persistor
- To load from.tblRep
- A table repository to restore BufferedDatTablesinStack
- Incoming FlowObjectStack
.exec
- For progressloadResult
- Where to report errors/warnings topreserveNodeMessage
- Whether possible node messages in the
persistor are to be preserved (parameter to configure method
that is called during load).
CanceledExecutionException
- If canceled.public void loadExecutionResult(NodeContainerExecutionResult result, ExecutionMonitor exec, WorkflowPersistor.LoadResult loadResult)
super.loadEx...
.
result
- The execution result (contains port objects, messages, etc)exec
- For progress information (no cancelation supported)loadResult
- A load result that contains, e.g. error messages.public abstract NodeContainerExecutionResult createExecutionResult(ExecutionMonitor exec) throws CanceledExecutionException
#loadExecutionResult(NodeContainerExecutionResult, ExecutionMonitor, LoadResult)
is called).
exec
- For progress information (this method will copy port
objects).
CanceledExecutionException
- If canceled.protected void saveExecutionResult(NodeContainerExecutionResult result)
result
- Where to save to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |