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 Stringm_Hostthe host.protected intm_Portthe 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 voiddefineOptions()Adds options to the internal list of options.protected StringdoSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)Sends the request command.protected StringdoSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)Sends the response command.StringgetHost()Returns the host to send the command to.intgetPort()Returns the port to send the command to.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringhostTipText()Returns the tip text for this property.StringportTipText()Returns the tip text for this property.protected Stringsend(RemoteCommand cmd, RemoteCommandProcessor processor, String host, int port, boolean request)Sends the command to the specified sscripting engine.voidsetHost(String value)Sets the host to send the command to.voidsetPort(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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
doSendRequestin 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:
doSendResponsein classAbstractConnection- Parameters:
cmd- the command to sendprocessor- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
-