Package adams.core.net.rabbitmq.send
Class FileBasedConverter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.net.rabbitmq.send.AbstractConverter
-
- adams.core.net.rabbitmq.send.FileBasedConverter
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.SizeOfHandler
,adams.flow.core.FlowContextHandler
,Serializable
public class FileBasedConverter extends AbstractConverter
Instead of sending potentially large payloads via a RabbitMQ, this meta-converter stores the actual payload in the specified directory and only sends the file name (without path) via RabbitMQ. Of course, requires sending and receiving ends to have access to the same directory.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractConverter
m_Converter
the base converter.protected adams.core.io.PlaceholderDirectory
m_PayloadDir
the directory to store the actual payload in.-
Fields inherited from class adams.core.net.rabbitmq.send.AbstractConverter
m_FlowContext
-
-
Constructor Summary
Constructors Constructor Description FileBasedConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the classes that the converter accepts.String
converterTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected byte[]
doConvert(Object payload, adams.core.MessageCollection errors)
Converts the payload.AbstractConverter
getConverter()
Returns the base converter to use.adams.core.io.PlaceholderDirectory
getPayloadDir()
Returns the directory for storing the payloads in.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
payloadDirTipText()
Returns the tip text for this property.void
setConverter(AbstractConverter value)
Sets the base converter to use.void
setPayloadDir(adams.core.io.PlaceholderDirectory value)
Sets the directory for storing the payloads in.-
Methods inherited from class adams.core.net.rabbitmq.send.AbstractConverter
check, convert, getFlowContext, setFlowContext
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Converter
protected AbstractConverter m_Converter
the base converter.
-
m_PayloadDir
protected adams.core.io.PlaceholderDirectory m_PayloadDir
the directory to store the actual payload in.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractConverter
- Returns:
- null if no info available, otherwise short string
-
setConverter
public void setConverter(AbstractConverter value)
Sets the base converter to use.- Parameters:
value
- the converter
-
getConverter
public AbstractConverter getConverter()
Returns the base converter to use.- Returns:
- the converter
-
converterTipText
public String converterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPayloadDir
public void setPayloadDir(adams.core.io.PlaceholderDirectory value)
Sets the directory for storing the payloads in.- Parameters:
value
- the directory
-
getPayloadDir
public adams.core.io.PlaceholderDirectory getPayloadDir()
Returns the directory for storing the payloads in.- Returns:
- the directory
-
payloadDirTipText
public String payloadDirTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
accepts
public Class[] accepts()
Returns the classes that the converter accepts.- Specified by:
accepts
in classAbstractConverter
- Returns:
- the classes
-
doConvert
protected byte[] doConvert(Object payload, adams.core.MessageCollection errors)
Converts the payload.- Specified by:
doConvert
in classAbstractConverter
- Parameters:
payload
- the payloaderrors
- for recording errors- Returns:
- null if failed to convert, otherwise byte array
-
-