Class FileListener

java.lang.Object
org.frankframework.larva.FileListener
All Implemented Interfaces:
AutoCloseable, IConfigurable

public class FileListener extends Object implements IConfigurable, AutoCloseable
File listener for the Test Tool.
Author:
Jaco de Groot
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Configure this component.
    Read the message from the specified file.
    void
    setDirectory(String directory)
    Set the directory to read the file from.
    void
    setFilename(String filename)
    Set the filename of the file to read the message from.
    void
    setFilename2(String filename2)
    When used, filename and filename2 are binary compared (returns 'true' or 'false' instead of the file content).
    void
    setInterval(long interval)
    Set the interval time in milliseconds between checks for creation of the file.
    void
    setTimeout(long timeout)
    Set the timeout in milliseconds waiting for creation of the file.
    void
    setWaitBeforeRead(long waitBeforeRead)
    Set the time to wait in milliseconds before starting to read the file.
    void
    setWildcard(String wildcard)
    Set the wildcard to find the file to read the message from.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileListener

      public FileListener()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • close

      public void close() throws ConfigurationException
      Specified by:
      close in interface AutoCloseable
      Throws:
      ConfigurationException
    • getMessage

      public Message getMessage() throws TimeoutException, ListenerException
      Read the message from the specified file. If the file doesn't exist, this methods waits a specified time before it attempts to read the file.
      Returns:
      The message read from the specified file
      Throws:
      TimeoutException
      ListenerException
    • setFilename

      public void setFilename(String filename)
      Set the filename of the file to read the message from.
    • setFilename2

      public void setFilename2(String filename2)
      When used, filename and filename2 are binary compared (returns 'true' or 'false' instead of the file content).
    • setDirectory

      public void setDirectory(String directory)
      Set the directory to read the file from.
    • setWildcard

      public void setWildcard(String wildcard)
      Set the wildcard to find the file to read the message from.
      Parameters:
      wildcard - to search for files in a directory
    • setWaitBeforeRead

      public void setWaitBeforeRead(long waitBeforeRead)
      Set the time to wait in milliseconds before starting to read the file. Set to -1 (default) to start reading the file directly.
    • setTimeout

      public void setTimeout(long timeout)
      Set the timeout in milliseconds waiting for creation of the file.
    • setInterval

      public void setInterval(long interval)
      Set the interval time in milliseconds between checks for creation of the file.