Package jmri.jmrix.bidib
Class BiDiBNodeInitializer
- java.lang.Object
-
- jmri.jmrix.bidib.BiDiBNodeInitializer
-
- All Implemented Interfaces:
java.lang.Runnable
public class BiDiBNodeInitializer extends java.lang.Object implements java.lang.Runnable
This class initializes or deinitializes a BiDiB node when it is found on system startup or if it is discovered or lost while the system is running.\ The real work is done in its own thread and from a node queue. Initializing is a time consuming process since a lot of data is read from the node.
-
-
Constructor Summary
Constructors Constructor Description BiDiBNodeInitializer(BiDiBTrafficController tc, org.bidib.jbidibc.core.BidibInterface bidib, java.util.Map<java.lang.Long,org.bidib.jbidibc.messages.Node> nodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconnectionInit()Get data from root node and from all other nodesvoidconnectionLost()Remove all nodesvoidinitNode(org.bidib.jbidibc.messages.Node node)Get everything we need from the node.voidnodeLost(org.bidib.jbidibc.messages.Node node)Remove a node from all named beans and from the nodes listvoidnodeNew(org.bidib.jbidibc.messages.Node node)Add a node to nodes list and notify all named beans to updatevoidrun()Execute queued node init and named beans update.
-
-
-
Constructor Detail
-
BiDiBNodeInitializer
public BiDiBNodeInitializer(BiDiBTrafficController tc, org.bidib.jbidibc.core.BidibInterface bidib, java.util.Map<java.lang.Long,org.bidib.jbidibc.messages.Node> nodes)
-
-
Method Detail
-
initNode
public void initNode(org.bidib.jbidibc.messages.Node node) throws org.bidib.jbidibc.messages.exception.ProtocolException
Get everything we need from the node. The node must already be inserted into the BiDiB node list.- Parameters:
node- node to initialize- Throws:
org.bidib.jbidibc.messages.exception.ProtocolException- when features can't be loaded
-
nodeLost
public void nodeLost(org.bidib.jbidibc.messages.Node node)
Remove a node from all named beans and from the nodes list- Parameters:
node- to remove
-
nodeNew
public void nodeNew(org.bidib.jbidibc.messages.Node node)
Add a node to nodes list and notify all named beans to update- Parameters:
node- to add
-
connectionLost
public void connectionLost()
Remove all nodes
-
connectionInit
public boolean connectionInit()
Get data from root node and from all other nodes- Returns:
- true on success
-
run
public void run()
Execute queued node init and named beans update. Finish the thread if the queue is empty- Specified by:
runin interfacejava.lang.Runnable
-
-