org.knime.core.node.exec
Class ThreadNodeExecutionJobManager

java.lang.Object
  extended by org.knime.core.node.exec.ThreadNodeExecutionJobManager
All Implemented Interfaces:
NodeExecutionJobManager

public class ThreadNodeExecutionJobManager
extends Object
implements NodeExecutionJobManager

Author:
wiswedel, University of Konstanz

Field Summary
static ThreadNodeExecutionJobManager INSTANCE
           
 
Constructor Summary
ThreadNodeExecutionJobManager()
           
ThreadNodeExecutionJobManager(ThreadPool pool)
           
 
Method Summary
 boolean canDisconnect(NodeExecutionJob job)
          Returns true, if a executing job continues running even after closing the workflow - and if this manager can reconnect to this job after re-opening the workflow again.
 boolean canSaveInternals()
          
 void closeAllViews()
          Close all open views.
 PortObjectSpec[] configure(PortObjectSpec[] inSpecs, PortObjectSpec[] nodeModelOutSpecs)
          In case the executor modifies the result of the underlying node it can create the appropriate output specs.
 void disconnect(NodeExecutionJob job)
          Disconnects the running job.
 URL getIcon()
          
 String getID()
          Returns a unique ID of this job manager implementations.
 NodeExecutionJobManagerPanel getSettingsPanelComponent(NodeContainer.NodeContainerSettings.SplitType nodeSplitType)
          Creates a new instance of a panel that holds components to display the job manager's settings and to allow the user to enter new values.
 NodeView<NodeModel> getView(NodeContainer nc)
          Return a new instance of a node view for the job of the provided node.
 String getViewName(NodeContainer nc)
          Creates a title for the corresponding view.
 boolean hasView()
          Returns true if this job manager provides a view.
 void load(NodeSettingsRO settings)
          Restores the properties of the specific job manager.
 NodeExecutionJob loadFromReconnectSettings(NodeSettingsRO settings, PortObject[] inports, NodeContainer snc)
          Read the information previously stored in the settings object and restore an executing job.
 void loadInternals(ReferencedFile directory)
          Restore the internals from a directory.
 void resetAllViews()
          Called when the underlying node is reset.
 void save(NodeSettingsWO settings)
          Saves parameters that customize this instance.
 void saveInternals(ReferencedFile directory)
          Save the internals of this instance to the target directory.
 void saveReconnectSettings(NodeExecutionJob job, NodeSettingsWO settings)
          Saves all the information necessary to reconnect to the specified job after it is disconnected.
 NodeExecutionJob submitJob(NodeContainer nc, PortObject[] data)
          Executes the given node container with this job manager.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static final ThreadNodeExecutionJobManager INSTANCE
Constructor Detail

ThreadNodeExecutionJobManager

public ThreadNodeExecutionJobManager()

ThreadNodeExecutionJobManager

public ThreadNodeExecutionJobManager(ThreadPool pool)
Method Detail

submitJob

public NodeExecutionJob submitJob(NodeContainer nc,
                                  PortObject[] data)
Executes the given node container with this job manager.

Specified by:
submitJob in interface NodeExecutionJobManager
Parameters:
nc - The node to execute (may be a single node container or a meta node)
data - The input data for that node.
Returns:
A job representing the pending execution.

getID

public String getID()
Returns a unique ID of this job manager implementations. Preferably this is the fully qualifying name of its package.
For a user readable label, see NodeExecutionJobManager.toString()

Specified by:
getID in interface NodeExecutionJobManager
Returns:
a unique ID of this job manager implementations

getSettingsPanelComponent

public NodeExecutionJobManagerPanel getSettingsPanelComponent(NodeContainer.NodeContainerSettings.SplitType nodeSplitType)
Creates a new instance of a panel that holds components to display the job manager's settings and to allow the user to enter new values. A new instance must be created every time this method is called.
Returns null if this job manager has no settings to adjust. The framework transfers the settings of the job manager in the panel. The returned panel can be un-initialized.

Specified by:
getSettingsPanelComponent in interface NodeExecutionJobManager
Parameters:
nodeSplitType - type of splitting permitted by the underlying node
Returns:
a new instance of the dialog component for this job manager

toString

public String toString()

Specified by:
toString in interface NodeExecutionJobManager
Overrides:
toString in class Object

canDisconnect

public boolean canDisconnect(NodeExecutionJob job)
Returns true, if a executing job continues running even after closing the workflow - and if this manager can reconnect to this job after re-opening the workflow again.

Specified by:
canDisconnect in interface NodeExecutionJobManager
Parameters:
job - to check for dis/reconnect ability
Returns:
true, if a executing job continues running even after closing the workflow - and if this manager can reconnect to this job after re-opening the workflow again.

loadFromReconnectSettings

public NodeExecutionJob loadFromReconnectSettings(NodeSettingsRO settings,
                                                  PortObject[] inports,
                                                  NodeContainer snc)
                                           throws InvalidSettingsException,
                                                  NodeExecutionJobReconnectException
Read the information previously stored in the settings object and restore an executing job.

Specified by:
loadFromReconnectSettings in interface NodeExecutionJobManager
Parameters:
settings - reconnect information stored during NodeExecutionJobManager.saveReconnectSettings(NodeExecutionJob, NodeSettingsWO)
inports - port objects that were provided at execution start time.
snc - Node whose remote executing is to be continued.
Returns:
a new job restored and representing the running job
Throws:
InvalidSettingsException - if the information in the settings object is invalid
NodeExecutionJobReconnectException - if reconnect failed.
See Also:
NodeExecutionJobManager.saveReconnectSettings(NodeExecutionJob, NodeSettingsWO)

disconnect

public void disconnect(NodeExecutionJob job)
Disconnects the running job.

Specified by:
disconnect in interface NodeExecutionJobManager
Parameters:
job - The job to cancel.

saveReconnectSettings

public void saveReconnectSettings(NodeExecutionJob job,
                                  NodeSettingsWO settings)
Saves all the information necessary to reconnect to the specified job after it is disconnected.

Specified by:
saveReconnectSettings in interface NodeExecutionJobManager
Parameters:
job - the job that is disconnected and must be restored later.
settings - stores the information in here
See Also:
NodeExecutionJobManager.loadFromReconnectSettings( NodeSettingsRO, PortObject[], NodeContainer)

save

public void save(NodeSettingsWO settings)
Saves parameters that customize this instance. It does not save the general job manager ID (that happens elsewhere). Job managers that are represented by a singleton, leave this method empty.

Specified by:
save in interface NodeExecutionJobManager
Parameters:
settings - to save to.

load

public void load(NodeSettingsRO settings)
          throws InvalidSettingsException
Restores the properties of the specific job manager. This is the reverse operation to NodeExecutionJobManager.save(NodeSettingsWO).

Specified by:
load in interface NodeExecutionJobManager
Parameters:
settings - To load from.
Throws:
InvalidSettingsException - If that fails.

configure

public PortObjectSpec[] configure(PortObjectSpec[] inSpecs,
                                  PortObjectSpec[] nodeModelOutSpecs)
In case the executor modifies the result of the underlying node it can create the appropriate output specs. Trivial implementations just return the nodeModelOutSpecs.

Specified by:
configure in interface NodeExecutionJobManager
Parameters:
inSpecs - port object specs from predecessor node(s)
nodeModelOutSpecs - the output specs created by the underlying node
Returns:
the output specs actually delivered at the node's output ports

getIcon

public URL getIcon()

Specified by:
getIcon in interface NodeExecutionJobManager
Returns:
the URL of the decorating image for the implementing manager

hasView

public boolean hasView()
Returns true if this job manager provides a view.

Specified by:
hasView in interface NodeExecutionJobManager
Returns:
true if this job manager provides a view.

getView

public NodeView<NodeModel> getView(NodeContainer nc)
Return a new instance of a node view for the job of the provided node.

Specified by:
getView in interface NodeExecutionJobManager
Parameters:
nc - the corresponding node container
Returns:
the view for the job if the node

getViewName

public String getViewName(NodeContainer nc)
Creates a title for the corresponding view.

Specified by:
getViewName in interface NodeExecutionJobManager
Parameters:
nc - the corresponding node container.
Returns:
the title for the view.

resetAllViews

public void resetAllViews()
Called when the underlying node is reset. Clear all open views.

Specified by:
resetAllViews in interface NodeExecutionJobManager

closeAllViews

public void closeAllViews()
Close all open views.

Specified by:
closeAllViews in interface NodeExecutionJobManager

canSaveInternals

public boolean canSaveInternals()

Specified by:
canSaveInternals in interface NodeExecutionJobManager
Returns:
whether this job manager has meaningful internals, for instance log files of remote jobs that were run.
See Also:
NodeExecutionJobManager.saveInternals(ReferencedFile)

loadInternals

public void loadInternals(ReferencedFile directory)
                   throws IOException
Restore the internals from a directory. This is the reverse operation to NodeExecutionJobManager.saveInternals(ReferencedFile). Implementations should consider to keep a pointer to the referenced file and load the internals on demand (in order to speed up the load routines).

Specified by:
loadInternals in interface NodeExecutionJobManager
Parameters:
directory - To load from.
Throws:
IOException - If that fails for any reason.

saveInternals

public void saveInternals(ReferencedFile directory)
                   throws IOException
Save the internals of this instance to the target directory. This method is only called if NodeExecutionJobManager.canSaveInternals() returns true.

Specified by:
saveInternals in interface NodeExecutionJobManager
Parameters:
directory - To save to (guaranteed to be empty)
Throws:
IOException - If that fails for any reason.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
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.