Class Command

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

public class Command extends Object implements Dumpable
A Command object. Commands are registered at a CommandRegistry, attach to Entities and EntityLists, and performed by CLI and SwiftMQ Explorer. The acutal command action is performed through a CommandExecutor, attached to the Command object.
Author:
IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
See Also:
  • Constructor Details

    • Command

      public Command(String name, String pattern, String description, boolean enabled, CommandExecutor commandExecutor)
      Create a new Command.
      Parameters:
      name - the name of the command, e.g. "new".
      pattern - a help pattern, displayed from CLI, e.g. "new [ ...]".
      description - a command description, e.g. "New Entity"
      enabled - true/false.
      commandExecutor - the executor.
    • Command

      public Command(String name, String pattern, String description, boolean enabled, CommandExecutor commandExecutor, boolean guiEnabled, boolean guiForChild)
      Create a new Command.
      Parameters:
      name - the name of the command, e.g. "new".
      pattern - a help pattern, displayed from CLI, e.g. "new [ ...]".
      description - a command description, e.g. "New Entity"
      enabled - true/false.
      commandExecutor - the executor.
      guiEnabled - states whether it is a command shown in the SwiftMQ Explorer.
      guiForChild - states whether it is a command to be attached to each child of an Entity instead of the ENtity itself.
  • 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
    • getPattern

      public String getPattern()
      Returns the pattern.
      Returns:
      pattern.
    • getName

      public String getName()
      Returns the name.
      Returns:
      name.
    • getTokens

      public String[] getTokens()
      Returns the tokenized name. For example, "show template" returns String[]{"show","template"}
      Returns:
      tokenized name.
    • getDescription

      public String getDescription()
      Retuns the description.
      Returns:
      description.
    • isEnabled

      public boolean isEnabled()
      Returns the enabled state.
      Returns:
      enabled state.
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables/disables the command.
      Parameters:
      enabled - true/false.
    • getParent

      public Entity getParent()
      Returns the parent entity.
      Returns:
      parent entity.
    • setParent

      protected void setParent(Entity parent)
      Internal use.
      Parameters:
      parent - parent.
    • getCommandExecutor

      public CommandExecutor getCommandExecutor()
      Returns the command executor.
      Returns:
      command executor.
    • isGuiEnabled

      public boolean isGuiEnabled()
      Returns whether the command is enabled for the SwiftMQ Explorer.
      Returns:
      true/false.
    • setGuiEnabled

      public void setGuiEnabled(boolean guiEnabled)
      Enables/disables this command for the SwiftMQ Explorer.
      Parameters:
      guiEnabled - true/false.
    • isGuiForChild

      public boolean isGuiForChild()
      Returns whether this command is for childs of an EntityList.
      Returns:
      true/false.
    • setGuiForChild

      public void setGuiForChild(boolean guiForChild)
      Enables/disables this command for the childs of an EntityList (SwiftMQ Explorer). Enabled, the command is shown on every child instead of the EntityList itself.
      Parameters:
      guiForChild - description.
    • equals

      public boolean equals(String[] cmd)
      Compares this command's tokenized command with another one.
      Parameters:
      cmd - tokenized command.
      Returns:
      true/false.
    • toJson

      public String toJson()
    • toString

      public String toString()
      Overrides:
      toString in class Object