Package org.openas2.processor.resender
Class DirectoryResenderModule
- java.lang.Object
-
- org.openas2.BaseComponent
-
- org.openas2.processor.BaseProcessorModule
-
- org.openas2.processor.BaseActiveModule
-
- org.openas2.processor.resender.BaseResenderModule
-
- org.openas2.processor.resender.DirectoryResenderModule
-
- All Implemented Interfaces:
Component
,ActiveModule
,ProcessorModule
,ResenderModule
public class DirectoryResenderModule extends BaseResenderModule
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_RESEND_DELAY
private org.apache.commons.logging.Log
logger
static java.lang.String
PARAM_ERROR_DIRECTORY
static java.lang.String
PARAM_RESEND_DELAY
static java.lang.String
PARAM_RESEND_DIRECTORY
private java.lang.String
resendDirPath
-
Fields inherited from class org.openas2.processor.resender.BaseResenderModule
TICK_INTERVAL
-
Fields inherited from interface org.openas2.processor.resender.ResenderModule
DO_RESEND, DO_RESENDMDN, OPTION_CAUSE, OPTION_INITIAL_SENDER, OPTION_RESEND_METHOD, OPTION_RETRIES
-
-
Constructor Summary
Constructors Constructor Description DirectoryResenderModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(java.lang.String action, Message msg, java.util.Map<java.lang.Object,java.lang.Object> options)
protected java.lang.String
getFilename()
void
handle(java.lang.String action, Message msg, java.util.Map<java.lang.Object,java.lang.Object> options)
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.protected boolean
isTimeToSend(java.io.File currentFile)
protected void
processFile(java.io.File file)
void
resend()
protected java.util.List<java.io.File>
scanDirectory()
-
Methods inherited from class org.openas2.processor.resender.BaseResenderModule
doStart, doStop
-
Methods inherited from class org.openas2.processor.BaseActiveModule
forceStop, 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.Component
destroy, getName, getParameters, getSession
-
-
-
-
Field Detail
-
PARAM_RESEND_DIRECTORY
public static final java.lang.String PARAM_RESEND_DIRECTORY
- See Also:
- Constant Field Values
-
PARAM_ERROR_DIRECTORY
public static final java.lang.String PARAM_ERROR_DIRECTORY
- See Also:
- Constant Field Values
-
PARAM_RESEND_DELAY
public static final java.lang.String PARAM_RESEND_DELAY
- See Also:
- Constant Field Values
-
resendDirPath
private java.lang.String resendDirPath
-
DEFAULT_RESEND_DELAY
public static final long DEFAULT_RESEND_DELAY
- See Also:
- Constant Field Values
-
logger
private org.apache.commons.logging.Log logger
-
-
Method Detail
-
canHandle
public boolean canHandle(java.lang.String action, Message msg, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
canHandle
in interfaceProcessorModule
- Overrides:
canHandle
in classBaseActiveModule
-
handle
public void handle(java.lang.String action, Message msg, java.util.Map<java.lang.Object,java.lang.Object> options) throws OpenAS2Exception
- Specified by:
handle
in interfaceProcessorModule
- Overrides:
handle
in classBaseActiveModule
- Throws:
OpenAS2Exception
-
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 classBaseComponent
- 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
-
resend
public void resend()
- Specified by:
resend
in classBaseResenderModule
-
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
-
getFilename
protected java.lang.String getFilename() throws InvalidParameterException
- Throws:
InvalidParameterException
-
isTimeToSend
protected boolean isTimeToSend(java.io.File currentFile)
-
processFile
protected void processFile(java.io.File file) throws OpenAS2Exception
- Throws:
OpenAS2Exception
-
scanDirectory
protected java.util.List<java.io.File> scanDirectory() throws OpenAS2Exception, java.io.IOException
- Throws:
OpenAS2Exception
java.io.IOException
-
-