Janino Expression Support and Play 1.2.3

24 views
Skip to first unread message

Tom Carchrae

unread,
Sep 24, 2011, 10:16:16 AM9/24/11
to cambridge...@googlegroups.com
I added support for Janino to Cambridge : http://docs.codehaus.org/display/JANINO/Basic  

This allows you to write Java as the template language.  (yay lazy me does not have to learn yet more languages :) ).  This should be nice and fast.  I'm still doing some testing with it, but seems to work fine.  Will give it a run through the benchmark test.

Kudos Erdinc for making it so easy to plug in a new language.

Minor thing with Janino is that it requires types, so I compile expressions on the first Eval.  The limitation here is if you call it with different arguments, eg, foo(1.0) followed by foo(1), it will probably blow up.  It is pretty trivial to fix this and compile a new evaluator for each different argument combination, I would probably change it to a cache of HashMap<List<Class>,ExpressionEvaluator> or something like that.

I also updated the Play support to 1.2.3  - there was some really minor broken API.

Tom

Erdinc Yilmazel

unread,
Sep 24, 2011, 11:21:06 AM9/24/11
to cambridge...@googlegroups.com
Hey Tom,

This is great. Please send me a patch after you do some further testing.

Thanks

 - Erdinc

Tom Carchrae

unread,
Sep 24, 2011, 12:26:08 PM9/24/11
to cambridge...@googlegroups.com
Here it is, I just zipped the Janino extension since it did not modify existing source code.

You'll also need the Janino jars from http://dist.codehaus.org/janino/janino-2.6.1.zip

I also noticed that after a "for" loop in Cambridge, the "globals" map in eval keeps some variables.  Perhaps you are setting them to "null" but you probably should simply remove them from the map.

Also, I did not test/handle the wrapExpressionAsList method in ExpressionLanguage.  I didn't get a chance to figure out what that was/how it should work.  

I'll send any improvements as I use it.

Tom
cambridge-janino.zip

Tom Carchrae

unread,
Sep 24, 2011, 12:32:53 PM9/24/11
to cambridge...@googlegroups.com
Here is the Play 1.2.3. patch.  I'll see about working on a proper module over the next week.  The patch makes it compile - it does not add support for the Annotations feature (which seemed to be about adding annotations for Date parsing/formatting).  I'll send an update if I get that working as well - but now it compiles against the latest Play.  

Also, the maven build chokes on the Play jars.  I don't know if it works for you.  I had to manually install the Play jars.  Would be much nicer if the maven build ran without any problems.

Tom

patch-play123.txt

Erdinc Yilmazel

unread,
Sep 24, 2011, 1:00:45 PM9/24/11
to cambridge...@googlegroups.com
Thanks for these Tom. Unfortunately I couldn't find maven jars from a global maven repository yet so you need to manually install the jar file to build that extension at the moment. I think I should create my own maven repository to distribute these dependencies and cambridge jars as well. 

Tom Carchrae

unread,
Sep 24, 2011, 1:05:10 PM9/24/11
to cambridge...@googlegroups.com
I think the Play developers are anti-maven - some argument about cross platform support.  Although I suspect it's actually their deep hatred of XML.  :)

Does Google Code disallow hosting of libs from other projects?  My preference is to commit an Eclipse project that has all dependencies included.  

Or just a simple page on the steps required to get it compiling would be useful.  

Tom

Erdinc Yilmazel

unread,
Sep 24, 2011, 1:25:18 PM9/24/11
to cambridge...@googlegroups.com
Play framework is distributed with apache2 license so it shouldn't be wrong to redistribute some of its jars in google code. To get things work with google code, you need to create a maven repository folder structure and then check-in that folder into subversion. Then people can access all those files through http under yourprojectname.googlecode.com/svn/

Erdinc

Rakesh Waghela

unread,
Oct 8, 2011, 12:12:44 PM10/8/11
to cambridge...@googlegroups.com
Any progress friends ?

Jon Stevens

unread,
Oct 19, 2011, 5:43:00 PM10/19/11
to cambridge...@googlegroups.com
It is just cause Maven is a pile of shit and the Play developers have a clue. ;-)
Reply all
Reply to author
Forward
0 new messages