com.tomgibara.pronto.control
Interface FileControllerSettings

All Superinterfaces:
ControllerSettings

public interface FileControllerSettings
extends ControllerSettings

Implementations of this interface may be passed to a control factory to create a controller that responds to instructions in a file. The file is periodically checked for creation/modification. When a change is identified, the file is read, and any control instructions it contains are executed.

It is anticipated that a common usage scenario for a file controller will be driving a Java application by another application on the same computer through the creation of an instructions file that is then read, executed and deleted by the java application.

Each line in the file should consist of a label-name optionally followed by a parameter. Blank lines and leading spaces are ignored. Lines whose first non-whitespace character is a # are treated as comments and are also 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.

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 on the file.
 java.io.File getFile()
          The file that will be checked for control instructions.
 boolean isFileDeleted()
          Whether the file is deleted after its control instructions have been read and executed.
 boolean isOlderIgnored()
          Whether changes in a file's last-modified that move 'back in time' should be ignored for the purpose of identifying changes in the file.
 boolean isPreexistingIgnored()
          Whether a file that already existed the first time it was checked should be ignored until the file is updated.
 

Method Detail

getFile

java.io.File getFile()
The file that will be checked for control instructions. If null is returned from this method then the controller will take no action.

Returns:
the file to monitor for control instructions.

getCheckPeriod

com.tomgibara.pronto.util.Duration getCheckPeriod()
The approximate time between successive checks on the file. If no duration is supplied, a default value is used. Refer to the documentation on pronto properties to find out the default value.

Returns:
how much time should elapse between polls, or null to use the default value

isFileDeleted

boolean isFileDeleted()
Whether the file is deleted after its control instructions have been read and executed.

Returns:
true if the file should be deleted after being read, false if the file should remain.

isPreexistingIgnored

boolean isPreexistingIgnored()
Whether a file that already existed the first time it was checked should be ignored until the file is updated. File changes are determined by the last-modified date.

Returns:
true if any file that existed before it was first checked should be ignored until the file changes, false otherwise

isOlderIgnored

boolean isOlderIgnored()
Whether changes in a file's last-modified that move 'back in time' should be ignored for the purpose of identifying changes in the file.

Returns:
true if the controller should ignore retro changes in a file's last-modified date.


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