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
FieldsModifier and TypeFieldDescriptionprotected Exceptionprotected ICommandprotected PluginManagerstatic final LoggerShared logger for all commands to write to -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis adds the list of global commands which are applicable for any context to this specific context instancevoidexecute(CommandParser commandParser, PrintStream out) Execute the entered command line with the output sent to the supplied print stream.voidexecute(String line, PrintStream out) Execute the entered command line with the output sent to the supplied print stream.voidexecute(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.booleanisCommandRecognised(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, waitMethods 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:IContextAllows 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:
isCommandRecognisedin interfaceIContext- Parameters:
command- - just the actual command WITHOUT ARGUMENTS- Returns:
-
execute
Description copied from interface:IContextExecute the entered command line with the output sent to the supplied print stream. -
execute
Description copied from interface:IContextExecute the entered command line with the output sent to the supplied print stream. -
execute
Description copied from interface:IContextExecute the entered command line with the output sent to the supplied print stream. -
getCommandNames
List of all the command names that are available within this context- Returns:
- list of names
-
getCommands
Description copied from interface:IContextReturns a list of commands which are available for this context- Specified by:
getCommandsin 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:IContextThe last command which was successfully executed by the context.- Specified by:
getLastExecutedCommandin interfaceIContext- Returns:
- the command or null if none have been executed or the command threw an exception
-
getLastCommandException
Description copied from interface:IContextProvides access to any uncaught exceptions thrown when the last command was executed.- Specified by:
getLastCommandExceptionin interfaceIContext- Returns:
- the exception or null of no uncaught exceptions were thrown
-