Class CommandMgr
- java.lang.Object
-
- com.ibm.websphere.management.cmdframework.CommandMgr
-
public abstract class CommandMgr extends java.lang.ObjectMain interface for the command framework component.Wherever the term of admin command is referred here, it refers to either a simple admin command
AdminCommandor a complex admin command, i.e. aTaskCommandthat includes multipleCommandStepsEach admin command and command group must have a unique non-localized name for user to identify the command or command group. The concept of command group is introduced to group a set of related commands together so that users can find the related commands easily. A command may belong to multiple command groups if a command may be used in multiple areas. In other words, a command group does not own the commands in the group.
This class provides following areas of functionalities:
- query available admin commands and admin command groups
- query meta data regarding to any admin command.
- create an admin command
- load a serialized admin command
- basic command history functionality
-
-
Field Summary
Fields Modifier and Type Field and Description protected static CommandMgrcmdMgrprotected static booleaninitialized
-
Constructor Summary
Constructors Constructor and Description CommandMgr()
-
Method Summary
Methods Modifier and Type Method and Description abstract AdminCommandcreateCommand(java.lang.String command)Creates an admin commandstatic AdminClientgetAdminClient()Get the AdminClient associate with the most recent ClientCommandMgr called bygetCommandMgr(AdminClient adminclient).abstract java.util.CollectiongetAllCommandGroupMetadata()Returns the metadata for a all the command groups.abstract java.util.CollectiongetAllCommandMetadata()static CommandMgrgetClientCommandMgr(AdminClient adminclient)Deprecated.As of release 7.0, replaced bygetCommandMgr(AdminClient)abstract com.ibm.websphere.management.cmdframework.commandmetadata.CommandGroupMetadatagetCommandGroupMetadata(java.lang.String commandGrp)Returns the metadata for a particular command group.abstract com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadatagetCommandMetadata(java.lang.String commandName)Returns the command metadata for a particular command.static CommandMgrgetCommandMgr()Access method to get the CommandMgr instance.static CommandMgrgetCommandMgr(AdminClient adminclient)Access method to get the CommandMgr instance in client mode.abstract CommandProviderHelpergetCommandProviderHelper()Returns a proper implementation of CommandProviderHelper for the current command execution environment.abstract java.util.CollectionlistAllCommands()abstract java.util.CollectionlistCommandGroups()Lists all the admin command groups.abstract java.util.CollectionlistCommands()Lists all the admin commands.abstract java.util.CollectionlistCommands(java.lang.String commandGroup)Lists all the admin commands in a particular command group.abstract AdminCommandloadCommand(java.io.InputStream serializedCmd)Loads an admin command from its serialized format into memory.
-
-
-
Field Detail
-
cmdMgr
protected static CommandMgr cmdMgr
-
initialized
protected static boolean initialized
-
-
Method Detail
-
getCommandMgr
public static CommandMgr getCommandMgr()
Access method to get the CommandMgr instance.- Returns:
- the CommandMgr instance. Returns null if the CommandMgrinitializer
failed to initialize command manager properly.
If
getClientCommandMgr(AdminClient)has been called prior to call thisgetCommandMgr()then the same client command manager will be returned.Otherwise, it will return a server command manager if AdminService is available, or return a local command manager if AdminService is not available. The subsequence
getCommandMgr()call after this will return the same server (or local) command manager.
-
getClientCommandMgr
public static CommandMgr getClientCommandMgr(AdminClient adminclient) throws CommandMgrInitException
Deprecated. As of release 7.0, replaced bygetCommandMgr(AdminClient)Access method to get the CommandMgr instance in client mode. The subsequencegetCommandMgr()call after thisgetClientCommandMgr(AdminClient)will return the same client command manager.- Returns:
- the CommandMgr instance.
- Throws:
CommandMgrInitException.CommandMgrInitException
-
getCommandMgr
public static CommandMgr getCommandMgr(AdminClient adminclient) throws CommandMgrInitException
Access method to get the CommandMgr instance in client mode. As of release 7.0, this method is the replacement ofgetClientCommandMgr(AdminClient). UnlikegetClientCommandMgr(AdminClient), the subsequencegetCommandMgr()call after thisgetCommandMgr(AdminClient)will not return a client command manager. Caller to this method needs to cache and manage the returned CommandMgr object for reuse.- Parameters:
adminclient- the AdminClient object that represents a remote server for command execution.- Returns:
- A new CommandMgr instance.
- Throws:
CommandMgrInitException
-
getAdminClient
public static AdminClient getAdminClient()
Get the AdminClient associate with the most recent ClientCommandMgr called bygetCommandMgr(AdminClient adminclient). This method may return a null pointer if ClientCommandMgr has not been initialized by callinggetCommandMgr(AdminClient adminclient). It is caller's responsibility to check the returned object, before using it.- Returns:
- an AdminClient object that is associate with the ClientCommandMgr.
-
listCommandGroups
public abstract java.util.Collection listCommandGroups() throws ConnectorException, CommandExceptionLists all the admin command groups.- Returns:
- a collection of the command group names.
- Throws:
ConnectorExceptionCommandException
-
listCommands
public abstract java.util.Collection listCommands(java.lang.String commandGroup) throws ConnectorException, CommandExceptionLists all the admin commands in a particular command group.- Parameters:
commandGroup- a command group name.- Returns:
- a collection of admin command names in the specified command group.
- Throws:
ConnectorExceptionCommandException
-
listCommands
public abstract java.util.Collection listCommands() throws ConnectorException, CommandExceptionLists all the admin commands.- Returns:
- a collection of admin command names.
- Throws:
ConnectorExceptionCommandException
-
listAllCommands
public abstract java.util.Collection listAllCommands() throws ConnectorException, CommandException- Throws:
ConnectorExceptionCommandException
-
getCommandMetadata
public abstract com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata(java.lang.String commandName) throws ConnectorException, CommandNotFoundException, CommandExceptionReturns the command metadata for a particular command.- Parameters:
commandName- an admin command name.- Returns:
- the command metadata of the specified admin command.
- Throws:
CommandNotFoundException- if the specified admin command is not found.ConnectorExceptionCommandException
-
getAllCommandMetadata
public abstract java.util.Collection getAllCommandMetadata() throws ConnectorException, CommandException- Throws:
ConnectorExceptionCommandException
-
getCommandGroupMetadata
public abstract com.ibm.websphere.management.cmdframework.commandmetadata.CommandGroupMetadata getCommandGroupMetadata(java.lang.String commandGrp) throws ConnectorException, CommandNotFoundException, CommandExceptionReturns the metadata for a particular command group.- Parameters:
commandGrp- a command group name- Returns:
- metadata for the specified command group.
- Throws:
CommandNotFoundException- if the specified command group is not found.ConnectorExceptionCommandException
-
getAllCommandGroupMetadata
public abstract java.util.Collection getAllCommandGroupMetadata() throws ConnectorException, CommandNotFoundException, CommandExceptionReturns the metadata for a all the command groups.- Returns:
- Collection of metadata for the command groups.
- Throws:
CommandNotFoundException- if the specified command group is not found.ConnectorExceptionCommandException
-
createCommand
public abstract AdminCommand createCommand(java.lang.String command) throws CommandNotFoundException, CommandException, ConnectorException
Creates an admin command- Parameters:
command- an admin command name.- Returns:
- an admin Command instance for the specified command name.
- Throws:
CommandNotFoundException- if the specified admin command is not found.CommandExceptionConnectorException
-
loadCommand
public abstract AdminCommand loadCommand(java.io.InputStream serializedCmd) throws CommandLoadException, ConnectorException, CommandException
Loads an admin command from its serialized format into memory.- Parameters:
serializedCmd- an inputstream that contains a serialized admin command.- Returns:
- an instance of admin Command.
- Throws:
CommandLoadException- command framework failed to load the admin command.ConnectorExceptionCommandException
-
getCommandProviderHelper
public abstract CommandProviderHelper getCommandProviderHelper()
Returns a proper implementation of CommandProviderHelper for the current command execution environment.
-
-