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

Leo Neumeyer commented on S4-5:
-------------------------------

I started to work on the AppMaker package. The goal is to use a builder pattern 
to build apps and do the bindings with Guice behind the scenes. I started with 
the end user API. I'm also considering modifying the App class to extend 
Guice's AbstractModule. Suggestions welcomed.

This is how a user would create an app:

{code:title=Prototyping App Builder|borderStyle=dashed}
package org.apache.s4.appbuilder;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {

        AppMaker am = new AppMaker();

        PEMaker pem1, pem2;
        StreamMaker s1;
        StreamMaker s2, s3;

        pem1 = am.addPE(PEZ.class);

        s1 = am.addStream(EventA.class).withName("My first 
stream.").withKeyFinder("{gender}").to(pem1);

        pem2 = am.addPE(PEY.class).to(s1);

        s2 = am.addStream(EventB.class).withName("My second 
stream.").withKeyFinder("{age}").to(pem2);

        s3 = am.addStream(EventB.class).withName("My third 
stream.").withKeyFinder("{height}").to(pem2);

        am.addPE(PEX.class).to(s2).to(s3);
    }
}
{code} 

Notes:

- I am not using generics here, instead I pass the PE and Event types. (I 
assume we can build what we want with reflection and only need the type.) 
- For now I am doing this as a separate package but this may end up: PEMaker -> 
ProcessingElement and StreamMaker -> Stream.
- The KeyFinder needs to be generated from a string. (Can we reuse the code 
from 0.3?)
- Need to build the graph using the Guice API. 

The branch name is appbuilder. - [GH 
repo|https://github.com/leoneu/s4-piper/tree/appbuilder/subprojects/s4-core/src/main/java/org/apache/s4/appbuilder]

                
> Prototype app builder
> ---------------------
>
>                 Key: S4-5
>                 URL: https://issues.apache.org/jira/browse/S4-5
>             Project: Apache S4
>          Issue Type: New Feature
>    Affects Versions: 0.5
>            Reporter: Leo Neumeyer
>            Priority: Minor
>             Fix For: 0.5
>
>
> Extend Guice AbstractModule to create a simple application builder layer. The 
> idea is to evaluate if we can use Guice to do all the wiring including PEs 
> and Streams and Apps.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to