[ 
https://issues.apache.org/jira/browse/POLYGENE-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16275787#comment-16275787
 ] 

Niclas Hedhman commented on POLYGENE-279:
-----------------------------------------


I am thinking that Composites are really flexible and neat to work with to 
override existing behavior. IF these builder factories are transients, then we 
got the full power of composites available, i.e. fragments and injections, 
instead of having to come up with new stuff on how that is going to work.

My local proof-of-concept has actually solved the issue quite neatly. The 
InjectionProvider uses the default transient builder factory mixin (but not a 
full Composite) to instantiate a TransientBuilderFactory. I looks quite ok on 
paper, and the injection context (whatever is deemed suitable) is passed as 
"uses" to the new builder factory. So, in principle this aligns with your 
"custom tbf should only be used for normal transients" statement.

At a conceptual level, it remains to to be understood if we need "Structure 
Composite" as a new meta type, which basically doesn't belong to a Module, or 
whether we should introduce a Visibility.global. The latter is likely to be 
abused, but perhaps that is a reasonable compromise, especially if other 
uses-cases (than this) can be established (configuration and security comes to 
mind).



> Custom @Structure injection types
> ---------------------------------
>
>                 Key: POLYGENE-279
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-279
>             Project: Polygene
>          Issue Type: New Feature
>            Reporter: Niclas Hedhman
>
> Use-case 1; UnitOfWorkFactory is currently depending on a UnitOfWorkFactory 
> declaration in every module where one need it injected, or otherwise one risk 
> having the wrong visibility established. The current behavior is a design 
> flaw, not present in earlier Qi4j versions.
> Use-case 2; MetricsProvider should be able to create module-specific (or 
> module-aware) Metric instances, without having to be declared in every module 
> where metrics are needed.
> Use-case 3; IdentityManager should be allowed to generate IDs that use module 
> names, without being declared in every module.
> Currently, we don't have any particular types that deal with @Structure 
> injections, nothing that holds the additional information needed. But there 
> is a need to be both a singleton, i.e. a Service as well as a unique object 
> that is injected into the target composite.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to