Class AbstractDirectoryPollingModule
- java.lang.Object
-
- com.helger.as2lib.AbstractDynamicComponent
-
- com.helger.as2lib.processor.module.AbstractProcessorModule
-
- com.helger.as2lib.processor.module.AbstractActiveModule
-
- com.helger.as2lib.processor.receiver.AbstractActiveReceiverModule
-
- com.helger.as2lib.processor.receiver.AbstractActivePollingModule
-
- com.helger.as2lib.processor.receiver.AbstractDirectoryPollingModule
-
- All Implemented Interfaces:
IDynamicComponent
,IProcessorActiveModule
,IProcessorModule
,IProcessorReceiverModule
- Direct Known Subclasses:
AS2DirectoryPollingModule
public abstract class AbstractDirectoryPollingModule extends AbstractActivePollingModule
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_DEFAULTS
static String
ATTR_DELIMITERS
static String
ATTR_ERROR_DIRECTORY
Path of the error directory.static String
ATTR_FORMAT
static String
ATTR_MIMETYPE
static String
ATTR_OUTBOX_DIRECTORY
Path of the directory to poll from.static String
ATTR_SENDFILENAME
static String
ATTR_SENT_DIRECTORY
Path of the error directory.static String
ATTR_STORED_ERROR_FILENAME
Optional filename for storage in the error directory.static String
ATTR_STORED_SENT_FILENAME
Optional filename for storage in the sent directory.-
Fields inherited from class com.helger.as2lib.processor.receiver.AbstractActivePollingModule
ATTR_POLLING_INTERVAL
-
Fields inherited from class com.helger.as2lib.AbstractDynamicComponent
m_aRWLock
-
-
Constructor Summary
Constructors Constructor Description AbstractDirectoryPollingModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkFile(File aFile)
protected abstract IMessage
createMessage()
void
initDynamicComponent(IAS2Session aSession, com.helger.commons.collection.attr.IStringMap aOptions)
After creating a Component object, this method should be called to set any parameters used by the component.void
poll()
The abstract message that is called in the defined interval and needs to be overridden by subclasses.protected void
processFile(File aFile)
protected void
scanDirectory(String sDirectory)
com.helger.commons.collection.impl.ICommonsMap<String,Long>
trackedFiles()
protected void
trackFile(File aFile)
void
updateMessage(IMessage aMsg, File aFile)
protected void
updateTracking()
-
Methods inherited from class com.helger.as2lib.processor.receiver.AbstractActivePollingModule
doStart, doStop, getInterval, isBusy, setInterval
-
Methods inherited from class com.helger.as2lib.processor.module.AbstractActiveModule
canHandle, equals, forceStop, handle, hashCode, isRunning, start, stop, toString
-
Methods inherited from class com.helger.as2lib.AbstractDynamicComponent
attrs, getAttributeAsIntRequired, getAttributeAsStringRequired, getName, getSession
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.as2lib.IDynamicComponent
attrs, getName, getSession
-
Methods inherited from interface com.helger.as2lib.processor.module.IProcessorActiveModule
isRunning, start, stop
-
Methods inherited from interface com.helger.as2lib.processor.module.IProcessorModule
canHandle, handle
-
-
-
-
Field Detail
-
ATTR_OUTBOX_DIRECTORY
public static final String ATTR_OUTBOX_DIRECTORY
Path of the directory to poll from.- See Also:
- Constant Field Values
-
ATTR_ERROR_DIRECTORY
public static final String ATTR_ERROR_DIRECTORY
Path of the error directory. May contain "date" and "msg" parameters.- See Also:
- Constant Field Values
-
ATTR_STORED_ERROR_FILENAME
public static final String ATTR_STORED_ERROR_FILENAME
Optional filename for storage in the error directory. May contain "date" and "msg" parameters.- Since:
- 4.8.0
- See Also:
- Constant Field Values
-
ATTR_SENT_DIRECTORY
public static final String ATTR_SENT_DIRECTORY
Path of the error directory. May contain "date" and "msg" parameters.- See Also:
- Constant Field Values
-
ATTR_STORED_SENT_FILENAME
public static final String ATTR_STORED_SENT_FILENAME
Optional filename for storage in the sent directory. May contain "date" and "msg" parameters.- Since:
- 4.8.0
- See Also:
- Constant Field Values
-
ATTR_FORMAT
public static final String ATTR_FORMAT
- See Also:
- Constant Field Values
-
ATTR_DELIMITERS
public static final String ATTR_DELIMITERS
- See Also:
- Constant Field Values
-
ATTR_DEFAULTS
public static final String ATTR_DEFAULTS
- See Also:
- Constant Field Values
-
ATTR_MIMETYPE
public static final String ATTR_MIMETYPE
- See Also:
- Constant Field Values
-
ATTR_SENDFILENAME
public static final String ATTR_SENDFILENAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
initDynamicComponent
public void initDynamicComponent(@Nonnull IAS2Session aSession, @Nullable com.helger.commons.collection.attr.IStringMap aOptions) throws AS2Exception
Description copied from interface:IDynamicComponent
After creating a Component object, this method should be called to set any parameters used by the component. Component implementations typically have required parameter checking and code to start timers and threads within this method.- Specified by:
initDynamicComponent
in interfaceIDynamicComponent
- Overrides:
initDynamicComponent
in classAbstractActivePollingModule
- Parameters:
aSession
- the component uses this object to access other componentsaOptions
- configuration values for the component. All parameters will be stored as attributes of this component. All attributes existing before this method is called will be removed!- Throws:
AS2Exception
- If an error occurs while initializing the componentAS2InvalidParameterException
- If a required parameter is null in the parameters Map- See Also:
IAS2Session
-
trackedFiles
@Nonnull @ReturnsMutableObject public final com.helger.commons.collection.impl.ICommonsMap<String,Long> trackedFiles()
- Returns:
- A map from absolute file path to the size of the file. Never
null
.
-
scanDirectory
protected void scanDirectory(String sDirectory) throws AS2InvalidParameterException
- Throws:
AS2InvalidParameterException
-
processFile
protected void processFile(@Nonnull File aFile) throws AS2Exception
- Throws:
AS2Exception
-
updateTracking
protected void updateTracking() throws AS2Exception
- Throws:
AS2Exception
-
updateMessage
public void updateMessage(@Nonnull IMessage aMsg, @Nonnull File aFile) throws AS2Exception
- Throws:
AS2Exception
-
poll
public void poll()
Description copied from class:AbstractActivePollingModule
The abstract message that is called in the defined interval and needs to be overridden by subclasses.- Specified by:
poll
in classAbstractActivePollingModule
-
-