Package com.swiftmq.mgmt
Class Command
- java.lang.Object
-
- com.swiftmq.mgmt.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 booleanequals(java.lang.String[] cmd)Compares this command's tokenized command with another one.CommandExecutorgetCommandExecutor()Returns the command executor.java.lang.StringgetDescription()Retuns the description.intgetDumpId()Returns a unique dump id for this object.java.lang.StringgetName()Returns the name.EntitygetParent()Returns the parent entity.java.lang.StringgetPattern()Returns the pattern.java.lang.String[]getTokens()Returns the tokenized name.booleanisEnabled()Returns the enabled state.booleanisGuiEnabled()Returns whether the command is enabled for the SwiftMQ Explorer.booleanisGuiForChild()Returns whether this command is for childs of an EntityList.voidreadContent(java.io.DataInput in)Read the content of this object from the stream.voidsetEnabled(boolean enabled)Enables/disables the command.voidsetGuiEnabled(boolean guiEnabled)Enables/disables this command for the SwiftMQ Explorer.voidsetGuiForChild(boolean guiForChild)Enables/disables this command for the childs of an EntityList (SwiftMQ Explorer).protected voidsetParent(Entity parent)Internal use.java.lang.StringtoJson()java.lang.StringtoString()voidwriteContent(java.io.DataOutput out)Write the content of this object to the stream.
-
-
-
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:DumpableReturns a unique dump id for this object.
-
writeContent
public void writeContent(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from interface:DumpableWrite the content of this object to the stream.- Specified by:
writeContentin interfaceDumpable- Parameters:
out- output stream- Throws:
java.io.IOException- if an error occurs
-
readContent
public void readContent(java.io.DataInput in) throws java.io.IOExceptionDescription copied from interface:DumpableRead the content of this object from the stream.- Specified by:
readContentin interfaceDumpable- 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:
toStringin classjava.lang.Object
-
-