|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
gov.nasa.gsfc.drl.rtstps.viewer.status.Distributor
public final class Distributor
This class contains a thread that periodically sends a status request to the RT-STPS server. It then distributes the status items to registered item listeners.
If you are interested in the server's command state (unloaded, loaded and stopped, or loaded and go), you can register here to receive the two StatusItems defining command state. However, StatusItems are only delivered periodically, so you won't get instantaneous response to button presses. It is better that you register with class CommandState, which will give you more immediate command state updates.
Status items are identified by a three part naming convention. An example is "path.vc42.Idle VCDUs", The first part is the type. It is the class name for an RT-STPS node and is also the element name in the XML setup file. For example, "path" identifies all CCSDS path service nodes. The second part is called block name here. It identifies a specific RT-STPS node and is the XML id field for an element. For example, "vc42" is just one CCSDS path service node of possibly many. The third part is the status item label for one specific status value. In the example, it is the number of idle VCDUs that the "vc42" path service node detected.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private long |
msTimeDelay
|
private RtStpsServices |
server
|
private java.util.TreeMap<java.lang.String,StatusListener> |
statusListeners
|
private boolean |
threadRunning
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Distributor(RtStpsServices server)
Create a Distributor object. |
|
Distributor(RtStpsServices server,
int secondsDelay)
Create a Distributor object. |
Method Summary | |
---|---|
void |
cancelStatusItemDelivery(StatusListener sl,
java.lang.String itemLabel)
Cancel status item delivery. |
StatusBlock[] |
doStatus()
Deliver status items to all listeners. |
java.util.List<java.lang.String> |
getBlockNamesByType(java.lang.String typeName)
Get a list of block names for a type. |
private java.util.List<java.lang.String> |
getBlockNamesByType(java.lang.String typeName,
StatusBlock[] statusBlocks,
java.util.List<java.lang.String> list)
Get a list of block names for a type. |
java.util.List<java.lang.String> |
getBlockNamesByTypes(java.lang.String[] typeNames)
Get a list of full block names for a list of types. |
java.lang.String[] |
getItemNamesByBlock(java.lang.String blockName)
Get a list of status item names for a block. |
void |
requestStatusItemDelivery(StatusListener sl,
java.lang.String itemLabel)
Request periodic delivery of a status item. |
void |
run()
|
void |
setDelay(int seconds)
Set the period in seconds between status collections. |
void |
stopDistributor()
Stop the distributor status collection thread. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private RtStpsServices server
private long msTimeDelay
private boolean threadRunning
private java.util.TreeMap<java.lang.String,StatusListener> statusListeners
Constructor Detail |
---|
public Distributor(RtStpsServices server)
public Distributor(RtStpsServices server, int secondsDelay)
Method Detail |
---|
public void setDelay(int seconds)
public void requestStatusItemDelivery(StatusListener sl, java.lang.String itemLabel)
sl
- The StatusListener who will receive delivery.itemLabel
- The full identification of the status item in the
form "typeName.blockName.itemName"public void cancelStatusItemDelivery(StatusListener sl, java.lang.String itemLabel)
sl
- The StatusListener who will receive delivery.itemLabel
- The full identification of the status item in the
form "typeName.blockName.itemName"public void stopDistributor()
public java.util.List<java.lang.String> getBlockNamesByType(java.lang.String typeName) throws java.rmi.RemoteException
typeName
- the type name
java.rmi.RemoteException
public java.util.List<java.lang.String> getBlockNamesByTypes(java.lang.String[] typeNames) throws java.rmi.RemoteException
typeNames
- Get all blocks that match the type name
java.rmi.RemoteException
private java.util.List<java.lang.String> getBlockNamesByType(java.lang.String typeName, StatusBlock[] statusBlocks, java.util.List<java.lang.String> list) throws java.rmi.RemoteException
typeName
- Get all blocks that match the type namestatusBlocks
- a non-null list of status blockslist
- It appends block names to this list. If null, it creates
a new list.
java.rmi.RemoteException
public java.lang.String[] getItemNamesByBlock(java.lang.String blockName) throws java.rmi.RemoteException
java.rmi.RemoteException
public StatusBlock[] doStatus() throws java.rmi.RemoteException
java.rmi.RemoteException
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |