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 @ConfigurationWarning("Please replace with DirectoryListener, in combination with a FileLineIteratorPipe") public class FileRecordListener extends Object implements IPullingListener<String>
Deprecated.
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 Details

    • log

      protected org.apache.logging.log4j.Logger log
      Deprecated.
  • Constructor Details

    • FileRecordListener

      public FileRecordListener()
      Deprecated.
  • Method Details

    • afterMessageProcessed

      public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<String> rawMessage, PipeLineSession pipeLineSession) throws ListenerException
      Deprecated.
      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.
      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.
      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.
      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.
      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.
      Gets a file to process.
    • getRawMessage

      public RawMessageWrapper<String> getRawMessage(@Nonnull Map<String,Object> threadContext) throws ListenerException
      Deprecated.
      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.
      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.
      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.
      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.
      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.
    • getSender

      public ISender getSender()
      Deprecated.
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • setName

      public void setName(String name)
      Deprecated.
      name of the listener as known to the adapter.
      Specified by:
      setName in interface INamedObject
    • getName

      public String getName()
      Deprecated.
      Specified by:
      getName in interface IConfigurationAware
      Specified by:
      getName in interface INamedObject
    • setInputDirectory

      public void setInputDirectory(String inputDirectory)
      Deprecated.
      the directory name to look in for files.
    • getInputDirectory

      public String getInputDirectory()
      Deprecated.
    • setWildcard

      public void setWildcard(String wildcard)
      Deprecated.
      the wildcard to look for files in the specified directory, e.g. \"*.inp\"
    • getWildcard

      public String getWildcard()
      Deprecated.
    • setDirectoryProcessedFiles

      public void setDirectoryProcessedFiles(String directoryProcessedFiles)
      Deprecated.
      the directory to store processed files in
    • getDirectoryProcessedFiles

      public String getDirectoryProcessedFiles()
      Deprecated.
    • setResponseTime

      public void setResponseTime(long responseTime)
      Deprecated.
      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.
    • setStoreFileNameInSessionKey

      public void setStoreFileNameInSessionKey(String storeFileNameInSessionKey)
      Deprecated.
      when set, the name of the read file is stored under this session key
    • getStoreFileNameInSessionKey

      public String getStoreFileNameInSessionKey()
      Deprecated.
    • getConfigurationClassLoader

      public ClassLoader getConfigurationClassLoader()
      Deprecated.
      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.
      Specified by:
      getApplicationContext in interface IConfigurationAware
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Deprecated.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware