Package com.swiftmq.mgmt
Class CommandRegistry
java.lang.Object
com.swiftmq.mgmt.CommandRegistry
- All Implemented Interfaces:
Dumpable
A CommandRegistry object will be attached to Entities/EntityLists. It contains
all commands for that Entity.
- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCommandRegistry
(String name, Entity myEntity) Creates a new CommandRegistry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommand
(Command command) Add a command.String[]
executeCommand
(String[] context, String[] commandString) Execute a command.findCommand
(String[] cmd) Find a command.Returns a list of all registered commands.int
Returns a unique dump id for this object.void
readContent
(DataInput in) Read the content of this object from the stream.void
removeCommand
(Command command) Remove a command.void
setDefaultCommand
(CommandExecutor defaultCommand) Set a default command executor.void
Set the context name.void
writeContent
(DataOutput out) Write the content of this object to the stream.
-
Constructor Details
-
CommandRegistry
Creates a new CommandRegistry.- Parameters:
name
- the name of the context; will be used to display help content.myEntity
- attached Entity.
-
-
Method Details
-
getDumpId
public int getDumpId()Description copied from interface:Dumpable
Returns a unique dump id for this object. -
writeContent
Description copied from interface:Dumpable
Write the content of this object to the stream.- Specified by:
writeContent
in interfaceDumpable
- Parameters:
out
- output stream- Throws:
IOException
- if an error occurs
-
readContent
Description copied from interface:Dumpable
Read the content of this object from the stream.- Specified by:
readContent
in interfaceDumpable
- Parameters:
in
- input stream- Throws:
IOException
- if an error occurs
-
setName
Set the context name.- Parameters:
name
- name.
-
setDefaultCommand
Set a default command executor. It will executed if no other registered command matches inexecuteCommand()
.- Parameters:
defaultCommand
- default command executor.
-
getCommands
Returns a list of all registered commands.- Returns:
- command list.
-
addCommand
Add a command.- Parameters:
command
- command.
-
removeCommand
Remove a command.- Parameters:
command
- command.
-
findCommand
Find a command.- Parameters:
cmd
- tokenized command name.- Returns:
- command or null.
-
executeCommand
Execute a command. If no command is found, the default command is executes. If no default command has been registered, a error structure is returned ("Unknown command").- Parameters:
context
- the command context.commandString
- the tokenized command string.- Returns:
- state structure.
-