Interface CommandService
-
- All Superinterfaces:
Comparable<Prioritized>,Contextual,Disposable,HasPluginInfo,Identifiable,Initializable,Locatable,Logged,Prioritized,PTService<Command>,RichPlugin,SciJavaPlugin,SciJavaService,Service,Versioned
- All Known Implementing Classes:
DefaultCommandService
public interface CommandService extends PTService<Command>, SciJavaService
Interface for service that keeps track of available commands.A command is a particular type of plugin that is also a
Module; i.e., it isRunnable, with typed inputs and outputs.The command service keeps a central index of all commands known to the system. It asks the
PluginServicefor available commands, then takes care of registering them with theModuleService.- Author:
- Curtis Rueden
- See Also:
SciJavaPlugin,ModuleService,PluginService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default EventServiceeventService()<C extends Command>
CommandInfogetCommand(Class<C> commandClass)Gets the first available command of the given class, or null if none.CommandInfogetCommand(String className)Gets the first available command of the given class name, or null if none.List<CommandInfo>getCommands()Gets the list of all availableCommands).<CT extends Command>
List<CommandInfo>getCommands(List<PluginInfo<CT>> plugins)Gets the list ofCommands corresponding to the given plugins.<C extends Command>
List<CommandInfo>getCommandsOfClass(Class<C> commandClass)Gets the list of commands of the given class.List<CommandInfo>getCommandsOfClass(String className)Gets the list of commands with the given class name.<CT extends Command>
List<CommandInfo>getCommandsOfType(Class<CT> type)Gets the list ofCommands of the given type.default EventServicegetEventService()Deprecated.UseeventService()instead.default ModuleServicegetModuleService()Deprecated.UsemoduleService()instead.default ModuleServicemoduleService()<C extends Command>
Future<CommandModule>run(Class<C> commandClass, boolean process, Object... inputs)Executes the first command of the given class.<C extends Command>
Future<CommandModule>run(Class<C> commandClass, boolean process, Map<String,Object> inputMap)Executes the first command of the given class.Future<CommandModule>run(String className, boolean process, Object... inputs)Executes the first command of the given class name.Future<CommandModule>run(String className, boolean process, Map<String,Object> inputMap)Executes the first command of the given class name.Future<CommandModule>run(CommandInfo info, boolean process, Object... inputs)Executes the given command.Future<CommandModule>run(CommandInfo info, boolean process, Map<String,Object> inputMap)Executes the given command.-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.PTService
create, getPlugins, getPluginService, getPluginType, pluginService
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
eventService
default EventService eventService()
-
moduleService
default ModuleService moduleService()
-
getCommands
List<CommandInfo> getCommands()
Gets the list of all availableCommands).
-
getCommands
<CT extends Command> List<CommandInfo> getCommands(List<PluginInfo<CT>> plugins)
Gets the list ofCommands corresponding to the given plugins.
-
getCommand
<C extends Command> CommandInfo getCommand(Class<C> commandClass)
Gets the first available command of the given class, or null if none.
-
getCommand
CommandInfo getCommand(String className)
Gets the first available command of the given class name, or null if none.
-
getCommandsOfType
<CT extends Command> List<CommandInfo> getCommandsOfType(Class<CT> type)
Gets the list ofCommands of the given type.
-
getCommandsOfClass
<C extends Command> List<CommandInfo> getCommandsOfClass(Class<C> commandClass)
Gets the list of commands of the given class.Most classes will have only a single match, but some special classes (such as ImageJ's
LegacyCommand) may match many entries.NB: Classes are matched by strict equality, not assignability; subtypes of the specified class will not match. For this behavior, use
getCommandsOfType(Class)on a common parent interface.
-
getCommandsOfClass
List<CommandInfo> getCommandsOfClass(String className)
Gets the list of commands with the given class name.Most classes will have only a single match, but some special classes (such as ImageJ's
LegacyCommand) may match many entries.NB: Classes are matched by strict equality, not assignability; subtypes of the specified class will not match. For this behavior, use
getCommandsOfType(Class)on a common parent interface.
-
run
Future<CommandModule> run(String className, boolean process, Object... inputs)
Executes the first command of the given class name.If no command with the given class name is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
- Parameters:
className- Class name of the command to execute.process- If true, executes the command with pre- and postprocessing steps from all availablePreprocessorPlugins andPostprocessorPlugins in the plugin index; if false, executes the command with no pre- or postprocessing. For more fine-grained control, see theModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)methods.inputs- List of input parameter names and values. The expected order is in pairs: an input name followed by its value, for each desired input to populate. Leaving some inputs unpopulated is allowed. Passing the name of an input that is not valid for the plugin, or passing a value of a type incompatible with the associated input parameter, will issue an error and ignore that name/value pair.- Returns:
Futureof the module instance being executed. CallingFuture.get()will block until execution is complete.
-
run
Future<CommandModule> run(String className, boolean process, Map<String,Object> inputMap)
Executes the first command of the given class name.If no command with the given class name is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
- Parameters:
className- Class name of the command to execute.process- If true, executes the command with pre- and postprocessing steps from all availablePreprocessorPlugins andPostprocessorPlugins in the plugin index; if false, executes the command with no pre- or postprocessing. For more fine-grained control, see theModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)methods.inputMap- Table of input parameter values, with keys matching the plugin's input parameter names. Passing a value of a type incompatible with the associated input parameter will issue an error and ignore that value.- Returns:
Futureof the module instance being executed. CallingFuture.get()will block until execution is complete.
-
run
<C extends Command> Future<CommandModule> run(Class<C> commandClass, boolean process, Object... inputs)
Executes the first command of the given class.If no command of the given class is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
- Type Parameters:
C- Class of the command to execute.- Parameters:
commandClass- Class object of the command to execute.process- If true, executes the command with pre- and postprocessing steps from all availablePreprocessorPlugins andPostprocessorPlugins in the plugin index; if false, executes the command with no pre- or postprocessing. For more fine-grained control, see theModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)methods.inputs- List of input parameter names and values. The expected order is in pairs: an input name followed by its value, for each desired input to populate. Leaving some inputs unpopulated is allowed. Passing the name of an input that is not valid for the plugin, or passing a value of a type incompatible with the associated input parameter, will issue an error and ignore that name/value pair.- Returns:
Futureof the module instance being executed. CallingFuture.get()will block until execution is complete.
-
run
<C extends Command> Future<CommandModule> run(Class<C> commandClass, boolean process, Map<String,Object> inputMap)
Executes the first command of the given class.If no command of the given class is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
- Type Parameters:
C- Class of the command to execute.- Parameters:
commandClass- Class object of the command to execute.process- If true, executes the command with pre- and postprocessing steps from all availablePreprocessorPlugins andPostprocessorPlugins in the plugin index; if false, executes the command with no pre- or postprocessing. For more fine-grained control, see theModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)methods.inputMap- Table of input parameter values, with keys matching the plugin's input parameter names. Passing a value of a type incompatible with the associated input parameter will issue an error and ignore that value.- Returns:
Futureof the module instance being executed. CallingFuture.get()will block until execution is complete.
-
run
Future<CommandModule> run(CommandInfo info, boolean process, Object... inputs)
Executes the given command.- Parameters:
info- The command to instantiate and run.process- If true, executes the command with pre- and postprocessing steps from all availablePreprocessorPlugins andPostprocessorPlugins in the plugin index; if false, executes the command with no pre- or postprocessing. For more fine-grained control, see theModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)methods.inputs- List of input parameter names and values. The expected order is in pairs: an input name followed by its value, for each desired input to populate. Leaving some inputs unpopulated is allowed. Passing the name of an input that is not valid for the plugin, or passing a value of a type incompatible with the associated input parameter, will issue an error and ignore that name/value pair.- Returns:
Futureof the module instance being executed. CallingFuture.get()will block until execution is complete.
-
run
Future<CommandModule> run(CommandInfo info, boolean process, Map<String,Object> inputMap)
Executes the given command.- Parameters:
info- The command to instantiate and run.process- If true, executes the command with pre- and postprocessing steps from all availablePreprocessorPlugins andPostprocessorPlugins in the plugin index; if false, executes the command with no pre- or postprocessing. For more fine-grained control, see theModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)methods.inputMap- Table of input parameter values, with keys matching the plugin's input parameter names. Passing a value of a type incompatible with the associated input parameter will issue an error and ignore that value.- Returns:
Futureof the module instance being executed. CallingFuture.get()will block until execution is complete.
-
getEventService
@Deprecated default EventService getEventService()
Deprecated.UseeventService()instead.
-
getModuleService
@Deprecated default ModuleService getModuleService()
Deprecated.UsemoduleService()instead.
-
-