Package adams.core.net.rabbitmq.receive
Class DataExchangeServerBasedConverter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.net.rabbitmq.receive.AbstractConverter
-
- adams.core.net.rabbitmq.receive.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 loads the actual payload from the the specified data exchange server using the token received 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_ActualDownloadURL
the actual server URL (download).protected adams.core.base.BaseURL
m_ActualRemoveURL
the actual server URL (remove).protected AbstractClientAuthentication
m_Authentication
the authentication to use.protected DataExchangeServerConnection
m_Connection
the connection in use.protected AbstractConverter
m_Converter
the base converter.protected boolean
m_Remove
whether to delete the data after 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.receive.AbstractConverter
m_FlowContext
-
-
Constructor Summary
Constructors Constructor Description DataExchangeServerBasedConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
authenticationTipText()
Returns the tip text for this property.String
check(byte[] 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 Object
doConvert(byte[] payload, adams.core.MessageCollection errors)
Converts the payload.Class
generates()
Returns the class that the converter generates.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.boolean
getRemove()
Returns whether to immediately remove the data from the server once successfully retrieved.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.String
removeTipText()
Returns the tip text for this property.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
setRemove(boolean value)
Sets whether to immediately remove the data from the server once successfully retrieved.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.receive.AbstractConverter
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_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_Remove
protected boolean m_Remove
whether to delete the data after use.
-
m_ActualDownloadURL
protected transient adams.core.base.BaseURL m_ActualDownloadURL
the actual server URL (download).
-
m_ActualRemoveURL
protected transient adams.core.base.BaseURL m_ActualRemoveURL
the actual server URL (remove).
-
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
-
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.
-
setRemove
public void setRemove(boolean value)
Sets whether to immediately remove the data from the server once successfully retrieved.- Parameters:
value
- true if to remove
-
getRemove
public boolean getRemove()
Returns whether to immediately remove the data from the server once successfully retrieved.- Returns:
- true if to remove
-
removeTipText
public String removeTipText()
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 classAbstractConverter
- Returns:
- the class
-
check
public String check(byte[] 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 Object doConvert(byte[] 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
-
-