com.tomgibara.pronto.control
Interface StdinControllerSettings

All Superinterfaces:
ControllerSettings

public interface StdinControllerSettings
extends ControllerSettings

Implementations of this interface may be passed to a control factory to create a controller that responds to instructions from STDIN (System.in). When new input on STDIN is received by the controller, any control instructions it contains are executed.

Such a controller could be used to control a Java application via a shell pipe, or provide a user with a simple interface with which to control execution.

Each line submitted on STDIN should consist of a label-name optionally followed by a parameter. Blank lines and leading spaces are ignored. An example line to a controller might be:

stop 20s

The interpretation of this line is entirely determined by the controller's engine and its corresponding adapter.

Lines supplied on STDIN are subject to a maximum length - this is intended to protect a Java application from excessive memory usage caused by long lines of input. See the documentation on pronto properties for more information about how to change this maximum length.

Note that the values returned for settings do not need to be stable; they can change between calls on the interface.

Author:
Tom Gibara

Method Summary
 com.tomgibara.pronto.util.Duration getCheckPeriod()
          The approximate time between successive checks for new input on STDIN.
 boolean isInteractive()
          Whether the input on STDIN is user interactive.
 

Method Detail

getCheckPeriod

com.tomgibara.pronto.util.Duration getCheckPeriod()
The approximate time between successive checks for new input on STDIN. Polling is necessary because there is no reliable cross-platform way of performing non-blocking IO on STDIN from Java. Returning a null value from this method indicates that the default value should be used. Refer to the documentation on pronto properties to find out the default value.

Returns:
the polling period on STDIN, or null

isInteractive

boolean isInteractive()
Whether the input on STDIN is user interactive. There is no way to identify whether the System.in stream is obtaining input from a user or a pipe. Returning a true value from this method will cause the controller to report input-errors to STDOUT, otherwise input errors are logged to the standard package logger.

Returns:
true if STDIN should be treated as interactive, false otherwise


Copyright © 2006-2007 Tom Gibara. All Rights Reserved.