pass app-label info into factory when registering objects #12106
Labels
C: Framework
P: normal
A defect affecting operation with a low possibility of significantly affects.
Rationale
Currently, the moose object factory throws an error if you register an object of the same class name more than once. This is to prevent name-clash errors between an app and other apps it depends on (e.g. two apps compiled together that both have a FooBar user object).
In order to move to a system where an app only has to instigate object registration for its direct dependencies (i.e. not transitive ones), we need to allow for the case that multiple paths through the app/module dependency graph of an app may reach the same transitive dependency. When I create FooApp that depends on App1 and App2 and both App1 and App2 depend on BarModule - I only want to have to call
App1::registerObjects(factory)
andApp2::registerObjects(factory)
from my app's registerObjects function. But this would mean that both App1 and App2 would callBarModule::registerObjects(factory)
- causing an error for duplicate registration.We need to allow the same object to be registered (without causing an error) to a factory multiple times as long as that object comes from the same application every time.
Description
The information necessary to relax the factory duplicate registration error checking already exists in the global Registry - it is just never passed to the factory. We need to pass this information (which app label each object is associated with) into the factory along with the object name when calling
Factory::reg
. This will facilitate allowing duplicate registrations making it possible to do automatic transitive app dependency object registration (which will require updating apps' registerObjects functions to call their direct dependencies' registerObjects functions in addition to registering their own objects).Impact
Should not require breaking any "external" APIs - only possibly modifying very internal Factory::reg function argument parameters. Mostly just enable more natural, robust objects registration for apps that depend on other apps/modules
The text was updated successfully, but these errors were encountered: