org.eodisp.wrapper.hla
Class ObjectInstanceProxy

java.lang.Object
  extended by org.eodisp.wrapper.hla.ObjectInstanceProxy
All Implemented Interfaces:
ObjectClassInstance

public class ObjectInstanceProxy
extends java.lang.Object
implements ObjectClassInstance

The base class of all object instance proxies.

Author:
Andrzej Kapolka, ibirrer

Field Summary
protected  boolean autoUpdateDisabled
          Whether or not automatic updating has been disabled.
protected  java.util.concurrent.CountDownLatch listenerLatch
          Latch to prevent unseen updates
protected  hla.rti1516.RTIambassador rtiAmbassador
          The run-time infrastructure ambassador.
 
Constructor Summary
protected ObjectInstanceProxy(hla.rti1516.RTIambassador pRTIAmbassador, hla.rti1516.ObjectClassHandle pClassHandle)
          Constructor for object instance proxies created to represent new locally owned objects.
protected ObjectInstanceProxy(hla.rti1516.RTIambassador pRTIAmbassador, hla.rti1516.ObjectClassHandle pClassHandle, java.lang.String pName)
          Constructor for object instance proxies created to represent new locally owned objects.
protected ObjectInstanceProxy(hla.rti1516.RTIambassador pRTIAmbassador, hla.rti1516.ObjectInstanceHandle pInstanceHandle, hla.rti1516.ObjectClassHandle pClassHandle, java.lang.String pName)
          Constructor for object instance proxies created in response to discovered objects.
 
Method Summary
protected  java.lang.Object createPassel()
           
 void delete()
          Deletes the object instance that this proxy represents.
protected  void getAttributeValuesToUpdate(hla.rti1516.AttributeHandleValueMap ahvm, boolean updateAll)
          Places the attribute values to update into the specified map.
 java.lang.String getName()
          Return the object instance name.
 hla.rti1516.ObjectClassHandle getObjectClassHandle()
           
 hla.rti1516.ObjectInstanceHandle getObjectInstanceHandle()
           
 boolean isAutoUpdateDisabled()
          Checks whether auto-update behavior is disabled for this proxy.
 boolean isDeleted()
          Checks whether the object instance that this proxy represents has been deleted.
protected  void notifyListeners(java.lang.Object passel, hla.rti1516.AttributeHandleValueMap attributeHandleValueMap)
           
 void notifyProvideAttributeValueUpdate(hla.rti1516.AttributeHandleSet theAttributes, byte[] userSuppliedTag)
           
 void notifyReflectAttributeValues(hla.rti1516.AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, hla.rti1516.OrderType sentOrdering, hla.rti1516.TransportationType theTransport, hla.rti1516.LogicalTime theTime, hla.rti1516.OrderType receivedOrdering, hla.rti1516.MessageRetractionHandle retractionHandle, hla.rti1516.RegionHandleSet sentRegions)
          Notifies the proxy of changes to the state of an object instance.
 void notifyRemoved(byte[] userSuppliedTag, hla.rti1516.OrderType sentOrdering, hla.rti1516.LogicalTime logicalTime, hla.rti1516.OrderType receivedOrdering, hla.rti1516.MessageRetractionHandle messageRetractionHandle)
           
 void resetWaitForListener()
           
 void setAutoUpdateDisabled(boolean autoUpdateDisabled)
          Disables or enables auto-update behavior for this proxy.
protected  void setDeleted(boolean pDeleted)
          Sets whether the object instance that this proxy represents has been deleted.
protected  void setPasselValues(java.lang.Object passel, hla.rti1516.AttributeHandleValueMap attributeHandleValueMap)
           
 java.lang.String toString()
          Returns a string representation of this object instance proxy.
 void updateAttributeValues(byte[] userSuppliedTag)
          Send updates of all modified attribute values to the federation.
 void updateAttributeValues(byte[] userSuppliedTag, boolean updateAll)
          Send updates of all, or all modified attribute values to the federation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rtiAmbassador

protected final hla.rti1516.RTIambassador rtiAmbassador
The run-time infrastructure ambassador.


autoUpdateDisabled

protected volatile boolean autoUpdateDisabled
Whether or not automatic updating has been disabled.


listenerLatch

protected final java.util.concurrent.CountDownLatch listenerLatch
Latch to prevent unseen updates

Constructor Detail

ObjectInstanceProxy

protected ObjectInstanceProxy(hla.rti1516.RTIambassador pRTIAmbassador,
                              hla.rti1516.ObjectInstanceHandle pInstanceHandle,
                              hla.rti1516.ObjectClassHandle pClassHandle,
                              java.lang.String pName)
Constructor for object instance proxies created in response to discovered objects.

Parameters:
pRTIAmbassador - the run-time infrastructure ambassador
pInstanceHandle - the object instance handle
pClassHandle - the object class handle
pName - the object name
Throws:
hla.rti1516.RTIinternalError - if an internal error occurred in the run-time infrastructure

ObjectInstanceProxy

protected ObjectInstanceProxy(hla.rti1516.RTIambassador pRTIAmbassador,
                              hla.rti1516.ObjectClassHandle pClassHandle)
                       throws hla.rti1516.ObjectClassNotDefined,
                              hla.rti1516.ObjectClassNotPublished,
                              hla.rti1516.FederateNotExecutionMember,
                              hla.rti1516.SaveInProgress,
                              hla.rti1516.RestoreInProgress,
                              hla.rti1516.RTIinternalError
Constructor for object instance proxies created to represent new locally owned objects. Automatically notifies the run-time infrastructure.

Parameters:
pRTIAmbassador - the run-time infrastructure ambassador
pClassHandle - the object class handle
Throws:
hla.rti1516.ObjectClassNotDefined - if the specified object class is not defined
hla.rti1516.ObjectClassNotPublished - if the specified object class is not published
hla.rti1516.FederateNotExecutionMember - if the federate is not a member of an execution
hla.rti1516.SaveInProgress - if a save operation is in progress
hla.rti1516.RestoreInProgress - if a restore operation is in progress
hla.rti1516.RTIinternalError - if an internal error occurred in the run-time infrastructure

ObjectInstanceProxy

protected ObjectInstanceProxy(hla.rti1516.RTIambassador pRTIAmbassador,
                              hla.rti1516.ObjectClassHandle pClassHandle,
                              java.lang.String pName)
                       throws hla.rti1516.ObjectClassNotDefined,
                              hla.rti1516.ObjectClassNotPublished,
                              hla.rti1516.IllegalName,
                              hla.rti1516.ObjectInstanceNameInUse,
                              hla.rti1516.FederateNotExecutionMember,
                              hla.rti1516.SaveInProgress,
                              hla.rti1516.RestoreInProgress,
                              hla.rti1516.RTIinternalError
Constructor for object instance proxies created to represent new locally owned objects. Automatically notifies the run-time infrastructure.

Parameters:
pRTIAmbassador - the run-time infrastructure ambassador
pClassHandle - the object class handle
pName - the object name
Throws:
hla.rti1516.ObjectClassNotDefined - if the specified object class is not defined
hla.rti1516.ObjectClassNotPublished - if the specified object class is not published
hla.rti1516.IllegalName - if the instance name has is illegal
hla.rti1516.ObjectInstanceNameInUse - if the instance name is already in use
hla.rti1516.FederateNotExecutionMember - if the federate is not a member of an execution
hla.rti1516.SaveInProgress - if a save operation is in progress
hla.rti1516.RestoreInProgress - if a restore operation is in progress
hla.rti1516.RTIinternalError - if an internal error occurred in the run-time infrastructure
Method Detail

notifyReflectAttributeValues

public void notifyReflectAttributeValues(hla.rti1516.AttributeHandleValueMap theAttributes,
                                         byte[] userSuppliedTag,
                                         hla.rti1516.OrderType sentOrdering,
                                         hla.rti1516.TransportationType theTransport,
                                         hla.rti1516.LogicalTime theTime,
                                         hla.rti1516.OrderType receivedOrdering,
                                         hla.rti1516.MessageRetractionHandle retractionHandle,
                                         hla.rti1516.RegionHandleSet sentRegions)
                                  throws hla.rti1516.AttributeNotRecognized,
                                         hla.rti1516.AttributeNotSubscribed,
                                         hla.rti1516.InvalidLogicalTime,
                                         hla.rti1516.FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Specified by:
notifyReflectAttributeValues in interface ObjectClassInstance
Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
theTime - the logical time associated with the attribute update
receivedOrdering - the type of ordering with which the update was received
retractionHandle - the message retraction handle
sentRegions - the set of region handles identifying the regions associated with the attribute update
Throws:
hla.rti1516.AttributeNotRecognized - if the attribute was not recognized
hla.rti1516.AttributeNotSubscribed - if the federate had not subscribed to the attribute
hla.rti1516.InvalidLogicalTime - if the specified logical time was invalid
hla.rti1516.FederateInternalError - if an error occurs in the federate

updateAttributeValues

public void updateAttributeValues(byte[] userSuppliedTag)
                           throws hla.rti1516.ObjectInstanceNotKnown,
                                  hla.rti1516.AttributeNotDefined,
                                  hla.rti1516.AttributeNotOwned,
                                  hla.rti1516.FederateNotExecutionMember,
                                  hla.rti1516.SaveInProgress,
                                  hla.rti1516.RestoreInProgress,
                                  hla.rti1516.RTIinternalError
Send updates of all modified attribute values to the federation.

Specified by:
updateAttributeValues in interface ObjectClassInstance
Parameters:
userSuppliedTag - the user-supplied tag to associate with the update
Throws:
hla.rti1516.ObjectInstanceNotKnown - if the object instance is unknown
hla.rti1516.AttributeNotDefined - if one of the attributes is undefined
hla.rti1516.AttributeNotOwned - if one of the attributes is not owned
hla.rti1516.FederateNotExecutionMember - if the federate is not a member of an execution
hla.rti1516.SaveInProgress - if a save operation is in progress
hla.rti1516.RestoreInProgress - if a restore operation is in progress
hla.rti1516.RTIinternalError - if an internal error occurred in the run-time infrastructure

updateAttributeValues

public void updateAttributeValues(byte[] userSuppliedTag,
                                  boolean updateAll)
                           throws hla.rti1516.ObjectInstanceNotKnown,
                                  hla.rti1516.AttributeNotDefined,
                                  hla.rti1516.AttributeNotOwned,
                                  hla.rti1516.FederateNotExecutionMember,
                                  hla.rti1516.SaveInProgress,
                                  hla.rti1516.RestoreInProgress,
                                  hla.rti1516.RTIinternalError
Send updates of all, or all modified attribute values to the federation.

Specified by:
updateAttributeValues in interface ObjectClassInstance
Parameters:
userSuppliedTag - the user-supplied tag to associate with the update
updateAll - if true provide updates for all attributes; if false, only provide updates for the modified ones
Throws:
hla.rti1516.ObjectInstanceNotKnown - if the object instance is unknown
hla.rti1516.AttributeNotDefined - if one of the attributes is undefined
hla.rti1516.AttributeNotOwned - if one of the attributes is not owned
hla.rti1516.FederateNotExecutionMember - if the federate is not a member of an execution
hla.rti1516.SaveInProgress - if a save operation is in progress
hla.rti1516.RestoreInProgress - if a restore operation is in progress
hla.rti1516.RTIinternalError - if an internal error occurred in the run-time infrastructure

getAttributeValuesToUpdate

protected void getAttributeValuesToUpdate(hla.rti1516.AttributeHandleValueMap ahvm,
                                          boolean updateAll)
                                   throws hla.rti1516.RTIinternalError
Places the attribute values to update into the specified map.

Parameters:
ahvm - the attribute handle value map to populate
updateAll - if true provide updates for all attributes; if false, only provide updates for the modified ones
Throws:
hla.rti1516.RTIinternalError - if an internal error occurs in the run-time infrastructure

toString

public java.lang.String toString()
Returns a string representation of this object instance proxy.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object instance proxy

getName

public java.lang.String getName()
Return the object instance name.

Returns:
the object instance name

setAutoUpdateDisabled

public void setAutoUpdateDisabled(boolean autoUpdateDisabled)
Disables or enables auto-update behavior for this proxy.

Parameters:
autoUpdateDisabled - true to disable auto-update, false to enable it

isAutoUpdateDisabled

public boolean isAutoUpdateDisabled()
Checks whether auto-update behavior is disabled for this proxy. Default: disabled.

Returns:
true if auto-update is disabled, false otherwise

delete

public void delete()
            throws hla.rti1516.DeletePrivilegeNotHeld,
                   hla.rti1516.FederateNotExecutionMember,
                   hla.rti1516.SaveInProgress,
                   hla.rti1516.RestoreInProgress,
                   hla.rti1516.RTIinternalError
Deletes the object instance that this proxy represents. If the instance has already been deleted, this method has no effect.

Throws:
hla.rti1516.DeletePrivilegeNotHeld - if the delete privilege is not held
hla.rti1516.FederateNotExecutionMember - if the federate is not a member of an execution
hla.rti1516.SaveInProgress - if a save operation is in progress
hla.rti1516.RestoreInProgress - if a restore operation is in progress
hla.rti1516.RTIinternalError - if an internal error occurred in the run-time infrastructure

setDeleted

protected void setDeleted(boolean pDeleted)
Sets whether the object instance that this proxy represents has been deleted.

Parameters:
pDeleted - whether or not the object instance has been deleted

isDeleted

public boolean isDeleted()
Checks whether the object instance that this proxy represents has been deleted.

Returns:
true if the object instance has been deleted, false otherwise

getObjectClassHandle

public hla.rti1516.ObjectClassHandle getObjectClassHandle()
Specified by:
getObjectClassHandle in interface ObjectClassInstance

getObjectInstanceHandle

public hla.rti1516.ObjectInstanceHandle getObjectInstanceHandle()
Specified by:
getObjectInstanceHandle in interface ObjectClassInstance

notifyProvideAttributeValueUpdate

public void notifyProvideAttributeValueUpdate(hla.rti1516.AttributeHandleSet theAttributes,
                                              byte[] userSuppliedTag)
                                       throws hla.rti1516.AttributeNotRecognized,
                                              hla.rti1516.AttributeNotOwned,
                                              hla.rti1516.FederateInternalError
Specified by:
notifyProvideAttributeValueUpdate in interface ObjectClassInstance
Throws:
hla.rti1516.AttributeNotRecognized
hla.rti1516.AttributeNotOwned
hla.rti1516.FederateInternalError

notifyRemoved

public void notifyRemoved(byte[] userSuppliedTag,
                          hla.rti1516.OrderType sentOrdering,
                          hla.rti1516.LogicalTime logicalTime,
                          hla.rti1516.OrderType receivedOrdering,
                          hla.rti1516.MessageRetractionHandle messageRetractionHandle)
Specified by:
notifyRemoved in interface ObjectClassInstance

createPassel

protected java.lang.Object createPassel()

setPasselValues

protected void setPasselValues(java.lang.Object passel,
                               hla.rti1516.AttributeHandleValueMap attributeHandleValueMap)

notifyListeners

protected void notifyListeners(java.lang.Object passel,
                               hla.rti1516.AttributeHandleValueMap attributeHandleValueMap)

resetWaitForListener

public void resetWaitForListener()
Specified by:
resetWaitForListener in interface ObjectClassInstance