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>
allowExtensions
private java.lang.String
errorDir
private java.util.List<java.lang.String>
excludeExtensions
private org.apache.commons.logging.Log
logger
private java.lang.String
outboxDir
static java.lang.String
PARAM_FILE_EXTENSION_EXCLUDE_FILTER
static java.lang.String
PARAM_FILE_EXTENSION_FILTER
static java.lang.String
PARAM_OUTBOX_DIRECTORY
private java.lang.String
sentDir
private 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 boolean
checkFile(java.io.File file)
protected abstract Message
createMessage()
private java.util.Map<java.lang.String,java.lang.Long>
getTrackedFiles()
boolean
healthcheck(java.util.List<java.lang.String> failures)
When invoked, the module must run a self check to verify it is functioning correctly.void
init(Session session, java.util.Map<java.lang.String,java.lang.String> options)
Component lifecycle hook.void
poll()
protected void
processFile(java.io.File file)
protected void
scanDirectory(java.lang.String directory)
private void
trackFile(java.io.File file)
private void
updateTracking()
-
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:Component
Component 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:
init
in interfaceComponent
- Overrides:
init
in 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:ActiveModule
When 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:
healthcheck
in interfaceActiveModule
- Specified by:
healthcheck
in 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:
poll
in classPollingModule
-
scanDirectory
protected void scanDirectory(java.lang.String directory) throws java.io.IOException, InvalidParameterException
- Throws:
java.io.IOException
InvalidParameterException
-
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:
createMessage
in 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()
-
-