org.springframework.shell.core
Interface ExecutionStrategy

All Known Implementing Classes:
SimpleExecutionStrategy

public interface ExecutionStrategy

Strategy interface to permit the controlled execution of methods.

This interface is used to enable a Shell to execute methods in a consistent, system-wide manner. A typical use case is to ensure user interface commands are not executed concurrently when other background threads are performing certain operations.

Since:
1.0

Method Summary
 Object execute(ParseResult parseResult)
          Executes the method indicated by the ParseResult.
 boolean isReadyForCommands()
          Indicates commands are able to be presented.
 void terminate()
          Indicates the execution runtime should be terminated.
 

Method Detail

execute

Object execute(ParseResult parseResult)
               throws RuntimeException
Executes the method indicated by the ParseResult.

Parameters:
parseResult - that should be executed (never presented as null)
Returns:
an object which will be rendered by the Shell implementation (may return null)
Throws:
RuntimeException - which is handled by the Shell implementation

isReadyForCommands

boolean isReadyForCommands()
Indicates commands are able to be presented. This generally means all important system startup activities have completed.

Returns:
whether commands can be presented for processing at this time

terminate

void terminate()
Indicates the execution runtime should be terminated. This allows it to cleanup before returning control flow to the caller. Necessary for clean shutdowns.