Raymond Feng wrote:
Hi,
Now we have interface-based models and the model objects are supposed
to be created by model factories. And the model implementation and
default model factory classes are subject to being overridden.
Therefore, we should try to avoid hard-coding the instantiation of
model implementation and default model factory classes, for example,
don't use new DefaultAssemblyFactory() or new ComponentReferenceImpl().
Yes. However, I don't think that it's mandatory to use a factory to
create these model instances. The factory is a way to hide the actual
implementation class of a given model, when you want to. In some cases
you'll want to select a specific implementation class, and then you do
not care much about using a factory.
This is especially required for the code that plugs into an extension
point.
I think that this is only required for extensions (implementation and
binding extensions) at this point.
And I expect these classes to receive the factory instances from
constructors or setter methods.
Yes, I'd prefer constructors.
IMO, the factory instances should be made available either from the
ExtensionPointRegistry or the specific extension point. We should
"inject" the correct factory instances during the
ModuleActivator.start() or when the extension is added to the
extension point. This way, the desired factories can be correctly
propagated.
The kind of injection you're proposing, like injection with autowiring
or extension points in a central registry, creates disguised globals. I
wouln't jump to that solution too quickly. I would suggest to first
review the actual places where Implementations and Bindings are created.
I am assuming that an Implementation extension is responsible for
creating the version of References and Services representing the
implementation artifact, so it can pick the appropriate model classes
representing these services and references.
At this moment, I still see quite a lot classes which don't follow
this pattern and I think we need to fix it as we're planning to use
different factory implementations to create model instances that also
implement interfaces for runtime behaviors.
Do you agree?
Thanks,
Raymond
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]