Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a DSL to describe a consumer chain #2

Open
cstroe opened this issue Sep 27, 2015 · 7 comments
Open

Create a DSL to describe a consumer chain #2

cstroe opened this issue Sep 27, 2015 · 7 comments

Comments

@cstroe
Copy link
Owner

cstroe commented Sep 27, 2015

Currently, to create a consumer chain that operates on an SVN Dump stream you must write Java code, compile it into your JAR and then run it on your SVN dump file. It is a tedious process.

To make this easier, we can create a DSL that describes a consumer chain. The file that describes the consumer chain can be read at runtime and the consumer chain be generated dynamically, requiring no recompilation.

This will make running the program from the CLI much easier.

The DSL should be implemented in JavaCC.

@cstroe cstroe changed the title Create a DSL to describe a ConsumerChain Create a DSL to describe a consumer chain Oct 7, 2015
@cstroe
Copy link
Owner Author

cstroe commented Oct 7, 2015

Commit b77596a adds a CliConsumer. The CliConsumer should have an option to read a DSL file to describe the consumer chain.

@cstroe
Copy link
Owner Author

cstroe commented Oct 10, 2015

Alternatively, we can use JSR 233: Scripting for the Java Platform, with any of the supported languages (there are many) to parse some dynamic scripting language. I'm thinking either Javascript or Ruby (or both).

http://www.drdobbs.com/jvm/jsr-223-scripting-for-the-java-platform/215801163

@cstroe
Copy link
Owner Author

cstroe commented Oct 10, 2015

Looks like Javascript support is distributed with Java:

The following 1 scripting engines were found

Engine name: Oracle Nashorn
    Version: 1.8.0_60
    Language: ECMAScript
    Engine supports the following extensions:
        js
    Engine has the following short names:
        nashorn
        Nashorn
        js
        JS
        JavaScript
        javascript
        ECMAScript
        ecmascript
=========================

@cstroe
Copy link
Owner Author

cstroe commented Oct 10, 2015

So adding support for any scripting language is as easy as making the ScriptEngine implementation available.

JRuby docs: https://github.com/jruby/jruby/wiki/Embedding-with-JSR-223

@cstroe
Copy link
Owner Author

cstroe commented Oct 10, 2015

This article (http://zeroturnaround.com/rebellabs/why-you-should-tap-into-the-power-of-ruby-from-the-comfort-of-the-jvm/) recommends using JRuby Embed (originally called RedBridge) instead of JSR 223, however, we should probably stick to JSR 223 to make adding other languages easy.

RedBridge explained: https://github.com/jruby/jruby/wiki/RedBridge
JRuby Java Integration: https://github.com/jruby/jruby/wiki/JavaIntegration

@cstroe
Copy link
Owner Author

cstroe commented Oct 10, 2015

Adding this to pom.xml:

<dependency>
    <groupId>org.jruby</groupId>
    <artifactId>jruby-complete</artifactId>
    <version>1.7.9</version>
</dependency>

Yields:

The following 2 scripting engines were found

Engine name: JSR 223 JRuby Engine
    Version: 1.7.9
    Language: ruby
    Engine supports the following extensions:
        rb
    Engine has the following short names:
        ruby
        jruby
=========================
Engine name: Oracle Nashorn
    Version: 1.8.0_60
    Language: ECMAScript
    Engine supports the following extensions:
        js
    Engine has the following short names:
        nashorn
        Nashorn
        js
        JS
        JavaScript
        javascript
        ECMAScript
        ecmascript
=========================

Very nice.

@cstroe
Copy link
Owner Author

cstroe commented Oct 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant