Actually I know good Java high level API and ORM for Apache Cassandra - Hector.
But can't find any native good solution for Scala. Anybody know any actual project with good quality, activity and ORM support for SuperColumns?
Phantom is actively developed and very well designed Scala DSL built on top of Datastax client.
Take a look at Scalandra a wrapper for Cassandra's Thrift API.
Besides scalandra there is also cascal and scromium
Related
I am deciding if I should learn Groovy and Scala, and currently I am comparing web frameworks. I like the Groovy language a bit more, but Play! works with both Java and Scala. Another thing pointing me towards Play! is the tight CoffeeScript Integration. For collaboration purposes, I need my framework to be able to affectively communicate and interact with some sort of JavaScript. For my choice I have a few questions on the Grails frameworks.
Questions
Can Grails use Java, or just Groovy?
Does Grails have any tight JavaScript integration? I mean can the two technologies communicate at runtime?
The Eclipse Grails Project seems to be maintained by spring. Does this mean Groovy can use Spring?
I am still confused on which to learn. Hopefully the answers to these questions will help me decide which to learn.
All of this information is widely available on the internet, easily found using Google or your favorite search engine. That said, here are the answers to your questions:
Question: Can Grails use Java, or just Groovy?
Answer: Grails uses both. Groovy is a dynamic language which runs within the JVM and in a lot of ways extends Java. Grails uses both Java and Groovy. You can use both within your Grails project as well. This allows you to leverage the vast array of Java libraries available. Much like Grails itself does.
Question: Does Grails have any tight JavaScript integration? I mean can the two technologies communicate at runtime?
Answer: Any Javascript library can be used, and they can (if you make them) communicate at runtime. (Your question doesn't really make a lot of sense). In regards to coffeescript (which you mentioned in your question), there are plugins available that will compile coffeescript at build time for your Grails project.
Question: The Eclipse Grails Project seems to be maintained by spring. Does this mean Groovy can use Spring?
Answer: Grails is built upon Spring, so yes. You (and it) can use Spring. There are a great number of reasons to leverage the Spring framework within your Grails project, and with the Bean builder DSL it's fairly straight forward to do so.
Matt Raible has a great comparison of all the JVM frameworks. I suggest checking out Play and Grails within that comparison to see how they rank in the broader comparison...
http://www.slideshare.net/mraible/comparing-jvm-web-frameworks-february-2014
You can very well use Java in Grails framework. There are two options:
1. Grails has a separate source folder for Java - here you can use Java classes
2. You can also use Java code inside a Groovy classes
Grails uses Spring and Hibernate
Try both out. Choosing a web framework is a big decision and it's worth spending some time choosing.
There is a list of usable frameworks in the creators blog of Atmosphere. I want to use scala and the Play Framework included with Atmosphere. In the blog he writes that Atmosphere works with "every" framework. Could it be that easy to integrate Atmosphere, and how?
I understand that this isn't necessarily the answer you were looking for, but I would suggest you look at Play's native comet support.
http://www.playframework.org/documentation/2.0/ScalaComet
http://www.playframework.org/documentation/api/2.0/scala/play/api/libs/Comet$.html
Do you have a particular use case that Atmosphere can solve more elegantly? If so, here's a thread that might help.
https://groups.google.com/forum/m/?fromgroups#!topic/atmosphere-framework/GM6fC6-eSLE
Yes, take a look at this project - it's a native implementation of Atmosphere running on top of Play!
I'm looking for this too. The benefits it would give are graceful degradation from websocket to long polling and a common api for these both client and server side.
I am working on a play framework project with scala in which I want to have Scala domain classes (or even Java domain classes) using MongoDb as data store.
I want maximum performance while serving hundreds of thousands if not millions of requests per day.
Since both scala language and Play framework is adding new features by the month, what is the best answer in terms of latest production version of the modules mentioned in the question
and play framework 1.2.2, scala 0.9.1+ and scala language 2.8+?
for anyone stumbling upon this question and using playframwork 2.1.x or above I highly recommend taking a look at reactivemongo site and github project.
It's a mongodb scala driver that allows asynchronous db operations.
Great performance and mature enough for use in production.
At the time of writing this the current version is 0.9 and is being used by us in production without any problems.
I use Morphia module, a MongoDB integration for Play! 1.2.x
For scala I would suggest you have a look at https://github.com/novus/salat
I've written a play plugin for salat which you can find here https://github.com/leon/play-salat
Good luck!
Is it based on mongoDb java driver ?
Can I use it when the domain model is scala program in version 1.2.2RC1+ of play framework?
Please note that questions that may have been answered before may not be relevant to play framework version 1.2.2RC1+.
If you are looking for a high level Java client for MongoDB, Give Kundera (https://github.com/impetus-opensource/Kundera) a try. It’s a JPA based client library for Cassandra, Hbase and MongoDB. There is a pretty good example here: https://github.com/impetus-opensource/Kundera/wiki/Getting-started
Morphia does run on top of/uses the mongodb java driver. All java ORM solutions do. I don't see why it would be a problem to run it in Scala. I have no experience with the "play framework".
I wanted to know if it was possible to use Spring MVC with a different JVM language than Java, e.g. Groovy or Scala. Or can Groovy only be run on Grails?
Also if it is possible, is this something which people try often, or do they just stick to the framework traditionally used?
Spring works perfectly well with scala because scala compiles to normal .class files which are Java-equivalent bytecode. I use Spring and scala all the time. It's even possible to use the Spring XML-extensibility to add support for scala-specific types, for example:
<bean class="my.scala.Class">
<property name="listProp">
<scala:list value-type="java.lang.Integer">
<value>1</value>
</scala:list>
</property>
</bean>
Sure, spring has excellent support for dynamic languages like Groovy. There is an entire chapter in the reference manual: http://static.springsource.org/spring/docs/2.5.6/reference/dynamic-language.html
As for scala; I tried doing this and it is possible. The problem is that JSP (or for that matter most templating languages supported by spring mvc) doesn't 'understand' scala collection types so I found myself converting between scala and java collections quite a lot. This should be better in Scala 2.8.0 but I haven't tested this myself.
Grails is implemented with Spring baked in, Grails 3 uses Spring-Boot. So that is definitely possible. You could also use Scala with Spring MVC. I don't know that you'd get the most mileage out of Scala with Spring MVC -- not a lot of opportunities to use Scala's functional programming features -- but there's nothing stopping you from trying it out.
I cannot speak for Scala, but I have personally used Spring with Groovy. Match made in heaven :)
Spring works very well with Scala, although Scala itself has features that mean you don't need
a dependency injection framework (such as Spring) in many cases.
Also, Scala isn't a dynamic language, it's a static language just as Java is. One of the primary goals of Scala was maximum interoperability with Java. This means that Scala compiles down to class files that look and feel just like Java objects, and can be seamlessly used as Java objects by external libraries and frameworks, such as Spring.
Well, what about writing the business logic in scala, so that the functional way scales well in multic core environments and let the rest handled by Spring and Hibernate. I think this is a pretty nice way to get the best of both worlds. Of course one can usw lift as a web app framework, but i think Spring is more actually mature and has more features. But the business logic is where the ball is rolling and so Scala and FP can handle this better than imperative java.
Right?
Your question should be classified:
groovy or scala compile to class and deployed
groovy not compile just deployed to tomcat
using traditional spring framework with a little groovy
using brand new framework to work with groovy e.g. grail
If you want using traditional spring framework e.g. spingmvc springcloud and want to add some groovy to implement business logic code, please use a new lib micro-mvc: https://github.com/jeffreyning/micro-mvc
This lib can scan interface as springbean and create a proxy to execute groovy.