Class Context
java.lang.Object
com.ibm.java.diagnostics.utils.Context
- All Implemented Interfaces:
IContext
- Direct Known Subclasses:
DTFJContext
A context represents the environment within which a command is executing.
This abstract class provides common functionality which is required by all
types of context.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Exception
protected ICommand
protected PluginManager
static final Logger
Shared logger for all commands to write to -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
This adds the list of global commands which are applicable for any context to this specific context instancevoid
execute
(CommandParser commandParser, PrintStream out) Execute the entered command line with the output sent to the supplied print stream.void
execute
(String line, PrintStream out) Execute the entered command line with the output sent to the supplied print stream.void
execute
(String command, String[] arguments, PrintStream out) Execute the entered command line with the output sent to the supplied print stream.List of all the command names that are available within this contextReturns a list of commands which are available for this contextProvides access to any uncaught exceptions thrown when the last command was executed.The last command which was successfully executed by the context.boolean
isCommandRecognised
(String command) Allows to check if the given command will be executed (i.e. if there is a command that will accept the string) without actually executing it, avoiding error messages etc.Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface com.ibm.java.diagnostics.utils.IContext
getPluginClassloader, getProperties, refresh
-
Field Details
-
globalCommands
-
commands
-
lastExecutedCommand
-
lastException
-
logger
Shared logger for all commands to write to -
loader
-
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
getPluginManager
-
isCommandRecognised
Description copied from interface:IContext
Allows to check if the given command will be executed (i.e. if there is a command that will accept the string) without actually executing it, avoiding error messages etc.- Specified by:
isCommandRecognised
in interfaceIContext
- Parameters:
command
- - just the actual command WITHOUT ARGUMENTS- Returns:
-
execute
Description copied from interface:IContext
Execute the entered command line with the output sent to the supplied print stream. -
execute
Description copied from interface:IContext
Execute the entered command line with the output sent to the supplied print stream. -
execute
Description copied from interface:IContext
Execute the entered command line with the output sent to the supplied print stream. -
getCommandNames
-
getCommands
Description copied from interface:IContext
Returns a list of commands which are available for this context- Specified by:
getCommands
in interfaceIContext
- Returns:
-
addGlobalCommandsToContext
protected void addGlobalCommandsToContext()This adds the list of global commands which are applicable for any context to this specific context instance -
getLastExecutedCommand
Description copied from interface:IContext
The last command which was successfully executed by the context.- Specified by:
getLastExecutedCommand
in interfaceIContext
- Returns:
- the command or null if none have been executed or the command threw an exception
-
getLastCommandException
Description copied from interface:IContext
Provides access to any uncaught exceptions thrown when the last command was executed.- Specified by:
getLastCommandException
in interfaceIContext
- Returns:
- the exception or null of no uncaught exceptions were thrown
-