Permalink
Browse files

Added s4-edsl sub-project skeleton.

  • Loading branch information...
1 parent 988ee77 commit 924bc55b4f86fceea8c0fba9668cb5c40fe42cf4 @leoneu leoneu committed Feb 4, 2012
View
@@ -72,7 +72,8 @@ libraries = [
zk: 'org.apache.zookeeper:zookeeper:3.3.1',
jcip: 'net.jcip:jcip-annotations:1.0',
junit: 'junit:junit:4.10',
- zkclient: 'com.github.sgroschupf:zkclient:0.1'
+ zkclient: 'com.github.sgroschupf:zkclient:0.1',
+ diezel: 'net.ericaro:diezel-maven-plugin:1.0.0-beta-3'
]
subprojects {
@@ -90,6 +91,7 @@ subprojects {
dependencies {
+ compile('javax.jms:jms:1.1')
/* Google. */
compile( libraries.guava )
compile( libraries.guice )
@@ -107,7 +109,7 @@ subprojects {
/* Misc. */
compile( libraries.jcip )
compile( libraries.zk ) {
- transitive = false
+ //transitive = false
}
/* Testing. */
@@ -125,7 +127,7 @@ subprojects {
dependsOnChildren()
-platformProjects = [project(':s4-base'), project(':s4-core'), project(':s4-comm')]
+platformProjects = [project(':s4-base'), project(':s4-core'), project(':s4-comm'), project(':s4-edsl')]
configurations {
platformLibs
View
@@ -16,6 +16,7 @@
include 's4-base'
include 's4-core'
include 's4-comm'
+include 's4-edsl'
include 's4-example'
include ':test-apps:simple-deployable-app-1'
include ':test-apps:simple-deployable-app-2'
@@ -0,0 +1,40 @@
+// Use the Diezel Maven plugin to build the project.
+// Gradle doesn't support Maven plugin as of version 1.0
+// Useful article: http://forums.gradle.org/gradle/topics/how_to_download_and_evoke_a_maven_plugin
+
+def generatedSourceDir = "${buildDir}/generated-src/java"
+def diezelSrcDir = "${projectDir}/src/main/diezel";
+
+dependencies {
+ compile project(":s4-core")
+}
+
+
+sourceSets {
+ generated {
+ java { srcDir $generatedSourceDir }
+ }
+}
+
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath libraries.diezel
+ }
+}
+task generateSources << {
+ outputs.dir generatedSourceDir
+ def mojo = new net.ericaro.diezel.plugin.DiezelMojo()
+ mojo.sourceDirectory = new File(diezelSrcDir);
+ mojo.outputDirectory = new File(generatedSourceDir);
+ mojo.staleMillis = 0;
+ mojo.project = new org.apache.maven.project.MavenProject();
+ org.apache.maven.model.Build build = new org.apache.maven.model.Build();
+ build.setDirectory(mojo.sourceDirectory.getAbsolutePath());
+ mojo.project.setBuild(build);
+ mojo.execute();
+}
+
+compileJava.source generateSources.outputs.files, sourceSets.main.java
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<diezelImplementation xmlns="http://diezel.ericaro.net/2.0.0/">
+ <package>org.apache.s4.core.edsl</package>
+ <name>Builder</name>
+ <implements>org.apache.s4.core.edsl.S4DSL</implements>
+ <transitions>
+ <transitionImplementation name="pe">
+ <body>
+ System.out.println("pe");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="type">
+ <body>
+ System.out.println("type");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="fireOn">
+ <body>
+ System.out.println("fireOn");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="ifInterval">
+ <body>
+ System.out.println("ifInterval");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="timer">
+ <body>
+ System.out.println("timer");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="withPeriod">
+ <body>
+ System.out.println("withPeriod");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="cache">
+ <body>
+ System.out.println("cache");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="expires">
+ <body>
+ System.out.println("expires");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="asSingleton">
+ <body>
+ System.out.println("asSingleton");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="emitEvent">
+ <body>
+ System.out.println("emitEvent");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="onField">
+ <body>
+ System.out.println("onField");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="onKey">
+ <body>
+ System.out.println("onKey");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="to">
+ <body>
+ System.out.println("to");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="info">
+ <body>
+ System.out.println("info");
+ </body>
+ </transitionImplementation>
+ <transitionImplementation name="build">
+ <body>
+ System.out.println("build");
+ return "Done!";
+ </body>
+ </transitionImplementation>
+
+ </transitions>
+</diezelImplementation>
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<diezel xmlns="http://diezel.ericaro.net/2.0.0/">
+ <package>org.apache.s4.core.edsl</package>
+ <name>S4DSL</name>
+ <expression>(pe , type , (fireOn , ifInterval? )? , (timer, withPeriod)? , (cache, size , expires? )? , asSingleton? , (emitEvent, onField?, onKey?, to )+ )+ , info?, build</expression>
+ <transitions>
+ <transition name="pe">
+ <signature>pe()</signature>
+ </transition>
+ <transition name="type">
+ <signature>type()</signature>
+ </transition>
+ <transition name="fireOn">
+ <signature>fireOn()</signature>
+ </transition>
+ <transition name="ifInterval">
+ <signature>ifInterval()</signature>
+ </transition>
+ <transition name="timer">
+ <signature>timer()</signature>
+ </transition>
+ <transition name="withPeriod">
+ <signature>withPeriod()</signature>
+ </transition>
+ <transition name="cache">
+ <signature>cache()</signature>
+ </transition>
+ <transition name="size">
+ <signature>size()</signature>
+ </transition>
+ <transition name="expires">
+ <signature>expires()</signature>
+ </transition>
+ <transition name="asSingleton">
+ <signature>asSingleton()</signature>
+ </transition>
+ <transition name="emitEvent">
+ <signature>emitEvent()</signature>
+ </transition>
+ <transition name="onField">
+ <signature>onField()</signature>
+ </transition>
+ <transition name="onKey">
+ <signature>onKey()</signature>
+ </transition>
+ <transition name="to">
+ <signature>to()</signature>
+ </transition>
+ <transition name="info">
+ <signature>info()</signature>
+ </transition>
+ <transition name="build">
+ <return>java.lang.String</return>
+ <signature>build()</signature>
+ </transition>
+ </transitions>
+</diezel>
@@ -0,0 +1,15 @@
+import org.apache.s4.core.edsl.BuilderS4DSL;
+
+public class Main {
+ public static BuilderS4DSL build() {
+ return new BuilderS4DSL();
+ }
+
+ public static void main(String[] args) {
+
+ String app = new BuilderS4DSL().pe().type().fireOn().ifInterval().cache().size().asSingleton().emitEvent()
+ .onField().to().build();
+ System.out.println(app);
+
+ }
+}

0 comments on commit 924bc55

Please sign in to comment.