Package com.swiftmq.mgmt
Class Entity
java.lang.Object
com.swiftmq.mgmt.Entity
- All Implemented Interfaces:
Dumpable
- Direct Known Subclasses:
Configuration
,EntityList
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 -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommand
(String name, Command command) Add a command to the command registry.void
Add an Entity.void
Adds an EntityWatchListener.void
addProperty
(String name, Property property) Add a property.protected boolean
commandIncluded
(Command command, String[] exclude) void
Creates the commands out of the command registry.Internal use only.Returns the command registry.String[]
Internal use only.Returns the description.String[]
Internal use only.Returns the display name.int
Returns a unique dump id for this object.Returns the dynamic object.String[]
Returns the dynamic property names.Returns a Map with all Entities.Returns a Sub-Entity.Returns the EntityAddListenerString[]
Returns an array with all sub-entity namesReturns the EntityRemoveListenergetIcon()
Internal use only.getName()
Returns the entity name.Returns the parent Entity.Returns a Map of all properties.getProperty
(String name) Returns a property.getState()
Internal use only.Returns the user object.boolean
Internal use only.protected boolean
boolean
protected void
notifyEntityWatchListeners
(boolean entityAdded, Entity entity) protected String
void
readContent
(DataInput in) Read the content of this object from the stream.protected String
protected byte[]
protected Dumpable
readDumpDumpable
(DataInput in, DumpableFactory factory) protected Entity.CloneableMap
readDumpDumpableEntityMap
(DataInput in, DumpableFactory factory) protected Entity.CloneableMap
readDumpDumpablePropMap
(DataInput in, DumpableFactory factory) protected String[]
void
removeCommand
(String name) Remove a command from the command registry.void
removeDynamicEntity
(Object dynamicObject) Removes an Entity with that dynamic object set.void
Removes all Entities.void
removeEntity
(Entity entity) Removes an Entity.void
Removes an EntityWatchListener.void
removeProperty
(String name) Remove a property.void
setDynamic
(boolean b) Internal use only.void
setDynamicObject
(Object dynamicObject) Attach a dynamic object to this entity.void
setDynamicPropNames
(String[] dynamicPropNames) Set an array of dynamic property names.void
setEntityAddListener
(EntityAddListener entityAddListener) Set the EntityAddListener.void
setEntityRemoveListener
(EntityRemoveListener entityRemoveListener) Set the EntityRemoveListener.void
setImageArray
(byte[] array) Internal use only.void
Set the entity name.protected void
void
Internal use only.void
setUpgrade
(boolean upgrade) void
setUserObject
(Object userObject) Attach a user object to this entity.toJson()
toString()
void
writeContent
(DataOutput out) Write the content of this object to the stream.protected void
writeDump
(DataOutput out, byte[] s) protected void
writeDump
(DataOutput out, Dumpable d) protected void
writeDump
(DataOutput out, String s) protected void
writeDump
(DataOutput out, String[] s) protected void
writeDump
(DataOutput out, Map map)
-
Field Details
-
SET_COMMAND
- See Also:
-
factory
-
-
Constructor Details
-
Entity
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. -
isSetParent
protected boolean isSetParent() -
writeDump
- Throws:
IOException
-
readDump
- Throws:
IOException
-
writeDump
- Throws:
IOException
-
readDumpStringArray
- Throws:
IOException
-
writeDump
- Throws:
IOException
-
readDumpByteArray
- Throws:
IOException
-
writeDump
- Throws:
IOException
-
readDumpDumpable
- Throws:
IOException
-
writeDump
- 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
Description copied from interface:Dumpable
Write the content of this object to the stream.- Specified by:
writeContent
in interfaceDumpable
- Parameters:
out
- output stream- Throws:
IOException
- if an error occurs
-
readContent
Description copied from interface:Dumpable
Read the content of this object from the stream.- Specified by:
readContent
in interfaceDumpable
- Parameters:
in
- input stream- Throws:
IOException
- if an error occurs
-
setImageArray
public void setImageArray(byte[] array) Internal use only. -
getIcon
Internal use only. -
isDynamic
public boolean isDynamic()Internal use only. -
setDynamic
public void setDynamic(boolean b) Internal use only. -
getUserObject
Returns the user object.- Returns:
- user object.
-
setUserObject
Attach a user object to this entity.- Parameters:
userObject
- user object.
-
getDynamicObject
Returns the dynamic object.- Returns:
- dynamic object.
-
setDynamicObject
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
Returns the dynamic property names.- Returns:
- array of property names.
-
setDynamicPropNames
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
Internal use only. -
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
Returns the command registry.- Returns:
- command registry.
-
getName
Returns the entity name.- Returns:
- entity name.
-
setName
Set the entity name.- Parameters:
name
- name.
-
getDisplayName
Returns the display name.- Returns:
- display name.
-
getDescription
Returns the description.- Returns:
- description.
-
addCommand
Add a command to the command registry.- Parameters:
name
- command name.command
- command.
-
removeCommand
Remove a command from the command registry.- Parameters:
name
- command name.
-
getState
Internal use only. -
setState
Internal use only. -
addProperty
Add a property.- Parameters:
name
- property name.property
- property.
-
removeProperty
Remove a property.- Parameters:
name
- property name.
-
getProperty
Returns a property.- Parameters:
name
- property name.- Returns:
- property.
-
getProperties
Returns a Map of all properties.- Returns:
- map of properties.
-
addEntity
Add an Entity.- Parameters:
entity
- entity.- Throws:
EntityAddException
- thrown by an EntityAddListener.
-
removeEntity
Removes an Entity.- Parameters:
entity
- entity.- Throws:
EntityRemoveException
- thrown by an EntityRemoveListener.
-
removeEntities
public void removeEntities()Removes all Entities. -
removeDynamicEntity
Removes an Entity with that dynamic object set.- Parameters:
dynamicObject
- dynamic object.
-
getEntity
Returns a Sub-Entity.- Parameters:
name
- name.- Returns:
- Entity.
-
getEntityNames
Returns an array with all sub-entity names- Returns:
- array with all sub-entity names.
-
getEntities
Returns a Map with all Entities.- Returns:
- entity map.
-
getParent
Returns the parent Entity.- Returns:
- parent Entity.
-
setParent
-
getEntityAddListener
Returns the EntityAddListener- Returns:
- listener.
-
setEntityAddListener
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
Returns the EntityRemoveListener- Returns:
- listener.
-
setEntityRemoveListener
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
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
Removes an EntityWatchListener.- Parameters:
l
- listener.
-
notifyEntityWatchListeners
-
createCopy
Internal use only. -
isUpgrade
public boolean isUpgrade() -
setUpgrade
public void setUpgrade(boolean upgrade) -
quote
-
commandIncluded
-
toJson
-
toString
-