Package org.openas2.processor.receiver
Class DirectoryPollingModule
- java.lang.Object
-
- org.openas2.BaseComponent
-
- org.openas2.processor.BaseProcessorModule
-
- org.openas2.processor.BaseActiveModule
-
- org.openas2.processor.receiver.BaseReceiverModule
-
- org.openas2.processor.receiver.MessageBuilderModule
-
- org.openas2.processor.receiver.PollingModule
-
- org.openas2.processor.receiver.DirectoryPollingModule
-
- All Implemented Interfaces:
Component,ActiveModule,ProcessorModule,ReceiverModule
- Direct Known Subclasses:
AS2DirectoryPollingModule
public abstract class DirectoryPollingModule extends PollingModule
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>allowExtensionsprivate java.lang.StringerrorDirprivate java.util.List<java.lang.String>excludeExtensionsprivate org.apache.commons.logging.Logloggerprivate java.lang.StringoutboxDirstatic java.lang.StringPARAM_FILE_EXTENSION_EXCLUDE_FILTERstatic java.lang.StringPARAM_FILE_EXTENSION_FILTERstatic java.lang.StringPARAM_OUTBOX_DIRECTORYprivate java.lang.StringsentDirprivate java.util.Map<java.lang.String,java.lang.Long>trackedFiles-
Fields inherited from class org.openas2.processor.receiver.MessageBuilderModule
PARAM_DEFAULTS, PARAM_DELIMITERS, PARAM_ERROR_DIRECTORY, PARAM_ERROR_FILENAME, PARAM_FORMAT, PARAM_MERGE_EXTRA, PARAM_MIMETYPE, PARAM_RESEND_MAX_RETRIES, PARAM_SENT_DIRECTORY, PARAM_SENT_FILENAME
-
-
Constructor Summary
Constructors Constructor Description DirectoryPollingModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancheckFile(java.io.File file)protected abstract MessagecreateMessage()private java.util.Map<java.lang.String,java.lang.Long>getTrackedFiles()booleanhealthcheck(java.util.List<java.lang.String> failures)When invoked, the module must run a self check to verify it is functioning correctly.voidinit(Session session, java.util.Map<java.lang.String,java.lang.String> options)Component lifecycle hook.voidpoll()protected voidprocessFile(java.io.File file)protected voidscanDirectory(java.lang.String directory)private voidtrackFile(java.io.File file)private voidupdateTracking()-
Methods inherited from class org.openas2.processor.receiver.PollingModule
doStart, doStop
-
Methods inherited from class org.openas2.processor.receiver.MessageBuilderModule
buildMessageData, buildMessageMetadata, createParser, processDocument
-
Methods inherited from class org.openas2.processor.BaseActiveModule
canHandle, forceStop, handle, isRunning, start, stop, toString
-
Methods inherited from class org.openas2.BaseComponent
destroy, getName, getParameter, getParameter, getParameterInt, getParameters, getSession, setParameter, setParameter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openas2.processor.ActiveModule
isRunning, start, stop
-
Methods inherited from interface org.openas2.Component
destroy, getName, getParameters, getSession
-
Methods inherited from interface org.openas2.processor.ProcessorModule
canHandle, handle
-
-
-
-
Field Detail
-
PARAM_OUTBOX_DIRECTORY
public static final java.lang.String PARAM_OUTBOX_DIRECTORY
- See Also:
- Constant Field Values
-
PARAM_FILE_EXTENSION_FILTER
public static final java.lang.String PARAM_FILE_EXTENSION_FILTER
- See Also:
- Constant Field Values
-
PARAM_FILE_EXTENSION_EXCLUDE_FILTER
public static final java.lang.String PARAM_FILE_EXTENSION_EXCLUDE_FILTER
- See Also:
- Constant Field Values
-
trackedFiles
private java.util.Map<java.lang.String,java.lang.Long> trackedFiles
-
outboxDir
private java.lang.String outboxDir
-
errorDir
private java.lang.String errorDir
-
sentDir
private java.lang.String sentDir
-
allowExtensions
private java.util.List<java.lang.String> allowExtensions
-
excludeExtensions
private java.util.List<java.lang.String> excludeExtensions
-
logger
private org.apache.commons.logging.Log logger
-
-
Method Detail
-
init
public void init(Session session, java.util.Map<java.lang.String,java.lang.String> options) throws OpenAS2Exception
Description copied from interface:ComponentComponent lifecycle hook. 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:
initin interfaceComponent- Overrides:
initin classPollingModule- Parameters:
session- the component uses this object to access other componentsoptions- configuration values for the component- Throws:
OpenAS2Exception- If an error occurs while initializing the component- See Also:
Session
-
healthcheck
public boolean healthcheck(java.util.List<java.lang.String> failures)
Description copied from interface:ActiveModuleWhen invoked, the module must run a self check to verify it is functioning correctly. Any failures must be reported in the failures list passed in to the method by the callee- Specified by:
healthcheckin interfaceActiveModule- Specified by:
healthcheckin classBaseActiveModule- Parameters:
failures- - a list of failures if any occur- Returns:
- - true if module has no problems otherwise false ith failure messages in passed in List
-
poll
public void poll()
- Specified by:
pollin classPollingModule
-
scanDirectory
protected void scanDirectory(java.lang.String directory) throws java.io.IOException, InvalidParameterException- Throws:
java.io.IOExceptionInvalidParameterException
-
checkFile
protected boolean checkFile(java.io.File file)
-
trackFile
private void trackFile(java.io.File file)
-
updateTracking
private void updateTracking()
-
createMessage
protected abstract Message createMessage()
- Specified by:
createMessagein classMessageBuilderModule
-
processFile
protected void processFile(java.io.File file) throws OpenAS2Exception- Throws:
OpenAS2Exception
-
getTrackedFiles
private java.util.Map<java.lang.String,java.lang.Long> getTrackedFiles()
-
-