Package org.openas2.processor.storage
Class BaseStorageModule
- java.lang.Object
-
- org.openas2.BaseComponent
-
- org.openas2.processor.BaseProcessorModule
-
- org.openas2.processor.storage.BaseStorageModule
-
- All Implemented Interfaces:
Component
,ProcessorModule
,StorageModule
- Direct Known Subclasses:
MDNFileModule
,MessageFileModule
public abstract class BaseStorageModule extends BaseProcessorModule implements StorageModule
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PARAM_FILENAME
static java.lang.String
PARAM_PROTOCOL
static java.lang.String
PARAM_TEMPDIR
-
Fields inherited from interface org.openas2.processor.storage.StorageModule
DO_STORE, DO_STOREMDN
-
-
Constructor Summary
Constructors Constructor Description BaseStorageModule()
-
Method Summary
All Methods Instance Methods Abstract 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.io.File
getFile(Message msg, java.lang.String fileParam)
Add one more method "getFile" to make no impact to all modules who call this method with only two parameter "Message msg" & "String fileParam"protected java.io.File
getFile(Message msg, java.lang.String fileParam, java.lang.String action)
Extracts name of the file from the file parameter and returns a File object with the file nameprotected abstract java.lang.String
getFilename(Message msg, java.lang.String fileParam, java.lang.String action)
protected abstract java.lang.String
getModuleAction()
void
init(Session session, java.util.Map<java.lang.String,java.lang.String> options)
Component lifecycle hook.protected void
store(java.io.File msgFile, java.io.InputStream in)
protected void
writeStream(java.io.InputStream in, java.io.File destination)
-
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, toString, wait, wait, wait
-
Methods inherited from interface org.openas2.Component
destroy, getName, getParameters, getSession
-
Methods inherited from interface org.openas2.processor.ProcessorModule
handle
-
-
-
-
Field Detail
-
PARAM_FILENAME
public static final java.lang.String PARAM_FILENAME
- See Also:
- Constant Field Values
-
PARAM_PROTOCOL
public static final java.lang.String PARAM_PROTOCOL
- See Also:
- Constant Field Values
-
PARAM_TEMPDIR
public static final java.lang.String PARAM_TEMPDIR
- See Also:
- Constant Field Values
-
-
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
-
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
-
getModuleAction
protected abstract java.lang.String getModuleAction()
-
getFile
protected java.io.File getFile(Message msg, java.lang.String fileParam) throws java.io.IOException, OpenAS2Exception
Add one more method "getFile" to make no impact to all modules who call this method with only two parameter "Message msg" & "String fileParam"- Parameters:
msg
- the context objectfileParam
- Name of the file- Returns:
- a File object
- Throws:
java.io.IOException
- - IO system has a problemOpenAS2Exception
- - internally handled error condition occurred
-
getFile
protected java.io.File getFile(Message msg, java.lang.String fileParam, java.lang.String action) throws java.io.IOException, OpenAS2Exception
Extracts name of the file from the file parameter and returns a File object with the file name- Parameters:
msg
- the context objectfileParam
- The parameter containing the format string for the file nameaction
- what to do- Returns:
- a File object
- Throws:
java.io.IOException
- - IO system has a problemOpenAS2Exception
- - internally handled error condition occurred
-
getFilename
protected abstract java.lang.String getFilename(Message msg, java.lang.String fileParam, java.lang.String action) throws InvalidParameterException
- Throws:
InvalidParameterException
-
store
protected void store(java.io.File msgFile, java.io.InputStream in) throws java.io.IOException, OpenAS2Exception
- Throws:
java.io.IOException
OpenAS2Exception
-
writeStream
protected void writeStream(java.io.InputStream in, java.io.File destination) throws java.io.IOException
- Throws:
java.io.IOException
-
-