Class 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 loads the actual payload from the specified directory using the file name (without path) received 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.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Field Detail

      • m_PayloadDir

        protected adams.core.io.PlaceholderDirectory m_PayloadDir
        the directory to store the actual payload in.
    • Constructor Detail

      • FileBasedConverter

        public FileBasedConverter()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.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 interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.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 interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class AbstractConverter
        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.
      • generates

        public Class generates()
        Returns the class that the converter generates.
        Specified by:
        generates in class AbstractConverter
        Returns:
        the class
      • doConvert

        protected Object doConvert​(byte[] payload,
                                   adams.core.MessageCollection errors)
        Converts the payload.
        Specified by:
        doConvert in class AbstractConverter
        Parameters:
        payload - the payload
        errors - for recording errors
        Returns:
        null if failed to convert, otherwise byte array