org.npsnet.xrti
Class DescriptorManager

java.lang.Object
  extended byorg.npsnet.xrti.DescriptorManager
All Implemented Interfaces:
HLAreflectionListener, ProxyAmbassadorListener

public class DescriptorManager
extends java.lang.Object
implements ProxyAmbassadorListener, HLAreflectionListener

Manages a set of descriptors that represent features of the federation (object classes, interaction classes, and so on).

Author:
Andrzej Kapolka

Field Summary
private static java.lang.String ATTRIBUTE
          The attribute tag.
private  java.util.HashMap attributeHandleDescriptorMap
          Maps attribute handles to attribute descriptors.
private  java.util.HashMap attributeHandleListenerMap
          Maps attribute handles to object class listeners.
private static java.lang.String DIMENSION
          The dimension tag.
private  java.util.HashMap dimensionHandleDescriptorMap
          Maps dimension handles to dimension descriptors.
private  java.util.HashMap dimensionNameDescriptorMap
          Maps dimension names to dimension descriptors.
private static java.lang.String DIMENSIONS
          The dimensions attribute.
private  int handleCounter
          The handle counter for bootstrap descriptors.
private static java.lang.String INTERACTION_CLASS
          The interaction class tag.
private  java.util.HashMap interactionClassHandleDescriptorMap
          Maps interaction class handles to interaction class descriptors.
private  java.util.HashMap interactionClassNameDescriptorMap
          Maps interaction class names to interaction class descriptors.
private  java.util.HashMap interactionClassNameListenersMap
          Maps interaction class names to interaction class listeners.
private static java.lang.String NAME
          The name attribute.
private static java.lang.String OBJECT_CLASS
          The object class tag.
private  java.util.HashMap objectClassHandleDescriptorMap
          Maps object class handles to object class descriptors.
private  java.util.HashMap objectClassNameDescriptorMap
          Maps object class names to object class descriptors.
private  java.util.HashMap objectClassNameListenersMap
          Maps object class names to object class listeners.
private  java.util.HashMap objectInstanceHandleDescriptorMap
          Maps object instance handles to object instance descriptors.
private  java.util.HashMap objectInstanceNameDescriptorMap
          Maps object instance names to object instance descriptors.
private static java.lang.String ORDER
          The order attribute.
private static java.lang.String PARAMETER
          The parameter tag.
private  java.util.HashMap parameterHandleDescriptorMap
          Maps parameter handles to parameter descriptors.
private  java.util.HashMap parameterHandleListenerMap
          Maps parameter handles to interaction class listeners.
private static java.lang.String PARENTS
          The parents attribute.
private  java.util.HashMap regionHandleDescriptorMap
          Maps region handles to region descriptors.
private static java.lang.String TRANSPORTATION
          The transportation attribute.
private static java.lang.String UPPER_BOUND
          The upper bound attribute.
 
Constructor Summary
DescriptorManager()
          Constructor.
 
Method Summary
 void addAttributeDescriptor(AttributeDescriptor ad)
          Adds an attribute descriptor.
protected  void addAttributeListener(AttributeHandle handle, ObjectClassDescriptor ocd)
          Adds a listener for attributes with the specified handle.
 void addBootstrapDescriptors(org.w3c.dom.Document fdd)
          Adds a set of descriptors corresponding to the features contained in the specified bootstrap federation description document.
 void addDimensionDescriptor(DimensionDescriptor dd)
          Adds a dimension descriptor.
 void addInteractionClassDescriptor(InteractionClassDescriptor icd)
          Adds an interaction class descriptor.
protected  void addInteractionClassListener(java.lang.String name, InteractionClassDescriptor icd)
          Adds a listener for interaction classes with a particular name.
 void addObjectClassDescriptor(ObjectClassDescriptor ocd)
          Adds an object class descriptor.
protected  void addObjectClassListener(java.lang.String name, ObjectClassDescriptor ocd)
          Adds a listener for object classes with a particular name.
 void addObjectInstanceDescriptor(ObjectInstanceDescriptor oid)
          Adds an object instance descriptor.
 void addParameterDescriptor(ParameterDescriptor pd)
          Adds a parameter descriptor.
protected  void addParameterListener(ParameterHandle handle, InteractionClassDescriptor icd)
          Adds a listener for parameters with the specified handle.
 void addRegionDescriptor(RegionDescriptor rd)
          Adds a region descriptor.
 AttributeDescriptor getAttributeDescriptor(AttributeHandle handle)
          Returns the descriptor for the attribute with the given handle.
 java.util.Collection getAttributeDescriptors()
          Returns an immutable collection containing the descriptors of all known attributes.
 DimensionDescriptor getDimensionDescriptor(DimensionHandle handle)
          Returns the descriptor for the dimension with the given handle.
 DimensionDescriptor getDimensionDescriptor(java.lang.String name)
          Returns the descriptor for the dimension with the given name.
 java.util.Collection getDimensionDescriptors()
          Returns an immutable collection containing the descriptors of all known dimensions.
 InteractionClassDescriptor getInteractionClassDescriptor(InteractionClassHandle handle)
          Returns the descriptor for the interaction class with the given handle.
 InteractionClassDescriptor getInteractionClassDescriptor(java.lang.String name)
          Returns the descriptor for the interaction class with the given name.
 java.util.Collection getInteractionClassDescriptors()
          Returns an immutable collection containing the descriptors of all known interaction classes.
 ObjectClassDescriptor getObjectClassDescriptor(ObjectClassHandle handle)
          Returns the descriptor for the object class with the given handle.
 ObjectClassDescriptor getObjectClassDescriptor(java.lang.String name)
          Returns the descriptor for the object class with the given name.
 java.util.Collection getObjectClassDescriptors()
          Returns an immutable collection containing the descriptors of all known object classes.
 ObjectInstanceDescriptor getObjectInstanceDescriptor(ObjectInstanceHandle handle)
          Returns the descriptor for the object instance with the given handle.
 ObjectInstanceDescriptor getObjectInstanceDescriptor(java.lang.String name)
          Returns the descriptor for the object instance with the given name.
 java.util.Collection getObjectInstanceDescriptors()
          Returns an immutable collection containing the descriptors of all known object instances.
 ParameterDescriptor getParameterDescriptor(ParameterHandle handle)
          Returns the descriptor for the parameter with the given handle.
 java.util.Collection getParameterDescriptors()
          Returns an immutable collection containing the descriptors of all known parameters.
 RegionDescriptor getRegionDescriptor(RegionHandle handle)
          Returns the descriptor for the region with the given handle.
 java.util.Collection getRegionDescriptors()
          Returns an immutable collection containing the descriptors of all known regions.
 boolean isBootstrapHandle(InteractionClassHandle ich)
          Checks whether the specified interaction class handle is a bootstrap handle.
 boolean isBootstrapHandle(ObjectClassHandle och)
          Checks whether the specified object class handle is a bootstrap handle.
 void nameUpdated(HLAreflection source, java.lang.String oldValue, java.lang.String newValue, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
          Notifies the listener that the name attribute has been updated.
 void objectInstanceProxyCreated(ProxyAmbassador pa, ObjectInstanceProxy oip)
          Notifies the listener that the proxy ambassador has created an object instance proxy.
 void objectInstanceProxyDestroyed(ProxyAmbassador pa, ObjectInstanceProxy oip)
          Notifies the listener that the proxy ambassador has destroyed an object instance proxy.
 void removeAttributeDescriptor(AttributeDescriptor ad)
          Removes an attribute descriptor.
 void removeDimensionDescriptor(DimensionDescriptor dd)
          Removes a dimension descriptor.
 void removeInteractionClassDescriptor(InteractionClassDescriptor icd)
          Removes an interaction class descriptor.
 void removeObjectClassDescriptor(ObjectClassDescriptor ocd)
          Removes an object class descriptor.
 void removeObjectInstanceDescriptor(ObjectInstanceDescriptor oid)
          Removes an object instance descriptor.
 void removeParameterDescriptor(ParameterDescriptor pd)
          Removes a parameter descriptor.
 void removeRegionDescriptor(RegionDescriptor rd)
          Removes a region descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT_CLASS

private static final java.lang.String OBJECT_CLASS
The object class tag.

See Also:
Constant Field Values

ATTRIBUTE

private static final java.lang.String ATTRIBUTE
The attribute tag.

See Also:
Constant Field Values

INTERACTION_CLASS

private static final java.lang.String INTERACTION_CLASS
The interaction class tag.

See Also:
Constant Field Values

PARAMETER

private static final java.lang.String PARAMETER
The parameter tag.

See Also:
Constant Field Values

DIMENSION

private static final java.lang.String DIMENSION
The dimension tag.

See Also:
Constant Field Values

NAME

private static final java.lang.String NAME
The name attribute.

See Also:
Constant Field Values

PARENTS

private static final java.lang.String PARENTS
The parents attribute.

See Also:
Constant Field Values

DIMENSIONS

private static final java.lang.String DIMENSIONS
The dimensions attribute.

See Also:
Constant Field Values

TRANSPORTATION

private static final java.lang.String TRANSPORTATION
The transportation attribute.

See Also:
Constant Field Values

ORDER

private static final java.lang.String ORDER
The order attribute.

See Also:
Constant Field Values

UPPER_BOUND

private static final java.lang.String UPPER_BOUND
The upper bound attribute.

See Also:
Constant Field Values

objectClassNameDescriptorMap

private java.util.HashMap objectClassNameDescriptorMap
Maps object class names to object class descriptors.


objectClassHandleDescriptorMap

private java.util.HashMap objectClassHandleDescriptorMap
Maps object class handles to object class descriptors.


objectClassNameListenersMap

private java.util.HashMap objectClassNameListenersMap
Maps object class names to object class listeners.


attributeHandleDescriptorMap

private java.util.HashMap attributeHandleDescriptorMap
Maps attribute handles to attribute descriptors.


attributeHandleListenerMap

private java.util.HashMap attributeHandleListenerMap
Maps attribute handles to object class listeners.


interactionClassNameDescriptorMap

private java.util.HashMap interactionClassNameDescriptorMap
Maps interaction class names to interaction class descriptors.


interactionClassHandleDescriptorMap

private java.util.HashMap interactionClassHandleDescriptorMap
Maps interaction class handles to interaction class descriptors.


interactionClassNameListenersMap

private java.util.HashMap interactionClassNameListenersMap
Maps interaction class names to interaction class listeners.


parameterHandleDescriptorMap

private java.util.HashMap parameterHandleDescriptorMap
Maps parameter handles to parameter descriptors.


parameterHandleListenerMap

private java.util.HashMap parameterHandleListenerMap
Maps parameter handles to interaction class listeners.


objectInstanceNameDescriptorMap

private java.util.HashMap objectInstanceNameDescriptorMap
Maps object instance names to object instance descriptors.


objectInstanceHandleDescriptorMap

private java.util.HashMap objectInstanceHandleDescriptorMap
Maps object instance handles to object instance descriptors.


dimensionNameDescriptorMap

private java.util.HashMap dimensionNameDescriptorMap
Maps dimension names to dimension descriptors.


dimensionHandleDescriptorMap

private java.util.HashMap dimensionHandleDescriptorMap
Maps dimension handles to dimension descriptors.


regionHandleDescriptorMap

private java.util.HashMap regionHandleDescriptorMap
Maps region handles to region descriptors.


handleCounter

private int handleCounter
The handle counter for bootstrap descriptors.

Constructor Detail

DescriptorManager

public DescriptorManager()
Constructor.

Method Detail

addBootstrapDescriptors

public void addBootstrapDescriptors(org.w3c.dom.Document fdd)
Adds a set of descriptors corresponding to the features contained in the specified bootstrap federation description document. Handle values will be assigned in the order that the described features are encountered in the document, starting at 1.

Parameters:
fdd - the parsed federation description document to interpret

isBootstrapHandle

public boolean isBootstrapHandle(ObjectClassHandle och)
Checks whether the specified object class handle is a bootstrap handle.

Parameters:
och - the object class handle to check
Returns:
true if the handle is a bootstrap handle, false otherwise

isBootstrapHandle

public boolean isBootstrapHandle(InteractionClassHandle ich)
Checks whether the specified interaction class handle is a bootstrap handle.

Parameters:
ich - the interaction class handle to check
Returns:
true if the handle is a bootstrap handle, false otherwise

objectInstanceProxyCreated

public void objectInstanceProxyCreated(ProxyAmbassador pa,
                                       ObjectInstanceProxy oip)
Notifies the listener that the proxy ambassador has created an object instance proxy.

Specified by:
objectInstanceProxyCreated in interface ProxyAmbassadorListener
Parameters:
pa - the proxy ambassador that generated the event
oip - the newly created object instance proxy

objectInstanceProxyDestroyed

public void objectInstanceProxyDestroyed(ProxyAmbassador pa,
                                         ObjectInstanceProxy oip)
Notifies the listener that the proxy ambassador has destroyed an object instance proxy.

Specified by:
objectInstanceProxyDestroyed in interface ProxyAmbassadorListener
Parameters:
pa - the proxy ambassador that generated the event
oip - the destroyed object instance proxy

nameUpdated

public void nameUpdated(HLAreflection source,
                        java.lang.String oldValue,
                        java.lang.String newValue,
                        byte[] userSuppliedTag,
                        OrderType sentOrdering,
                        TransportationType theTransport)
Notifies the listener that the name attribute has been updated.

Specified by:
nameUpdated in interface HLAreflectionListener
Parameters:
source - the source of the notification
oldValue - the old value of the attribute
newValue - the new value of the attribute
userSuppliedTag - the user-supplied tag associated with the update
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update

addObjectClassListener

protected void addObjectClassListener(java.lang.String name,
                                      ObjectClassDescriptor ocd)
Adds a listener for object classes with a particular name.

Parameters:
name - the object class name of interest
ocd - the object class descriptor to notify

addAttributeListener

protected void addAttributeListener(AttributeHandle handle,
                                    ObjectClassDescriptor ocd)
Adds a listener for attributes with the specified handle.

Parameters:
handle - the attribute handle of interest
ocd - the object class descriptor to notify

addInteractionClassListener

protected void addInteractionClassListener(java.lang.String name,
                                           InteractionClassDescriptor icd)
Adds a listener for interaction classes with a particular name.

Parameters:
name - the interaction class name of interest
icd - the interaction class descriptor to notify

addParameterListener

protected void addParameterListener(ParameterHandle handle,
                                    InteractionClassDescriptor icd)
Adds a listener for parameters with the specified handle.

Parameters:
handle - the parameter handle of interest
icd - the interaction class descriptor to notify

addObjectClassDescriptor

public void addObjectClassDescriptor(ObjectClassDescriptor ocd)
Adds an object class descriptor.

Parameters:
ocd - the object class descriptor to add

removeObjectClassDescriptor

public void removeObjectClassDescriptor(ObjectClassDescriptor ocd)
Removes an object class descriptor.

Parameters:
ocd - the object class descriptor to remove

getObjectClassDescriptor

public ObjectClassDescriptor getObjectClassDescriptor(java.lang.String name)
Returns the descriptor for the object class with the given name.

Parameters:
name - the name of the object class
Returns:
the object class descriptor, or null if no such descriptor exists

getObjectClassDescriptor

public ObjectClassDescriptor getObjectClassDescriptor(ObjectClassHandle handle)
Returns the descriptor for the object class with the given handle.

Parameters:
handle - the handle of the object class
Returns:
the object class descriptor, or null if no such descriptor exists

getObjectClassDescriptors

public java.util.Collection getObjectClassDescriptors()
Returns an immutable collection containing the descriptors of all known object classes. Each element of the collection will be an ObjectClassDescriptor.

Returns:
an immutable collection containing the descriptors of all known object classes

addAttributeDescriptor

public void addAttributeDescriptor(AttributeDescriptor ad)
Adds an attribute descriptor.

Parameters:
ad - the attribute descriptor to add

removeAttributeDescriptor

public void removeAttributeDescriptor(AttributeDescriptor ad)
Removes an attribute descriptor.

Parameters:
ad - the attribute descriptor to remove

getAttributeDescriptor

public AttributeDescriptor getAttributeDescriptor(AttributeHandle handle)
Returns the descriptor for the attribute with the given handle.

Parameters:
handle - the handle of the attribute
Returns:
the attribute descriptor, or null if no such descriptor exists

getAttributeDescriptors

public java.util.Collection getAttributeDescriptors()
Returns an immutable collection containing the descriptors of all known attributes. Each element of the collection will be an AttributeDescriptor.

Returns:
an immutable collection containing the descriptors of all known attributes

addInteractionClassDescriptor

public void addInteractionClassDescriptor(InteractionClassDescriptor icd)
Adds an interaction class descriptor.

Parameters:
icd - the interaction class descriptor to add

removeInteractionClassDescriptor

public void removeInteractionClassDescriptor(InteractionClassDescriptor icd)
Removes an interaction class descriptor.

Parameters:
icd - the interaction class descriptor to remove

getInteractionClassDescriptor

public InteractionClassDescriptor getInteractionClassDescriptor(java.lang.String name)
Returns the descriptor for the interaction class with the given name.

Parameters:
name - the name of the interaction class
Returns:
the interaction class descriptor, or null if no such descriptor exists

getInteractionClassDescriptor

public InteractionClassDescriptor getInteractionClassDescriptor(InteractionClassHandle handle)
Returns the descriptor for the interaction class with the given handle.

Parameters:
handle - the handle of the interaction class
Returns:
the interaction class descriptor, or null if no such descriptor exists

getInteractionClassDescriptors

public java.util.Collection getInteractionClassDescriptors()
Returns an immutable collection containing the descriptors of all known interaction classes. Each element of the collection will be an InteractionClassDescriptor.

Returns:
an immutable collection containing the descriptors of all known interaction classes

addParameterDescriptor

public void addParameterDescriptor(ParameterDescriptor pd)
Adds a parameter descriptor.

Parameters:
pd - the parameter descriptor to add

removeParameterDescriptor

public void removeParameterDescriptor(ParameterDescriptor pd)
Removes a parameter descriptor.

Parameters:
pd - the parameter descriptor to remove

getParameterDescriptor

public ParameterDescriptor getParameterDescriptor(ParameterHandle handle)
Returns the descriptor for the parameter with the given handle.

Parameters:
handle - the handle of the parameter
Returns:
the parameter descriptor, or null if no such descriptor exists

getParameterDescriptors

public java.util.Collection getParameterDescriptors()
Returns an immutable collection containing the descriptors of all known parameters. Each element of the collection will be a ParameterDescriptor.

Returns:
an immutable collection containing the descriptors of all known parameters

addObjectInstanceDescriptor

public void addObjectInstanceDescriptor(ObjectInstanceDescriptor oid)
Adds an object instance descriptor.

Parameters:
oid - the object instance descriptor to add

removeObjectInstanceDescriptor

public void removeObjectInstanceDescriptor(ObjectInstanceDescriptor oid)
Removes an object instance descriptor.

Parameters:
oid - the object instance descriptor to remove

getObjectInstanceDescriptor

public ObjectInstanceDescriptor getObjectInstanceDescriptor(java.lang.String name)
Returns the descriptor for the object instance with the given name.

Parameters:
name - the name of the object instance
Returns:
the object instance descriptor, or null if no such descriptor exists

getObjectInstanceDescriptor

public ObjectInstanceDescriptor getObjectInstanceDescriptor(ObjectInstanceHandle handle)
Returns the descriptor for the object instance with the given handle.

Parameters:
handle - the handle of the object instance
Returns:
the object instance descriptor, or null if no such descriptor exists

getObjectInstanceDescriptors

public java.util.Collection getObjectInstanceDescriptors()
Returns an immutable collection containing the descriptors of all known object instances. Each element of the collection will be an ObjectInstanceDescriptor.

Returns:
an immutable collection containing the descriptors of all known object instances

addDimensionDescriptor

public void addDimensionDescriptor(DimensionDescriptor dd)
Adds a dimension descriptor.

Parameters:
dd - the dimension descriptor to add

removeDimensionDescriptor

public void removeDimensionDescriptor(DimensionDescriptor dd)
Removes a dimension descriptor.

Parameters:
dd - the dimension descriptor to remove

getDimensionDescriptor

public DimensionDescriptor getDimensionDescriptor(java.lang.String name)
Returns the descriptor for the dimension with the given name.

Parameters:
name - the name of the dimension
Returns:
the dimension descriptor, or null if no such descriptor exists

getDimensionDescriptor

public DimensionDescriptor getDimensionDescriptor(DimensionHandle handle)
Returns the descriptor for the dimension with the given handle.

Parameters:
handle - the handle of the dimension
Returns:
the dimension descriptor, or null if no such descriptor exists

getDimensionDescriptors

public java.util.Collection getDimensionDescriptors()
Returns an immutable collection containing the descriptors of all known dimensions. Each element of the collection will be a DimensionDescriptor.

Returns:
an immutable collection containing the descriptors of all known dimensions

addRegionDescriptor

public void addRegionDescriptor(RegionDescriptor rd)
Adds a region descriptor.

Parameters:
rd - the region descriptor to add

removeRegionDescriptor

public void removeRegionDescriptor(RegionDescriptor rd)
Removes a region descriptor.

Parameters:
rd - the region descriptor to remove

getRegionDescriptor

public RegionDescriptor getRegionDescriptor(RegionHandle handle)
Returns the descriptor for the region with the given handle.

Parameters:
handle - the handle of the region
Returns:
the region descriptor, or null if no such descriptor exists

getRegionDescriptors

public java.util.Collection getRegionDescriptors()
Returns an immutable collection containing the descriptors of all known regions. Each element of the collection will be a RegionDescriptor.

Returns:
an immutable collection containing the descriptors of all known regions