Package adams.scripting.connection
Class DefaultConnection
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.scripting.connection.AbstractConnection
-
- adams.scripting.connection.DefaultConnection
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Connection
,Serializable
,Comparable<Connection>
public class DefaultConnection extends AbstractConnection
Sends the command to the specified host:port.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Host
the host.protected int
m_Port
the host port.-
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 DefaultConnection()
-
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
doSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the request command.protected String
doSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the response command.String
getHost()
Returns the host to send the command to.int
getPort()
Returns the port to send the command to.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
hostTipText()
Returns the tip text for this property.String
portTipText()
Returns the tip text for this property.protected String
send(RemoteCommand cmd, RemoteCommandProcessor processor, String host, int port, boolean request)
Sends the command to the specified sscripting engine.void
setHost(String value)
Sets the host to send the command to.void
setPort(int value)
Sets the port to send the command to.-
Methods inherited from class adams.scripting.connection.AbstractConnection
checkRequest, checkResponse, cleanUp, compareTo, equals, sendRequest, sendResponse, toString
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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, 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.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Host
protected String m_Host
the host.
-
m_Port
protected int m_Port
the host port.
-
-
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
-
setHost
public void setHost(String value)
Sets the host to send the command to.- Parameters:
value
- the host
-
getHost
public String getHost()
Returns the host to send the command to.- Returns:
- the host
-
hostTipText
public String hostTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setPort
public void setPort(int value)
Sets the port to send the command to.- Parameters:
value
- the port
-
getPort
public int getPort()
Returns the port to send the command to.- Returns:
- the port
-
portTipText
public String portTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractConnection
- Returns:
- null if no info available, otherwise short string
-
send
protected String send(RemoteCommand cmd, RemoteCommandProcessor processor, String host, int port, boolean request)
Sends the command to the specified sscripting engine.- Parameters:
cmd
- the command to sendprocessor
- the processor for formatting/parsinghost
- the host to send the command toport
- the host portrequest
- whether Request or Response- Returns:
- null if successfully sent, otherwise error message
-
doSendRequest
protected String doSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the request command.- Specified by:
doSendRequest
in classAbstractConnection
- Parameters:
cmd
- the command to sendprocessor
- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
doSendResponse
protected String doSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the response command.- Specified by:
doSendResponse
in classAbstractConnection
- Parameters:
cmd
- the command to sendprocessor
- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
-