Package adams.console
Class Logging
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,RemoteCommandProcessorHandler
,Serializable
public class Logging extends AbstractConsoleApplication implements StoppableWithFeedback, RemoteCommandProcessorHandler
Allows to capture the logging of an ADAMS instance.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Logging.RemoteListenerRunnableWithLog
Runnable that outputs the log records to stdout.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
the default port to use for receiving logging messages.protected RemoteCommandProcessor
m_CommandProcessor
the command processor.protected BaseHostname
m_LocalHost
the local host/port to use.protected int
m_MaxFailures
the maximum number of connection failures to handle (-1 for indefinite).protected BaseHostname
m_RemoteHost
the remote host/port to connect to.protected boolean
m_Stopped
whether listening was stopped.-
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 Logging()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
commandProcessorTipText()
Returns the tip text for this property.protected DefaultScriptingEngine
configureEngine(int defPort)
Returns new instance of a configured scripting engine.void
defineOptions()
Adds options to the internal list of options.protected String
execute()
Executes the application.RemoteCommandProcessor
getCommandProcessor()
Returns the command processor in use.BaseHostname
getLocalHost()
Returns the local host/port to send the log records to.int
getMaxFailures()
Returns the maximum number of connection failures to tolerate.BaseHostname
getRemoteHost()
Returns the host to capture the logging from.String
globalInfo()
Returns a string describing the object.boolean
isStopped()
Whether the execution has been stopped.String
localHostTipText()
Returns the tip text for this property.static void
main(String[] args)
Starts the terminal application from commandline.String
maxFaiuresTipText()
Returns the tip text for this property.String
remoteHostTipText()
Returns the tip text for this property.String
sendCommandWithReponse(RemoteCommandWithResponse cmd, BaseHostname local, BaseHostname remote, int defPort)
Sends the specified command and the response handler for intercepting the result.void
setCommandProcessor(RemoteCommandProcessor value)
Sets the command processor to use.void
setLocalHost(BaseHostname value)
Sets the local host/port to send the log records to.void
setMaxFailures(int value)
Sets the maximum number of conection failures to tolerate.void
setRemoteHost(BaseHostname value)
Sets the host to capture the logging from.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.console.AbstractConsoleApplication
forCommandLine, forName, runApplication
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, 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
-
DEFAULT_PORT
public static final int DEFAULT_PORT
the default port to use for receiving logging messages.- See Also:
- Constant Field Values
-
m_RemoteHost
protected BaseHostname m_RemoteHost
the remote host/port to connect to.
-
m_LocalHost
protected BaseHostname m_LocalHost
the local host/port to use.
-
m_CommandProcessor
protected RemoteCommandProcessor m_CommandProcessor
the command processor.
-
m_MaxFailures
protected int m_MaxFailures
the maximum number of connection failures to handle (-1 for indefinite).
-
m_Stopped
protected boolean m_Stopped
whether listening was stopped.
-
-
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
-
setCommandProcessor
public void setCommandProcessor(RemoteCommandProcessor value)
Sets the command processor to use.- Specified by:
setCommandProcessor
in interfaceRemoteCommandProcessorHandler
- Parameters:
value
- the processor
-
getCommandProcessor
public RemoteCommandProcessor getCommandProcessor()
Returns the command processor in use.- Specified by:
getCommandProcessor
in interfaceRemoteCommandProcessorHandler
- Returns:
- the processor
-
commandProcessorTipText
public String commandProcessorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setRemoteHost
public void setRemoteHost(BaseHostname value)
Sets the host to capture the logging from.- Parameters:
value
- the host/port
-
getRemoteHost
public BaseHostname getRemoteHost()
Returns the host to capture the logging from.- Returns:
- the host/port
-
remoteHostTipText
public String remoteHostTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLocalHost
public void setLocalHost(BaseHostname value)
Sets the local host/port to send the log records to.- Parameters:
value
- the local host/port
-
getLocalHost
public BaseHostname getLocalHost()
Returns the local host/port to send the log records to.- Returns:
- the local host/port
-
localHostTipText
public String localHostTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaxFailures
public void setMaxFailures(int value)
Sets the maximum number of conection failures to tolerate.- Parameters:
value
- the maximum, -1 for indefinite
-
getMaxFailures
public int getMaxFailures()
Returns the maximum number of connection failures to tolerate.- Returns:
- the maximum, -1 for indefinite
-
maxFaiuresTipText
public String maxFaiuresTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
configureEngine
protected DefaultScriptingEngine configureEngine(int defPort)
Returns new instance of a configured scripting engine.- Parameters:
defPort
- the default port to use- Returns:
- the engine
-
sendCommandWithReponse
public String sendCommandWithReponse(RemoteCommandWithResponse cmd, BaseHostname local, BaseHostname remote, int defPort)
Sends the specified command and the response handler for intercepting the result.- Parameters:
cmd
- the command to sendlocal
- the local hostremote
- the remote hostdefPort
- the default port to use
-
execute
protected String execute()
Executes the application.- Specified by:
execute
in classAbstractConsoleApplication
- Returns:
- null if successful, otherwise error message
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStopped
in interfaceStoppableWithFeedback
- Returns:
- true if stopped
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceStoppable
-
-