Project Avatar brings thin server architectures to Java EE 7

Java Development News:

Project Avatar brings thin server architectures to Java EE 7

By Cameron McKenzie

25 Sep 2013 | TheServerSide.com

How do you create a single-page interface in Java? And not just the HTML5 front-end components that use jQuery and new browser features such as client-side storage, but the back-end components, as well?

At the JavaOne conference in 2011, Cameron Purdy and Adam Messinger appeared to have an answer to that question, as they hinted at Project Avatar, a framework Oracle was working on that would fully embrace the concept of rich, modern, HTML5 clients with thin server architectures supporting them on the server side. And of course, all of this would be developed using the modern Web browser and standard Java-based technologies. It was a great announcement, or pre-announcement, said Purdy, vice president of development at Redwood Shores, Calif.-based Oracle, but not much had been spoken about the project since.

There was a simple demo and some additional talk about it at JavaOne 2012, but Google hits on the topic have been pretty nascent, and nobody in any of the Java IRC groups knew much about it. There was a nagging feeling that this very promising project was going to run out of steam, especially with so much effort at Oracle being expended on cloud computing, Project Lambda and the release of Java EE 7.

But two years after it was first announced, it seems like all systems are a go, with Purdy adding a new feather to his cap as he announced during Sunday's JavaOne 2013 keynote that not only was Project Avatar alive and going strong, but the project was being open sourced, as well.

"We announced Project Avatar two years ago. We've been steadily working away on this," Purdy said. "This time it's not a pre-announcement. We are announcing today that we are open sourcing Project Avatar, and it should be available right now."

And when one digs into Avatar, it becomes pretty clear that given so many dependencies on Java EE 7, the project really couldn't have been properly released to the community until Java EE 7 became generally available, especially given the way the framework uses the enterprise edition's new HTML5 support. "When it comes to the key, cool new thing in Java EE 7, that's HTML5 support," Purdy said, "which includes support for things like WebSockets, server sent events, RESTful support and all of these technologies that go into building modern, Web-based applications." And of course, all of these technologies are fundamental to Avatar.

Quickly examining the online docs, Avatar appears to provide a single programming model for both client-side and server-side development, drawing inevitable comparisons to the popular Google Web Toolkit framework, which has a similar approach. Going hand in hand with the concept of a thin server architecture (TSA), Avatar relies on the HTML5 client to both manage and choose when server-side resources need to be invoked, greatly simplifying the role of the server in the Avatar architecture, while providing the user interface developer with a greater level of control and flexibility with regards to how the user interacts with the system.

The development philosophy of Avatar seems to be a bit of an inversion of what enterprise Java developers have been used to in the past. JavaScript is everywhere on the server side, supporting events, REST, WebSockets and the like, while the client side is all about HTML5 and CSS3. According to the design docs, the client side only requires a minimal level of competency with JavaScript, as copy and pasting templatized code is enough to get a Web-based client chatting effectively with its server-side siblings. The server side uses JavaScript much more intensely. "We leverage Project Nashorn from Java SE to make the Java EE container polyglot," Purdy said. "We extend Java EE to support JavaScript and Node-style services running in an application server."

Integration with live data is another aspect of Avatar with which Purdy seems especially proud. "Avatar has support for NoSQL databases along with the concept of live information coming up from the databases into the application, not just request-response to the database, but live."

"This time it's not a pre-announcement," Purdy said, with a somewhat perturbed inflection in his voice, making it clear there has been no shortage of people in the development community bothering him about the status of the project over the last couple of years. "We want to continue to make Java EE simple to develop. Support the latest standards and keep these things relevant." With Project Avatar now released and open sourced, Oracle's Purdy and his team are clearly working hard to live up to that commitment.

Related Resources