1 package org.springframework.roo.shell;
2
3 /**
4 * Strategy interface to permit the controlled execution of methods.
5 *
6 * <p>
7 * This interface is used to enable a {@link Shell} to execute methods in a consistent, system-wide
8 * manner. A typical use case is to ensure user interface commands are not executed concurrently
9 * when other background threads are performing certain operations.
10 *
11 * @author Ben Alex
12 * @since 1.0
13 *
14 */
15 public interface ExecutionStrategy {
16
17 /**
18 * Executes the method indicated by the {@link ParseResult}.
19 *
20 * @param parseResult that should be executed (never presented as null)
21 * @return an object which will be rendered by the {@link Shell} implementation (may return null)
22 * @throws RuntimeException which is handled by the {@link Shell} implementation
23 */
24 Object execute(ParseResult parseResult) throws RuntimeException;
25
26 /**
27 * Indicates commands are able to be presented. This generally means all important
28 * system startup activities have completed.
29 *
30 * @return whether commands can be presented for processing at this time
31 */
32 boolean isReadyForCommands();
33 }