Package adams.scripting.connection
Class AbstractConnection
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.scripting.connection.AbstractConnection
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Connection,Serializable,Comparable<Connection>
- Direct Known Subclasses:
AbstractConnectionEnhancer,AbstractMultiConnection,AbstractSSHConnection,DefaultConnection,FTPConnection,Multicast
public abstract class AbstractConnection extends AbstractOptionHandler implements Connection
Ancestor for connections.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
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 AbstractConnection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringcheckRequest(RemoteCommand cmd)Hook method that checks the request command and setup for sending it.protected StringcheckResponse(RemoteCommand cmd)Hook method that checks the response command and setup for sending it.voidcleanUp()Cleans up data structures, frees up memory.intcompareTo(Connection o)Compares this connection with the other one using the commandline string.protected abstract StringdoSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)Sends the request command.protected abstract StringdoSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)Sends the response command.booleanequals(Object o)Checks whether the object is the same as this one.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringsendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)Sends the request command.StringsendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)Sends the response command.StringtoString()Just returns the commandline.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, 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, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Returns:
- null if no info available, otherwise short string
-
checkRequest
protected String checkRequest(RemoteCommand cmd)
Hook method that checks the request command and setup for sending it.- Parameters:
cmd- the command to check- Returns:
- null if successful, otherwise error message
-
doSendRequest
protected abstract String doSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the request command.- Parameters:
cmd- the command to sendprocessor- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
sendRequest
public String sendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the request command.- Specified by:
sendRequestin interfaceConnection- Parameters:
cmd- the command to sendprocessor- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
checkResponse
protected String checkResponse(RemoteCommand cmd)
Hook method that checks the response command and setup for sending it.- Parameters:
cmd- the command to check- Returns:
- null if successful, otherwise error message
-
doSendResponse
protected abstract String doSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the response command.- Parameters:
cmd- the command to sendprocessor- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
sendResponse
public String sendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the response command.- Specified by:
sendResponsein interfaceConnection- Parameters:
cmd- the command to sendprocessor- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
compareTo
public int compareTo(Connection o)
Compares this connection with the other one using the commandline string.- Specified by:
compareToin interfaceComparable<Connection>- Parameters:
o- the other connection- Returns:
- less than zero, equal to zero or greater than zero if the commandline string is less, equal or greater than this one
-
equals
public boolean equals(Object o)
Checks whether the object is the same as this one.- Overrides:
equalsin classObject- Parameters:
o- the other object- Returns:
- true if also a connection object and the same commandline
- See Also:
compareTo(Connection)
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.
Default implementation does nothing.- Specified by:
cleanUpin interfaceCleanUpHandler
-
toString
public String toString()
Just returns the commandline.- Overrides:
toStringin classAbstractOptionHandler- Returns:
- the commandline
-
-