Interface Module
-
- All Superinterfaces:
Runnable
- All Known Subinterfaces:
MutableModule
- All Known Implementing Classes:
AbstractModule,CommandModule,DefaultMutableModule,DynamicCommand,Inputs,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
Moduleinterface represents a specific instance of a module, while the correspondingModuleInforepresents metadata about that module, particularly its input and output names and types.- Author:
- Aivar Grislis, Curtis Rueden
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidcancel()Performs necessary cleanup in response to cancellation of the module execution.ObjectgetDelegateObject()Gets the object containing the module's actual implementation.ModuleInfogetInfo()Gets metadata about this module.ObjectgetInput(String name)Gets the value of the input with the given name.Map<String,Object>getInputs()Gets a table of input values.ObjectgetOutput(String name)Gets the value of the output with the given name.Map<String,Object>getOutputs()Gets a table of output values.voidinitialize()Initializes the module.booleanisInputResolved(String name)Gets the resolution status of the input with the given name.booleanisOutputResolved(String name)Gets the resolution status of the output with the given name.default booleanisResolved(String name)Deprecated.UseisInputResolved(String)instead.voidpreview()Computes a preview of the module's execution results, if available.voidresolveInput(String name)Marks the input with the given name as resolved.voidresolveOutput(String name)Marks the output with the given name as resolved.voidsetInput(String name, Object value)Sets the value of the input with the given name.voidsetInputs(Map<String,Object> inputs)Sets input values according to the given table.voidsetOutput(String name, Object value)Sets the value of the output with the given name.voidsetOutputs(Map<String,Object> outputs)Sets output values according to the given table.default voidsetResolved(String name, boolean resolved)Deprecated.UseresolveInput(String)andunresolveInput(String)instead.voidunresolveInput(String name)Marks the input with the given name as unresolved.voidunresolveOutput(String name)Marks the output with the given name as unresolved.
-
-
-
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 withRunnable.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 withpreview()to undo any changes made as a result of the preview.- See Also:
ModuleInfo.canCancel()
-
initialize
void initialize() throws MethodCallExceptionInitializes the module.First, the module's global initializer method (if any) is called, followed by each individual
ModuleIteminitializer 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 bygetInfo().getDelegateClassName(). This object must possess all callback methods specified byModuleItem.getCallback().The nature of this method is implementation-specific; e.g., a
CommandModulewill return its associatedCommand. 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 returnthis.
-
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.
-
isInputResolved
boolean isInputResolved(String name)
Gets the resolution status of the input with the given name.- See Also:
resolveInput(String)
-
isOutputResolved
boolean isOutputResolved(String name)
Gets the resolution status of the output with the given name.- See Also:
resolveOutput(String)
-
resolveInput
void resolveInput(String name)
Marks the input with the given name as resolved. A "resolved" input is known to have a final, valid value for use with the module.ModulePreprocessors in the module execution chain that populate input values (e.g.InputHarvesterplugins) will typically skip over inputs which have already been resolved.
-
resolveOutput
void resolveOutput(String name)
Marks the output with the given name as resolved. A "resolved" output has been handled by the framework somehow, typically displayed to the user.ModulePostprocessors in the module execution chain that handle output values (e.g. theDisplayPostprocessor) will typically skip over outputs which have already been resolved.
-
unresolveInput
void unresolveInput(String name)
Marks the input with the given name as unresolved.- See Also:
resolveInput(String)
-
unresolveOutput
void unresolveOutput(String name)
Marks the output with the given name as unresolved.- See Also:
resolveOutput(String)
-
isResolved
@Deprecated default boolean isResolved(String name)
Deprecated.UseisInputResolved(String)instead.
-
setResolved
@Deprecated default void setResolved(String name, boolean resolved)
Deprecated.UseresolveInput(String)andunresolveInput(String)instead.
-
-