Package com.swiftmq.mgmt
Class Entity
- java.lang.Object
-
- com.swiftmq.mgmt.Entity
-
- All Implemented Interfaces:
Dumpable
- Direct Known Subclasses:
Configuration,EntityList
public class Entity extends java.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classEntity.CloneableMap
-
Field Summary
Fields Modifier and Type Field Description protected DumpableFactoryfactorystatic java.lang.StringSET_COMMAND
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCommand(java.lang.String name, Command command)Add a command to the command registry.voidaddEntity(Entity entity)Add an Entity.voidaddEntityWatchListener(EntityWatchListener l)Adds an EntityWatchListener.voidaddProperty(java.lang.String name, Property property)Add a property.protected booleancommandIncluded(Command command, java.lang.String[] exclude)voidcreateCommands()Creates the commands out of the command registry.EntitycreateCopy()Internal use only.CommandRegistrygetCommandRegistry()Returns the command registry.java.lang.String[]getContext()Internal use only.java.lang.StringgetDescription()Returns the description.java.lang.String[]getDisplayContext()Internal use only.java.lang.StringgetDisplayName()Returns the display name.intgetDumpId()Returns a unique dump id for this object.java.lang.ObjectgetDynamicObject()Returns the dynamic object.java.lang.String[]getDynamicPropNames()Returns the dynamic property names.java.util.MapgetEntities()Returns a Map with all Entities.EntitygetEntity(java.lang.String name)Returns a Sub-Entity.EntityAddListenergetEntityAddListener()Returns the EntityAddListenerjava.lang.String[]getEntityNames()Returns an array with all sub-entity namesEntityRemoveListenergetEntityRemoveListener()Returns the EntityRemoveListenerjavax.swing.ImageIcongetIcon()Internal use only.java.lang.StringgetName()Returns the entity name.EntitygetParent()Returns the parent Entity.java.util.MapgetProperties()Returns a Map of all properties.PropertygetProperty(java.lang.String name)Returns a property.java.lang.StringgetState()Internal use only.java.lang.ObjectgetUserObject()Returns the user object.booleanisDynamic()Internal use only.protected booleanisSetParent()booleanisUpgrade()protected voidnotifyEntityWatchListeners(boolean entityAdded, Entity entity)protected java.lang.Stringquote(java.lang.String s)voidreadContent(java.io.DataInput in)Read the content of this object from the stream.protected java.lang.StringreadDump(java.io.DataInput in)protected byte[]readDumpByteArray(java.io.DataInput in)protected DumpablereadDumpDumpable(java.io.DataInput in, DumpableFactory factory)protected Entity.CloneableMapreadDumpDumpableEntityMap(java.io.DataInput in, DumpableFactory factory)protected Entity.CloneableMapreadDumpDumpablePropMap(java.io.DataInput in, DumpableFactory factory)protected java.lang.String[]readDumpStringArray(java.io.DataInput in)voidremoveCommand(java.lang.String name)Remove a command from the command registry.voidremoveDynamicEntity(java.lang.Object dynamicObject)Removes an Entity with that dynamic object set.voidremoveEntities()Removes all Entities.voidremoveEntity(Entity entity)Removes an Entity.voidremoveEntityWatchListener(EntityWatchListener l)Removes an EntityWatchListener.voidremoveProperty(java.lang.String name)Remove a property.voidsetDynamic(boolean b)Internal use only.voidsetDynamicObject(java.lang.Object dynamicObject)Attach a dynamic object to this entity.voidsetDynamicPropNames(java.lang.String[] dynamicPropNames)Set an array of dynamic property names.voidsetEntityAddListener(EntityAddListener entityAddListener)Set the EntityAddListener.voidsetEntityRemoveListener(EntityRemoveListener entityRemoveListener)Set the EntityRemoveListener.voidsetImageArray(byte[] array)Internal use only.voidsetName(java.lang.String name)Set the entity name.protected voidsetParent(Entity parent)voidsetState(java.lang.String state)Internal use only.voidsetUpgrade(boolean upgrade)voidsetUserObject(java.lang.Object userObject)Attach a user object to this entity.java.lang.StringtoJson()java.lang.StringtoString()voidwriteContent(java.io.DataOutput out)Write the content of this object to the stream.protected voidwriteDump(java.io.DataOutput out, byte[] s)protected voidwriteDump(java.io.DataOutput out, Dumpable d)protected voidwriteDump(java.io.DataOutput out, java.lang.String s)protected voidwriteDump(java.io.DataOutput out, java.lang.String[] s)protected voidwriteDump(java.io.DataOutput out, java.util.Map map)
-
-
-
Field Detail
-
SET_COMMAND
public static final java.lang.String SET_COMMAND
- See Also:
- Constant Field Values
-
factory
protected DumpableFactory factory
-
-
Constructor Detail
-
Entity
public Entity(java.lang.String name, java.lang.String displayName, java.lang.String description, java.lang.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 Detail
-
getDumpId
public int getDumpId()
Description copied from interface:DumpableReturns a unique dump id for this object.
-
isSetParent
protected boolean isSetParent()
-
writeDump
protected void writeDump(java.io.DataOutput out, java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
readDump
protected java.lang.String readDump(java.io.DataInput in) throws java.io.IOException- Throws:
java.io.IOException
-
writeDump
protected void writeDump(java.io.DataOutput out, java.lang.String[] s) throws java.io.IOException- Throws:
java.io.IOException
-
readDumpStringArray
protected java.lang.String[] readDumpStringArray(java.io.DataInput in) throws java.io.IOException- Throws:
java.io.IOException
-
writeDump
protected void writeDump(java.io.DataOutput out, byte[] s) throws java.io.IOException- Throws:
java.io.IOException
-
readDumpByteArray
protected byte[] readDumpByteArray(java.io.DataInput in) throws java.io.IOException- Throws:
java.io.IOException
-
writeDump
protected void writeDump(java.io.DataOutput out, Dumpable d) throws java.io.IOException- Throws:
java.io.IOException
-
readDumpDumpable
protected Dumpable readDumpDumpable(java.io.DataInput in, DumpableFactory factory) throws java.io.IOException
- Throws:
java.io.IOException
-
writeDump
protected void writeDump(java.io.DataOutput out, java.util.Map map) throws java.io.IOException- Throws:
java.io.IOException
-
readDumpDumpablePropMap
protected Entity.CloneableMap readDumpDumpablePropMap(java.io.DataInput in, DumpableFactory factory) throws java.io.IOException
- Throws:
java.io.IOException
-
readDumpDumpableEntityMap
protected Entity.CloneableMap readDumpDumpableEntityMap(java.io.DataInput in, DumpableFactory factory) throws java.io.IOException
- Throws:
java.io.IOException
-
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
-
setImageArray
public void setImageArray(byte[] array)
Internal use only.
-
getIcon
public javax.swing.ImageIcon getIcon()
Internal use only.
-
isDynamic
public boolean isDynamic()
Internal use only.
-
setDynamic
public void setDynamic(boolean b)
Internal use only.
-
getUserObject
public java.lang.Object getUserObject()
Returns the user object.- Returns:
- user object.
-
setUserObject
public void setUserObject(java.lang.Object userObject)
Attach a user object to this entity.- Parameters:
userObject- user object.
-
getDynamicObject
public java.lang.Object getDynamicObject()
Returns the dynamic object.- Returns:
- dynamic object.
-
setDynamicObject
public void setDynamicObject(java.lang.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 java.lang.String[] getDynamicPropNames()
Returns the dynamic property names.- Returns:
- array of property names.
-
setDynamicPropNames
public void setDynamicPropNames(java.lang.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 java.lang.String[] getContext()
Internal use only.
-
getDisplayContext
public java.lang.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:
EntityList
-
getCommandRegistry
public CommandRegistry getCommandRegistry()
Returns the command registry.- Returns:
- command registry.
-
getName
public java.lang.String getName()
Returns the entity name.- Returns:
- entity name.
-
setName
public void setName(java.lang.String name)
Set the entity name.- Parameters:
name- name.
-
getDisplayName
public java.lang.String getDisplayName()
Returns the display name.- Returns:
- display name.
-
getDescription
public java.lang.String getDescription()
Returns the description.- Returns:
- description.
-
addCommand
public void addCommand(java.lang.String name, Command command)Add a command to the command registry.- Parameters:
name- command name.command- command.
-
removeCommand
public void removeCommand(java.lang.String name)
Remove a command from the command registry.- Parameters:
name- command name.
-
getState
public java.lang.String getState()
Internal use only.
-
setState
public void setState(java.lang.String state)
Internal use only.
-
addProperty
public void addProperty(java.lang.String name, Property property)Add a property.- Parameters:
name- property name.property- property.
-
removeProperty
public void removeProperty(java.lang.String name)
Remove a property.- Parameters:
name- property name.
-
getProperty
public Property getProperty(java.lang.String name)
Returns a property.- Parameters:
name- property name.- Returns:
- property.
-
getProperties
public java.util.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(java.lang.Object dynamicObject)
Removes an Entity with that dynamic object set.- Parameters:
dynamicObject- dynamic object.
-
getEntity
public Entity getEntity(java.lang.String name)
Returns a Sub-Entity.- Parameters:
name- name.- Returns:
- Entity.
-
getEntityNames
public java.lang.String[] getEntityNames()
Returns an array with all sub-entity names- Returns:
- array with all sub-entity names.
-
getEntities
public java.util.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 java.lang.String quote(java.lang.String s)
-
commandIncluded
protected boolean commandIncluded(Command command, java.lang.String[] exclude)
-
toJson
public java.lang.String toJson()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-