copyright The Portico Project 2008.

org.portico.impl.hla1516
Class Impl1516Helper

java.lang.Object
  extended by org.portico.impl.hla1516.Impl1516Helper
All Implemented Interfaces:
ISpecHelper

public class Impl1516Helper
extends Object
implements ISpecHelper

This class helps provides helper methods to the Default1516RTIAmbassador class and helps bridge the gap between the Portico compatibility layer and the HLA 1516 interface. The basic thrust of this class (like all ISpecHelper implementations) is that it provides the necessary facilities to turn HLA-interface-specific code into Portico-clean, interface independant code.

To maintain the independence of Portico from any particular HLA interface specification, this is one of the *ONLY* classes that is allowed to have classes from the hla.rti namespace in it. All other classes should use the facilities provided by the org.portico.shared.compat package


Field Summary
private  hla.rti1516.FederateAmbassador fedamb
           
private  LRC lrc
           
private  LRCState state
           
 
Constructor Summary
Impl1516Helper()
           
 
Method Summary
 void checkAccess()
          Check to see if we are currently ticking (and thus not able to make an RTI callback).
 void checkAdvancing()
          Check to see if we are advancing.
 void checkJoined()
          This method checks to see if the federate associated with this LRC is joined to a federation.
 void checkRestore()
           
 void checkSave()
           
 void checkSyncAnnounced(String label)
          Checks to see if the given synchronization point label has been announced
 void checkTimeConstrained()
          Check to see if there is a time constrained enable pending.
 void checkTimeRegulation()
          Check to see if there is a time regulation enable pending.
 void checkValidTime(double time)
          Validate that the given time is valid for the current state (that it is equal to or greater than the current LBTS for this federate).
 boolean evokeMultiple(double min, double max)
          Try and process as many messages as possible.
 boolean evokeSingle(double timeout)
          Process a single callback, waiting as long as the given timeout (in seconds) for one if there are none pendings.
 hla.rti1516.FederateAmbassador getFederateAmbassador()
           
 ObjectModel getFOM()
           
 org.apache.log4j.Logger getLRCLogger()
           
 LRCState getState()
           
 ObjectModel parseFOM(URL fdd)
           
 void processMessage(com.lbf.commons.messaging.MessageContext context)
           
 void setFederateAmbassador(hla.rti1516.FederateAmbassador fedamb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lrc

private LRC lrc

state

private LRCState state

fedamb

private hla.rti1516.FederateAmbassador fedamb
Constructor Detail

Impl1516Helper

public Impl1516Helper()
               throws hla.rti1516.RTIinternalError
Throws:
hla.rti1516.RTIinternalError
Method Detail

processMessage

public void processMessage(com.lbf.commons.messaging.MessageContext context)
                    throws Exception
Throws:
Exception

getState

public LRCState getState()

getFOM

public ObjectModel getFOM()

evokeSingle

public boolean evokeSingle(double timeout)
                    throws hla.rti1516.RTIinternalError
Process a single callback, waiting as long as the given timeout (in seconds) for one if there are none pendings. Return true if there are more messages waiting to be processed or false if there are none.

Parameters:
timeout - The length of time to wait if there are no callbacks to process (in seconds)
Returns:
True if there are still more callbacks that can be processed, false otherwise
Throws:
hla.rti1516.RTIinternalError

evokeMultiple

public boolean evokeMultiple(double min,
                             double max)
                      throws hla.rti1516.RTIinternalError
Try and process as many messages as possible. Spend up to max time doing so. If there are none to process, wait only as long as min. Return true if there are more callbacks that could be processed, false otherwise

Parameters:
min - The minimum amount of time (in seconds) to wait if there are no callbacks to process
max - The maximum amount of time to process messages for (in seconds)
Returns:
True if there are still more callbacks that can be processed, false otherwise
Throws:
hla.rti1516.RTIinternalError

parseFOM

public ObjectModel parseFOM(URL fdd)
                     throws hla.rti1516.CouldNotOpenFDD,
                            hla.rti1516.ErrorReadingFDD
Throws:
hla.rti1516.CouldNotOpenFDD
hla.rti1516.ErrorReadingFDD

checkAccess

public void checkAccess()
                 throws hla.rti1516.RTIinternalError
Check to see if we are currently ticking (and thus not able to make an RTI callback). If we are currently ticking, a ConcurrentAccessAttempted will be thrown.

Throws:
hla.rti1516.RTIinternalError

checkAdvancing

public void checkAdvancing()
                    throws hla.rti1516.InTimeAdvancingState
Check to see if we are advancing. If we are, throw an exception.

Throws:
hla.rti1516.InTimeAdvancingState

checkTimeRegulation

public void checkTimeRegulation()
                         throws hla.rti1516.RequestForTimeRegulationPending
Check to see if there is a time regulation enable pending. If there is, throw an exception

Throws:
hla.rti1516.RequestForTimeRegulationPending

checkTimeConstrained

public void checkTimeConstrained()
                          throws hla.rti1516.RequestForTimeConstrainedPending
Check to see if there is a time constrained enable pending. If there is, throw an exception

Throws:
hla.rti1516.RequestForTimeConstrainedPending

checkValidTime

public void checkValidTime(double time)
                    throws hla.rti1516.InvalidLogicalTime
Validate that the given time is valid for the current state (that it is equal to or greater than the current LBTS for this federate).

Throws:
hla.rti1516.InvalidLogicalTime

checkSave

public void checkSave()
               throws hla.rti1516.SaveInProgress
Throws:
hla.rti1516.SaveInProgress

checkRestore

public void checkRestore()
                  throws hla.rti1516.RestoreInProgress
Throws:
hla.rti1516.RestoreInProgress

checkJoined

public void checkJoined()
                 throws hla.rti1516.FederateNotExecutionMember
This method checks to see if the federate associated with this LRC is joined to a federation. If it is not, a FederateNotExecutionMember exception is thrown.

Throws:
hla.rti1516.FederateNotExecutionMember

checkSyncAnnounced

public void checkSyncAnnounced(String label)
                        throws hla.rti1516.SynchronizationPointLabelNotAnnounced
Checks to see if the given synchronization point label has been announced

Throws:
hla.rti1516.SynchronizationPointLabelNotAnnounced

getFederateAmbassador

public hla.rti1516.FederateAmbassador getFederateAmbassador()

setFederateAmbassador

public void setFederateAmbassador(hla.rti1516.FederateAmbassador fedamb)

getLRCLogger

public org.apache.log4j.Logger getLRCLogger()

copyright The Portico Project 2008.