Class Entity

java.lang.Object
com.swiftmq.mgmt.Entity
All Implemented Interfaces:
Dumpable
Direct Known Subclasses:
Configuration, EntityList

public class Entity extends Object implements Dumpable
A Entity represents a node within the management tree. It may contain Property objects, as well as sub-entities. Each Entity must have a CommandRegistry where commands are registered to be performed on that Entity or their childs.
Author:
IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
  • Field Details

  • Constructor Details

    • Entity

      public Entity(String name, String displayName, String description, String state)
      Creates a new Entity.
      Parameters:
      name - the name of the entity.
      displayName - the display name.
      description - a description.
      state - the state (not used at the moment).
    • Entity

      protected 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
    • isSetParent

      protected boolean isSetParent()
    • writeDump

      protected void writeDump(DataOutput out, String s) throws IOException
      Throws:
      IOException
    • readDump

      protected String readDump(DataInput in) throws IOException
      Throws:
      IOException
    • writeDump

      protected void writeDump(DataOutput out, String[] s) throws IOException
      Throws:
      IOException
    • readDumpStringArray

      protected String[] readDumpStringArray(DataInput in) throws IOException
      Throws:
      IOException
    • writeDump

      protected void writeDump(DataOutput out, byte[] s) throws IOException
      Throws:
      IOException
    • readDumpByteArray

      protected byte[] readDumpByteArray(DataInput in) throws IOException
      Throws:
      IOException
    • writeDump

      protected void writeDump(DataOutput out, Dumpable d) throws IOException
      Throws:
      IOException
    • readDumpDumpable

      protected Dumpable readDumpDumpable(DataInput in, DumpableFactory factory) throws IOException
      Throws:
      IOException
    • writeDump

      protected void writeDump(DataOutput out, Map map) throws IOException
      Throws:
      IOException
    • readDumpDumpablePropMap

      protected Entity.CloneableMap readDumpDumpablePropMap(DataInput in, DumpableFactory factory) throws IOException
      Throws:
      IOException
    • readDumpDumpableEntityMap

      protected Entity.CloneableMap readDumpDumpableEntityMap(DataInput in, DumpableFactory factory) throws IOException
      Throws:
      IOException
    • 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
    • setImageArray

      public void setImageArray(byte[] array)
      Internal use only.
    • getIcon

      public ImageIcon getIcon()
      Internal use only.
    • isDynamic

      public boolean isDynamic()
      Internal use only.
    • setDynamic

      public void setDynamic(boolean b)
      Internal use only.
    • getUserObject

      public Object getUserObject()
      Returns the user object.
      Returns:
      user object.
    • setUserObject

      public void setUserObject(Object userObject)
      Attach a user object to this entity.
      Parameters:
      userObject - user object.
    • getDynamicObject

      public Object getDynamicObject()
      Returns the dynamic object.
      Returns:
      dynamic object.
    • setDynamicObject

      public void setDynamicObject(Object dynamicObject)
      Attach a dynamic object to this entity. In case this entity is dynamic (part of the usage list), and there is a dynamic object which corresponds to this entity, e.g. a connection object, this should be attached with this method.
      Parameters:
      dynamicObject - dynamic object.
    • getDynamicPropNames

      public String[] getDynamicPropNames()
      Returns the dynamic property names.
      Returns:
      array of property names.
    • setDynamicPropNames

      public void setDynamicPropNames(String[] dynamicPropNames)
      Set an array of dynamic property names. These are displayed in the dynamic chart of a dynamic entity, each with a separate colored line. The type of these dynamic properties must be of Integer, and, of course, the properties must be added to this entity.
      Parameters:
      dynamicPropNames - array of property names.
    • getContext

      public String[] getContext()
      Internal use only.
    • getDisplayContext

      public String[] getDisplayContext()
      Internal use only.
    • createCommands

      public void createCommands()
      Creates the commands out of the command registry. Normally, this is performed automatically, except for dynamic entities.
      See Also:
    • getCommandRegistry

      public CommandRegistry getCommandRegistry()
      Returns the command registry.
      Returns:
      command registry.
    • getName

      public String getName()
      Returns the entity name.
      Returns:
      entity name.
    • setName

      public void setName(String name)
      Set the entity name.
      Parameters:
      name - name.
    • getDisplayName

      public String getDisplayName()
      Returns the display name.
      Returns:
      display name.
    • getDescription

      public String getDescription()
      Returns the description.
      Returns:
      description.
    • addCommand

      public void addCommand(String name, Command command)
      Add a command to the command registry.
      Parameters:
      name - command name.
      command - command.
    • removeCommand

      public void removeCommand(String name)
      Remove a command from the command registry.
      Parameters:
      name - command name.
    • getState

      public String getState()
      Internal use only.
    • setState

      public void setState(String state)
      Internal use only.
    • addProperty

      public void addProperty(String name, Property property)
      Add a property.
      Parameters:
      name - property name.
      property - property.
    • removeProperty

      public void removeProperty(String name)
      Remove a property.
      Parameters:
      name - property name.
    • getProperty

      public Property getProperty(String name)
      Returns a property.
      Parameters:
      name - property name.
      Returns:
      property.
    • getProperties

      public Map getProperties()
      Returns a Map of all properties.
      Returns:
      map of properties.
    • addEntity

      public void addEntity(Entity entity) throws EntityAddException
      Add an Entity.
      Parameters:
      entity - entity.
      Throws:
      EntityAddException - thrown by an EntityAddListener.
    • removeEntity

      public void removeEntity(Entity entity) throws EntityRemoveException
      Removes an Entity.
      Parameters:
      entity - entity.
      Throws:
      EntityRemoveException - thrown by an EntityRemoveListener.
    • removeEntities

      public void removeEntities()
      Removes all Entities.
    • removeDynamicEntity

      public void removeDynamicEntity(Object dynamicObject)
      Removes an Entity with that dynamic object set.
      Parameters:
      dynamicObject - dynamic object.
    • getEntity

      public Entity getEntity(String name)
      Returns a Sub-Entity.
      Parameters:
      name - name.
      Returns:
      Entity.
    • getEntityNames

      public String[] getEntityNames()
      Returns an array with all sub-entity names
      Returns:
      array with all sub-entity names.
    • getEntities

      public Map getEntities()
      Returns a Map with all Entities.
      Returns:
      entity map.
    • getParent

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

      protected void setParent(Entity parent)
    • getEntityAddListener

      public EntityAddListener getEntityAddListener()
      Returns the EntityAddListener
      Returns:
      listener.
    • setEntityAddListener

      public void setEntityAddListener(EntityAddListener entityAddListener)
      Set the EntityAddListener. There can only be 1 EntityAddListener which is responsible to verify the addition and may be throw an EntityAddException.
      Parameters:
      entityAddListener - listener.
    • getEntityRemoveListener

      public EntityRemoveListener getEntityRemoveListener()
      Returns the EntityRemoveListener
      Returns:
      listener.
    • setEntityRemoveListener

      public void setEntityRemoveListener(EntityRemoveListener entityRemoveListener)
      Set the EntityRemoveListener. There can only be 1 EntityRemoveListener which is responsible to verify the removal and may be throw an EntityRemoveException.
      Parameters:
      entityRemoveListener - listener.
    • addEntityWatchListener

      public void addEntityWatchListener(EntityWatchListener l)
      Adds an EntityWatchListener. There can be several of thos listeners registered at an Entity. They all are informed on addition/removal of sub-entities after the action has been performed (Entity added/removed).
      Parameters:
      l - listener.
    • removeEntityWatchListener

      public void removeEntityWatchListener(EntityWatchListener l)
      Removes an EntityWatchListener.
      Parameters:
      l - listener.
    • notifyEntityWatchListeners

      protected void notifyEntityWatchListeners(boolean entityAdded, Entity entity)
    • createCopy

      public Entity createCopy()
      Internal use only.
    • isUpgrade

      public boolean isUpgrade()
    • setUpgrade

      public void setUpgrade(boolean upgrade)
    • quote

      protected String quote(String s)
    • commandIncluded

      protected boolean commandIncluded(Command command, String[] exclude)
    • toJson

      public String toJson()
    • toString

      public String toString()
      Overrides:
      toString in class Object