Package nl.nn.adapterframework.receivers
Class FileRecordListener
- java.lang.Object
-
- nl.nn.adapterframework.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.Filelistener
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
log
Deprecated.
-
Constructor Summary
Constructors Constructor Description FileRecordListener()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<String> rawMessage, PipeLineSession pipeLineSession)
Deprecated.Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.protected String
archiveFile(File file)
Deprecated.Moves a file to another directory and places a UUID in the name.void
close()
Deprecated.Close all resources used for listening.void
closeThread(Map<String,Object> threadContext)
Deprecated.Finalizes a message receiving thread.void
configure()
Deprecated.Configure does some basic checks (directoryProcessedFiles is a directory, inputDirectory is a directory, wildcard is filled etc.);Message
extractMessage(RawMessageWrapper<String> rawMessage, Map<String,Object> context)
Deprecated.Extracts data from message obtained fromIPullingListener.getRawMessage(Map)
orIPushingListener.wrapRawMessage(Object, PipeLineSession)
.org.springframework.context.ApplicationContext
getApplicationContext()
Deprecated.ClassLoader
getConfigurationClassLoader()
Deprecated.This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.String
getDirectoryProcessedFiles()
Deprecated.protected File
getFileToProcess()
Deprecated.Gets a file to process.String
getInputDirectory()
Deprecated.String
getName()
Deprecated.RawMessageWrapper<String>
getRawMessage(Map<String,Object> threadContext)
Deprecated.Retrieves a single record from a file.long
getResponseTime()
Deprecated.ISender
getSender()
Deprecated.String
getStoreFileNameInSessionKey()
Deprecated.String
getWildcard()
Deprecated.void
open()
Deprecated.Prepares the listener for receiving messages.Map<String,Object>
openThread()
Deprecated.Prepares a thread for receiving messages.protected Iterator<String>
parseToRecords(String input)
Deprecated.Parse a String to an Iterator with objects (records).void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Deprecated.void
setDirectoryProcessedFiles(String directoryProcessedFiles)
Deprecated.the directory to store processed files invoid
setInputDirectory(String inputDirectory)
Deprecated.the directory name to look in for files.void
setName(String name)
Deprecated.name of the listener as known to the adapter.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 filevoid
setSender(ISender sender)
Deprecated.void
setStoreFileNameInSessionKey(String storeFileNameInSessionKey)
Deprecated.when set, the name of the read file is stored under this session keyvoid
setWildcard(String wildcard)
Deprecated.the wildcard to look for files in the specified directory, e.g.String
toString()
Deprecated.
-
-
-
Method Detail
-
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 interfaceIListener<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 interfaceIListener<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 beforeIListener.close()
is called.- Specified by:
closeThread
in interfaceIPullingListener<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 interfaceIConfigurable
- Specified by:
configure
in interfaceIListener<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 interfaceIPullingListener<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 fromIPullingListener.getRawMessage(Map)
orIPushingListener.wrapRawMessage(Object, PipeLineSession)
. May also extract other parameters from the message and put those into the context.- Specified by:
extractMessage
in interfaceIListener<String>
- Parameters:
rawMessage
- TheRawMessageWrapper
from which to extract theMessage
.context
- Context to populate. Either aPipeLineSession
or aMap
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 interfaceIListener<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 interfaceIPullingListener<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.
-
setName
public void setName(String name)
Deprecated.name of the listener as known to the adapter.- Specified by:
setName
in interfaceINamedObject
-
getName
public String getName()
Deprecated.- Specified by:
getName
in interfaceIConfigurationAware
- Specified by:
getName
in interfaceINamedObject
-
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 interfaceIScopeProvider
- Returns:
- returns the ClassLoader created by the
ClassLoaderManager
.
-
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext()
Deprecated.- Specified by:
getApplicationContext
in interfaceIConfigurationAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Deprecated.- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
-