Class Command

  • All Implemented Interfaces:
    Dumpable

    public class Command
    extends java.lang.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:
    CommandRegistry, Entity, EntityList
    • Constructor Summary

      Constructors 
      Constructor Description
      Command​(java.lang.String name, java.lang.String pattern, java.lang.String description, boolean enabled, CommandExecutor commandExecutor)
      Create a new Command.
      Command​(java.lang.String name, java.lang.String pattern, java.lang.String description, boolean enabled, CommandExecutor commandExecutor, boolean guiEnabled, boolean guiForChild)
      Create a new Command.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.String[] cmd)
      Compares this command's tokenized command with another one.
      CommandExecutor getCommandExecutor()
      Returns the command executor.
      java.lang.String getDescription()
      Retuns the description.
      int getDumpId()
      Returns a unique dump id for this object.
      java.lang.String getName()
      Returns the name.
      Entity getParent()
      Returns the parent entity.
      java.lang.String getPattern()
      Returns the pattern.
      java.lang.String[] getTokens()
      Returns the tokenized name.
      boolean isEnabled()
      Returns the enabled state.
      boolean isGuiEnabled()
      Returns whether the command is enabled for the SwiftMQ Explorer.
      boolean isGuiForChild()
      Returns whether this command is for childs of an EntityList.
      void readContent​(java.io.DataInput in)
      Read the content of this object from the stream.
      void setEnabled​(boolean enabled)
      Enables/disables the command.
      void setGuiEnabled​(boolean guiEnabled)
      Enables/disables this command for the SwiftMQ Explorer.
      void setGuiForChild​(boolean guiForChild)
      Enables/disables this command for the childs of an EntityList (SwiftMQ Explorer).
      protected void setParent​(Entity parent)
      Internal use.
      java.lang.String toJson()  
      java.lang.String toString()  
      void writeContent​(java.io.DataOutput out)
      Write the content of this object to the stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Command

        public Command​(java.lang.String name,
                       java.lang.String pattern,
                       java.lang.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​(java.lang.String name,
                       java.lang.String pattern,
                       java.lang.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 Detail

      • 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​(java.io.DataOutput out)
                          throws java.io.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:
        java.io.IOException - if an error occurs
      • readContent

        public void readContent​(java.io.DataInput in)
                         throws java.io.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:
        java.io.IOException - if an error occurs
      • getPattern

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

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

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

        public java.lang.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​(java.lang.String[] cmd)
        Compares this command's tokenized command with another one.
        Parameters:
        cmd - tokenized command.
        Returns:
        true/false.
      • toJson

        public java.lang.String toJson()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object