I'm just thinking out loud here...I need to be able to rapidly build and deploy simple RESTful interfaces to models stored in Derby (within a Karaf-based setup). I'm wondering what the potential for using Scalatra is to do this, considering database access and general Scala support within OSGi. I believe SMX4 supports Scala bundles...but not positive.I'd considered using Groovy, but don't know of a Sinatra-like DSL there - and am currently working with Restlets.Any thoughts? TIA.Kit |
On 15 November 2010 14:18, Kit Plummer <[hidden email]> wrote:
> > I'm just thinking out loud here...I need to be able to rapidly build and deploy simple RESTful interfaces to models stored in Derby (within a Karaf-based setup). I'm wondering what the potential for using Scalatra is to do this, considering database access and general Scala support within OSGi. That should be fine really. Ross is a fine chap & hangs out on the Scalate IRC room :). It might be that Scalatra might need a little tweak or two to make it proper OSGi bundles - not sure if its OSGi ready yet. As an aside I'm personally a big fan of JAXRS/Jersey for writing RESTful resources; I particularly like being able to use dependency injection into the resource bean so its easy to share state and code across different kinds of resources & methods - plus being able to create very modular web applications as the template-URI space for a web application is figured out by combining all the resource beans on the classpath; rather than a single chunk of DSL. Though Scalatra is very cool too & can be a little simpler to get started I think due to its DSL nature. I guess an ideal for JAXRS 2.0 for me would be something in between Scalatra and Jersey; so its nice and DRY and you can choose to either write DSL methods inline like in Scalatra or write injected resource beans like JAXRS (though maybe a little more DRY). > I believe SMX4 supports Scala bundles...but not positive.I'd considered using Groovy, but don't know of a Sinatra-like DSL there - and am currently working with Restlets.Any thoughts? TIA.Kit Any Scala code just compiles down to regular bytecode, so it should work fine inside OSGi providing you use the OSGi-ified scala-library bundle. Where there is more of a challenge is when you dynamically compile Scala code on the fly though (e.g. using Scalate as a template engine then changing the templates on the fly rather than precompiling them as part of your build process). Though I think Gert's got Scalate working nicely in OSGi these days. I'm totally biased, but I really like Scalate as an alternative to JSP/Velocity/FreeMarker/StringTemplate for creating views when you are not just using JAXB/Jackson to render XML/JSON from DTOs. In particular Jade is awesome for markup & HTML and SSP for arbitrary text. BTW the various Scala DSLs for database access are looking great. e.g. http://squeryl.org/selects.html ScalaModules also looks cool for working with OSGi... https://github.com/weiglewilczek/scalamodules -- James ------- FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: jstrachan Blog: http://macstrac.blogspot.com/ Open Source Integration |
Free forum by Nabble | Edit this page |