org.scijava.module
Interface Module

All Superinterfaces:
Runnable
All Known Subinterfaces:
MutableModule
All Known Implementing Classes:
AbstractModule, CommandModule, DefaultMutableModule, DynamicCommand, InteractiveCommand, ModuleCommand, OptionsPlugin, ScriptModule

public interface Module
extends Runnable

A module is an encapsulated piece of functionality with inputs and outputs.

There are several types of modules, including plugins and scripts, as well as workflows, which are directed acyclic graphs consisting of modules whose inputs and outputs are connected.

The Module interface represents a specific instance of a module, while the corresponding ModuleInfo represents metadata about that module, particularly its input and output names and types.

Author:
Aivar Grislis, Curtis Rueden

Method Summary
 void cancel()
          Performs necessary cleanup in response to cancellation of the module execution.
 Object getDelegateObject()
          Gets the object containing the module's actual implementation.
 ModuleInfo getInfo()
          Gets metadata about this module.
 Object getInput(String name)
          Gets the value of the input with the given name.
 Map<String,Object> getInputs()
          Gets a table of input values.
 Object getOutput(String name)
          Gets the value of the output with the given name.
 Map<String,Object> getOutputs()
          Gets a table of output values.
 void initialize()
          Initializes the module.
 boolean isResolved(String name)
          Gets the resolution status of the input with the given name.
 void preview()
          Computes a preview of the module's execution results, if available.
 void setInput(String name, Object value)
          Sets the value of the input with the given name.
 void setInputs(Map<String,Object> inputs)
          Sets input values according to the given table.
 void setOutput(String name, Object value)
          Sets the value of the output with the given name.
 void setOutputs(Map<String,Object> outputs)
          Sets output values according to the given table.
 void setResolved(String name, boolean resolved)
          Sets the resolution status of the input with the given name.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

preview

void preview()
Computes a preview of the module's execution results, if available. A preview is a quick approximation of the results that would be obtained by actually executing the module with Runnable.run(). Not all modules support previews.

See Also:
ModuleInfo.canPreview()

cancel

void cancel()
Performs necessary cleanup in response to cancellation of the module execution. This is useful in conjunction with preview() to undo any changes made as a result of the preview.

See Also:
ModuleInfo.canCancel()

initialize

void initialize()
                throws MethodCallException
Initializes the module.

First, the module's global initializer method (if any) is called, followed by each individual ModuleItem initializer method (i.e., ModuleItem.initialize(Module)).

Throws:
MethodCallException
See Also:
ModuleInfo.getInitializer(), ModuleItem.initialize(Module)

getInfo

ModuleInfo getInfo()
Gets metadata about this module.


getDelegateObject

Object getDelegateObject()
Gets the object containing the module's actual implementation. By definition, this is an object whose fully qualified class name is given by getInfo().getDelegateClassName(). This object must possess all callback methods specified by ModuleItem.getCallback().

The nature of this method is implementation-specific; e.g., a CommandModule will return its associated Command. For modules that are not plugins, the result may be something else. If you are implementing this interface directly, a good rule of thumb is to return this.


getInput

Object getInput(String name)
Gets the value of the input with the given name.


getOutput

Object getOutput(String name)
Gets the value of the output with the given name.


getInputs

Map<String,Object> getInputs()
Gets a table of input values.


getOutputs

Map<String,Object> getOutputs()
Gets a table of output values.


setInput

void setInput(String name,
              Object value)
Sets the value of the input with the given name.


setOutput

void setOutput(String name,
               Object value)
Sets the value of the output with the given name.


setInputs

void setInputs(Map<String,Object> inputs)
Sets input values according to the given table.


setOutputs

void setOutputs(Map<String,Object> outputs)
Sets output values according to the given table.


isResolved

boolean isResolved(String name)
Gets the resolution status of the input with the given name. A "resolved" input is known to have a final, valid value for use with the module.


setResolved

void setResolved(String name,
                 boolean resolved)
Sets the resolution status of the input with the given name. A "resolved" input is known to have a final, valid value for use with the module.



Copyright © 2009–2015 SciJava. All rights reserved.