Class AbstractStorageModule
- java.lang.Object
-
- com.helger.as2lib.AbstractDynamicComponent
-
- com.helger.as2lib.processor.module.AbstractProcessorModule
-
- com.helger.as2lib.processor.storage.AbstractStorageModule
-
- All Implemented Interfaces:
IDynamicComponent,IProcessorModule,IProcessorStorageModule
- Direct Known Subclasses:
MDNFileModule,MessageFileModule
public abstract class AbstractStorageModule extends AbstractProcessorModule implements IProcessorStorageModule
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_CHARSETstatic StringATTR_FILENAMEstatic StringATTR_PROTOCOLstatic StringATTR_TEMPDIR-
Fields inherited from class com.helger.as2lib.AbstractDynamicComponent
m_aRWLock
-
Fields inherited from interface com.helger.as2lib.processor.storage.IProcessorStorageModule
DO_STORE, DO_STOREMDN, DO_VALIDATE_AFTER_STORE, DO_VALIDATE_BEFORE_STORE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStorageModule(String sModuleAction)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanHandle(String sAction, IMessage aMsg, Map<String,Object> aOptions)Check if this processor module can handle a certain action on the provided messagebooleanequals(Object o)protected CharsetgetCharset()StringgetCharsetName()protected FilegetFile(IMessage aMsg, String sFileParam)Not final - see #105StringgetFilename()protected abstract StringgetFilename(IMessage aMsg, String sFileParam)StringgetProtocol()StringgetTempDir()inthashCode()voidinitDynamicComponent(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.voidsetCharsetName(String sCharsetName)voidsetFilename(String sFilename)voidsetProtocol(String sProtocol)voidsetTempDir(String sTempDir)protected voidstore(File aMsgFile, InputStream aIS)-
Methods inherited from class com.helger.as2lib.AbstractDynamicComponent
attrs, getAttributeAsIntRequired, getAttributeAsStringRequired, getName, getSession, toString
-
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.IProcessorModule
handle
-
-
-
-
Field Detail
-
ATTR_FILENAME
public static final String ATTR_FILENAME
- See Also:
- Constant Field Values
-
ATTR_PROTOCOL
public static final String ATTR_PROTOCOL
- See Also:
- Constant Field Values
-
ATTR_TEMPDIR
public static final String ATTR_TEMPDIR
- See Also:
- Constant Field Values
-
ATTR_CHARSET
public static final String ATTR_CHARSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCharset
@Nonnull protected Charset getCharset()
- Returns:
- The charset configured via
ATTR_CHARSETparameter or the system default. Nevernull.
-
canHandle
public final boolean canHandle(@Nonnull String sAction, @Nonnull IMessage aMsg, @Nullable Map<String,Object> aOptions)
Description copied from interface:IProcessorModuleCheck if this processor module can handle a certain action on the provided message- Specified by:
canHandlein interfaceIProcessorModule- Parameters:
sAction- The action to be executed. Nevernull.aMsg- The message in question. May be an AS2 message or an MDN message. Nevernull.aOptions- The options to be considered. May benull.- Returns:
trueof this module can handle the respective message,falseif not.
-
initDynamicComponent
public final void initDynamicComponent(@Nonnull IAS2Session aSession, @Nullable com.helger.commons.collection.attr.IStringMap aOptions) throws AS2Exception
Description copied from interface:IDynamicComponentAfter 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:
initDynamicComponentin interfaceIDynamicComponent- Overrides:
initDynamicComponentin classAbstractDynamicComponent- 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
-
getFilename
protected abstract String getFilename(IMessage aMsg, String sFileParam) throws AS2InvalidParameterException
- Throws:
AS2InvalidParameterException
-
getFile
@Nonnull @OverrideOnDemand protected File getFile(@Nonnull IMessage aMsg, @Nullable String sFileParam) throws IOException, AS2Exception
Not final - see #105- Parameters:
aMsg- The source messagesFileParam- The parameter name including the filename- Returns:
- File The
Fileto be used - Throws:
IOException- In case of IO errorAS2Exception- In case of error- Since:
- 2007-06-01
-
store
protected void store(@Nonnull File aMsgFile, @Nonnull @WillClose InputStream aIS) throws IOException
- Throws:
IOException
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAbstractDynamicComponent
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDynamicComponent
-
-