Package adams.scripting.processor
Class DefaultProcessor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.scripting.processor.AbstractRemoteCommandProcessor
-
- adams.scripting.processor.DefaultProcessor
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,RemoteCommandProcessor
,Serializable
public class DefaultProcessor extends AbstractRemoteCommandProcessor
Processors for simple remote command format.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
MESSAGE_CHARSET
static int
PAYLOAD_WIDTH
the width in characters for the base64 encoded payload.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description DefaultProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Properties header, byte[] payload)
Turns the command properties and payload into a single string to send.String
globalInfo()
Returns a string describing the object.RemoteCommand
parse(String data, MessageCollection errors)
Instantiates the command from the received data string.RemoteCommand
read(File file, MessageCollection errors)
Reads a remote command from a file.boolean
write(RemoteCommand cmd, File file, MessageCollection errors)
Writes a remote command to a file.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
PAYLOAD_WIDTH
public static final int PAYLOAD_WIDTH
the width in characters for the base64 encoded payload.- See Also:
- Constant Field Values
-
MESSAGE_CHARSET
public static final String MESSAGE_CHARSET
- See Also:
- Constant Field Values
-
-
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
-
parse
public RemoteCommand parse(String data, MessageCollection errors)
Instantiates the command from the received data string.- Parameters:
data
- the data string to parseerrors
- for collecting errors- Returns:
- the instantiated command, null if failed to parse
-
format
public String format(Properties header, byte[] payload)
Turns the command properties and payload into a single string to send.- Parameters:
header
- the header datapayload
- the payload- Returns:
- the assembled string
-
read
public RemoteCommand read(File file, MessageCollection errors)
Reads a remote command from a file.- Parameters:
file
- the file to readerrors
- for collecting errors- Returns:
- the remote command, null if failed to load
-
write
public boolean write(RemoteCommand cmd, File file, MessageCollection errors)
Writes a remote command to a file.- Parameters:
cmd
- the command to writefile
- the file to write toerrors
- for collecting errors- Returns:
- true if successful
-
-