Sunday, November 22, 2009

Bye Bye Zembly :(

This is in the memory of my favourite social programming platform Zembly which was an interesting attempt of Sun Microsystems making easy writing the applications for social platforms such as Facebook, Orkut, Meebo, OpenSocial and the iPhone by sharing services and widgets with the developer community. One of my blog post posted earlier this year, has a JavaFX Piano widget hosted on Zembly , and one of the JQuery games which I couldnt manage to finish :( . So far I dont know clearly why its being shut down, below is an excerpt from the mail which I received from Sun.

"We regret to inform you that on November 30th, 2009 we will be suspending this service.

More than three years ago, we started this project with the goal of making it easy to create next-generation Web apps. Our original tagline was "Build the web, using the web," and the ideas we were incubating around platform-mediated Web applications, Web API mashups, and social programming were brand new.

We learned a lot along the way. Your confidence and enthusiasm helped us improve the project and do amazing things that we never imagined when we began this journey.


Thank you to everyone who's been with us through the ups and downs. It's heartening to see that many of the best ideas pioneered in zembly have started to appear elsewhere. With your support, we're proud to have contributed to the DNA of the Web. "

All I want to say to the Zembly team is that,hats off to you people, you guys built an incredible social programming platform. I had learned a lot by cloning widgets contributed by you guys.

Saturday, September 5, 2009

JavaFX 1.2+ Spring + Hibernate

Related to discussions going on in BoJUG, I was tempted to develop a Proof-of-Concept for using JavaFX as view technology in a web application backed by spring and hibernate stack . Well Spring already provides remoting support for communicating to rich clients. Currently,spring supports four remoting technologies .
In my application, I am using Spring's HTTP Invoker which allows for Java serialization via HTTP, supporting any Java interface (just like the RMI invoker). The corresponding support classes are

1) org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean

is a factory bean for HTTP invoker proxies. It behaves like the proxied service when used as bean reference, exposing the specified service interface. Serializes remote invocation objects and deserializes remote invocation result objects.

2) org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter

is an HTTP request handler that exports the specified service bean as HTTP invoker service endpoint, accessible via an HTTP invoker proxy.It deserializes remote invocation objects and serializes remote invocation result objects.

I started of with developing an application that fetches and displays employee data using JavaFX,Spring and Hibernate.
The whole application was developed as 2 separate Netbeans projects.

1)empFXClient : is a JavaFX application.
2)empRemote: is a web application that uses empFXClient as view by embedding it as an applet inside a web page.

You can browse the code for both the projects online here . If you have Netbeans 6.5 and/or an SVN client then you can check out both the netbeans projects locally from kenai using the following URL and play with it.

https://kenai.com/svn/fxspring~svn-repository (requires kenai registeration)

We require 2 config files on the server side
1)web.xml
contextConfigLocation
/WEB-INF/empapp-servlet.xml


org.springframework.web.context.ContextLoaderListener


empapp
org.springframework.web.servlet.DispatcherServlet
1


empapp
/empapp/*


30


index.jsp




2)empapp-servlet.xml




















com/empapp/persistence/Employee.hbm.xml




hibernate.dialect=org.hibernate.dialect.MySQLDialect

























Spring Http invoker uses Java serialization just like RMI, but provides the same ease of setup
as Caucho's HTTP-based Hessian and Burlap protocols. As springs api docs says "HTTP invoker is the recommended protocol for Java-to-Java remoting.
It is more powerful and more extensible than Hessian and Burlap, at the expense of being tied to Java. Nevertheless, it is as easy to set up as Hessian and Burlap, which is its main advantage compared to RMI".

There is a nice example available which shows integrating JavaFX with JBoss Seam/spring using Flamingo DS through Hessian protocol. http://java.dzone.com/articles/javafx-and-seam-flamingo

Saturday, May 16, 2009

JavaFX and JQuery Widgets with Zembly

Since, I attended the BOJUG meet on JavaFX in Dec 2008 ,I was very excited about trying it out. Finally I managed to get some time to work on it.I found it easy and fun to learn as it is almost like writing Java2D code in a more sophisticated form. I was looking out for ways to create something that can be shared across blogging and other social networking sites something like flash widgets but not in flash.Being a Java developer it looks very scary to me ;). Then almost a month and a half back I got to know about this new browser based social programming environment Zembly from Sun Microsystems. I was not fully aware of how these widgets are published simultaneously on various social networks.But after exploring Zembly I found creating these kind of widgets very easy and interesting.My interest dragged me to write these two small apps which are published on Blogger and iGoogle using Zembly.
Added below is a JavaFX piano which can be played through keyboard(use Keys:A,W,E,D,R,T,G,Y,U,J,I,O,L to play various piano keys) or through mouse.
I will be posting the link to download the FXPiano netbeans project very soon.


FXPiano

The (kind of) game widget added below uses jQuery for animation and effects.It is not yet fully completed.


Game(under development)

While working on both the apps I found zemblys JavaScript/CSS/(X)HTML editor support really good. It provides code completion on CTRL+Space just like netbeans . The default javascript editor also provides applet based syntax highliting. Apart from the default editor they also have Mozilla labs Bespin editor which is also light weight and provides awesome syntax highliting.

Zembly simply rocks because of some basic features like "Clone and Edit","Preview Widget" which allows you to clone ,play and preview any widget developed by somebody else. It helped beginners like me a lot. Moreover it provides many inbuilt templates like NewsTicker, FeedScroller, GoogleMapMaker,3D-PhotoCarousel,YouTube Video Player etc. which are ready to use vanilla templates ,all you need to do is just customize according to your requirement. Zembly is huge, I am yet to try developing full fledged FaceBook and Meebo Apps which I will be looking forward to do now.