Class FileRecordListener

java.lang.Object
org.frankframework.receivers.FileRecordListener
All Implemented Interfaces:
IConfigurable, IConfigurationAware, IListener<String>, INamedObject, IPullingListener<String>, IScopeProvider, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Deprecated(forRemoval=true, since="7.6.0") @ConfigurationWarning("Please replace with DirectoryListener, in combination with a FileLineIteratorPipe") public class FileRecordListener extends Object implements IPullingListener<String>
Deprecated, for removal: This API element is subject to removal in a future version.
File listener that looks in a directory for files according to a wildcard. When a file is found, it is read in a String object and parsed to records. After reading the file, the file is renamed and moved to a directory.
Author:
Johan Verrips
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.logging.log4j.Logger
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<String> rawMessage, PipeLineSession pipeLineSession)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.
    protected String
    Deprecated, for removal: This API element is subject to removal in a future version.
    Moves a file to another directory and places a UUID in the name.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Close all resources used for listening.
    void
    closeThread(Map<String,Object> threadContext)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Finalizes a message receiving thread.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Configure does some basic checks (directoryProcessedFiles is a directory, inputDirectory is a directory, wildcard is filled etc.);
    Deprecated, for removal: This API element is subject to removal in a future version.
    org.springframework.context.ApplicationContext
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected File
    Deprecated, for removal: This API element is subject to removal in a future version.
    Gets a file to process.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    getRawMessage(Map<String,Object> threadContext)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Retrieves a single record from a file.
    long
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Prepares the listener for receiving messages.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Prepares a thread for receiving messages.
    protected Iterator<String>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Parse a String to an Iterator with objects (records).
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    setDirectoryProcessedFiles(String directoryProcessedFiles)
    Deprecated, for removal: This API element is subject to removal in a future version.
    the directory to store processed files in
    void
    setInputDirectory(String inputDirectory)
    Deprecated, for removal: This API element is subject to removal in a future version.
    the directory name to look in for files.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    name of the listener as known to the adapter.
    void
    setResponseTime(long responseTime)
    Deprecated, for removal: This API element is subject to removal in a future version.
    The time in milliseconds to delay when no records are to be processed, and this class has to look for the arrival of a new file
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    setStoreFileNameInSessionKey(String storeFileNameInSessionKey)
    Deprecated, for removal: This API element is subject to removal in a future version.
    when set, the name of the read file is stored under this session key
    void
    setWildcard(String wildcard)
    Deprecated, for removal: This API element is subject to removal in a future version.
    the wildcard to look for files in the specified directory, e.g.
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • log

      protected org.apache.logging.log4j.Logger log
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • FileRecordListener

      public FileRecordListener()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • afterMessageProcessed

      public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<String> rawMessage, PipeLineSession pipeLineSession) throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IListener
      Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.
      Specified by:
      afterMessageProcessed in interface IListener<String>
      Throws:
      ListenerException
    • archiveFile

      protected String archiveFile(File file) throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Moves a file to another directory and places a UUID in the name.
      Returns:
      String with the name of the (renamed and moved) file
      Throws:
      ListenerException
    • close

      public void close() throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IListener
      Close all resources used for listening. Called once each time the listener is stopped.
      Specified by:
      close in interface IListener<String>
      Throws:
      ListenerException
    • closeThread

      public void closeThread(@Nonnull Map<String,Object> threadContext) throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IPullingListener
      Finalizes a message receiving thread. Called once for each thread that listens for messages, just before IListener.close() is called.
      Specified by:
      closeThread in interface IPullingListener<String>
      Throws:
      ListenerException
    • configure

      public void configure() throws ConfigurationException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure does some basic checks (directoryProcessedFiles is a directory, inputDirectory is a directory, wildcard is filled etc.);
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IListener<String>
      Throws:
      ConfigurationException
    • getFileToProcess

      protected File getFileToProcess()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets a file to process.
    • getRawMessage

      public RawMessageWrapper<String> getRawMessage(@Nonnull Map<String,Object> threadContext) throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieves a single record from a file. If the file is empty or fully processed, it looks wether there is a new file to process and returns the first record.
      Specified by:
      getRawMessage in interface IPullingListener<String>
      Throws:
      ListenerException
    • extractMessage

      public Message extractMessage(@Nonnull RawMessageWrapper<String> rawMessage, @Nonnull Map<String,Object> context)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IListener
      Extracts data from message obtained from IPullingListener.getRawMessage(Map) or IPushingListener.wrapRawMessage(Object, PipeLineSession). May also extract other parameters from the message and put those into the context.
      Specified by:
      extractMessage in interface IListener<String>
      Parameters:
      rawMessage - The RawMessageWrapper from which to extract the Message.
      context - Context to populate. Either a PipeLineSession or a Map threadContext depending on caller.
      Returns:
      input Message for adapter.
    • open

      public void open() throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IListener
      Prepares the listener for receiving messages. open() is called once each time the listener is started.
      Specified by:
      open in interface IListener<String>
      Throws:
      ListenerException
    • openThread

      @Nonnull public Map<String,Object> openThread() throws ListenerException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IPullingListener
      Prepares a thread for receiving messages. Called once for each thread that will listen for messages.
      Specified by:
      openThread in interface IPullingListener<String>
      Returns:
      the threadContext for this thread. The threadContext is a Map in which thread-specific data can be stored. May not be null, must be a mutable map type.
      Throws:
      ListenerException
    • parseToRecords

      protected Iterator<String> parseToRecords(String input)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parse a String to an Iterator with objects (records). This method currently uses the end-of-line character ("\n") as a seperator. This method is easy to extend to satisfy your project needs.
    • setSender

      public void setSender(ISender sender)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getSender

      public ISender getSender()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object
    • setName

      public void setName(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      name of the listener as known to the adapter.
      Specified by:
      setName in interface INamedObject
    • getName

      public String getName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getName in interface IConfigurationAware
      Specified by:
      getName in interface INamedObject
    • setInputDirectory

      public void setInputDirectory(String inputDirectory)
      Deprecated, for removal: This API element is subject to removal in a future version.
      the directory name to look in for files.
    • getInputDirectory

      public String getInputDirectory()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setWildcard

      public void setWildcard(String wildcard)
      Deprecated, for removal: This API element is subject to removal in a future version.
      the wildcard to look for files in the specified directory, e.g. \"*.inp\"
    • getWildcard

      public String getWildcard()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setDirectoryProcessedFiles

      public void setDirectoryProcessedFiles(String directoryProcessedFiles)
      Deprecated, for removal: This API element is subject to removal in a future version.
      the directory to store processed files in
    • getDirectoryProcessedFiles

      public String getDirectoryProcessedFiles()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setResponseTime

      public void setResponseTime(long responseTime)
      Deprecated, for removal: This API element is subject to removal in a future version.
      The time in milliseconds to delay when no records are to be processed, and this class has to look for the arrival of a new file
      Default value
      1000
    • getResponseTime

      public long getResponseTime()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setStoreFileNameInSessionKey

      public void setStoreFileNameInSessionKey(String storeFileNameInSessionKey)
      Deprecated, for removal: This API element is subject to removal in a future version.
      when set, the name of the read file is stored under this session key
    • getStoreFileNameInSessionKey

      public String getStoreFileNameInSessionKey()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getConfigurationClassLoader

      public ClassLoader getConfigurationClassLoader()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IScopeProvider
      This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.
      Specified by:
      getConfigurationClassLoader in interface IScopeProvider
      Returns:
      returns the ClassLoader created by the ClassLoaderManager.
    • getApplicationContext

      public org.springframework.context.ApplicationContext getApplicationContext()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getApplicationContext in interface IConfigurationAware
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware