Package adams.scripting.command.basic
Class RetrieveFile
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,RemoteCommand
,RemoteCommandWithErrorMessage
,RemoteCommandWithResponse
,Serializable
public class RetrieveFile extends AbstractCommandWithResponse
Retrieves a file as binary blob.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
m_Content
the actual payload.protected PlaceholderFile
m_LocalFile
the local file to save to.protected PlaceholderFile
m_RemoteFile
the file to retrieve.-
Fields inherited from class adams.scripting.command.AbstractCommandWithResponse
m_ErrorMessage, m_ResponseConnection
-
Fields inherited from class adams.scripting.command.AbstractCommand
m_RemoteScriptingEngineHandler, m_Request
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.scripting.command.RemoteCommand
KEY_COMMAND, KEY_TYPE, VALUE_REQUEST, VALUE_RESPONSE
-
-
Constructor Summary
Constructors Constructor Description RetrieveFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected String
doHandleRequest(RemoteScriptingEngine engine, RemoteCommandProcessor processor)
Handles the request.PlaceholderFile
getLocalFile()
Returns the local file to save the remote file to.PlaceholderFile
getRemoteFile()
Returns the remote file to send.byte[]
getRequestPayload()
Always zero-length array.Object[]
getRequestPayloadObjects()
Returns the objects that represent the request payload.byte[]
getResponsePayload()
Returns the payload of the response, if any.Object[]
getResponsePayloadObjects()
Returns the objects that represent the response payload.String
globalInfo()
Returns a string describing the object.void
handleResponse(RemoteScriptingEngine engine, ResponseHandler handler)
Handles the response.String
localFileTipText()
Returns the tip text for this property.String
remoteFileTipText()
Returns the tip text for this property.void
setLocalFile(PlaceholderFile value)
Sets the local file to save the remote file to.void
setRemoteFile(PlaceholderFile value)
Sets the remote file to send.void
setRequestPayload(byte[] value)
Ignored.void
setResponsePayload(byte[] value)
Sets the payload for the response.String
toString()
Returns a short description of the command.-
Methods inherited from class adams.scripting.command.AbstractCommandWithResponse
afterSendResponse, assembleResponse, assembleResponseHeader, beforeSendResponse, getDefaultResponseConnection, getErrorMessage, getResponseConnection, hasErrorMessage, parse, prepareResponsePayload, responseConnectionTipText, setResponseConnection
-
Methods inherited from class adams.scripting.command.AbstractCommand
afterSendRequest, assembleRequest, assembleRequestHeader, beforeSendRequest, getRemoteScriptingEngineHandler, handleRequest, initialize, isRequest, prepareRequestPayload, setRemoteScriptingEngineHandler, setRequest
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.scripting.command.RemoteCommand
afterSendRequest, assembleRequest, beforeSendRequest, getRemoteScriptingEngineHandler, handleRequest, isRequest, setRemoteScriptingEngineHandler, setRequest
-
-
-
-
Field Detail
-
m_RemoteFile
protected PlaceholderFile m_RemoteFile
the file to retrieve.
-
m_LocalFile
protected PlaceholderFile m_LocalFile
the local file to save to.
-
m_Content
protected byte[] m_Content
the actual payload.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractCommandWithResponse
-
setRemoteFile
public void setRemoteFile(PlaceholderFile value)
Sets the remote file to send.- Parameters:
value
- the file
-
getRemoteFile
public PlaceholderFile getRemoteFile()
Returns the remote file to send.- Returns:
- the file
-
remoteFileTipText
public String remoteFileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setLocalFile
public void setLocalFile(PlaceholderFile value)
Sets the local file to save the remote file to.- Parameters:
value
- the file
-
getLocalFile
public PlaceholderFile getLocalFile()
Returns the local file to save the remote file to.- Returns:
- the file
-
localFileTipText
public String localFileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setRequestPayload
public void setRequestPayload(byte[] value)
Ignored.- Parameters:
value
- the payload
-
getRequestPayload
public byte[] getRequestPayload()
Always zero-length array.- Returns:
- the payload
-
getRequestPayloadObjects
public Object[] getRequestPayloadObjects()
Returns the objects that represent the request payload.- Returns:
- the objects
-
doHandleRequest
protected String doHandleRequest(RemoteScriptingEngine engine, RemoteCommandProcessor processor)
Handles the request.- Overrides:
doHandleRequest
in classAbstractCommandWithResponse
- Parameters:
engine
- the remote engine handling the requestprocessor
- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
toString
public String toString()
Returns a short description of the command.- Overrides:
toString
in classAbstractCommandWithResponse
- Returns:
- the description
-
setResponsePayload
public void setResponsePayload(byte[] value)
Sets the payload for the response.- Parameters:
value
- the payload
-
getResponsePayload
public byte[] getResponsePayload()
Returns the payload of the response, if any.- Returns:
- the payload
-
getResponsePayloadObjects
public Object[] getResponsePayloadObjects()
Returns the objects that represent the response payload.- Returns:
- the objects
-
handleResponse
public void handleResponse(RemoteScriptingEngine engine, ResponseHandler handler)
Handles the response.- Specified by:
handleResponse
in interfaceRemoteCommandWithResponse
- Overrides:
handleResponse
in classAbstractCommandWithResponse
- Parameters:
engine
- the remote engine handling the responsehandler
- for handling the response
-
-