[
https://issues.apache.org/jira/browse/S4-5?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196394#comment-13196394
]
Leo Neumeyer commented on S4-5:
-------------------------------
After studying how to implement fluent grammars in Java, I came up with a
formal definition. Please review.
Grammar in EBNF format (railroad diagram attached generated with this great
tool: http://railroad.my28msec.com/rr/ui )
{code}
s4 ::= 'graph' 'info'? 'create'
graph ::= 'pe' '('STRING')' 'type' '('CLASS_TYPE')'
(FIRE_ON )?
(TIMER)?
(CACHE)?
'asSingleton'?
EMIT
EMIT ::= 'emit' '(' ('event' '(' STRING ')' ('onField''('STRING')')?
('onKey''('(CLASS_TYPE|STRING)')')? 'to' '(' STRING ')' )+
FIRE_ON ::= 'fireOn''('STRING')' ('ifInterval''('NUMBER ',' TIMEUNIT')' )?
TIMER ::= 'timer' 'period''('NUMBER ',' TIMEUNIT')'
CACHE ::= 'size''('NUMBER')' ('expires''('NUMBER ',' TIMEUNIT')')?
PROPERTY ::= ('p''('STRING',' VALUE')')+
TIMEUNIT ::= 'TimeUnit.'('HOURS'|'MINUTES'|'SECONDS')
STRING ::= '"'([A-Z][a-z][_])+'"'
NUMBER ::= [0-9]+
CLASS_TYPE ::= STRING'.class'
VALUE ::= STRING | NUMBER
{code}
Example:
{code}
s4().graph(
pe("PEZ").type(PEZ.class)
.fireOn("EVC").ifInterval(5, TimeUnit.SECONDS)
.cache().size(1000).expires(3, TimeUnit.HOURS)
.emit( event("EVB").to("PEX") ),
pe("PEY").type(PEY.class)
.property( p("duration", 4),
p("height", 99)
)
.timer().period(2, TimeUnit.MINUTES)
.emit( event("EVA").onField("stream3")
.onKey(DurationKeyFinder.class).to("PEZ"),
event("EVA").onField("heightpez")
.onKey(HeightKeyFinder.class).to("PEZ") ),
pe("PEX").type(PEX.class)
.property( p("query", "money") )
.asSingleton()
.cache().size(100).expires(1, TimeUnit.MINUTES)
.emit( event("EVB").onKey(QueryKeyFinder.class).to("PEY",
"PEZ") )
),
.info(
organization(name("Algo Tech"), url("http://algotech.com")),
app(name("Meaning Extractor"),
icon("http://algotech.com/meicon.png")),
author("Thomas Edison"),
)
).create();
{code}
> 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