This overlaps a lot with the Pipelines already part of Tinkerpop.
(
https://github.com/tinkerpop/pipes) You may be able to implement these as pipes.
Also, be careful not to get so stuck on doing everything in rules that you miss the fact
that some things aren't going to be rule driven, or don't make sense in rules.
Otherwise the rules will become overly complex and may not add much value.
I think the casting of XML files, or filtering of XML files by their namespace and doctype
are fine for rules, but things like:
* Parsing an EJB and connecting XML files to Java files: probably not suited well for
Rules because it is a 1 time thing and spec specific.
* Highlighting lines in Java or XML by Regex or XPath: probably well suited for Rules
because it is user driven what needs to be highlighted, and may expand over time.
Brad Davis
Red Hat Consulting
Email: bdavis(a)redhat.com | c: 980.226.7865 |
http://www.redhat.com
----- Original Message -----
From: "Ondrej Zizka" <ozizka(a)redhat.com>
To: windup-dev(a)lists.jboss.org, "Lincoln Baxter" <lbaxter(a)redhat.com>
Sent: Friday, May 2, 2014 7:26:34 PM
Subject: [windup-dev] Rules API
Hi,
WRT rules API, as proposed at
https://github.com/windup/windup/blob/master/engine/config/api/src/main/j...
It's nice, with some comments.
I know it was typed in a hurry, but anyway:
1) The (when, perform) structure would be basic for all rules?
2) This seems like it will build object tree, which will then be
processed, right? No space for custom code?
3) Isn't that a fluent API overuse? How about something like:
new ConfigBuilder( ... ){{
addRule( new MavenPomRule( this, ... ){
boolean when( ) { return Selection.exists(XMLFile.class,
"xmls").with("doctype", DOCTYPE_POM); }
void perform( MavenPomInfo mpi ){ ... }
}
);
}}.run();
It's verbose now but with Java 8 lambdas, it would be less.
While it's a bit more verbose, it would have obvious benefits of better
debuggability, and would better leverage Java's features like
inheritance (imagine AbstractXmlFileRule and it's subclasses for
whatever one would want to do with a XML file, having few of its
properties passed as parameters.
Btw this code above is inspired by Wicket and GWT.
4) .withDoctype("http://maven.apache.org/POM/4.0.0") ?
doctype is a property... Better .with(PropNames.DOCTYPE,
"http://maven.apache.org/POM/4.0.0") ?
5) Could the variable be filled outside .when () ? But perhaps just a
matter of taste.
More later when we have some more examples.
Nice!
Ondra
_______________________________________________
windup-dev mailing list
windup-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/windup-dev