Sunday, December 28, 2008

Tuesday, November 25, 2008

Kicking ESB functions out from the box (read container)

Routing and mediation are the important features of ESB and it happens within the container. The ways to communicate and collaborate with outside world (read outside the container) is to have WS interface publishes by a system outside or through different adapters. What can be done for a data collection requirement using ESB? Let me toss a problem; a collection agent - managed by third party proprietary system - collects data, zips it, and stores in a network connected computer in a designated directory. Requirement is to collect the zip files from the designated directory, send to to a processor machine to process the files inside the zip files send the process reports to another central repository and update the database about their URI/URL locations and relationships with collected zips. How can we solve this? how can we fit (?) ESB here? 

Friday, August 8, 2008

JVM level clustering, Network Attached Memory - Terracotta

Off late I have found a good JVM clustering solution with certain degree of tolerable intrusiveness. It can wash away many existing datacentre application if implemented carefully. Period. Has CISCO heard it? Incidentally I am a CISCO employee though in this blog I express my personal opinions only and may or may not be aligned with CISCO vision. Read a tutorial on terracotta at http://frameworkfactory.org/Framework_Factory/Flog/Entries/2009/8/26_Open_source_JVM_Clustering_and_Network_Attached_Memory_using_Terracotta.html

Thursday, July 31, 2008

Servlet 3.0 - A comprehensive study and example

Servlet 3.0 is an overhaul to the ageing servlet technology. The features I liked in the servlet 3.0 are:
- Making web.xml optional, I really dislike handling 'BOILER PLATE' XML while coding. By using declarative style of programming(To java 5/6/7 people this is pretty old now) it is much easier and fun writing a servlet - bootstrappers will like it much. I will just show you one code snippet using servlet 3.0 that just works.

package org.objectengineering.exp.servlet3;
import javax.servlet.http.annotation.*;


@Servlet(urlMappings={"/foo"})
public class MyFirstServlet3 {
}

Thats it. Try it on a servlet 3.0 capable container like jetty 7.0. While writing this post the latest jetty was 7.0.0-pre1. Your servlet writing is over - can't believe ;) - go and deploy it now - you can skip the web.xml part. done.

Greg Wilkins proposal for asynchronous servlet is interesting and I am looking for its adoption by JSR expert commitee. The proposal can be found at http://dist.codehaus.org/jetty/misc/AsyncServlet3.0-draft0.html.

Saturday, July 12, 2008

Spring Integration: the new kid on the block (of ESB?!!)

I just started exploring Spring Intrgration just day after it was released - the version 1.0.0.M5. Here I will share my first impression with Spring Integration followed by subsequent trials and experimentations. Enforcement for speration of concerns without being intrusive is something at the core of Spring philosophy and it is further extended in Spring Integration. Not to be vary theoritical but to communicate some important points about Spring Integration - I am directly copying some excerpts from officila Spring Integration reference; those are goals and principles of Spring Integration.

Goals:
• Provide a simple model for implementing complex enterprise integration solutions.
• Facilitate asynchronous, message-driven behavior within a Spring-based application.
• Promote intuitive, incremental adoption for existing Spring users.

principles:
• Components should be loosely coupled for modularity and testability.
• The framework should enforce separation of concerns between business logic and integration logic.
• Extension points should be abstract in nature but within well-defined boundaries to promote reuse and portability.

Sunday, March 9, 2008

RUP Academy

=== lets make this happening ===

Friday, March 7, 2008

Review: Ten faces of innovation - Tom Kelley

I really liked the book, the way Tom described the different aspects and facets of innovation! The facets are - The Hurdler, The Caregiver, The Collaborator, The Cross-Polinator, The Experimenter, The Anthropologist, The Experience Architect, The Set Designer, The Storyteller, The Director. I agree with Tom that to be successful in innovation you have to touch upon most of the facets that he described. For this installment of writing I will talk about 'The Anthropologist'.

Saturday, February 16, 2008

Atom and XMPP based team collaboration and communication platform

2 weeks back I started working on a web development project as my weekend project to experiment on Atom & XMPP. Later I was confident to forward-factor the experimentation to a real-valued project that I was thinking for a long time - a seamless team collaboration and communication platform. All the communication and collaboration can be done from just a single page.

The business driver behind the idea:


  • Single page team collaboration suite


    • Project status, stories and discussions are on the live dashboard – real-time, editable, provokes participation

    • Developer friendly way of on-time reporting (consolidation is automatic) – just by setting the status message of your messenger/communicator

    • Chat on the page

    • Real time discussion on the dashboard – makes other people aware about others activities and provokes for participation. Imagine 2 guys discussing about Hibernate and is on the show on dashboard – can you take a seat back and just ignore it?

    • Assign, track and manage tasks – all online

    • Manage contacts – nothing new but can’t live without it

    • Call contacts


  • Reduces the need for email exchange – emails are difficult to track

  • Open cultured team collaboration with improved communication

  • You are always aware what is happening in your team - no matter who are you (although access rights can be implemented)


The salient features of this product are:
 Feed (Atom with optional RSS support) based project tracking, project story, project discussion, announcements etc.
 Presence (XMPP) based reporting – open reporting model
 Instant messaging
 Task definition, allocation and tracking
 Contacts management
 VoIP calls (SIP based)

Saturday, January 26, 2008

A weekend with GWT, JavaScript & client-side xml processing using XSLT

I wanted a simple, effective, technologically advanced and appealing online test (exam) system for the trainings that I occasionally provide. I had two intentions while developing this - one, to test participants' knowledge in the topics on that I provide training - second, this weekend project itself is a demonstration of 'Assembly Line Software Development' - a post lean method - that I devised to make software development more cleaner and faster.

I donated this prototype to TME, Capgemini France - where I work as a Telco Architect in the week days. It will undergo a massive makeup and dressing room session to have more commercial features in order to make it usable for TME certification exam.

I used GWT (Google Web Toolkit) - some standard and some advanced features - and some javascript. GWT is fun to use with one disappointing thing - it does not yet support java generics and other Java 5/+ features at the client side. That means it does not have a compiler to translate java 5 specific code to javascript. For the folks not yet exposed to GWT - GWT is a sophisticated Java to JavaScript compiler with some added server side utility-ish features.

Let's just see where GWT is useful: GWT allows Java developers to write browser based application that comprises components (GUI stuffs), contents (text, image, xml etc.), events and content manipulation. A Java developer writes this in Java, allowing him/her to develop browser based application in a true object oriented way (more accurately in java way). GWT compiler translates the 'client-side' java code into cross-browser JavaScript code. It also has some server side utility-ish features - naturally that doesn't need to be translated into JavaScript.

Some quick start references 1) GWT official getting started guide 2) A good article on oracle site

The GWT features used in the the project are given below. I will write about them from three aspects - one - why I have used it, two - a brief note about the feature with reference and three - a note on how I have used it to gain some special benefit/effect.

1) RemoteServiceServlet:
Why I have used it: to serve the question set. The question set is in XML. Initially I thought to put it in the public html (equivalent) directory and thought to process them at the client side. I dropped the idea in order to avoid users' sniffing into the the questions as the questions have answers inbuilt to it for instant and easy evaluation. So... I have used this feature to serve question set from server side.

Note on the feature: At the the server side there is a service implementation that extends the RemoteServiceServlet and implements the service interface. A good place to have a look into - how to use RemoteServiceServlet is Remote Procedure Call. The catch here is to write an asynchronous interface corresponding to the service interface. Look at the above link content to understand more.

How I have used it in online exam module: The service implementation - the extension of RemoteServiceServlet - used to construct questions from XML. A question is a serialized object constructed from the said XML fragment and finally the questions - the serialized objects - put into a list and sent across to the client.

A special note: At the server side code you can freely use Java 5/6 features depending on the compiler version you are using that is not possible at the client side code. GWT 1.4.61 - the latest GWT distro - doesn't support Java 5/+ style of coding at the client side. I love using Java 5/+ features very much; specially generics.

The below picture is taken from GWT official page.


You can very well enjoy using Java 5/6 features to write server side components shown at the right hand side of the picture. I am waiting to see Java 5 related features in GWT soon.

At the client side - you instantiate YourServiceAsync is special way to get the service instance.




YourServiceAsync yourService = (YourServiceAsync) GWT
.create( YourService.class );
ServiceDefTarget endpoint = (ServiceDefTarget) yourService;
String moduleRelativeURL = GWT.getModuleBaseURL()
+ "servletalias";
endpoint.setServiceEntryPoint( moduleRelativeURL );

Now your service instance 'yourService' is ready and the operations in it are ready to be called. 'servletalias' points the implementation of the Service extending RemoteServiceServlet and is specified in .gwt.xml. Refer Remote Procedure Call for more clarity.

Architectural consideration: Simply pushing most of the processing to the client side, saving the server from crushing large data and perform more operations. There are only two calls between client and server - one - to get the set of questions and another - sending the report back to the server - not for processing but to store for future reference. For a particular exam XML (containing questions) processing is required only once at the server side after that its only functionality would be just to send the set of questions in the form of a list to the client. Efficient and simplistic - is not it?

2) UI features:
This is the most used and most useful set of features in GWT.
Why I have used it: To save myself writing JavaScriot codes and making them compatible with different browser families. To be more precious - GWT has been chosen for that matter. Like many others, I am comfortable in writing Java codes, moreover it is easy to detect development time errors and correct them. Debugging is also easier compare to JavaScript debugging.
Note on the feature: The UI components are similar to Swing UI components. It is the essence of GWT but very easy to use. Refer the GWT getting started article on GWT official web page. I am not going to talk much on this as it is standard and available in detail on the official website.
How I have used it: In standard way. haha...

Special Note: I had tough time dealing with RadioButton. It made me to bang my head several times. What was the problem? The problem was a bit complicated; the behavior of radio button is just as it should be; the problem originated from my special expectation from RadioButton behavior. I used check box for the question that has multiple right answers to show the options and radio buttons for single right answer. Each selection event makes a particular flag 'true' and deselection event 'false'. In check box there are clear selection and de-selection events upon onClick() - so no problem with check box. In case of radio button - there is no event on de-selection as onClick() only can check a radio button but can not uncheck - and this behavior is required. I, then, tried to use onFocus() and onLostFocus(), it seemed to work well but did not; due to the fact when you navigate away from the group where the radio buttons are placed - it fires the onLostFocus() event that is not desirable. Finally I solved this problem with some other way. So be careful when you are frequently updating any global value based on the events captured from radio button. ;)

3) JavaScript Native Interface (JSNI): Very useful, wonderful feature.
Why I have selected this: I wanted to process XML with the XSLT at the browser end. GWT does not have XSLT processor API so I had to write a Java Method in JavaScript. Intersting... right!!! Both were new and exciting for me. Please have a look at the code I have written for your quick reference.


package com.objectengineering.onlinetest.client;
...
.....

public class OnlineTest {
...
.....
private String xmlString = "";
...

int generateReport() {
...
.....
xmlString = doc.toString();
xmlString(); // the native method is called the way a normal
//java method is called
.....
...
}
public native void xmlString() /*-{
var xmlDoc =
this.@com.objectengineering.onlinetest.client.OnlineTest::xmlString;
//the global class variable xmlString is called in this way
var win = $wnd.open("","","");
win.document.open("text/xml");

// code for IE
if (window.ActiveXObject)
{
var doc=new ActiveXObject("Microsoft.XMLDOM");
doc.async="false";
doc.loadXML(xmlDoc);
xslDoc=new ActiveXObject("Microsoft.XMLDOM");
xslDoc.async=false;
xslDoc.load("test.xsl");
var outDoc = doc.transformNode(xslDoc);
win.document.write(outDoc);
}
// code for Mozilla, Firefox, Opera, etc.
else
{
var parser=new DOMParser();
var doc=parser.parseFromString(xmlDoc,"text/xml");
var xsldoc = document.implementation.createDocument("", "", null);
xsldoc.async = false;
xsldoc.load("test.xsl");
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsldoc);
var xmlObject = xsltProcessor.transformToFragment(doc, document);
// var xmlObject = xsltProcessor.transformToDocument(doc);
var htmlDoc = new XMLSerializer().serializeToString(xmlObject);
win.document.documentElement.appendChild(xmlObject);
win.stop(); //required to solve a mozilla javascript bug
}
// return htmlDoc;
}-*/;
}

The native operation's code should be enclosed within the block comment.
That means if there is a method written in Java script - it should look
like
access_modifier native return_type  method_name( argunments ) /*-{
//your java script code goes here
}-*/;
If the method is
'aMthoed()' and if the return type is void and no argument then it should look like
public native void aMethod () /*-{
//your java script code goes here
}-*/