Package adams.scripting.command.basic
Class SendFile
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.scripting.command.AbstractCommand
-
- adams.scripting.command.basic.SendFile
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,RemoteCommand
,Serializable
public class SendFile extends AbstractCommand
Sends 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_File
the file to send.protected PlaceholderDirectory
m_RemoteDir
the remote directory where to place the file.-
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 SendFile()
-
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.String
fileTipText()
Returns the tip text for this property.PlaceholderFile
getFile()
Returns the file to send.PlaceholderDirectory
getRemoteDir()
Returns the remote directory to place the file in.byte[]
getRequestPayload()
Returns the payload of the request, if any.Object[]
getRequestPayloadObjects()
Returns the objects that represent the request payload.String
globalInfo()
Returns a string describing the object.protected void
prepareRequestPayload()
Hook method for preparing the request payload,String
remoteDirTipText()
Returns the tip text for this property.void
setFile(PlaceholderFile value)
Sets the file to send.void
setRemoteDir(PlaceholderDirectory value)
Sets the remote directory to place the file in.void
setRequestPayload(byte[] value)
Sets the payload for the request.String
toString()
Returns a short description of the command.-
Methods inherited from class adams.scripting.command.AbstractCommand
afterSendRequest, assembleRequest, assembleRequestHeader, beforeSendRequest, getRemoteScriptingEngineHandler, handleRequest, initialize, isRequest, parse, 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
-
-
-
-
Field Detail
-
m_File
protected PlaceholderFile m_File
the file to send.
-
m_RemoteDir
protected PlaceholderDirectory m_RemoteDir
the remote directory where to place the file.
-
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 classAbstractOptionHandler
-
setFile
public void setFile(PlaceholderFile value)
Sets the file to send.- Parameters:
value
- the file
-
getFile
public PlaceholderFile getFile()
Returns the file to send.- Returns:
- the file
-
fileTipText
public String fileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setRemoteDir
public void setRemoteDir(PlaceholderDirectory value)
Sets the remote directory to place the file in.- Parameters:
value
- the dir
-
getRemoteDir
public PlaceholderDirectory getRemoteDir()
Returns the remote directory to place the file in.- Returns:
- the dir
-
remoteDirTipText
public String remoteDirTipText()
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)
Sets the payload for the request.- Parameters:
value
- the payload
-
prepareRequestPayload
protected void prepareRequestPayload()
Hook method for preparing the request payload,- Overrides:
prepareRequestPayload
in classAbstractCommand
-
getRequestPayload
public byte[] getRequestPayload()
Returns the payload of the request, if any.- 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.- Specified by:
doHandleRequest
in classAbstractCommand
- 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 classAbstractCommand
- Returns:
- the description
-
-