|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.portico.lrc.LRCState
public class LRCState
This class contains all the state information that relates to a specific LRC
instance.
Rather than pollute the LRC
code with all this state-data, it was factored into this
separate class. The data here represents the state of the LRC (and the federate that is using
it) at any given time. Further entities are stored and accessible through here, including the
LRCInstanceRepository
that contains a cache of all the relevant object and attribute
information that the LRC knows about (such as handles, owners, etc...). Also contained is the
LRCInterestManager
, which holds all the publication and subscription interests for the
federate.
LRCState
class also contains a number of helper methods that can perform common
validation checks and can throw the appropriate exception types if the LRC is currently not
in a valid state for a particular action to occur.
The LRCState
also provides a facility that allows arbitrary properties to be stored
within it. This is intended to provided a baseline facility that plugins can use to store and
fetch information (rather than having to come up with something of their own). See the
getProperty and setProperty method families.
Nested Class Summary | |
---|---|
static class |
LRCState.Status
This enum is used to describe the current constrained and regulating state of the LRC |
static class |
LRCState.SyncPoint
This enum governs sync point status |
Field Summary | |
---|---|
private boolean |
advancing
|
private boolean |
async
|
private LRCState.Status |
constrained
|
private int |
federateHandle
|
private String |
federateName
|
private String |
federationName
|
private ObjectModel |
fom
|
private LRCInterestManager |
interestManager
|
private boolean |
joined
|
private double |
lookahead
|
private Map<String,Object> |
properties
|
private LRCRegionStore |
regionStore
|
private LRCState.Status |
regulating
|
private LRCInstanceRepository |
repository
|
private HashMap<String,LRCState.SyncPoint> |
syncPoints
|
private LRC |
theLRC
|
private boolean |
ticking
|
private double |
timeCurrent
|
private double |
timeRequested
|
Constructor Summary | |
---|---|
LRCState(LRC theLRC)
Create a new LRCState that is linked to the given LRC . |
Method Summary | ||
---|---|---|
void |
achieveSyncPoint(String label)
Mark the given sync point as achieved by this federate. |
|
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()
Checks to see whether or not the LRC is currently in the middle of a restore process. |
|
void |
checkSave()
Checks to see whether or not the LRC is currently in the middle of a save process. |
|
void |
checkSyncAnnounced(String label)
Checks to see if the given synchronization point label has been announced |
|
void |
checkSyncNotAchieved(String label)
Checks to see if the given sync point has already been acheived. |
|
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). |
|
void |
federationSynchronized(String label)
Remove the given sync point from the store. |
|
boolean |
getAsynchronousDelivery()
|
|
LRCState.Status |
getConstrained()
|
|
double |
getCurrentTime()
|
|
int |
getFederateHandle()
|
|
String |
getFederateName()
|
|
String |
getFederationName()
|
|
ObjectModel |
getFOM()
|
|
double |
getLBTS()
The current requested time + the current look ahead. |
|
double |
getLookahead()
|
|
LRCInstanceRepository |
getLRCInstanceRepository()
|
|
LRCInterestManager |
getLRCInterestManager()
|
|
LRCRegionStore |
getLRCRegionStore()
|
|
Map<String,Object> |
getProperties()
Gets the properties map directly. |
|
Object |
getProperty(String key)
Fetch the value of a previously bound property. |
|
|
getProperty(String key,
Class<X> type)
This is the same as getProperty(String) except that you can specify the type which
the contained value should be. |
|
LRCState.Status |
getRegulating()
|
|
double |
getRequestedTime()
|
|
boolean |
hasProperty(String key)
Return true if there is a contained property for the given key, false otherwise. |
|
boolean |
isAdvancing()
|
|
boolean |
isConstrained()
|
|
boolean |
isJoined()
|
|
boolean |
isRegulating()
|
|
boolean |
isTicking()
|
|
void |
registerSyncPoint(String label)
Register the given sync point with the LRC. |
|
void |
reinitialize()
This method clears out any previous status that was contained within the instance. |
|
void |
setAdvancing(boolean advancing)
|
|
void |
setAsynchronousDelivery(boolean value)
This will enable/disable asynchronous delivery. |
|
void |
setConstrained(LRCState.Status status)
Enable/Disable time constrained. |
|
void |
setCurrentTime(double time)
|
|
void |
setFederateHandle(int federateHandle)
|
|
void |
setFederateName(String federateName)
|
|
void |
setFederationName(String federationName)
|
|
void |
setFOM(ObjectModel fom)
|
|
void |
setJoined(boolean joined)
|
|
void |
setLookahead(double lookahead)
|
|
void |
setProperty(String key,
Object value)
Add a property to the state. |
|
void |
setRegulating(LRCState.Status status)
|
|
void |
setRequestedTime(double time)
|
|
void |
setTicking(boolean ticking)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Map<String,Object> properties
private LRC theLRC
private String federateName
private int federateHandle
private String federationName
private boolean joined
private ObjectModel fom
private LRCState.Status constrained
private LRCState.Status regulating
private boolean async
private boolean advancing
private boolean ticking
private double timeCurrent
private double timeRequested
private double lookahead
private LRCInterestManager interestManager
private HashMap<String,LRCState.SyncPoint> syncPoints
private LRCInstanceRepository repository
private LRCRegionStore regionStore
Constructor Detail |
---|
public LRCState(LRC theLRC)
LRCState
that is linked to the given LRC
. This constructor calls
the reinitialize()
method once it is finished in order to set up the initial state.
Method Detail |
---|
public void reinitialize()
LRCState
its initial values during construction, and it also used to
clear out any stale data once a federate resigns from a federation (so that when it joins
again, it does so with a clean slate).
public void registerSyncPoint(String label)
public void achieveSyncPoint(String label) throws JSynchronizationLabelNotAnnounced
JSynchronizationLabelNotAnnounced
public void federationSynchronized(String label)
public void checkAccess() throws JConcurrentAccessAttempted
JConcurrentAccessAttempted
JConcurrentAccessAttempted
public void checkAdvancing() throws JTimeAdvanceAlreadyInProgress
JTimeAdvanceAlreadyInProgress
public void checkTimeRegulation() throws JEnableTimeRegulationPending
JEnableTimeRegulationPending
public void checkTimeConstrained() throws JEnableTimeConstrainedPending
JEnableTimeConstrainedPending
public void checkValidTime(double time) throws JInvalidFederationTime
JInvalidFederationTime
public void checkSave() throws JSaveInProgress
JSaveInProgress
exception.
JSaveInProgress
public void checkRestore() throws JRestoreInProgress
JRestoreInProgress
exception.
JRestoreInProgress
public void checkJoined() throws JFederateNotExecutionMember
JFederateNotExecutionMember
public void checkSyncAnnounced(String label) throws JSynchronizationLabelNotAnnounced
JSynchronizationLabelNotAnnounced
public void checkSyncNotAchieved(String label) throws JRTIinternalError
JRTIinternalError
public String getFederateName()
public void setFederateName(String federateName)
public int getFederateHandle()
public void setFederateHandle(int federateHandle)
public String getFederationName()
public void setFederationName(String federationName)
public boolean isJoined()
public void setJoined(boolean joined)
public double getCurrentTime()
public void setCurrentTime(double time)
public double getRequestedTime()
public void setRequestedTime(double time)
public double getLookahead()
public void setLookahead(double lookahead)
public double getLBTS()
public LRCState.Status getConstrained()
public void setConstrained(LRCState.Status status)
LRCQueue
(as it is
caching this value), so there is no need to notify it directly.
public boolean isConstrained()
public LRCState.Status getRegulating()
public void setRegulating(LRCState.Status status)
public boolean isRegulating()
public boolean isAdvancing()
public void setAsynchronousDelivery(boolean value)
LRCQueue
(as it is caching this value). So there is no need for you to do so.
public boolean getAsynchronousDelivery()
public void setAdvancing(boolean advancing)
public boolean isTicking()
public void setTicking(boolean ticking)
public ObjectModel getFOM()
public void setFOM(ObjectModel fom)
public LRCInterestManager getLRCInterestManager()
public LRCInstanceRepository getLRCInstanceRepository()
public LRCRegionStore getLRCRegionStore()
public void setProperty(String key, Object value)
public Object getProperty(String key)
public <X> X getProperty(String key, Class<X> type)
getProperty(String)
except that you can specify the type which
the contained value should be. If there is no value for that key or the type of the value
does not match up with the given value, null is returned. Otherwise, the value is cast to
the given type and returned.
public boolean hasProperty(String key)
public Map<String,Object> getProperties()
|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |