Package adams.core.net.rabbitmq.send
Class DataExchangeServerBasedConverter
- 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.DataExchangeServerBasedConverter
-
- 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 DataExchangeServerBasedConverter extends AbstractConverter
Instead of sending potentially large payloads via a RabbitMQ, this meta-converter uploads the payload to the specified data exchange server and only sends the token for obtaining the data again via RabbitMQ.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractClientAuthentication
m_ActualAuthentication
the actual authentication in use.protected adams.core.base.BaseURL
m_ActualURL
the actual server URL.protected AbstractClientAuthentication
m_Authentication
the authentication to use.protected DataExchangeServerConnection
m_Connection
the connection in use.protected AbstractConverter
m_Converter
the base converter.protected com.fasterxml.jackson.databind.ObjectMapper
m_Mapper
the object mapper in use.protected adams.core.base.BaseURL
m_Server
the data exchange server to use.protected boolean
m_UseFlowContextConnection
whether to use a DEX connection from the flow context.-
Fields inherited from class adams.core.net.rabbitmq.send.AbstractConverter
m_FlowContext
-
-
Constructor Summary
Constructors Constructor Description DataExchangeServerBasedConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the classes that the converter accepts.String
authenticationTipText()
Returns the tip text for this property.String
check(Object payload)
Hook method for checks.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.AbstractClientAuthentication
getAuthentication()
Returns the authentication to use for accessing the server.AbstractConverter
getConverter()
Returns the base converter to use.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.adams.core.base.BaseURL
getServer()
Returns the data exchange server to use.boolean
getUseFlowContextConnection()
Returns whether the data exchange server connection available through the flow context is used rather than the server/authentication defined here.String
globalInfo()
Returns a string describing the object.protected void
reset()
Resets the scheme.String
serverTipText()
Returns the tip text for this property.void
setAuthentication(AbstractClientAuthentication value)
Sets the authentication to use for accessing the server.void
setConverter(AbstractConverter value)
Sets the base converter to use.void
setServer(adams.core.base.BaseURL value)
Sets the data exchange server to use.void
setUseFlowContextConnection(boolean value)
Sets whether the data exchange server connection available through the flow context is used rather than the server/authentication defined here.String
useFlowContextConnectionTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.net.rabbitmq.send.AbstractConverter
convert, getFlowContext, setFlowContext
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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_UseFlowContextConnection
protected boolean m_UseFlowContextConnection
whether to use a DEX connection from the flow context.
-
m_Connection
protected transient DataExchangeServerConnection m_Connection
the connection in use.
-
m_Server
protected adams.core.base.BaseURL m_Server
the data exchange server to use.
-
m_Authentication
protected AbstractClientAuthentication m_Authentication
the authentication to use.
-
m_Mapper
protected transient com.fasterxml.jackson.databind.ObjectMapper m_Mapper
the object mapper in use.
-
m_ActualURL
protected transient adams.core.base.BaseURL m_ActualURL
the actual server URL.
-
m_ActualAuthentication
protected AbstractClientAuthentication m_ActualAuthentication
the actual authentication in use.
-
-
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
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
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.
-
setUseFlowContextConnection
public void setUseFlowContextConnection(boolean value)
Sets whether the data exchange server connection available through the flow context is used rather than the server/authentication defined here.- Parameters:
value
- true if to use connection from context
-
getUseFlowContextConnection
public boolean getUseFlowContextConnection()
Returns whether the data exchange server connection available through the flow context is used rather than the server/authentication defined here.- Returns:
- true if to use connection from context
-
useFlowContextConnectionTipText
public String useFlowContextConnectionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setServer
public void setServer(adams.core.base.BaseURL value)
Sets the data exchange server to use.- Parameters:
value
- the server
-
getServer
public adams.core.base.BaseURL getServer()
Returns the data exchange server to use.- Returns:
- the server
-
serverTipText
public String serverTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAuthentication
public void setAuthentication(AbstractClientAuthentication value)
Sets the authentication to use for accessing the server.- Parameters:
value
- the authentication
-
getAuthentication
public AbstractClientAuthentication getAuthentication()
Returns the authentication to use for accessing the server.- Returns:
- the authentication
-
authenticationTipText
public String authenticationTipText()
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
-
check
public String check(Object payload)
Hook method for checks.- Overrides:
check
in classAbstractConverter
- Parameters:
payload
- the payload to check- Returns:
- null if sucessfully checked, otherwise error message
-
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
-
-