Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ttools: allow environment-sensitive parameter reporting
New interface DynamicTask introduced for tasks with parameter lists that are sensitive to the environment. This allows the help system to be more helpful at runtime.
- Loading branch information
Showing
2 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
ttools/src/main/uk/ac/starlink/ttools/task/DynamicTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package uk.ac.starlink.ttools.task; | ||
|
||
import uk.ac.starlink.task.Environment; | ||
import uk.ac.starlink.task.Parameter; | ||
import uk.ac.starlink.task.TaskException; | ||
|
||
/** | ||
* Extends the Task interface by methods which allow task parameters to be | ||
* queried based on a (at least partially) populated Environment. | ||
* By default, Tasks report the Parameters they use so that the on-line | ||
* help system can supply that information to users at runtime. | ||
* However, for some tasks the parameters in use depend on the value of | ||
* other parameters. This interface allows tasks to make that information | ||
* available. The method implementations are considered to be on a | ||
* best-efforts basis, it is not guaranteed that they will be able to | ||
* report all the parameters. This information is only used for user help. | ||
* | ||
* @author Mark Taylor | ||
* @since 19 Sep 2014 | ||
*/ | ||
public interface DynamicTask { | ||
|
||
/** | ||
* Attempts to find a parameter with a given name that might be used | ||
* by this task in the content of the given environment. | ||
* This ought not to result in additional prompts to the user. | ||
* | ||
* @param env execution environment | ||
* @param paramName requested parameter name | ||
* @return parameter with the given name, or null | ||
*/ | ||
Parameter getParameterByName( Environment env, String paramName ) | ||
throws TaskException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters