Class CommandRegistry

java.lang.Object
com.swiftmq.mgmt.CommandRegistry
All Implemented Interfaces:
Dumpable

public class CommandRegistry extends Object implements 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 Details

    • CommandRegistry

      public CommandRegistry(String name, Entity myEntity)
      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.
      Specified by:
      getDumpId in interface Dumpable
      Returns:
      unique dump id
    • writeContent

      public void writeContent(DataOutput out) throws IOException
      Description copied from interface: Dumpable
      Write the content of this object to the stream.
      Specified by:
      writeContent in interface Dumpable
      Parameters:
      out - output stream
      Throws:
      IOException - if an error occurs
    • readContent

      public void readContent(DataInput in) throws IOException
      Description copied from interface: Dumpable
      Read the content of this object from the stream.
      Specified by:
      readContent in interface Dumpable
      Parameters:
      in - input stream
      Throws:
      IOException - if an error occurs
    • setName

      public void setName(String name)
      Set the context name.
      Parameters:
      name - name.
    • setDefaultCommand

      public void setDefaultCommand(CommandExecutor defaultCommand)
      Set a default command executor. It will executed if no other registered command matches in executeCommand().
      Parameters:
      defaultCommand - default command executor.
    • getCommands

      public List getCommands()
      Returns a list of all registered commands.
      Returns:
      command list.
    • addCommand

      public void addCommand(Command command)
      Add a command.
      Parameters:
      command - command.
    • removeCommand

      public void removeCommand(Command command)
      Remove a command.
      Parameters:
      command - command.
    • findCommand

      public Command findCommand(String[] cmd)
      Find a command.
      Parameters:
      cmd - tokenized command name.
      Returns:
      command or null.
    • executeCommand

      public String[] executeCommand(String[] context, String[] commandString)
      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.