Re: What should ProvidingManager.provide() return if not supported?
Randall Wood <rhwood@...>
The requirement (and this is an *absolute* requirement) for NamedBeans is that the user name is optional, and the system name is the only name that’s needed.toggle quoted messageShow quoted text
User Names are set by the user, and only by the user, not by system connections (unless the message in the system contains both something that can be a system name and something that can be a user name).
This is because devices on a connection (like LocoNet) can *only* be addressed by data encoded in the system name.
If you can’t work with that constraint then you don’t have a usable design (especially for a device on the LocoNet).
Put another way, you can’t create a discovered LocoNet device with a user name, because the LocoNet did not provide a user name to use, just an address that is encoded into the system name.
ProvidingManagers are designed to work with system connected devices to allow a flow like LocoNet traffic handler on connection “L”, sees message from thing at address 42->reads message, determines thing is Turnout->requests bean for turnout at address 42 (I.e. requests bean LT42) be provided->ProvidingManager returns that bean, creating it if needed.
If you *really* need to add LocoNet devices that can’t be provided implement ProxyManager instead of extending AbstractProxyManager.
But I would first reconsider your requirement that user names be assigned, since that’s not possible on the LocoNet itself.
On Jan 5, 2020, at 08:56, danielb987 <db123@...> wrote: