Geertjan is a DZone Zone Leader and has posted 468 posts at DZone. You can read more from them at their website. View Full User Profile

Interview: Farrukh Ijaz on the Vroom Web Framework

  • submit to reddit

Farrukh Ijaz is from Pakistan and lives in Qatar. He works for a diplomatic company as a Senior System Analyst. In his company they use NetBeans IDE for developing Java EE applications. Open Source development is Farrukh's hobby. Here he talks about his web framework, called "Vroom":

He's also created a NetBeans plugin, which you can download here:

Here's a screenshot showing part of the plugin in action:


Below follows the interview, with a full tutorial starting on the 2nd page:

Firstly, Farrukh, can you tell us a bit about Java EE and NetBeans in your part of the world?

Jave EE is not very famous in the Middle East because it's a myth over here that it is is for large enterprise applications only and that it's overkill for small organizations.

Regarding NetBeans, I was told by some of my ex-collegues that NetBeans is gaining popularity among Java EE developers in Saudi Arabia because it is free, easy to use and the best IDE to develop applications for Tomcat and GlassFish.

Now, you've created a new web framework called "Vroom". But there are so many web franeworks already. Why did you feel the need to create another one?

When I was little I read a book entitled "Miss Know It All", a simple riddle dazzles the lady who was Miss Know It All in the story. The riddle was something like this: Which room is always empty no matter what you put into it? And the answer was, "Room for Improvement". "Vroom for Improvement :-)"

In a nutshell, can you specify three reasons why I would use Vroom?

  • Vroom does not introduce any new custom tags or API. It's based on HTML and simple Java Beans so the learning curve is smooth.
  • Vroom provides central management of meta tags, javascripts, stylesheet and contents. That helps us to keep our web pages neat and compact. In addition to this, it provides a better way to bind HTML DOM events with server side Java methods.
  • It can be used independently, however. It does not claim to replace Struts or JSF. It integrates well with these frameworks and adds value. And even those who are used to Struts or JSF can easily benefit from the additional features provided by Vroom.

In what ways do other frameworks not provide these features?

  • No Ajax knowledge is required, every event binding is behind the scenes an implicit Ajax request/response implementation.
  • Extremely simple to use because it's based on simple HTML and Java Beans.
  • A single configuration file to manage meta tags, stylesheets, scripts.
  • Coarse / Fine grained event binding. E.g. a whole webpage can be bound with a single java bean or a every single HTML DOM Event can be bound to 1 or more java methods available in same or different java beans.
  • Support to invoke javascript of content update as a response of a method call.
  • Chornological rule inheritence e.g. If a webpage uri is defined in more than 1 webpage rules in vroom-config.xml, the rule that appears first will apply first, all preceding rules apply as per their occurance.

To work with the framework, and to popularize it, you created a NetBeans plugin. Can you say something about how it was to create it?

Before starting the plugin development, I thought about the basic features that I wanted my plugin to provide which were:

  • A comprehensive code completion for Vroom's framework configuration file (vroom-config.xml)
  • Vroom Framework to be available as a Web Framework in the IDE

Well the implementation was not so simple. I googled for code completion tips and found an article here. The article was good for building a basic understanding about how the code completion infrastructure works. But my objective was more complicated. The reason was that "vroom-config.xml" is an XML file and by default inherits code completion for XML tags. The problem occurred when I wanted to write JavaScript and HTML tags within CDATA sections.

I spent some time to figure out what can be the better approach and finally I decided to build my own mini editors for HTML and JavaScript. I wrote three different completion providers, VroomConfigCompletionProvider, VroomJSCompletionProvider and VroomHtmlCompletionProvider. I registered VroomConfigCompletionProvider with text/vroom-config+xml Mimetype, VroomJSCompletionProvider with text/javascript and VroomHtmlCompletionProvider with text/html in layer.xml.

The issue was I didn't want my code completion to get invoked in NetBean's JavaScript and HTML editors. To solve this problem I had to create two different mini editors so I could use my own editor panes (VroomJSEditorPane for javascript and VroomHtmlEditorPane for html). In VroomJSCompletionProvider, before creating the task, I placed a check that if the JTextComponent is an instance of VroomJSEditorPane then create and return the task else return null. I did something similar for VroomHtmlCompletionProvider.

The next important thing for me was to register the Vroom Framework under Web Frameworks. This was not so difficult thanks to the NetBeans API that I found how to use the Web and DDProvider API to register the framework under Web Frameworks and make entries in "web.xml" file respectively.

My good luck is I never got stuck for long because I never give up. For some features, I went to the online repository of NetBeans Source Code to locate specific implementations if it was not clear in the NetBeans API Javadoc.

It was really fun to explore the API and I enjoyed every single discovery I made to implement specific functionality. I have used almost all of the major APIs of NetBeans at this stage.

The resources I used to build the plugin include NetBeans API documentation, NetBeans source code and the NetBeans tutorial for code completion.

Last but not the least I used some common sense to use these resources effectively! :-)



figure-1.jpg4.27 KB
figure-2.png167.25 KB
Published at DZone with permission of its author, Geertjan Wielenga.