JMRI: System StructureHistorically, systems weren't arranged this way, so existing code may not be a good example.
Want to expose very little above the jmrix package.
Basic core is communications code, often a "TrafficManager"
Tools should go in a swing sub-package
Specific connection types for a single protocol can go in subdirectories.
Role of ConnectionConfig, SystemConnectionMemo
See also the Multiple Connection Update page.
Initialization SequenceThis section describes the LocoNet implementation of the new (2010) configuration system. "NN" refers to e.g. the locobuffer, pr3 or similar connection-specific class.
- jmri.jmrix.loconet.NN.configurexml.ConnectionConfigXml is invoked by the configurexml mechanism when the specific class is named in an XML input file.
- The ConnectionConfigXml object is a child of the jmri.jmrix.configurexml.AbstractConnectionConfigXml class, which invokes the getInstance() method of it (not a static method) in its load() method to load the "adapter" member variable with a specific *Adapter class, e.g. MS100Adapter.
- Later, after the port is (hopefully) up, AbstractConnectionConfigXml invokes the Adapter's configure() method.
- That Adapter configure() method does, in order
(this has now been refactored into LocoNetSystemConnectionMemo
itself, so this list has to be reordered)
- sets up Packetizer/port/etc as needed
- configureCommandStation() from LnPortController
- configureManagers() from LnPortController, but overridden in e.g. PR3Adapter.
- does any other initialization of it's own, e.g. startThreads()
At this point, the system is basically up and ready for operation.
- Finally, a jmri.jmrix.loconet.LocoNetSystemConnectionMemo object is created and registered with the InstanceManager.
- Later, jmri.jmrix.ActiveSystemsMenu and/or jmri.jmrix.SystemsMenu wants to create user menus, and finds the LocoNetSystemConnectionMemo object in the InstanceManager
- The menu code asks that specific SystemConnectionMemo object to create and return the menu. It does so, in the process connecting each Action to itself so that the individual tools will be able to connect to the proper e.g. TrafficController, SlotMonitor, etc.
- When an Action is fired later on, the invoked class(es) enquire of the LocoNetSystemConnectionMemo when they need a resource, instead of referring to an instance() method in the resource's class.
- Basic manager needs to have getSystemPrefix in addition to letter
- ProxyManager has to check for system prefix, not letter