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

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


I don't think this should be visible in the API, so we are targeting for SPI 
level feature.

{code:java}
public interface StructureHolder
{
    Module module();
}
{code}

should be enough to handle everything so far. And then if the injected object 
is a Transient, then any Service it needs to interact with is done through 
regular injection or serviceFinder, either in the module the Transient is 
declared or for the module where it was injected. This becomes implementation 
detail and use-case specific, which I think is a good thing.

In ModuleSpi we add;

{code:java}
    <T> T findStructureComponent( Class<T> structureType);
{code}

to look up any of these structure types. A better name than StructureComponent 
is probably needed. Maybe StructureComposite.

> 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