You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Gyewon Lee (JIRA)" <ji...@apache.org> on 2014/11/12 16:57:34 UTC

[jira] [Comment Edited] (REEF-31) Introduce namespace to handle binding multiple implementations to the same interface

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

Gyewon Lee edited comment on REEF-31 at 11/12/14 3:57 PM:
----------------------------------------------------------

[~markus.weimer]
#6
It makes sense to me, but is it possible to bind a list whose elements come from different configurations? For example, I think it'd be hard to do the following injection in the doc example, because we cannot specify the exact location of the list unless we provide a special API for sharing objects in list.

{{List<Binding> AReceivers = new ArrayList<>();
AReceivers.add(cb_b1.getBinding(Node.class));
AReceivers.add(cb_b2.getBinding(Node.class));
AReceivers.add(cb_b3.getBinding(Node.class));
cb_a.bindList(Receivers.class, AReceivers);}}

#7

When injector counters a {{Binding}} object in {{buildInjectionPlan()}}, it finds the target {{ConfigurationBuilder}} by the reference in it and the injector builds an injection plan for the {{Binding}} according to the configuration in the namespace. The injection plan should contain its namespace information in it. When getting instance, objects inside the target instance are cached according to its nodename and namespae, the "Singleton in a namespace semantics" are assured.

[~juliaw]
I've not started the impl part. Maybe I can work on it after the concrete design is done. We can make a call about implementation issues before or after I start the work. When do you think is the best?

Thanks for the good comments, Julia and Markus.
Gyewon


was (Author: gyewonlee):
[~markus.weimer]
#6
It makes sense to me, but is it possible to bind a list whose elements come from different configurations? For example, I think it'd be hard to do the following injection in the doc example, because we cannot specify the exact location of the list unless we provide a special API for sharing objects in list.

{{
List<Binding> AReceivers = new ArrayList<>();
AReceivers.add(cb_b1.getBinding(Node.class));
AReceivers.add(cb_b2.getBinding(Node.class));
AReceivers.add(cb_b3.getBinding(Node.class));
cb_a.bindList(Receivers.class, AReceivers);
}}

#7

When injector counters a {{Binding}} object in {{buildInjectionPlan()}}, it finds the target {{ConfigurationBuilder}} by the reference in it and the injector builds an injection plan for the {{Binding}} according to the configuration in the namespace. The injection plan should contain its namespace information in it. When getting instance, objects inside the target instance are cached according to its nodename and namespae, the "Singleton in a namespace semantics" are assured.

[~juliaw]
I've not started the impl part. Maybe I can work on it after the concrete design is done. We can make a call about implementation issues before or after I start the work. When do you think is the best?

Thanks for the good comments, Julia and Markus.
Gyewon

> Introduce namespace to handle binding multiple implementations to the same interface
> ------------------------------------------------------------------------------------
>
>                 Key: REEF-31
>                 URL: https://issues.apache.org/jira/browse/REEF-31
>             Project: REEF
>          Issue Type: New Feature
>            Reporter: Byung-Gon Chun
>            Assignee: Julia
>         Attachments: Tang-namespace-based-injection-gyewonlee.docx
>
>
> We extend Tang to allow binding multiple implementations to the same interface. One example usage is to create a DAG of operators, each of which has the same interface EventHandler.
> The current approach is to introduce the "namespace" concept in Injector.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)