<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-701490274833023197</atom:id><lastBuildDate>Mon, 23 Jan 2012 05:43:48 +0000</lastBuildDate><category>Unix</category><category>EJB</category><category>JMS</category><category>BPM</category><category>Miscellaneous</category><category>Android</category><category>Java</category><category>Software Design</category><category>Spring Framework</category><category>Web Services</category><category>Web App</category><title>Blog on Technologies like BPM,Web Services, Android, J2EE</title><description /><link>http://yaseen-javaj2ee.blogspot.com/</link><managingEditor>noreply@blogger.com (Yaseen Khan)</managingEditor><generator>Blogger</generator><openSearch:totalResults>43</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/blogspot/HGid" /><feedburner:info uri="blogspot/hgid" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-3221820828206993508</guid><pubDate>Thu, 19 Feb 2009 14:44:00 +0000</pubDate><atom:updated>2009-02-19T13:40:00.655-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web Services</category><title>Web Services,SOAP 1.2 and WSDL 1.1- Lecture at Harvard University(Computer Science)</title><description>One of the best Podcasts I have come across, on Web Services concepts...&lt;br /&gt;&lt;br /&gt;&lt;div align="center"&gt; &lt;br /&gt;&lt;p&gt;&lt;span class="darkblueHeadline"&gt;Lecture 11: Web Services, SOAP 1.2, and WSDL 1.1 &lt;br&gt; &lt;br /&gt;&lt;span class="body"&gt;Harvard Extension School\'s Computer Science E-259: XML with J2EE&lt;/span&gt;&lt;br&gt;&lt;EMBED SRC="http://www.fas.harvard.edu/~cscie259/podcasts/2007/lectures/lecture11.mov" WIDTH="400" TARGET="myself" SCALE="1" CONTROLLER="TRUE"  autoplay="false"&gt;&lt;/embed&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;      &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Double-click on the "blank" screen to start the video, I set "autoplay" option to false, just to make sure users who are not interested in this podcast don't get confused while browsing other content on this blog.&lt;br /&gt;&lt;br /&gt;Note : If you fail to see this video, pls make sure you have "&lt;a href="http://www.apple.com/quicktime/download/"&gt;Quicktime&lt;/a&gt;" Player installed..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-3221820828206993508?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/Hvv-zos2R9c" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/Hvv-zos2R9c/web-servicessoap-12-and-wsdl-11-lecture.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/web-servicessoap-12-and-wsdl-11-lecture.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-2628752149493298596</guid><pubDate>Wed, 18 Feb 2009 08:21:00 +0000</pubDate><atom:updated>2009-02-18T16:25:14.884-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Unix</category><title>PERL Script for getting "Timestamps" -Files Creation Time</title><description>perl -e '@q=stat($ARGV[0]); print time-$q[9]' file1&lt;br /&gt;&lt;br /&gt;ls -ltr&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;#^ PROGRAM DESCRIPTION&lt;br /&gt;#^ -------------------&lt;br /&gt;#^ This program prints the modification times and names of files.&lt;br /&gt;#^ It uses the following format:  inodetime.pl filename&lt;br /&gt;#^ It will accept:  inodetime.pl filename1 filename2 filename3&lt;br /&gt;#^                  inodetime.pl /tmp/file*&lt;br /&gt;#^ The format of the output is: YYYYMMDDhhmmss filename&lt;br /&gt;#^ example:&lt;br /&gt;#^           $ inodetime.pl /tmp/t*&lt;br /&gt;#^           19961115105425 /tmp/test.sql&lt;br /&gt;#^           19970116113616 /tmp/tststat.pl&lt;br /&gt;#^&lt;br /&gt;#^###################################################################&lt;br /&gt;&lt;br /&gt;# Get the (next) input from the command line&lt;br /&gt;while ($curfile = $ARGV[0])&lt;br /&gt;{&lt;br /&gt;# Do following code block only if $curfile exists&lt;br /&gt;   if (-e $curfile)&lt;br /&gt;   {&lt;br /&gt;# stat structure into variables&lt;br /&gt;      ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,&lt;br /&gt;      $atime,$mtime,$ctime,$blksize,$blocks) = stat("$curfile");&lt;br /&gt;# time structure into variables&lt;br /&gt;      local($sec,$min,$hr,$day,$mon,$yr,$wday,@dntcare) = localtime($mtime);&lt;br /&gt;      $yr = ($yr&gt;=70) ? $yr+1900 : $yr+2000;&lt;br /&gt;      $yr="$yr";&lt;br /&gt;      $mon = (++$mon &lt; 10) ? "0$mon" : "$mon";&lt;br /&gt;      $day = ($day &lt; 10) ? "0$day" : "$day";&lt;br /&gt;      $hr  = ($hr &lt; 10) ? "0$hr" : "$hr";&lt;br /&gt;      $min = ($min &lt; 10) ? "0$min" : "$min";&lt;br /&gt;      $sec = ($sec &lt; 10) ? "0$sec" : "$sec";&lt;br /&gt;# Rearrange in the YYYYMMDDhhmmss format and assign to $dte variable&lt;br /&gt;      $dte = join('',$yr,$mon,$day,$hr,$min,$sec);&lt;br /&gt;      # Print modification date and filename&lt;br /&gt;      print ("$dte $curfile\n");&lt;br /&gt;   }&lt;br /&gt;# Shift to next position in command line&lt;br /&gt;   shift (@ARGV);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#! /usr/bin/ksh&lt;br /&gt;&lt;br /&gt;typeset -Z2 d m&lt;br /&gt;Jan=1 Feb=2 Mar=3 Apr=4 May=5 Jun=6 Jul=7 Aug=8 Sep=9 Oct=10 Nov=11 Dec=12&lt;br /&gt;date "+%Y %m" | read year month&lt;br /&gt;&lt;br /&gt;for i ; do&lt;br /&gt;        line=$(ls -dl $i)&lt;br /&gt;        line=${line##+([! ])+([ ])}&lt;br /&gt;        line=${line##+([! ])+([ ])}&lt;br /&gt;        line=${line##+([! ])+([ ])}&lt;br /&gt;        line=${line##+([! ])+([ ])}&lt;br /&gt;        line=${line##+([! ])+([ ])}&lt;br /&gt;        set -A stamp $line&lt;br /&gt;        d=${stamp[1]}&lt;br /&gt;        eval m=\$${stamp[0]}&lt;br /&gt;        y=${stamp[2]}&lt;br /&gt;        ((${#y} != 4)) &amp;&amp; ((y=year-(m&gt;month)))&lt;br /&gt;        echo $y $m $d $i&lt;br /&gt;done&lt;br /&gt;exit 0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-2628752149493298596?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/ok3G2IpmLlk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/ok3G2IpmLlk/perl-script-for-getting-timestamps.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/perl-script-for-getting-timestamps.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-3358746842693605599</guid><pubDate>Wed, 18 Feb 2009 08:16:00 +0000</pubDate><atom:updated>2009-02-18T03:19:04.143-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Adding Custom Events using JBoss JBPM - JPDL</title><description>&lt;span style="font-weight:bold;"&gt;Adding Custom Events&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Goal: Provide a mechanism to suspend a task for a period of time, and automatically resume the task after the time period is up.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Solution: Add custom Events for task suspend and task resume, override the suspend and resume methods in a custom task instance to fire the suspend and resume events.&lt;br /&gt;&lt;br /&gt;1) Optional - Add two new EVENTTYPEs for suspend and resume to the org.jbpm.graph.def.Event class. (not necessary however, just a convenience)&lt;br /&gt;&lt;br /&gt; public static final String EVENTTYPE_TASK_SUSPEND = "task-suspend";&lt;br /&gt;  public static final String EVENTTYPE_TASK_RESUME = "task-resume";&lt;br /&gt;&lt;br /&gt;2) Optional - Add these to the supported EventTypes in the org.jbpm.graph.def.Task class. (not necessary since jBPM determines event-types dynamically).&lt;br /&gt;&lt;br /&gt;static final String[] supportedEventTypes = new String[]{&lt;br /&gt;   Event.EVENTTYPE_TASK_CREATE,&lt;br /&gt;   Event.EVENTTYPE_TASK_ASSIGN,&lt;br /&gt;   Event.EVENTTYPE_TASK_START,&lt;br /&gt;   Event.EVENTTYPE_TASK_END,&lt;br /&gt;   Event.EVENTTYPE_TASK_SUSPEND,&lt;br /&gt;   Event.EVENTTYPE_TASK_RESUME&lt;br /&gt;&lt;br /&gt;2) Subclass .jbpm.graph.exe.TaskInstance&lt;br /&gt;&lt;br /&gt;Override Suspend and Resume&lt;br /&gt;&lt;br /&gt; public void suspend(String date) {&lt;br /&gt;  super.suspend();&lt;br /&gt;     if ( (task!=null)&lt;br /&gt;             &amp;amp;&amp;amp; (token!=null)&lt;br /&gt;           ) {&lt;br /&gt;          ExecutionContext executionContext = new ExecutionContext(token);&lt;br /&gt;           // the TASK_SUSPEND event is fired&lt;br /&gt;          executionContext.setTaskInstance(this);&lt;br /&gt;          executionContext.setTask(task);&lt;br /&gt;          executionContext.getTaskInstance().setVariable("suspendUntilDate", date);&lt;br /&gt;          task.fireEvent(Event.EVENTTYPE_TASK_SUSPEND, executionContext);&lt;br /&gt;        }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void resume() {&lt;br /&gt;  super.resume();&lt;br /&gt;     if ( (task!=null)&lt;br /&gt;             &amp;amp;&amp;amp; (token!=null)&lt;br /&gt;           ) {&lt;br /&gt;          ExecutionContext executionContext = new ExecutionContext(token);&lt;br /&gt;           // the TASK_RESUME event is fired&lt;br /&gt;          executionContext.setTaskInstance(this);&lt;br /&gt;          executionContext.setTask(task);&lt;br /&gt;          task.fireEvent(Event.EVENTTYPE_TASK_RESUME, executionContext);&lt;br /&gt;        }&lt;br /&gt; } &lt;br /&gt;&lt;br /&gt;3) Configure the timer on the task&lt;br /&gt;&lt;br /&gt;&amp;lt;process-definition&lt;br /&gt; xmlns="urn:jbpm.org:jpdl-3.1"&lt;br /&gt; name="simple"&amp;gt;&lt;br /&gt;  &amp;lt;action name="resume" class="com.sample.action.ResumeActionHander" /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;start-state name="start"&amp;gt;&lt;br /&gt;     &amp;lt;transition name="" to="Create Order"&amp;gt;&amp;lt;/transition&amp;gt;&lt;br /&gt;  &amp;lt;/start-state&amp;gt;&lt;br /&gt;  &amp;lt;end-state name="end"&amp;gt;&amp;lt;/end-state&amp;gt;&lt;br /&gt;    &amp;lt;task-node name="Approve Order" create-tasks="true"&amp;gt;&lt;br /&gt;       &amp;lt;task name="approve" description="Review order"&amp;gt;&lt;br /&gt;          &amp;lt;assignment class="com.sample.assignment.SomeAssignmentHandler"&lt;br /&gt;  &amp;lt;/assignment&amp;gt;    &lt;br /&gt;         &amp;lt;event type='task-suspend'&amp;gt;&lt;br /&gt;   &amp;lt;action name="Suspend Timer" class="com.sample.action.CreateTimerActionHandler"&amp;gt;&lt;br /&gt;             &amp;lt;action&amp;gt;resume&amp;lt;/action&amp;gt;&lt;br /&gt;           &amp;lt;/action&amp;gt;&lt;br /&gt;   &amp;lt;/event&amp;gt;&lt;br /&gt;   &amp;lt;event type="task-resume"&amp;gt;&lt;br /&gt;   &amp;lt;action name="SendMessage" class="com.sample.action.MessageActionHandler"&amp;gt;&lt;br /&gt;   &amp;lt;message&amp;gt;resumed the task instance&amp;lt;/message&amp;gt;&lt;br /&gt;    &amp;lt;/action&amp;gt; &lt;br /&gt;    &amp;lt;/event&amp;gt;&lt;br /&gt;        &amp;lt;controller class="com.sample.taskinstance.CustomTaskControllerHandler"&amp;gt;&amp;lt;/controller&amp;gt;&lt;br /&gt;      &amp;lt;/task&amp;gt;&lt;br /&gt;      &amp;lt;transition name="" to="end"&amp;gt;&amp;lt;/transition&amp;gt;&lt;br /&gt;    &amp;lt;/task-node&amp;gt;&lt;br /&gt;  ...&lt;br /&gt;&amp;lt;/process-definition&amp;gt;&lt;br /&gt;&lt;br /&gt;4) Implement CreateTimerActionHandler&lt;br /&gt;&lt;br /&gt;public class CreateTimerActionHandler implements ActionHandler {&lt;br /&gt;&lt;br /&gt; private String action;&lt;br /&gt;&lt;br /&gt; private static final long serialVersionUID = 1L;&lt;br /&gt;&lt;br /&gt; /** {@inheritDoc} */&lt;br /&gt; public void execute(ExecutionContext executionContext) throws Exception {&lt;br /&gt;  Timer timer = new Timer(executionContext.getToken());&lt;br /&gt;  timer.setName(executionContext.getAction().getName());&lt;br /&gt;&lt;br /&gt;  TaskInstance taskInstance = executionContext.getTaskInstance();&lt;br /&gt;  String dueDate = (String)taskInstance.getVariable("suspendUntilDate");&lt;br /&gt;&lt;br /&gt;  // parse the due date&lt;br /&gt;  DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT,&lt;br /&gt;    DateFormat.SHORT);&lt;br /&gt;  Date date = format.parse(dueDate);&lt;br /&gt;  timer.setDueDate(date);&lt;br /&gt;&lt;br /&gt;  // retrieve a named action from the process definition&lt;br /&gt;  Action action = executionContext.getProcessDefinition().getAction(&lt;br /&gt;    this.action);&lt;br /&gt;  timer.setAction(action);&lt;br /&gt;  // set the TaskInstance so the resume action knows what taskInstance to resume&lt;br /&gt;  timer.setTaskInstance(taskInstance);&lt;br /&gt;&lt;br /&gt;  SchedulerService schedulerService = (SchedulerService) Services&lt;br /&gt;    .getCurrentService(Services.SERVICENAME_SCHEDULER);&lt;br /&gt;  schedulerService.createTimer(timer);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;5) Implement ResumeActionHandler&lt;br /&gt;&lt;br /&gt;public class Resume implements ActionHandler {&lt;br /&gt;public class ResumeActionHandler implements ActionHandler {&lt;br /&gt;&lt;br /&gt; private static final long serialVersionUID = 1L;&lt;br /&gt;&lt;br /&gt; public void execute(ExecutionContext executionContext) throws Exception {&lt;br /&gt;   System.out.println("resuming taskInstance");&lt;br /&gt;&lt;br /&gt;   TaskInstance taskInstance = executionContext.getTaskInstance();&lt;br /&gt;   System.out.println("TaskInstance is " + taskInstance);&lt;br /&gt;  &lt;br /&gt;   CustomTaskInstance cti = (CustomTaskInstance) executionContext.getJbpmContext().getSession().load(CustomTaskInstance.class, new Long(taskInstance.getId()));&lt;br /&gt;   cti.resume();&lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-3358746842693605599?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/uUWX9r2m7Ks" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/uUWX9r2m7Ks/adding-custom-events-using-jboss-jbpm.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/adding-custom-events-using-jboss-jbpm.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-1757611531283498329</guid><pubDate>Wed, 18 Feb 2009 08:09:00 +0000</pubDate><atom:updated>2009-02-18T03:13:56.840-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Creating "Timer" tasks in JBoss JBPM using JPDL</title><description>NOTE: This example has not been updated to work with jBPM versions 3.2 or greater.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Use-Case&lt;/span&gt; &lt;br /&gt;Suppose you receive an order on 2006/10/05 and some related task is created on 10/7; the task needs to be done within 5 days of recieving the order. How do we do that?&lt;br /&gt;jBPM's definition language, JPDL, does not provide a packaged mechanism for dynamically setting Due Dates on Timers and Tasks based on arbitrary data. However, it is not too difficult to work up a solution that brings us the flexibility we need. Here is an example that takes advantage of an ActionHandler? to set these due dates dynamically based on a process instance variable:&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;process-definition name="Due date Test"&amp;gt;&lt;br /&gt; &amp;lt;start-state name='START' &amp;gt;&lt;br /&gt;   &amp;lt;transition name='done' to='NODE1'/&amp;gt;&lt;br /&gt; &amp;lt;/start-state&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;task-node name='NODE1'&amp;gt;&lt;br /&gt;   &amp;lt;task name='task1'/&amp;gt;&lt;br /&gt;   &amp;lt;event type='node-enter' &amp;gt;&lt;br /&gt;       &amp;lt;create-timer name='myTimeout' duedate='2000 days' &amp;gt;&lt;br /&gt;           &amp;lt;script&amp;gt;System.out.println("I reset my timer!");&amp;lt;/script&amp;gt;&lt;br /&gt;       &amp;lt;/create-timer&amp;gt;&lt;br /&gt;       &amp;lt;!-- Dynamically set due date of the timer created in the line above.&lt;br /&gt;            (This ActionHandler can also be used to dynamically set a Task's due date&lt;br /&gt;            by substituting the &amp;lt;timerName&amp;gt; tag with a &amp;lt;taskName&amp;gt; tag) --&amp;gt;&lt;br /&gt;       &amp;lt;action name='setThisTimer' class='com.???.UpdateDueDateAH'&amp;gt;&lt;br /&gt;           &amp;lt;timerName&amp;gt;myTimeout&amp;lt;/timerName&amp;gt;&lt;br /&gt;           &amp;lt;!-- Process instance variable containing a java.util.Date. This value will&lt;br /&gt;                be used as a base value for calculating the Timer's new due date. If not&lt;br /&gt;                provided, the current time will be used. --&amp;gt;&lt;br /&gt;           &amp;lt;baseTimeVar&amp;gt;testDate&amp;lt;/baseTimeVar&amp;gt;&lt;br /&gt;           &amp;lt;!-- The 'baseTimeVar' Date can be modified by optionally adding a period of&lt;br /&gt;                time. The value is a valid jBPM Duration styled string --&amp;gt;&lt;br /&gt;           &amp;lt;addDuration&amp;gt;2 minutes&amp;lt;/addDuration&amp;gt;&lt;br /&gt;       &amp;lt;/action&amp;gt;&lt;br /&gt;   &amp;lt;/event&amp;gt;&lt;br /&gt;   &amp;lt;event type='node-leave' &amp;gt;&lt;br /&gt;       &amp;lt;!-- To mimic the 'node context' of the short hand timer syntax &amp;lt;timer&amp;gt;, we&lt;br /&gt;            would need to ensure that our timer is cancelled on node exit. --&amp;gt;&lt;br /&gt;       &amp;lt;cancel-timer name='timeout' /&amp;gt;&lt;br /&gt;   &amp;lt;/event&amp;gt;&lt;br /&gt;   &amp;lt;event type='task-create'&amp;gt;&lt;br /&gt;       &amp;lt;!-- Use UpdateDueDateAH here to dynamically set a task's due date --&amp;gt;&lt;br /&gt;       &amp;lt;action name='setDueDate' class='com.???.UpdateDueDateAH'&amp;gt;&lt;br /&gt;           &amp;lt;taskName&amp;gt;task1&amp;lt;/taskName&amp;gt;&lt;br /&gt;           &amp;lt;baseTimeVar&amp;gt;testDate&amp;lt;/baseTimeVar&amp;gt;&lt;br /&gt;           &amp;lt;addDuration&amp;gt;5 minutes&amp;lt;/addDuration&amp;gt;&lt;br /&gt;       &amp;lt;/action&amp;gt;&lt;br /&gt;   &amp;lt;/event&amp;gt;&lt;br /&gt;  &amp;lt;transition name='done' to='NODE2'/&amp;gt;&lt;br /&gt; &amp;lt;transition name='_sys_redoNode' to='NODE1'/&amp;gt;&lt;br /&gt; &amp;lt;/task-node&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;state name='NODE2'&amp;gt;&lt;br /&gt;   &amp;lt;!-- Timers with this syntax are created on node-enter and cancelled on node-leave.&lt;br /&gt;        If timer creation is needed from within an event element or the timer should continue&lt;br /&gt;        after the node has exited, then use &amp;lt;create-timer&amp;gt; instead --&amp;gt;&lt;br /&gt;   &amp;lt;timer name='thisNodeOnlyTimeout' duedate='5 minutes' transition='done' /&amp;gt;&lt;br /&gt;   &amp;lt;transition name='done' to='END'/&amp;gt;&lt;br /&gt; &amp;lt;/state&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;end-state name="END" /&amp;gt;&lt;br /&gt;&amp;lt;/process-definition&amp;gt;&lt;br /&gt;...and here is the UpdateDueDateAH? class:&lt;br /&gt;/*&lt;br /&gt;* UpdateDueDateAH.java&lt;br /&gt;*&lt;br /&gt;* &lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;package com.???;&lt;br /&gt;&lt;br /&gt;import org.apache.commons.logging.Log;&lt;br /&gt;import org.apache.commons.logging.LogFactory;&lt;br /&gt;import org.jbpm.graph.def.ActionHandler;&lt;br /&gt;import org.jbpm.graph.exe.ExecutionContext;&lt;br /&gt;import org.jbpm.graph.exe.Token;&lt;br /&gt;import org.jbpm.taskmgmt.exe.*;&lt;br /&gt;&lt;br /&gt;import org.jbpm.calendar.BusinessCalendar;&lt;br /&gt;import org.jbpm.calendar.Duration;&lt;br /&gt;&lt;br /&gt;import org.jbpm.svc.Services;&lt;br /&gt;import org.jbpm.scheduler.SchedulerService;&lt;br /&gt;import org.jbpm.db.SchedulerSession;&lt;br /&gt;import org.jbpm.scheduler.exe.Timer;&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.util.Calendar;&lt;br /&gt;import java.util.Date;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;public class UpdateDueDateAH implements ActionHandler{&lt;br /&gt;  &lt;br /&gt;   //-- variables set by process def action parameter elements --&lt;br /&gt;   private String baseTimeVar = null;&lt;br /&gt;   private String addDuration = null; //a jbpm Duration styled string&lt;br /&gt;   private String timerName = null;  //either this OR taskName should be set&lt;br /&gt;   private String taskName = null;   //either this OR timerName should be set&lt;br /&gt;  &lt;br /&gt;   private ExecutionContext ec = null;&lt;br /&gt;   public Log log = LogFactory.getLog(this.getClass());&lt;br /&gt;&lt;br /&gt;   public UpdateDueDateAH() {&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   /*Execute the action handler*/&lt;br /&gt;   public void execute(ExecutionContext executionContext){&lt;br /&gt;       ec = executionContext;&lt;br /&gt;       try{&lt;br /&gt;           Token token = ec.getToken();&lt;br /&gt;          &lt;br /&gt;           Date newDueDate = null;&lt;br /&gt;           if(timerName != null) {&lt;br /&gt;               SchedulerSession schedulerSession = ec.getJbpmContext().getSchedulerSession();&lt;br /&gt;               //apparently throws an exception if no timer is found...&lt;br /&gt;               List timers = schedulerSession.findTimersByName(timerName, token);&lt;br /&gt;               for(Object o : timers) {&lt;br /&gt;                   Timer timer = (Timer)o;&lt;br /&gt;                   try{&lt;br /&gt;                       newDueDate = this.calculateDueDate();&lt;br /&gt;                       timer.setDueDate(newDueDate);&lt;br /&gt;                   }catch(Exception e) {&lt;br /&gt;                       throw new Exception("Timer '" + timer.getName() + "' due date was not updated to " +&lt;br /&gt;                               newDueDate + "': " + e);&lt;br /&gt;                   }&lt;br /&gt;                   schedulerSession.saveTimer(timer);&lt;br /&gt;                   log.info("Timer '" + timer.getName() + "' due date updated to " + timer.getDueDate());&lt;br /&gt;               }&lt;br /&gt;           }else if(taskName != null) {&lt;br /&gt;               TaskMgmtInstance tmi = ec.getTaskMgmtInstance();&lt;br /&gt;               for(Object o : tmi.getTaskInstances()) {&lt;br /&gt;                   TaskInstance task = (TaskInstance)o;&lt;br /&gt;                   //if wildcard is specified, update all tasks...&lt;br /&gt;                   if(taskName.equals("*")) {&lt;br /&gt;                       try{&lt;br /&gt;                           newDueDate = this.calculateDueDate();&lt;br /&gt;                           task.setDueDate(newDueDate);&lt;br /&gt;                       }catch(Exception e) {&lt;br /&gt;                           throw new Exception("Task '" + task.getName() + "' due date was not updated to " +&lt;br /&gt;                                   newDueDate + "': " + e);&lt;br /&gt;                       }&lt;br /&gt;                       log.info("Task '" + task.getName() + "' due date updated to " + task.getDueDate());&lt;br /&gt;                   }else{&lt;br /&gt;                       if(taskName.equals(task.getName())) {&lt;br /&gt;                           try{&lt;br /&gt;                               newDueDate = this.calculateDueDate();&lt;br /&gt;                               task.setDueDate(newDueDate);&lt;br /&gt;                           }catch(Exception e) {&lt;br /&gt;                               throw new Exception("Task '" + task.getName() + "' due date was not updated to '" +&lt;br /&gt;                                       newDueDate + "': " + e);&lt;br /&gt;                           }&lt;br /&gt;                           log.info("Task '" + task.getName() + "' due date updated to "+task.getDueDate());&lt;br /&gt;                       }&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;          &lt;br /&gt;       }catch(java.lang.Exception e){&lt;br /&gt;           log.error(e.getMessage(), e);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   private Date calculateDueDate() throws Exception {&lt;br /&gt;       Date dueDate = null;&lt;br /&gt;      &lt;br /&gt;       Calendar cal = Calendar.getInstance();&lt;br /&gt;       //if a baseTime is specified, we'll use that; otherwise, we'll just use the current time&lt;br /&gt;       if(baseTimeVar != null &amp;amp;&amp;amp; baseTimeVar.length() &amp;gt; 0) {&lt;br /&gt;           Object baseTime = ec.getContextInstance().getVariable(baseTimeVar);&lt;br /&gt;           if(baseTime != null) {&lt;br /&gt;               if(baseTime instanceof String) {&lt;br /&gt;                   throw new Exception("Could not calculate Due Date: the variable '" + baseTimeVar + "' should be a type of java.util.Date.");&lt;br /&gt;               }else if(baseTime instanceof Date) {&lt;br /&gt;                   cal.setTime((Date)baseTime);&lt;br /&gt;               }else{&lt;br /&gt;                   throw new Exception("Could not calculate Due Date: baseTimeVar '" + baseTimeVar +&lt;br /&gt;                                       "' was specified but no valid date/time data was found.");&lt;br /&gt;               }&lt;br /&gt;           }else{&lt;br /&gt;               throw new Exception("Could not calculate Due Date: baseTimeVar was specified but no data was found.");&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       if(addDuration != null) {&lt;br /&gt;           BusinessCalendar businessCalendar = new BusinessCalendar();&lt;br /&gt;           Duration duration = new Duration(addDuration);&lt;br /&gt;           dueDate = businessCalendar.add( cal.getTime(), duration );&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       return dueDate;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public void setTimerName(String timerName) {&lt;br /&gt;       if(timerName != null &amp;amp;&amp;amp; timerName.trim().length() &amp;gt; 0) this.timerName = timerName;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public void setTaskName(String taskName) {&lt;br /&gt;       if(taskName != null &amp;amp;&amp;amp; taskName.trim().length() &amp;gt; 0) this.taskName = taskName;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public void setBaseTimeVar(String baseTimeVar) {&lt;br /&gt;       this.baseTimeVar = baseTimeVar;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   /*&lt;br /&gt;    * Takes a jbpm Duration styled string&lt;br /&gt;    */&lt;br /&gt;   public void setAddDuration(String addDuration) {&lt;br /&gt;       this.addDuration = addDuration;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Softwares used : JBoss JBPM JPDL 3.2.2, XML&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-1757611531283498329?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/2SDpTuWWlX8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/2SDpTuWWlX8/creating-timer-tasks-in-jboss-jbpm.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/creating-timer-tasks-in-jboss-jbpm.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-294339519105093042</guid><pubDate>Wed, 18 Feb 2009 07:43:00 +0000</pubDate><atom:updated>2009-02-18T03:04:22.585-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Deploying JBoss JBPM Web Console(3.2.2) on Weblogic 9.2</title><description>&lt;span style="font-weight:bold;"&gt;Steps to deploy the jbpm-console on Weblogic 9.1 and Oracle 9i&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note: I didnt try this effort using latest JBoss JBPM Version,if you run into issues with new version,let me know..&lt;br /&gt;&lt;br /&gt;1.  Download the jbpm- jPDL Suite (jbpm-jpdl-3.2.1.zip) or the latest stable version   jbpm-jpdl-3.2.2 from &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=70542&amp;amp;package_id=145174"&gt;http://sourceforge.net/project/showfiles.php?group_id=70542&amp;amp;package_id=145174&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2.  Extract to C:\&lt;br /&gt;&lt;br /&gt;3.  Go to deploy folder at C:\jbpm-jpdl-3.2.2\deploy&lt;br /&gt;&lt;br /&gt;4.  Create a new Folder jbpm-console&lt;br /&gt;&lt;br /&gt;5. Create a directory structure as,&lt;br /&gt;C:\jbpm-jpdl-3.2.2\deploy\jbpm-console&lt;br /&gt;                                              \build&lt;br /&gt;           \dist&lt;br /&gt;           \src&lt;br /&gt;           \WebContent&lt;br /&gt;           \build.xml&lt;br /&gt;&lt;br /&gt;6. The contents of build.xml are :&lt;br /&gt;&lt;br /&gt;&amp;lt;project basedir="." default="create.war"&amp;gt;&lt;br /&gt;&amp;lt;property name="dist" value="dist" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;target name="create.war"&amp;gt;&lt;br /&gt;&amp;lt;war destfile="dist/jbpm-console.war" webxml="WebContent/WEB-INF/web.xml" basedir="WebContent"&amp;gt;&lt;br /&gt;&amp;lt;/war&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;br /&gt;7. The contents of WebContent folder are, the directory structure is,&lt;br /&gt;  WebContent&lt;br /&gt;                      \images&lt;br /&gt;                      \META-INF&lt;br /&gt;                      \sa&lt;br /&gt;                      \ua&lt;br /&gt;                      \WEB-INF&lt;br /&gt;                      \index.jsp&lt;br /&gt;Just copy the webapp contents from c:\jbpm-jpdl-3.2.2\deploy\webapp  into WebContent folder&lt;br /&gt;&lt;br /&gt;8.The contents of index.jsp file are :&lt;br /&gt;&lt;br /&gt;&amp;lt;%&lt;br /&gt;final String queryString = request.getQueryString();&lt;br /&gt;final String contextRoot = request.getContextPath();&lt;br /&gt;final String target = contextRoot + "/sa/processes.jsf";&lt;br /&gt;if (queryString != null &amp;amp;&amp;amp; queryString.length() &amp;gt; 0) {&lt;br /&gt; response.sendRedirect(target + "?" + queryString);&lt;br /&gt;} else {&lt;br /&gt; response.sendRedirect(target);&lt;br /&gt;}&lt;br /&gt;%&amp;gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;9. Go to WebContent folder and remove jboss-web.xml&lt;br /&gt;                               &lt;br /&gt;10.Go to WebContent\WEB-INF\classes folder and edit hibernate.cfg.xml file&lt;br /&gt;&lt;br /&gt;Add these lines ,&lt;br /&gt;&lt;br /&gt;&amp;lt;property  name="hibernate.dialect"&amp;gt;org.hibernate.dialect.Oracle9Dialect&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- JDBC connection properties (begin) --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;property name="hibernate.connection.driver_class"&amp;gt;oracle.jdbc.driver.OracleDriver&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.connection.url"&amp;gt;jdbc:oracle:thin:@HOSTNAME:1521:SID&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.connection.username"&amp;gt;USER&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.connection.password"&amp;gt;PASS&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- JDBC connection properties (end) --&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;property name="hibernate.cache.provider_class"&amp;gt;org.hibernate.cache.HashtableCacheProvider&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;br /&gt;     &amp;lt;property name="hibernate.transaction.factory_class"&amp;gt;org.hibernate.transaction.JDBCTransactionFactory&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;br /&gt;Comment these lines in hibernate.cfg.xml&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- DataSource properties (begin) === --&amp;gt;&lt;br /&gt;&amp;lt;!--  &amp;lt;property name="hibernate.connection.datasource"&amp;gt;java:/JbpmDS&amp;lt;/property&amp;gt;&lt;br /&gt; ==== DataSource properties (end) --&amp;gt;   &lt;br /&gt;&lt;br /&gt;Assumption:jbpm tables already created on the Oracle 9i application schema.&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- identity mappings (begin) --&amp;gt;&lt;br /&gt;&amp;lt;!--  &amp;lt;mapping resource="org/jbpm/identity/User.hbm.xml"/&amp;gt;&lt;br /&gt; &amp;lt;mapping resource="org/jbpm/identity/Group.hbm.xml"/&amp;gt;&lt;br /&gt; &amp;lt;mapping resource="org/jbpm/identity/Membership.hbm.xml"/&amp;gt;&lt;br /&gt;  identity mappings (end) --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- logging properties (begin) ===&lt;br /&gt; &amp;lt;property name="hibernate.show_sql"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.format_sql"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.use_sql_comments"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt; ==== logging properties (end) --&amp;gt;&lt;br /&gt;&lt;br /&gt;11.  Copy the following jars from C:\jbpm-jpdl-3.2.1\server\server\jbpm\lib&lt;br /&gt;to C:\jbpm-jpdl-3.2.1\deploy\jbpm-console\WebContent   \WEB-INF\lib&lt;br /&gt;commons-beanutils.jar&lt;br /&gt;dom4j.jar&lt;br /&gt;antlr-2.7.6.jar&lt;br /&gt;ojdbc14.jar&lt;br /&gt;hibernate3.jar&lt;br /&gt;jboss-backport-concurrent.jar&lt;br /&gt;commons-digester.jar&lt;br /&gt;cglib.jar&lt;br /&gt;jbpm-jpdl.jar&lt;br /&gt;bsh.jar&lt;br /&gt;jbossretro-rt.jar&lt;br /&gt;commons-logging.jar&lt;br /&gt;asm.jar&lt;br /&gt;stax-api-1.0.jar&lt;br /&gt;wstx-lgpl-2.0.6.jar&lt;br /&gt;commons-collections.jarjboss-retro-1.1.0-rt.jar&lt;br /&gt;cglib.jar&lt;br /&gt;jbpm-jpdl.jar&lt;br /&gt;bsh.jar&lt;br /&gt;jbossretro-rt.jar&lt;br /&gt;commons-logging.jar&lt;br /&gt;asm.jar&lt;br /&gt;stax-api-1.0.jar&lt;br /&gt;wstx-lgpl-2.0.6.jar&lt;br /&gt;commons-collections.jar&lt;br /&gt;&lt;br /&gt;12. Edit the access.properties  file in  C:\jbpm-jpdl-3.2.2\deploy\jbpm-console\WebContent\WEB-INF and add the user roles the application needs, like&lt;br /&gt;&lt;br /&gt;role.identities.user=manager,admin,user&lt;br /&gt;role.identities.user.add=manager,admin,user&lt;br /&gt;role.identities.user.delete=manager,admin,user&lt;br /&gt;role.identities.user.modify=manager,admin,user&lt;br /&gt;&lt;br /&gt;role.identities.group=manager,admin,user&lt;br /&gt;role.identities.group.add=manager,admin,user&lt;br /&gt;role.identities.group.delete=manager,admin,user&lt;br /&gt;role.identities.group.modify=manager,admin,user&lt;br /&gt;&lt;br /&gt;# Process definition operations&lt;br /&gt;role.process.deploy=manager,admin,user&lt;br /&gt;role.process.delete=manager,admin,user&lt;br /&gt;role.process.start=manager,admin,user&lt;br /&gt;&lt;br /&gt;# Process instance and token operations&lt;br /&gt;role.execution.suspend=manager,admin,user&lt;br /&gt;role.execution.edit=manager,admin,user&lt;br /&gt;role.execution.delete=manager,admin,user&lt;br /&gt;role.execution.end=manager,admin,user&lt;br /&gt;&lt;br /&gt;# Task management operations&lt;br /&gt;role.tasks=manager,admin,user&lt;br /&gt;role.task.assign=manager,admin,user&lt;br /&gt;role.task.assign.any=manager,admin,user&lt;br /&gt;role.task.modify=manager,admin,user&lt;br /&gt;&lt;br /&gt;# Job management operations&lt;br /&gt;role.jobs=manager,admin,user&lt;br /&gt;role.jobs.delete=manager,admin,user&lt;br /&gt;&lt;br /&gt;13. Add weblogic.xml in   C:\jbpm-jpdl-3.2.2\deploy\jbpm-console\WebContent\WEB-INF&lt;br /&gt;The contents are :&lt;br /&gt;&lt;br /&gt;&amp;lt;weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"&lt;br /&gt;               xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"&lt;br /&gt;               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;               xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd&lt;br /&gt;                                   http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&amp;gt;&lt;br /&gt;&amp;lt;jsp-descriptor&amp;gt;&lt;br /&gt;     &amp;lt;debug&amp;gt;true&amp;lt;/debug&amp;gt;&lt;br /&gt; &amp;lt;/jsp-descriptor&amp;gt;&lt;br /&gt;&amp;lt;context-root&amp;gt;jbpm-console&amp;lt;/context-root&amp;gt;&lt;br /&gt;&amp;lt;/weblogic-web-app&amp;gt;&lt;br /&gt;&lt;br /&gt;14. Edit the web.xml file  C:\jbpm-jpdl-3.2.1\deploy\jbpm-console\WebContent\WEB-INF&lt;br /&gt; And comment these lines&lt;br /&gt;&lt;br /&gt;&amp;lt;!--   &amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;         &amp;lt;web-resource-name&amp;gt;Secure Area&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;         &amp;lt;url-pattern&amp;gt;/sa/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;         &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;         &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;         &amp;lt;role-name&amp;gt;user&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt; &amp;lt;/security-constraint&amp;gt;--&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Login configuration option #1 - use the login page ==&amp;gt;&lt;br /&gt; &amp;lt;login-config&amp;gt;&lt;br /&gt;     &amp;lt;auth-method&amp;gt;FORM&amp;lt;/auth-method&amp;gt;&lt;br /&gt;     &amp;lt;form-login-config&amp;gt;&lt;br /&gt;         &amp;lt;form-login-page&amp;gt;/ua/login.jsf&amp;lt;/form-login-page&amp;gt;&lt;br /&gt;         &amp;lt;form-error-page&amp;gt;/ua/login.jsf?error=true&amp;lt;/form-error-page&amp;gt;&lt;br /&gt;     &amp;lt;/form-login-config&amp;gt;&lt;br /&gt; &amp;lt;/login-config&amp;gt;&lt;br /&gt; &amp;lt;!== End Login configuration option #1 --&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- Login configuration option #2 - use basic auth ==&amp;gt;&lt;br /&gt; &amp;lt;login-config&amp;gt;&lt;br /&gt;     &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;     &amp;lt;realm-name&amp;gt;jBPM Administration Console&amp;lt;/realm-name&amp;gt;&lt;br /&gt; &amp;lt;/login-config&amp;gt;&lt;br /&gt; &amp;lt;!== End Login configuration option #2 --&amp;gt;&lt;br /&gt;&lt;br /&gt;And ,&lt;br /&gt;&amp;lt;!-- This section is so that the web console can deploy in the jbpm-enterprise.ear module --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--   &amp;lt;ejb-local-ref&amp;gt;&lt;br /&gt;     &amp;lt;ejb-ref-name&amp;gt;ejb/LocalTimerServiceBean&amp;lt;/ejb-ref-name&amp;gt;&lt;br /&gt;     &amp;lt;ejb-ref-type&amp;gt;Session&amp;lt;/ejb-ref-type&amp;gt;&lt;br /&gt;     &amp;lt;local-home&amp;gt;org.jbpm.scheduler.ejbtimer.LocalTimerServiceHome&amp;lt;/local-home&amp;gt;&lt;br /&gt;     &amp;lt;local&amp;gt;org.jbpm.scheduler.ejbtimer.LocalTimerService&amp;lt;/local&amp;gt;&lt;br /&gt;     &amp;lt;ejb-link&amp;gt;TimerServiceBean&amp;lt;/ejb-link&amp;gt;&lt;br /&gt; &amp;lt;/ejb-local-ref&amp;gt; --&amp;gt;&lt;br /&gt;&lt;br /&gt;15. After making all these changes, run  “ant  build.xml” from  C:\jbpm-jpdl-3.2.2\deploy\jbpm-console  at command prompt   and then “ ant create.war” to create the jbpm-console.war file in “C:\jbpm-jpdl-3.2.2\deploy\jbpm-console\dist”&lt;br /&gt;&lt;br /&gt;16.  Copy this war file in C:\bea91\user_projects\domains\PRJ_DOMAIN\autodeploy and start your application server to deploy jbpm console on weblogic&lt;br /&gt;&lt;br /&gt;17. Go to http://localhost:7001/jbpm-console&lt;br /&gt;&lt;br /&gt;18. Softwares Needed :&lt;br /&gt;Ant 1.6.5/Ant1.7 , weblogic 9.0/9.1/9.2 , jbpm-jpdl-3.2.2 suite&lt;br /&gt;&lt;br /&gt;19.While deploying this war file on weblogic if you get any exceptions listed below, follow the solutions given below&lt;br /&gt;&lt;br /&gt;a)  javax.enterprise.deploy.spi.exceptions.InvalidModuleException: [J2EE Deployment SPI:260105]Failed to create DDBeanRoot for application, 'C:\jbpm-jpdl-3.2.1\deploy\jbpmgui.war'&lt;br /&gt;use  2.3 dtd instead of 2.4 xsd&lt;br /&gt;&lt;br /&gt;&amp;lt;weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;               xsi:schemaLocation="http://www.bea.com/ns/weblogic/90  http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd&lt;br /&gt;  http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&amp;gt;&lt;br /&gt;&lt;br /&gt;b)  error 503 service unavailable&lt;br /&gt;Set the following Environment variables:&lt;br /&gt;i) JAVA_HOME = c:\bea\jdk142_08\bin;C:\bea\jrockit81sp5_142_08\bin;&lt;br /&gt;ii) ANT_HOME = c:\ant\bin&lt;br /&gt;iii)       CLASSPATH = c:\bea\weblogic91\server\lib;C:\bea\weblogic91\server\lib\Weblogic.jar;&lt;br /&gt;(You might need to set some of these CLASSPATHS after building the WAR files)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Any questions, please leave comments and suggestions are more than welcome...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-294339519105093042?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/jNmV43EOMxA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/jNmV43EOMxA/deploying-jboss-jbpm-web-console322-on.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/deploying-jboss-jbpm-web-console322-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-8199508095777072058</guid><pubDate>Wed, 18 Feb 2009 07:21:00 +0000</pubDate><atom:updated>2009-02-18T02:25:57.972-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web App</category><title>Introduction to "Wicket" Web Framework</title><description>Wicket, is an open source, lightweight, component-based Java web framework&lt;br /&gt;that brings the Java Swing event-based programming model to web development&lt;br /&gt;&lt;br /&gt;Wicket allows you to easily customize this default behavior though. All user pages typically extend Wicket’s WebPage—a subclass of Wicket’s Page class. There needs to be a one-to-one correspondence between the HTML elements with a wicket:id attribute and the Page components&lt;br /&gt;&lt;br /&gt;In Wicket,a model (an object implementing the IModel interface) acts as the source of data for a component..&lt;br /&gt;&lt;br /&gt;Wicket could also be classified as an event-driven framework. Wicket HTML components&lt;br /&gt;register themselves as listeners (defined through several Wicket listener interfaces) for requests originating from the client browser. For example, Wicket’s Form component registers itself as an IFormSubmitListener, while a DropDownChoice implements the IOnChangeListener interface. When a client activity results in some kind of request on a component, Wicket calls the corresponding listener method. For example, on an HTML page submit, a Form component’s onSubmit() method gets called, while a change in a drop-down selection results in a call to DropDownChoice.onSelectionChanged&lt;br /&gt;&lt;br /&gt;With proper mark-up/logic separation, a POJO data model, and a refreshing lack of XML, Wicket makes developing web-apps in Java simple and enjoyable again. Swap the boilerplate, complex debugging and brittle code for powerful, reusable components written with plain Java and HTML.&lt;br /&gt;&lt;br /&gt;The component’s id value must match the wicket:id attribute of the&lt;br /&gt;template’s corresponding HTML component&lt;br /&gt;&lt;br /&gt;During the page render phase, Wicket does the following:&lt;br /&gt;1. It kicks off the page rendering process by calling the Page.render() method.&lt;br /&gt;2. The Page locates the corresponding markup template and begins iterating over the&lt;br /&gt;HTML tags, converting them into an internal Java representation in the process.&lt;br /&gt;3. If a tag without wicket:id is found, it is rendered as is.&lt;br /&gt;4. If a tag with wicket:id is found, the corresponding Wicket component in the Page is located, and the rendering is delegated to the component.&lt;br /&gt;5. The Page instance is then stored in an internal store called PageMap. Wicket maintains one PageMap per user session.&lt;br /&gt;&lt;br /&gt;In Wicket, the component hierarchy is specified explicitly through Java code—which allows you to modularize code and reuse components via all the standard abstraction features of a modern object-oriented language. This is quite different from other frameworks like Tapestry, wherein the page components are typically specified in an XML page specification file listing the components used in the page&lt;br /&gt;&lt;br /&gt;WicketServlet expects to be supplied with an IWebApplicationFactory implementation in&lt;br /&gt;order to delegate the responsibility of creating the WebApplication class. A factory implementation could be specified as a servlet initialization parameter in web.xml against the key application➥FactoryClassName. In the absence of such an entry, WicketServlet uses ContextParamWeb➥ApplicationFactory by default. As the name suggests, this class looks up a servlet context parameter to determine the WebApplication class name. The expected web.xml param-name in this case is&lt;br /&gt;applicationClassName. ContextParamWebApplicationFactory works perfectly for majority of the cases Register the CompoundPropertyModel instance with the parent component,&lt;br /&gt;* Form in this case, for the children to inherit from. So all the * remaining components will then use the UserProfile instance * as its model, using OGNL like 'setters' and 'getters'&lt;br /&gt;&lt;br /&gt;Wicket’s CompoundPropertyModel allows you to use each component’s ID as a property-path expression to the parent component’s model&lt;br /&gt;&lt;br /&gt;Wicket looks for the presence of a system property called wicket.configuration first. If it doesn’t find one, it looks for the value corresponding to a servlet initialization parameter named configuration. In the absence of the preceding settings, it looks for an identical servlet context parameter setting. If none of the&lt;br /&gt;preceding listed lookups succeed, Wicket configures the application in development mode by default. Note that the value for configuration has to be either development or deployment identified by fields wicket.Application.DEVELOPMENT and wicket.Application.DEPLOYMENT, respectively&lt;br /&gt;&lt;br /&gt;You must be curious about the parameter bookmarkablePage in the URL. Actually, there is nothing special that makes the page bookmarkable. Any page is considered bookmarkable if it has a public default constructor and/ or a public constructor with a PageParameters argument. A bookmarkable page URL can be cached by the browser and can be used to access the page at a later point in time, while a nonbookmarkable&lt;br /&gt;page cannot be accessed this way. A non-bookmarkable page URL makes sense only in the&lt;br /&gt;context it was generated. If the page wants to be bookmarkable and accept parameters off the URL, it needs to implement the Page(PageParameters params) constructor&lt;br /&gt;&lt;br /&gt;After the page is rendered, it is put into a PageMap. The PageMap instance lives in session and keeps the last n pages ( this number is configurable through Wicket’s ApplicationSettings object). When a form is submitted, the page is brought back from PageMap and the form handler is executed on it. The PageMap uses a Least Recently Used (LRU) algorithm by default to evict pages—to reduce space taken up in session.&lt;br /&gt;You can configure Wicket with your own implementation of the eviction strategy. Wicket specifies the strategy through the interface wicket.session.pagemap.IPageMapEvictionStrategy. You can configure&lt;br /&gt;your implementation by invoking getSessionSettings().setPageMapEvictionStrategy&lt;br /&gt;(yourPageMapEvicationStrategyInstance) in the WebApplication.init() method&lt;br /&gt;&lt;br /&gt;Component.setResponsePage method can be used to direct the user to a different page after page submit feedback component using Wicket’s built-in ListView&lt;br /&gt;&lt;br /&gt;Wicket has a FeedbackPanel component that can display all types of messages associated with components nested within a page&lt;br /&gt;&lt;br /&gt;Note that Wicket does call validate() on the subsequent components,&lt;br /&gt;even if a component featured ahead in the page hierarchy has failed validation, accumulating the error messages on the way.&lt;br /&gt;&lt;br /&gt;Validation in Wicket is specified through the IValidator interface. Since you can attach any number of IValidator interface implementations to a Wicket component through the component’s overloaded add() method, Wicket developers have made sure that they can be chained as well Validators are thread-safe. It is OK to link the same validator instance with multiple components&lt;br /&gt;&lt;br /&gt;It acts as a translation layer between HTTP request parameters&lt;br /&gt;and your model class, and the way it does this is through converters&lt;br /&gt;Wicket accesses the converters through a factory class and makes it centrally available through Wicket’s ApplicationSettings class&lt;br /&gt;&lt;br /&gt;All converters are supposed to implement the IConverter interface. It has a single&lt;br /&gt;method: public Object convert(Object value, Class c)&lt;br /&gt;All components allow you to specify the custom converter through the&lt;br /&gt;getConverter() method&lt;br /&gt;&lt;br /&gt;FeedbackMessages acts as a container for messages logged at any level, namely debug, info, error, warn. You can access messages specified at a particular log level in the form of a list (java.util.List) by supplying a filter of the type IFeedbackMessageFilter to FeedbackMessages&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-8199508095777072058?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/jjGa-jNhkhA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/jjGa-jNhkhA/introduction-to-wicket-web-framework.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/introduction-to-wicket-web-framework.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-5194177828519276452</guid><pubDate>Wed, 18 Feb 2009 06:58:00 +0000</pubDate><atom:updated>2009-02-18T16:15:21.597-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Using BPM for Software Delivery-The Process</title><description>&lt;span style="font-weight:bold;"&gt;Using BPM for Software Delivery&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Traditional Approach:&lt;/span&gt;&lt;br /&gt;1. Software projects go through requirements analysis. This phase involves talking to business and get individual requirements in document fashion and then are converted into software design and implementation decisions.&lt;br /&gt;2. These requirements together form complete picture.&lt;br /&gt;3. In that sense it is bottom-up design approach. Which leaves a lot to interpretation when it comes to how business and IT “see” the complete picture of organizational flow of information.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;BPM Approach:&lt;/span&gt;&lt;br /&gt;1. Main way it differs from traditional approach is that, it is top-down approach. Meaning it should start with Business Analysts and/or Users creating block diagrams to describe their overall flow of information in complete manner.&lt;br /&gt;2. These blocks can be as abstract or detailed as Business can provide or wants them to be.&lt;br /&gt;3. Each of these blocks interact with others via various synchronous/asynchronous mechanisms there by enabling Service Oriented Architecture (SOA) in the design and foundational infrastrure of all business requirements.&lt;br /&gt;4. This also will automatically make sure all the sides involved “see” EXACT same “big picture” and can agree on the same.&lt;br /&gt;5. Corollary effect of that is to allow all levels to drill down , see interdependencies, and make whole organization flexible, and more responsive to changes/updates.&lt;br /&gt;6. Increased ROI, Risk-mitigation, reduced cost and other benefits follow the above.&lt;br /&gt;***** BPM tool is ideal for flows of information that can be depicted as individual tasks that are controlled by some business logic or rules and can in general be described as a “process”&lt;br /&gt;Most, if not all business process can be described in such a manner,&lt;br /&gt;***&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Implementation methodology:&lt;/span&gt;&lt;br /&gt;To achieve BPM enabled software delivery following steps should be taken.&lt;br /&gt;1. Business users/Analysts will provide Block diagram describing the process in terms of individual steps, decisions and flows. &lt;br /&gt;This is very much like the “flow-charts” that all are familier with. Any IDE based tool of BPM (Jboss JBPM Engine) provides an easy to use and quick to adapt designer (Eclipse based Graphical Process Designer (GPD)) that can be used for this purpose.&lt;br /&gt;This tool will create a simple text (xml formatted) file. Please see attached diagram below for example of such an image.&lt;br /&gt;&lt;br /&gt;2.These blocks are then filled with details of functionality that is represented by that block.This normally means business analyst and business users doing requirements analysis and create a simple document that will give following information.&lt;br /&gt;a. Globally applicable rules for process flows.&lt;br /&gt;a. – These might include details such as business units responsible and allowed to see this process.&lt;br /&gt;b. What are global variables if any are there any rules or validation that apply when this process fits in bigger flow as a sub-process maybe. (for e.g. Create Employee Payroll process might be a sub-process to Hire New Employee Process and can only be run if new employee SSN is validated  against legal dept’s validate SSN service”)&lt;br /&gt;c. Global tasks needed which can be organization wide rules or task. (for. e.g. upon completion of each order above email may be sent to manager)&lt;br /&gt;b. Each individual block should then be given detailed description with following pieces&lt;br /&gt;a. What is the functionality? Describe actual task&lt;br /&gt;b. Timers and notification info – Due date, (if any) escalation actions (might be emails to supervisors, automated DB updates) , Rules for sending emails on task start, completion, expiring of task due dates etc.&lt;br /&gt;c. Assignment and management rules – What business roles should be able to start/complete/stop task. Is task automatically sent to some user or is there specific set of rule for doing so.&lt;br /&gt;d. User Interface details – Does task have any specific screen that should be associated while performing that task.&lt;br /&gt;e. Auditing information – What are the business Process measurement matrices that are needed. (for e.g. Number of Orders processed in a day? Total Orders not completed in time, How many employees have more than 10 tasks in their to-do list etc)&lt;br /&gt;f. If there is existing application/code that already does a particular functionality depicted by a block it should be noted and it will be RE-USED in almost all cases.&lt;br /&gt;g. After all the above are given, any other specific rules, details of tasks, out of ordinary requests etc should be noted in a separate section under each block details.&lt;br /&gt;&lt;br /&gt;3. Block diagram and subsequent info then is sent to IT for analysis and IT will create design and solution.&lt;br /&gt;a. After previous steps and input from them, IT basically has all the info needed. At this point IT will likely look for re-use, application integration of existing coded functionality, and custom coding of new or updated functionality. But even if individual step is missed or has bugs.. the “BIG PICTURE” will be exactly what business has in mind.&lt;br /&gt;b. IT does not have to write code to follow business flow, BPM tools will automatically do that based on outcome of individual business steps.&lt;br /&gt;c. Business performance matrices become automatically available. – For this BPM tool will integrate with outside monitoring tools as needed,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-5194177828519276452?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/8SaDjgZACjY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/8SaDjgZACjY/using-bpm-for-software-delivery-process.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/using-bpm-for-software-delivery-process.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-3655530325941880185</guid><pubDate>Wed, 18 Feb 2009 06:14:00 +0000</pubDate><atom:updated>2009-02-18T03:36:04.749-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Possible reasons for Web Application Memory Leaks-And Solutions</title><description>1) Check the version of CGLIB Jar Version deployed in container&lt;br /&gt;&lt;br /&gt;And possible known classes in CGLIB which cause memory leak are present in Package - net.sf.cglib.proxy and these are the Classes with bugs&lt;br /&gt;a) LazyLoader b) InvocationHandler c) Enhancer&lt;br /&gt;&lt;br /&gt;The fix has been applied in CGLIB 2.2 JAR&lt;br /&gt;&lt;br /&gt;2) If your application uses Spring Framework for Dependency Injection and JavaBeans Introspection,make sure the WebApp Domain, deployment descriptor "web.xml" has references to different Spring Listener classes like org.springframework.web.util.Log4jConfigListener &amp; org.springframework.web.context.ContextLoaderListener&lt;br /&gt;&lt;br /&gt;Spring offers another listener : org.springframework.web.util.IntrospectorCleanupListener&lt;br /&gt;&lt;br /&gt;This is the Listener that flushes the JavaBeans Introspector cache on web app shutdown. Register this listener in "web.xml" to guarantee proper release of the web app class loader and the classes that it holds.&lt;br /&gt;&lt;br /&gt;If the JavaBeans Introspector has been used to analyze application classes, the Introspector cache will hold a hard reference to those classes. Consequently, those classes and the web app class loader will not be garbage collected on web app shutdown!&lt;br /&gt;&lt;br /&gt;Unfortunately, the only way to clean up the Introspector is to flush the entire cache, as there is no way to specifically determine the application's classes referenced there. This will remove cached introspection results for all other applications in the server too.&lt;br /&gt;&lt;br /&gt;Note that this listener is not necessary when using Spring's beans infrastructure, as Spring's own introspection results cache will immediately flush an analyzed class from the JavaBeans Introspector cache.&lt;br /&gt;&lt;br /&gt;Application classes hardly ever need to use the JavaBeans Introspector directly, so are normally not the cause of Introspector resource leaks. Rather, many libraries and frameworks do not clean up the Introspector..&lt;br /&gt;&lt;br /&gt;Note that a single such Introspector leak will cause the entire web app class loader to not get garbage collected! This has the consequence that you will see all the application's static class resources (like singletons) around after web app shutdown, which is not the fault of those classes!&lt;br /&gt;&lt;br /&gt;Possible Solution : Add this code in web.xml and place it before any other Spring Listeners&lt;br /&gt;&lt;br /&gt;&amp;lt;listener&amp;gt;&lt;br /&gt;&amp;lt;listener-class&amp;gt;&lt;br /&gt;org.springframework.web.util.IntrospectorCleanupListener&lt;br /&gt;&amp;lt;/listener-class&amp;gt;&lt;br /&gt;&amp;lt;/listener&amp;gt;&lt;br /&gt;&lt;br /&gt;3) Problem with DOM4J JAR&lt;br /&gt;&lt;br /&gt;There's a problem with the use of ThreadLocals for caching, it's never cleaned up. If the ClassLoader is thrown away (e.g. if a webapp is reloaded), then the ThreadLocal stuff hold until the Thread dies, which might take a while in a Servlet container where the Threads are pooled. In such situation, DOM4J would prevent the webapp's ClassLoader to be garbage collected, which would creates a a memory leak and eventually an OOM if the webapp is reloaded too many times.&lt;br /&gt;&lt;br /&gt;Workaround : if possible,avoid using ThreadLocal class(Programmatically it can be done)&lt;br /&gt;&lt;br /&gt;4) Get the latest version of JDOM JAR...the latest version 1.1 has fix for known memory leak issues being caused by org.jdom.input.SAXHandler class in older versions&lt;br /&gt;&lt;br /&gt;5) Last but not the least, make sure you have Java Profilers like Eclipse Profiler Plugin(this is the best as far as Iam concerned), JProbe ,VisualGC or JSTAT running against web application server...&lt;br /&gt;&lt;br /&gt;Feel free to add any more known bugs which cause memory leaks.....!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-3655530325941880185?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/LsVmTnfnP6U" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/LsVmTnfnP6U/possible-reasons-for-web-application.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/possible-reasons-for-web-application.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-458236155997399197</guid><pubDate>Wed, 18 Feb 2009 06:05:00 +0000</pubDate><atom:updated>2009-02-18T01:10:24.166-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Enhancing BPM Processes Performance</title><description>&lt;span style="font-weight:bold;"&gt;Declaring BPM Processes Instance Variables as "Separated"...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From my personal experience it has been seen so far that if the BPM Processes has big Instance Variables like Value Objects,Transfer Objects, Collection Objects, they consume lot of memory for processing each single instance and BPM Engine starts throwing Severe Exceptions like "Max Instance Size has exceeded",which will hinder the progress of execution of business activity.&lt;br /&gt;&lt;br /&gt;Below is the short synopsis related to different ways of increasing Max Instance Size  in ALBPM...&lt;br /&gt;&lt;br /&gt;Advantages:&lt;br /&gt;1)Enhance BPM Processes Execution&lt;br /&gt;2)Lowering the BPM Message size can affect the performance of these processes specially...&lt;br /&gt;&lt;br /&gt;Disadvantages of Higher Message size:&lt;br /&gt;Each single process instance takes that much more time to persist to BPM DB and they are stored as Binary Objects(BLOB) in DB...so it will increase the cache memory/space consumed by these processes in DB&lt;br /&gt;&lt;br /&gt;Workaround with 32KB Instance Size:&lt;br /&gt;Declare these 'big' (10k or more) instance variables (VO/TO)as 'separated'. In ALBPM,while declaring variables,there is an attribute called 'Category' and the default value is 'Normal'. If you declare an instance variable as 'Separated' the data will be stored in another database table and it's size won't count towards the process instance size and it will not affect the BPM DB Cache Memory..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-458236155997399197?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/h74Iox6vxxw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/h74Iox6vxxw/enhancing-bpm-processes-performance.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/enhancing-bpm-processes-performance.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-3080879657255358375</guid><pubDate>Wed, 18 Feb 2009 05:59:00 +0000</pubDate><atom:updated>2009-02-18T16:15:36.339-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Cataloging Components in ALBPM</title><description>1)When registering/creating Java Libraries as part of External Resources in BPM Studio, we have two options :Versionable and Non-versionable &lt;br /&gt;If we select "Versionable",then the JARS will be included in the Project Export from Studio and when the project is published and deployed into an Enterprise Environment, then these will be stored as binaries in the BPM Directory Service..The BPM Engine and Workspace applications will be pulling them and injecting into appropriate classloader...As per the configuration for the Java Libraries in the Enterprise Process Administrator,they are just there for a reference..The binding is determined at project publication time if we use "Versionable" Java Libraries..&lt;br /&gt;&lt;br /&gt;2)On the other hand,if we use Non-Versionable Libraries for BPM Cataloging,then manually we need to include them into Process Administrator's Classpath...Most likely, these JARS wll need to be copied into Process Administrators' WEB-INF/lib directory.... and the path  is, ~/albpm5.7/j2eewl/webapps/webconsole/WEB-INF/lib and then restart the BPM Server...&lt;br /&gt;&lt;br /&gt;Basic principle to follow before you catalog BPM components in Studio is to make sure &lt;br /&gt;&lt;br /&gt;1 )The "External Resources" does include "Versionable" libraries before publishing/deploying the BPM project to get the latest JAR files and make them run in ALBPM Enterprise Server. Right Click -&gt; "External Resources" -&gt; Select "Versionable" -&gt; then do a publish/deploy project in Studio.&lt;br /&gt;&lt;br /&gt;2) Then complete the BPM Catalog process manually from studio&lt;br /&gt;&lt;br /&gt;Copy the Application JARS in BPM Webconsole and Portal WEB-INF/lib folder and regenerate BPM EAR to get latest versions of these files and then execute BPM cataloging from Studio using External Resources..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-3080879657255358375?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/ttF67NzRkOM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/ttF67NzRkOM/cataloging-components-in-albpm.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2009/02/cataloging-components-in-albpm.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-894969046293778718</guid><pubDate>Wed, 08 Oct 2008 17:26:00 +0000</pubDate><atom:updated>2008-10-08T13:32:31.026-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Android</category><title>Anatomy &amp; Physiology of Android OS</title><description>Android has been designed as a modern mobile platform that will enable applications to take full advantage of the mobile device capabilities. This session will break down the various components of the Android platform, examine how they work, and give developers a deeper understanding of the underlying technologies that drive the Android platform...&lt;div&gt;This video tutorial will give you deep understanding of how Linux Kernel 2.6.24 is stacked up inside Android OS including the different drivers,libraries and runtime interfaces which drives the Android platform and the applications which run on it....&lt;/div&gt;&lt;div&gt;Source: GoogleDevelopers&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/G-36noTCaiA&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/G-36noTCaiA&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-894969046293778718?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/bVBh1mQ_3xA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/bVBh1mQ_3xA/anatomy-physiology-of-android-os.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/10/anatomy-physiology-of-android-os.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-2074285040010299393</guid><pubDate>Fri, 03 Oct 2008 00:12:00 +0000</pubDate><atom:updated>2008-10-02T20:15:51.446-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">EJB</category><title>EJB 3.1 Specifications Overview</title><description>Source: The Server Side.....&lt;br /&gt;&lt;br /&gt;Kenneth Saks is the specification lead for Enterprise JavaBeans 3.1 (JSR 318) . This talk will give the latest update on the contents of the EJB 3.1 specification , which will soon be released for Public Draft Review.&lt;br /&gt;&lt;br /&gt;With its 3.0 release, the Enterprise JavaBeans™ (EJB™) architecture underwent a dramatic simplification targeted at ease of use for application developers. The purpose of the Enterprise JavaBeans 3.1 specification is to further simplify the EJB architecture by reducing its complexity from the developer's point of view, while also adding new features in response to the needs of the community.&lt;br /&gt;&lt;br /&gt;Topics will include : .war packaging of EJB components, improved unit testing support, portable global JNDI names, singleton beans, startup/shutdown callbacks, a simplified(no interface) local view, asynchronous session bean invocations, automatic timer creation, and more&lt;br /&gt;&lt;br /&gt;&lt;embed flashvars="autoplay=false" width="400" height="320" allowfullscreen="true" allowscriptaccess="always" src="http://www.ustream.tv/flash/video/757545" type="application/x-shockwave-flash" &gt;&lt;/embed&gt;&lt;a href="http://www.ustream.tv/" style="padding:2px 0px 4px;width:400px;background:#FFFFFF;display:block;color:#000000;font-weight:normal;font-size:10px;text-decoration:underline;text-align:center;" target="_blank"&gt;Live Video streaming by Ustream&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-2074285040010299393?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/xCQPsdgj6oE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/xCQPsdgj6oE/ejb-31-specifications-overview.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/10/ejb-31-specifications-overview.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-467411789199679438</guid><pubDate>Thu, 02 Oct 2008 23:46:00 +0000</pubDate><atom:updated>2008-10-02T19:48:28.072-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Android</category><title>Visa to Develop Applications for Android, Nokia Phones</title><description>Visa wants to become a part of your mobile phone, working with Nokia on realizing mobile payments and also announcing services for Google's Android platform.&lt;br /&gt;&lt;br /&gt;The idea of using the mobile phone as a payment device has been around for along time, but has not yet encountered widespread success. With more than 3 billion mobile devices already in the market today, though, Visa sees a big opportunity to extend its reach, according to Elizabeth Buse, global head of product at Visa.&lt;br /&gt;&lt;br /&gt;For future owners of the T-Mobile G1 and other upcoming Android phones, Visa will at first include three services, Alerts, Offers and Locator, which will be available for download before the end of the year.&lt;br /&gt;&lt;br /&gt;With Alerts consumers will receive what Visa calls "near real-time" notification of purchase activity, based on rules defined by the cardholder.&lt;br /&gt;&lt;br /&gt;Offers and Locator will make it possible for users to receive targeted offers, based on for example previous purchases, and show consumers nearby locations of shops or ATMs that accepts Visa. The two functions can also be combined. Consumers would opt in to the services, only activating those they choose, and would be able to opt out at any time, according to Visa.&lt;br /&gt;&lt;br /&gt;The services will at first be offered to Chase Visa card holders in the U.S., and Visa says it plans to add more banks later.&lt;br /&gt;&lt;br /&gt;Visa is also developing a payment application that will enable consumers to make mobile payments with Android phones.&lt;br /&gt;&lt;br /&gt;Visa's work with Nokia is also about making payments possible using the mobile phone. Using the Nokia 6212 classic, expected to be available starting next month, users will be able to make contactless payments, remote payments, money transfers, as well as receive alerts and notifications, according to Nokia.&lt;br /&gt;&lt;br /&gt;What makes all that possible is built-in support for a technology called NFC (Near-Field Communications), which lets consumers simply wave the phone within a few inches of a special point-of-sale reader to complete a transaction.&lt;br /&gt;&lt;br /&gt;Nokia and Visa will first do trials with financial institutions, but for it to really take off the retail sector has to get onboard, and that is currently a blocking point, according to Richard Webb, directing analyst at Infonetics Research.&lt;br /&gt;&lt;br /&gt;"Mobile payments are a good thing for the mobile sector, but there is no real gain for the retail sector, which would have to upgrade its systems for payments to work," said Webb.&lt;br /&gt;&lt;br /&gt;Companies such as Nokia and Visa have to explain what's in it for retailers, but there are also other aspects that need to be addressed before mobile payments can take off, including security and trust, according to Webb.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-467411789199679438?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/aH35mk92wZM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/aH35mk92wZM/visa-to-develop-applications-for.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/10/visa-to-develop-applications-for.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-4195632308482703500</guid><pubDate>Wed, 14 May 2008 02:35:00 +0000</pubDate><atom:updated>2009-02-18T16:15:51.936-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BPM</category><title>Business Process Management- Quick look at three more products</title><description>Business Process Management ,the subject or concept which is gripping every major enterprise applications deployment now-a-days coupled with SOA/Web Services, has been part of my pedigree since more than a year now and the more I tend to learn about it, the more I feel like a naive,its such a vast concept . Many people have asked me how do you define a "Business Process Management"? and I tend to come up with different answers (not my fault...because each of the BPM solution providers have their own definition and meaning to it.&lt;br /&gt;&lt;br /&gt;First thing first, as part of BPM initiatives so far I have been exposed to different products like Jboss JBPM(I still feel this is the best one,as far as IDE based BPM tools go,next best Intalio) , Albpm , Savvion &amp;amp;  Intalio.&lt;br /&gt;&lt;br /&gt;Currently Iam working on an enterprise application using ALBPM(Aqualogic BPM) from BEA  as the BPM product and good thing is adopted by many leading companies and the thing which sometimes worries me about it is very little documentation and support from BEA(thats my perception) and coming from IDE background primarily for most of the development ,I feel it is behind Jboss Jbpm or Intalio because these products does support IDEs like Eclipse,which definitely makes my life easy as a Developer,Well BEA may argue with me that ALBPM Studio 6.0 has development environment similar to Eclipse  or rather built on Eclipse IDE,but then Iam using ALBPM Studio 5.7  right now which doesnt come with full IDE support ...But I must say among commercial solutions this fits the bill...&lt;br /&gt;&lt;br /&gt;And over the year,one thing which has worried me as a BPM Developer is how best I can make the Business Analysts or the business folks,understand the business processes which I have developed better,because in hindsight we expect them to be not technical savvy to really understand the workflow pattern being used nor how it has been developed since their major priority is how best this workflow/application fits their business needs .....For Example,l to overcome this situation,in one of my assignments while using Jboss Jbpm,I had to develop an EXE file or installer (something like Java Web Start)for BA and Testers,which simulates the workflow processes being developed without them having to worry about seeing it in action in a IDE ..And then as part of my curiosity and research,I realized there are different BPM solutions/products out there in IT industry that are so easy to understand ,that even non-technical folks can understand.And with this article Iam going to introduce such BPM products because most of them are browser based and not IDE based ...&lt;br /&gt;&lt;br /&gt;Today we will be looking at 3 different BPM products that have been adopted by noted companies and how best they are serving the needs for workflow management and development.I will be giving an overview about each one of them,their features and benefits&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;I) &lt;/span&gt;&lt;a href="http://www.appian.com"&gt;&lt;span style="font-weight: bold;"&gt;Appian&lt;/span&gt;&lt;/a&gt; : Accidently I came across this product and it is definitely worth trying in any business process management effort. And when I see its &lt;a href="http://www.appian.com/customers/list.jsp"&gt;customers list&lt;/a&gt; who have adopted  &lt;span class="font"&gt;Appian-Enterprise-based business process management (BPM) solution for their IT departmen&lt;span style="text-decoration: underline;"&gt;t &lt;/span&gt;it definitely must have some reason to it.Then I realized the advantages/benefits it brings to the table.&lt;/span&gt;From its legacy in the portal/knowledge-management (KM) space, Appian has built its functionality into a full blown BPM suite. In turn, it's built on a Java base following the Unified Modeling Language (UML) and the XML Process Definition Language (xPDL). (These are solid standards all, and which seem to be doing what standards should do without the interference of the European Union and Document Freedom Day groupies--. From an open source perspective, Appian comes with JBoss out of the box but of course works with WebSphere and WebLogic. It makes use of Lucene search engine as well. Not open source but Appian’s doing some real interesting stuff with KX Systems Kdb.  &lt;p&gt;But the good news is that users don’t have to worry about all that technology stuff . Appian’s Form and Rules Designers and other real-user-facing components all work vis a straight Web interface (no need for Flash, plug-ins, etc.). That’s important for security requirements, which is key to many of Appian's government customers. But it is also good for ease of use for any customer. More important are the ease of Appian BPM implementation templates developed over the 10 years since it was founded. Examples are available for procurement in federal government, for wealth management with rules for credit scoring, a program with Instill to build a quality management solution for the food/service industry... I think the best place to know about Appian would be seeing its recorded webinars&lt;br /&gt;&lt;/p&gt;&lt;a href="http://www.cordys.com/"&gt;&lt;span style="font-weight: bold;"&gt;II) &lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;a href="www.cordys.com"&gt;Cordys&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Cordys BPMS&lt;/b&gt; is a single toolset, built from the ground up to offer comprehensive BPM and SOA capabilities, giving business managers direct control over new and existing processes.And I you see the below listed features,Iam sure everyone will be curios to use and test it for their BPM efforts.And when I see that a utility which I use frequently for my business needs "WebEx", the leading provider of Web communication services has adopted Cordys,I gave it a try.&lt;br /&gt;Features &amp;amp; Benefits :&lt;br /&gt;a)Graphical, browser-based interface&lt;br /&gt;* Accurately draw executable business processes using a Visio-like application&lt;br /&gt;* Bridge the gap between business and IT&lt;br /&gt;* Enable business users to control and quickly change their own processes&lt;br /&gt;* Consolidate and present data from disparate sources as one unified and personalized   workspace for higher productivity&lt;br /&gt;b)Intuitive, drag-and-drop business process execution, with   virtually no coding&lt;br /&gt;cDistributed, fault-tolerant, and scalable architecture&lt;br /&gt;    * Configure nonstop, fault-tolerant runtime environments with no single point of failure on commodity hardware&lt;br /&gt;d)Real-time alerts and notifications&lt;br /&gt;    * Accelerate responsiveness to critical events and exceptions&lt;br /&gt;e)Operational intelligence dashboard&lt;br /&gt;    * Obtain real-time, enterprise-wide visibility of business process performance and business metrics&lt;br /&gt;f)Historical analysis&lt;br /&gt;    * Discover enterprise performance trends for more-informed decision making&lt;br /&gt;g)Composite application framework&lt;br /&gt;    * Create Web 2.0 interfaces quickly by visualizing, combining, and manipulating data from disparate sources&lt;br /&gt;h)Composite application developer&lt;br /&gt;    * Create needed business services&lt;br /&gt;i)SOA Grid&lt;br /&gt;       * Connect incompatible systems together, allowing them to communicate&lt;br /&gt;    * Rapidly assemble composite objects based on a variety of previously non-interoperable backends&lt;br /&gt;    * Govern and manage Web services, both in design and run time&lt;br /&gt;j)Data manager&lt;br /&gt;       * Facilitate template-based reconciliation of differences among disparate data connected to the Cordys platform&lt;br /&gt;k)Secure file transfer&lt;br /&gt;        * Provide end-to-end document security, including legal grade non-repudiation and guaranteed integrity of transmitted data&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;III) &lt;a href="http://www.lombardisoftware.com/bpm-resource-center.php"&gt;Lombardi&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;Last but not the least is Lombardi.Best place to know about this product is its &lt;a href="http://www.lombardisoftware.com/bpm-resource-center.php"&gt;resource section&lt;/a&gt;&lt;br /&gt;Major customer which has adopted Lombardi's Teamworks BPM software is Wells Fargo Financial.&lt;br /&gt;&lt;br /&gt;I hope some of the organizations start looking at adopting at either one of these for their BPM implementations,considering how easy they can be understood and used by workflow developers,business folks and Business Analysts.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-4195632308482703500?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/o71uqc_ekSc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/o71uqc_ekSc/business-process-management-quick-look.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>1</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/05/business-process-management-quick-look.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-7132986726488573797</guid><pubDate>Tue, 19 Feb 2008 02:22:00 +0000</pubDate><atom:updated>2009-02-18T16:16:05.059-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web Services</category><title>Developing Secure Web Services</title><description>Web Services,SOA,everywhere.Well,it certainly has so much positive impact on current IT community and proving its worth being adopted by leading industry players such as IBM, HP, Oracle, Microsoft, Novell, and Sun for different Web Services products.Yes Iam talking about SOA-Web Services which are here to stay and look set to dominate the deployment of major enterprise applications in the coming years.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IBM’s definition of Web Services states that “Web Services are self-contained,  modular applications that can be described, published, located, and invoked over  a network, generally, the World Wide Web.” In one of my previous articles,&lt;a href="http://yaseen-javaj2ee.blogspot.com/2008/02/different-design-patterns-for-web.html"&gt;Web Services Patterns&lt;/a&gt; we looked at the advantages provided by SOA applications.&lt;br /&gt;When the definition refers to Web  Services being invoked over the World Wide Web, it means that they use HTTP as  the transport layer and an XML-based message layer. However, Web Services do not  actually require HTTP—XML-formatted data can be sent over other transport  protocols (message queuing, for example), which may be more suited to  mission-critical transactions.&lt;br /&gt;&lt;br /&gt;Web Services generally uses the HTTP and SSL ports (TCP ports 80 and 443,  respectively) in order to pass through firewalls. In the early days of “Web  Services,” vendors would say that their products were “firewall compliant.” This  meant that firewalls would not block the Web Services traffic, whereas CORBA  traffic attempting to use CORBA-specific ports may be blocked. Web Services make  it easier to deploy distributed computing without having to open firewall ports,  or having to “punch a hole in the firewall” as network administrators like to  say. This “under the radar” deployment has serious security implications. Most  firewalls are unable to distinguish Web Services traffic, traveling over HTTP  and SSL ports, from Web browser traffic.&lt;br /&gt;The word “Services” in Web Services refers to a Service-Oriented Architecture  (SOA). SOA is a recent development in distributed computing, in which  applications call functionality from other applications over a network. In an  SOA, functionality is “published” on a network where two important capabilities  are provided— “discovery,” the ability to find the functionality, and “binding,”  the ability to connect to the functionality. In the Web Services architecture,  these activities correspond to three roles: Web Service provider, Web Service  requester, and Web Service broker, which correspond to the “publish,” “find,”  and “bind” aspects of a Service-Oriented Architecture.&lt;br /&gt;&lt;br /&gt;Web Services security focuses on the application layer, although security at the  lower layers remains important. The implementation technologies on which we focus are HTTP and SOAP,  although we will keep SMTP security in mind also since SOAP can be bound to SMTP  as well as HTTP.It may not seem immediately obvious why security for SOAP presents  such a challenge. After all, SOAP is generally bound to HTTP, which already has  SSL for authentication and confidentiality. In addition, many Web authorization  tools already exist. It is a reasonable question to ask why these aren’t enough,  and the answer is made up of a number of reasons.The first reason is that, although frequently bound to HTTP, SOAP  is independent of the underlying communications layers. Many different  communications technologies can be used in the context of one multi-hop SOAP  message; for example, using HTTP for the first leg, then SMTP for the next leg,  and so forth. End-to-end security cannot therefore rely on a security technology  that presupposes one particular communications technology. Even in the case of a  single SOAP message targeted at a Web Service, transport-level security only  deals with the originator of the SOAP request. SOAP requests are generated by  machines, not by people. If the Web Service wishes to perform security based on  the end user, it must have access to authentication and/or authorization  information about the end user on whose behalf the SOAP request is being sent.  This is the second reason for Web Services security.&lt;br /&gt;&lt;br /&gt;SOAP is a technology used to enable software to talk to other software much  easier than was previously possible. End users (that is, humans) do not make  SOAP messages themselves. However, if access to the Web Service is to be decided  based on the information about the end user, the Web Service must have access to  the information that allows it to make this authorization decision. This  information does not have to include the end user’s actual identity.How can this information about the end user be conveyed to the Web  Service? Session layer or transport layer security between the application  server and the Web Service doesn’t convey information about the identity of the  end user of the Web Service. It merely conveys information about the application  server that is sending the SOAP message. It may be the case that many of the  requests to the Web Service originate from that application server.This challenge is addressed by including security information  about the end user in the SOAP message itself. This information may concern the  end user’s identity, attributes of the end user, or simply an indication that  this user has already been authenticated and/or authorized by the Web server.  This information allows the Web Service to make an informed authorization  decision.This scenario is likely to be widespread where many Web  Services are used to implement functionality “behind the scenes.” It shouldn’t  be the case that the end user has to reauthenticate each time a SOAP request  must be sent on their behalf. The challenge of providing this functionality is  sometimes called “single sign-on” or “federated trust.”&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;WS-Routing&lt;/span&gt; provides a means for SOAP messages to route between multiple Web  Services. WS-Routing defines how to insert routing information into the header  of a SOAP message. This routing information can be thought of as equivalent to  routing tables that operate at lower layers of the OSI stack for routing IP  packets.WS-Routing means that one SOAP message may traverse multiple SOAP  “hops” between the originator and the endpoint. The systems that implement these  hops may have nothing in common apart from the ability to parse and route a SOAP  message.When routing between Web Services, the requirement for  confidentiality can apply from the originator through to the final SOAP  endpoint. It may be a requirement that information be kept secret from SOAP  intermediaries. There may be a chance that  intermediaries may disclose the  information either deliberately or through leaving “gaps” between one  transport-level security session and the next. While the data is decrypted, it  is vulnerable. This is the same problem that plagued the first release of the  Wireless Access Protocol (WAP), in which data was decrypted in between the  wireless encryption session and encryption on the fixed wire. This so-called  “WAP gap” caused a loss of confidence in WAP security and was addressed in later  releases of the WAP specification. Implementing encryption only at the transport  level makes a “SOAP gap.”It is often noted that most security breaches happen not  while data is in transit, but while data is in storage. This is the principle of  least resistance—attempting to decrypt eavesdropped encrypted data from an SSL  session is much more difficult than simply testing if a Web site maintainer has  remembered to block direct access to the database where the credit card numbers  are stored. If decrypted data is stolen from a database, the consequences are no  less dramatic. Once data has reached its final destination, it must be stored in  a secure state. Confidentiality for a SOAP transaction should not involve simply  chaining instances of confidentiality together, since “SOAP gaps” of unencrypted  data are available between each decryption and encryption.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Web Services Security Specifications&lt;/span&gt;&lt;br /&gt;Confidential information in a SOAP message should remain confidential over the  course of a number of SOAP hops.A number of industry specifications have been developed for this  purpose. These specifications can be organized into two distinct categories:A standardized framework to include XML-formatted security  data into SOAP messages.Standards for expressing security data in XML format. This  security information should be used for the high-level principles of security:  confidentiality, authentication, authorization, integrity, and so  forth. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;WS-Security&lt;/span&gt;&lt;br /&gt;WS-Security has emerged as the de facto method of inserting  security data into SOAP messages. Work on WS-Security began in 2001, was  published by Microsoft, VeriSign, and IBM in April 2002, and was then submitted  in June 2002 to the OASIS standards body in order to be made into an industry  standard. WS-Security defines placeholders in the SOAP header in order to insert  security data. It defines how to add encryption and digital signatures to SOAP  messages, and then a general mechanism for inserting arbitrary security tokens.  WS-Security is “tight” enough to present the definitive means of including  security data into SOAP messages, but is “loose” enough to not place limits on  what that security data can be.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;XML  Encryption&lt;/span&gt;&lt;br /&gt;XML Encryption is a specification from the W3C. It provides  not only a way of encrypting portions of XML documents, but also a means of  encrypting any data and rendering the encrypted data in XML format. XML  Encryption makes encryption functionality easier to deploy.XML Encryption is not a replacement for SSL. SSL is still the de  facto choice for confidentiality between two entities that are communicating  using HTTP. However, if the security context extends beyond this individual HTTP  connection, XML Encryption is ideal for confidentiality. The capability to  encrypt XML is nothing new, because XML is just text after all. However, the  ability to &lt;i class="emphasis"&gt;selectively encrypt&lt;/i&gt; XML data is what makes XML  Encryption so useful for Web Services. Encrypting an entire SOAP message is  counterproductive, because the SOAP message must include enough information to  be useful—routing information, for example. Selectively encrypting data in the  SOAP message is useful, however. Certain information may be hidden from SOAP  intermediaries as it travels from the originator to the destination Web  Service.XML Encryption does not introduce any new cryptography algorithms  or techniques. Triple-DES or RSA encryption may still be used for the actual  encryption. XML Encryption provides a way to format the meta-information about  which algorithm was used, and when the encryption occurred. This aids the Web  Service in decrypting the data, provided the decryption key is available to it.  This is important, because prior to XML Encryption the only standardization of  encryption data was for e-mail messages (that is, S/MIME). If an organization  wished to send encrypted data to another organization, both organizations would  have to agree on the format of the encrypted data, how and which algorithms to  use, and possibly also how to send an encrypted key. Now that information can be  contained in an XML Encryption block.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;XML Signature&lt;/span&gt;&lt;br /&gt;XML Signature is a specification produced jointly by the W3C  and the Internet Engineering Task Force (IETF). Like XML Encryption, it does not  only apply to XML. As well as explaining how to digitally sign portions of an  XML document, XML Signature also explains how to express the digital signature  of any data as XML. As such, it is an “XML-aware digital signature.” PKCS#7 is a  means of rendering encrypted data, and signed data, which predates XML Signature  and XML Encryption. Rather than using XML, it uses Abstract Syntax Notation  number 1 (ASN.1). ASN.1 is a binary format, renowned for its complexity.  Producing or verifying a PKCS#7 signature requires not just cryptography  software, but also an ASN.1 interpreter. XML Signature also requires  cryptography software, of course, but an XML DOM replaces the ASN.1  interpreter.&lt;br /&gt;The power of XML Signature for Web Services is the ability to  selectively sign XML data. For example, a single SOAP parameter passed to a  method of a Web Service may be signed. If the SOAP request passes through  intermediaries en route to the destination Web Service, XML Signature ensures  end-to-end integrity.WS-Security describes how to include XML Signature data in a  SOAP message. An important feature of XML Signature is that it can be very  selective about what data in an XML instance is signed. This feature is  particularly useful for Web Services. For example, if a single SOAP parameter  needs to be signed but the SOAP message’s header needs to be changed during  routing, an XML Signature can be used that only signs the parameter in question  and excludes other parts of the SOAP message. Doing so ensures end-to-end  integrity for the SOAP parameter while permitting changes to the SOAP’s header  information.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Security Assertions Markup Language (SAML)&lt;/span&gt; provides a means of  expressing information about authentication and authorization, as well as  attributes of an end user (for example, a credit limit) in XML format. SAML data  may be inserted into a SOAP message using the WS-Security framework. SAML is  used to express information about an act of authentication or authorization that  has occurred in the past. It does not provide authentication, but can express  information about an authentication event that has occurred in the past; for  example, "User X authenticated using a password at time Y.” If an entity is  authorized based on the fact that they were previously authorized by another  system, this is called “portable trust.” SAML is important to address the  challenge of multihop SOAP messages also, because separate authentication to  each Web Service is often out of the question. By authenticating once, being  authorized, and effectively reusing that authorization for subsequent Web  Services, single sign-on for Web Services can be achieved.Note that this information in a SAML assertion may not indicate  the end user’s identity. The user may have authenticated using a username and  password, and the administrator of the Web site may have no idea of the user’s  actual identity. It may simply be an indication that the user presented  credentials and was authenticated and authorized. SAML allows information to be  placed into a SOAP message to say “this person was authorized according to a  certain security policy at a certain time." If the recipient of this SOAP  message trusts the issuer of the SAML data, the end user can also be authorized  for the Web Service. This SAML data is known as an “assertion” because the  issuer is &lt;i class="emphasis"&gt;asserting&lt;/i&gt; information about the end user. The  concept of security assertions has existed before SAML, and is already widely  used in existing software.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;XML Access Control Markup Language (XACML)&lt;/span&gt; is designed to express  access control rules in XML format. Although the two technologies are not  explicitly linked, XACML may be used in conjunction with SAML. An authorization  decision expressed in a SAML assertion may have been based on rules expressed in  XACML.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Microsoft’s Passport&lt;/span&gt; technology takes a different approach to  single sign-on. The user authenticates to the passport infrastructure, either  directly through www.passport .com or through an affiliate site that makes use  of functionality provided by passport.com. Once the user is authenticated and  authorized by Passport, their authentication status is also available to other  Web Services that use Passport. Like SAML, this provides single sign-on.  However, the model is different, relying on a central point of authentication  rather than SAML’s architecture where authentication happens at an individual  Web Service. By being implemented at the site of the Web Service itself, SAML  authentication and authorization information may be based on &lt;i class="emphasis"&gt;role-based security&lt;/i&gt;. Role-based security means that access to  resources is based on the user’s organizational role; for example, in a medical  setting doctors may have access to certain information while nurses have access  to different information.&lt;br /&gt;&lt;br /&gt;In this article(from Web Services Security),I tried to just give an overview on the different specifications that can be used to achieve Web Services security,for a detailed understanding,I suggest get a good book like this one,"Web Services Security",to whom I owe these excerpts,and get a clear understanding as to implementing and using specifications for securing the web services you develop.And thanks to ,Mark O'Neil,for his inputs and allowing me to use some stuff from his book.&lt;/p&gt;&lt;p class="last-para"&gt;&lt;span style="font-weight: bold;"&gt;Recommended books&lt;/span&gt; :&lt;br /&gt;&lt;/p&gt;&lt;p class="last-para"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.amazon.com/Web-Services-Security-Mark-ONeill/dp/0072224711/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1203391148&amp;amp;sr=1-1"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_VnFS8PNEOkk/R7pK11k6OxI/AAAAAAAABYI/gd6mBzmRTos/s200/web+services+security.jpg" alt="" id="BLOGGER_PHOTO_ID_5168525811136477970" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.amazon.com/Securing-Web-Services-WS-Security-Demystifying/dp/0672326515/ref=cm_cr_pr_pb_i"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_VnFS8PNEOkk/R7pRtlk6OzI/AAAAAAAABYY/RiavtOhBPDM/s200/sec.jpg" alt="" id="BLOGGER_PHOTO_ID_5168533365983951666" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Suggested Reading&lt;/span&gt;&lt;/p&gt;&lt;p class="last-para"&gt;&lt;a href="http://www.oasis-open.org/specs/index.php#wssv1.0"&gt;WS-Security Specification&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/articles/ws-standards-wcf-bustamante"&gt;Web Services Standards &amp;amp; Specifications&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ibm.com/developerworks/library/specification/ws-secure/"&gt;&lt;br /&gt;Web Services Security-by IBM&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/articles/service-firewall"&gt;&lt;br /&gt;Implementing Service Firewall Pattern&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Suggested Video Tutorial&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/secure-reliable-webservices"&gt;Secure and Reliable Web Services-by InfoQ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/saml"&gt;SAML-An Overview&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Web Services Attacks &amp; Defense Strategies&lt;/span&gt;&lt;br /&gt;&lt;embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-7420398397610555824&amp;hl=en" flashvars=""&gt; &lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-7132986726488573797?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/mgDKEwFLQmU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/mgDKEwFLQmU/developing-secure-web-services.html</link><author>noreply@blogger.com (Yaseen Khan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_VnFS8PNEOkk/R7pK11k6OxI/AAAAAAAABYI/gd6mBzmRTos/s72-c/web+services+security.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/02/developing-secure-web-services.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-4042955474069603164</guid><pubDate>Thu, 14 Feb 2008 18:38:00 +0000</pubDate><atom:updated>2008-02-16T01:02:07.358-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web Services</category><title>Different Design Patterns for Web Services-An Overview</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VnFS8PNEOkk/R7SQllk6OSI/AAAAAAAABTs/Di6vdB7uM_0/s1600-h/web.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_VnFS8PNEOkk/R7SQllk6OSI/AAAAAAAABTs/Di6vdB7uM_0/s200/web.jpg" alt="" id="BLOGGER_PHOTO_ID_5166913647917283618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Web Services provide an important building block for integrating disparate  computing platforms and, indirectly, provide a mechanism to integrate their  global value chains. You can build Web Services after the system was originally  deployed, making them similar in many ways to today's EAI software, but you can  also build them along with new software as the open Application Programming  Interface (API) to the application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Advantages of using Web Services&lt;br /&gt;&lt;/span&gt;Using Web Services , you can build an API which islanguage- neutral and platform-neutral format, programmers can access data from  one system and quickly move it to the other through the Web Service. There are  several strengths to this approach: &lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;p class="first-para"&gt;Programmers can write the data-transfer programs in any  language or platform with which they are comfortable.&lt;/p&gt; &lt;/li&gt;&lt;li class="listitem"&gt; &lt;p class="first-para"&gt;The source and target systems can control the requests and  updates of data in such a way that they do not interfere with a running system.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;Consider the number of ways that a simple problem, such as notifying interested  parties of a change to an object's state, are solved with a platform such as  Java 2 Standard Edition. Some developers may use an intermediate file to track  changes, with interested parties reading the file to find out when and how an  object changed. Other developers may &lt;a name="26"&gt;&lt;/a&gt;&lt;a name="page6"&gt;&lt;/a&gt;construct  a point-to-point notification system, or even a set of one-to-many  Publish/Subscribe patterns. Some developers may have one type of naming  convention for the adding and removing of listeners; other developers may not  have any naming convention for the same operations-these are some of the areas where Web Services can be highly useful&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using Design Patterns&lt;br /&gt;&lt;/span&gt;Patterns can be applied to any portion of the software cycle which usually involve gathering requirements, creating the architecture, designing the  software, and implementing it.Thousands of software design patterns document the common problems encountered  by software designers and generic solutions for those problems. For example, an  architect may give a system structure that identifies a point in the system  where an object change drives listeners to make changes in their own state, or  the change kicks off a business process. In these cases, a designer can look and  determine that the Publish/Subscribe or the Observer pattern can fulfill the  requirements and constraints an architect put on the design. Once identification  of patterns is complete, the generic structure given in a pattern drives the  design of the particular system structure.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Web Services Design Patterns&lt;/span&gt;&lt;br /&gt;The following patterns look at how Web Services implement the service-oriented  architecture, how service implementations interact with the Web Service  environment, and how to locate and use Web Services:       &lt;a name="34"&gt;&lt;/a&gt;&lt;a name="page9"&gt;&lt;/a&gt;&lt;b class="bold"&gt;&lt;br /&gt;Service-Oriented Architecture:&lt;/b&gt; The Web Services environment is an  architecture implementation known as the &lt;i class="emphasis"&gt;service-oriented  architecture&lt;/i&gt;. There are several different implementations of the  service-oriented architecture with Web Services having the most penetration in  the industry to date. Implementations of service-oriented architectures stress  two attributes: implementation transparency and location transparency.  Implementation transparency requires a common system structure that applies  equally to all possible underlying service implementations and a neutral  mechanism for describing services. Location transparency requires the use of  agnostic interfaces.&lt;br /&gt;&lt;b class="bold"&gt;Architecture Adapter:&lt;/b&gt; This pattern expands on  the GoF Adapter pattern. Although the GoF Adapter pattern resides in  object-oriented programming as a way to adapt an exposed interface from a  component to an expected dependent interface from another component, the  Architectural Adapter pattern is responsible for allowing two completely  separate architectures to interoperate.&lt;br /&gt;&lt;b class="bold"&gt;Service Directory:&lt;/b&gt; In statically bound  systems, and even in many dynamic systems, companies assume that their choices  for the purchaser of software are the right choices. The Web Service paradigm  challenges this tradition. Instead, by creating detailed metadata about a  service, a service user should be able to locate your service and use it without  application modification. The metadata in a service-oriented architecture  includes its interface, location for binding, mechanism for communication, and  information about the business that created the service. This pattern goes into  depth on the Service Directory patterns that are inherent in the leading service  architectures and that you will encounter in Web Services.&lt;br /&gt;&lt;b class="bold"&gt;Business Object:&lt;/b&gt; This pattern discusses  the typical structure and contents of a single business object. Although the  frequency that you will use a single business object for deployment is low,  there are substantial lessons you can learn from the exercise of deploying a  business object. As with the first three patterns, this pattern is heavy in  discussion around the Web Service environment and lessons you can learn from  deploying relatively simple objects.&lt;br /&gt;&lt;b class="bold"&gt;Business Object Collection:&lt;/b&gt; In business, you  will rarely find business objects that are not collected. Like the business  object itself, handling collections with Web Services yields substantial  instructional substance as you learn more about the Web Service environment.&lt;br /&gt;&lt;b class="bold"&gt;Business Process (Composition):&lt;/b&gt; Business systems  today revolve more around business processes than around supporting business  objects. A business process does not necessarily correlate to a single business  object but is more abstract in nature. This pattern looks at business processes  and lays a general framework for exposing them as Web Services. The business  process is also a form of composition. To achieve a business process, multiple  business objects and, often, other business processes and activities must  run.&lt;br /&gt;&lt;b class="bold"&gt;Asynchronous Business Process:&lt;/b&gt; A world  where all business processes are synchronous would be a fine world to live in  for programmers. Unfortunately, most important business processes are not  synchronous. Even the most basic business processes, such as fulfilling a book  order, run into asynchronous complexities. In introducing the Asynchronous  Business Process pattern, you will find many similarities to the relationship  between business objects and business object collections&lt;br /&gt;&lt;b class="bold"&gt;Event Monitor:&lt;/b&gt; Often, the burden of  determining when events occur in a service lies with the client. There are a  variety of reasons for this, such as the service not having a reasonable  publish/subscribe interface or the client desiring control of the event  determination. This is a common, and relatively simple, design pattern to  implement that has well- established roots throughout software history.&lt;br /&gt;&lt;b class="bold"&gt;Observer:&lt;/b&gt; Rather than leaving a client to  determine when data changed on a server, it is often more efficient to have the  server component tell interested clients when data changes. This is especially  true when the server component has a low frequency of updates compared to the  frequency that clients will want to check. The Observer pattern formalizes the  relationship between one or more clients and a Web Service that contains  interesting state. The Web Service delivers events to interested clients when an  interesting change occurs. The Gang of Four documented the Observer pattern.  This implementation is similar to the original documentation of the pattern,  with necessary information about Web Services.&lt;br /&gt;&lt;b class="bold"&gt;Publish/Subscribe:&lt;/b&gt; The Publish/Subscribe  pattern [Buschmann] is a heavily used pattern in EAI software as well as in many  distributed programming paradigms. The Publish/Subscribe pattern is interesting  in the context of the definition of Web Services as application components.  Using a topic-based mechanism common in very loosely coupled architectures, you  create a stand-alone event service that is, in effect, an application component.  The event service forwards published events to subscribers without awareness of  the application components that use the event service.&lt;br /&gt;&lt;b class="bold"&gt;Physical Tiers:&lt;/b&gt; Throughout the book and  the sample implementations in the chapters, you will use a simple Java-based  deployment mechanism built into Apache Axis. Therefore, your components live  entirely within the process space that Apache Axis uses. This is not an optimal  model for enterprise applications. The model discourages runtime reuse and  creates a larger footprint than is necessary. Further, the event patterns  produced some interesting challenges for a Web Service environment. A client  interested in events from a Web Service often exists in its own process. This  pattern discusses Web Service implementations that must, and often should,  communicate to other processes for their implementation behavior.&lt;br /&gt;&lt;b class="bold"&gt;Faux Implementation:&lt;/b&gt; One of the most  fascinating pieces of the Internet is the ability of someone or something to be  able to pretend to be something they are not and actually get away with it. As  long as an interface and the behavior of a service implementation is what others  expect, there is no way to tell what drives the behavior of the service  implementation. The Observer and Publish/Subscribe patterns require clients to  implement a Web Service to receive event publications. The Faux Implementation  pattern shows that as long as the behavior fulfills the contract, there is no  reason you have to implement a service with traditional mechanisms&lt;br /&gt;&lt;b class="bold"&gt;Service Factory:&lt;/b&gt; Class factories are  common in Java programming. A class factory gives a mechanism to bind to a class  implementation at runtime rather than compile time. The same capability is  possible with service implementations. For example, there is no reason that a  company must use a single package shipper for all shipments. Instead, the  service factory illustrates how your application can determine what service to  use at runtime.&lt;br /&gt;&lt;b class="bold"&gt;Data Transfer  Object:&lt;/b&gt; The Data Transfer Object pattern originated with Java 2 Enterprise  Edition (J2EE) patterns. When you move from a single process application to a  distributed application, calls between participants in the distributed  architecture become more expensive in terms of performance. By giving clients  mechanisms to get groups of commonly accessed data in single operations, you can  streamline clients and lower the number of accesses necessary to your Web  Service.&lt;br /&gt;&lt;b class="bold"&gt;Partial Population:&lt;/b&gt; The Data Transfer  Object pattern passes fully populated data structures between programs. This is  a great paradigm but creates a proliferation of data structures and relegates  the service implementation to determining what the most likely groups of  accessed data will be. Partial population takes a different approach to data  transfers; it allows clients to tell the server what parts of a data structure  to populate. In this way, you can lighten the burden on the communication  mechanism as well as the query in the server object. This technique is  especially useful for services that contain complex, nested data structures (not  something you will typically find in a Web Service  environment).&lt;blockquote class="blockquote"&gt;&lt;blockquote class="blockquote"&gt;   &lt;/blockquote&gt;&lt;blockquote class="blockquote"&gt;   &lt;/blockquote&gt;&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Suggested Reading &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.soaprpc.com/patterns/"&gt;&lt;span style="font-weight: bold;"&gt;Patterns for Service Oriented Architecture&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://webservices.xml.com/pub/a/ws/2004/06/16/patterns.html"&gt;&lt;span style="font-weight: bold;"&gt;Web Services Integration Patterns-Part 1&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://webservices.xml.com/pub/a/ws/2004/06/30/patterns.html"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Web Services Integration Patterns-Part 2&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.enterpriseintegrationpatterns.com/"&gt;&lt;span style="font-weight: bold;"&gt;Enterprise Integration Patterns&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Suggested Video Tutorial&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/hohpe-soa-development"&gt;Developing SOA applications&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/davis-real-world-ws"&gt;Real World Web Services &lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Web Services Middleware&lt;br /&gt;&lt;object height="355" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/PJfxNKplAZ4&amp;amp;rel=1"&gt;&lt;param name="wmode" value="transparent"&gt;&lt;embed src="http://www.youtube.com/v/PJfxNKplAZ4&amp;amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Web Services Overview&lt;br /&gt;&lt;embed style="width: 400px; height: 326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-8382710273255813697&amp;amp;hl=en" flashvars=""&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;Thats All for now !!&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-4042955474069603164?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/eV0E3BV_UCc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/eV0E3BV_UCc/different-design-patterns-for-web.html</link><author>noreply@blogger.com (Yaseen Khan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_VnFS8PNEOkk/R7SQllk6OSI/AAAAAAAABTs/Di6vdB7uM_0/s72-c/web.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/02/different-design-patterns-for-web.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-6060263290676867030</guid><pubDate>Wed, 06 Feb 2008 02:52:00 +0000</pubDate><atom:updated>2008-02-16T01:05:46.120-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Performance Management of Java Applications</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VnFS8PNEOkk/R6kt1JDCABI/AAAAAAAABMc/iXTIMAofAvM/s1600-h/books.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_VnFS8PNEOkk/R6kt1JDCABI/AAAAAAAABMc/iXTIMAofAvM/s200/books.jpg" alt="" id="BLOGGER_PHOTO_ID_5163708838741934098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Today I would like discuss on Performance Management of Java applications and handling memory leaks in Java. Having spend some unnerving moments and time myself ,related to handling memory leaks (OutOfMemoryError) issues in one the enterprise application being already in production in a  clustered environment recently,I was faced with having long meetings and discussions with the customer and the people in the higher hierarchy level at the company ,to fine tune their application which was the source of generating more revenue and profits to them and  as a  Senior Consultant , I was looked upon as source of providing guidance and technical tips to achieve that.And thats when I realized that not always the old paradigm that while using Java we need not worry about  allocating and freeing memory of objects holds true...And here Iam not giving you an overview on the steps or the code I followed &amp;amp; wrote,better you learn yourself,but rather an overview on the tools you can use to manage and fine tune Java applications. To start with let us understand the term  Garbage Collection in Java and in the process of submitting the proof of concept to the customer,the tools that can be used for handling such scenarios ,as part of my R&amp;amp;D I came across the tools mentioned below which will certainly help  Java developers in fine tuning their applications and my personal favorite is YourKit Java Profiler.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Garbage Collection in Java&lt;br /&gt;&lt;/span&gt;In Java ,you create objects, and JVM takes care of removing them when they are no longer needed by the application through a mechanism known as garbage collection.The job of the garbage collector is to find objects that are no longer needed by an application and to remove them when they can no longer be accessed or referenced. The garbage collector starts at the root nodes, classes that persist throughout the life of a Java application, and sweeps though all of the nodes that are referenced. As it traverses the nodes, it keeps track of which objects are actively being referenced. Any classes that are no longer being referenced are then eligible to be garbage collected. The memory resources used by these objects can be returned to the Java virtual machine (JVM) when the objects are deleted...And how best can you do that?  Below is the brief synopsis of the tools you can use in Java for performance tuning.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tools you can use for handling memory leaks and performance management&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/performance/jvmstat/visualgc.html"&gt;VisualGC&lt;/a&gt;- &lt;/span&gt;Visual Garbage Collection Monitoring tool&lt;br /&gt;The &lt;b&gt;visualgc&lt;/b&gt; tool attaches to an instrumented HotSpot JVM and collects and graphically displays garbage collection, class loader, and HotSpot compiler performance data.&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jstat.html"&gt;JSTAT &lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt; The &lt;b&gt;jstat&lt;/b&gt; tool displays performance statistics for an instrumented HotSpot Java virtual machine (JVM). The target JVM is identified by its virtual machine identifier, or &lt;a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jstat.html#vmidoption"&gt;&lt;i&gt;vmid&lt;/i&gt;&lt;/a&gt; option described below.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;:This utility is unsupported and may not be available in future versions of the J2SE SDK. It is not currently available on Windows 98 and Windows ME platforms.&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: left;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jmap.html"&gt;JMap&lt;/a&gt;&lt;br /&gt;&lt;b&gt;jmap &lt;/b&gt;prints shared object memory maps or heap memory details of a given process or core file or a remote debug server.This utility is unsupported and may or may not be available in future versions of the J2SE SDK.&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="https://hat.dev.java.net/"&gt;Hat&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;HAT is a program that analyzes a heap dump file for Java programs. This tool can help a developer to debug and analyze the objects in a running Java program. It is particularly useful when debugging unintentional object retention.&lt;strong&gt;&lt;/strong&gt;     Starting with Java SE 6, HAT has been replaced with jhat, which     is included with the standard Sun     distribution.  HAT is      not being maintained in a stand-alone configuration. The Heap Analysis  Tool (HAT) helps to debug unnecessary object retention (sometimes called "memory leaks") by providing a convenient  means to browse the object topology in a heap snapshot, which is generated by  the Java VM.  HAT reads a hprof file, then sets itself up as a web  server--therefore allowing you to run queries against a heap dump contained  within the hprof file.For further information, &lt;a href="https://hat.dev.java.net/doc/README.html"&gt;read this article&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.quest.com/jprobe/"&gt;JProbe&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;JProbe &lt;/strong&gt;is an enterprise-class Java profiler providing intelligent diagnostics on memory usage, performance and test coverage, allowing developers to quickly pinpoint and repair the root cause of application code performance and stability problems that obstruct component and integration integrity. With JProbe’s intuitive, unified UI, it’s easier to navigate and configure all JProbe analysis tools.JProbe also provides a powerful filtering mechanism for controlling the data display, including nine different metrics for sorting and coloring data for clutter-free, easier viewing.&lt;/p&gt;&lt;a href="http://www.yourkit.com/features/index.jsp"&gt;Yourkit Java Profiler&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The best part about Yourkit Java Profiler is , it does integrate seamlessly with different IDEs like Eclipse,Intellij etc and provides full support for Java 5 and Java 6.For the list of benefits and features,this great tool provides ,read &lt;a href="http://www.yourkit.com/features/index.jsp"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And thats all for now,say whatever you want to and any other tools that can be used for handling memory leaks in Java.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www-306.ibm.com/software/awdtools/purify/"&gt;Rational Purify&lt;/a&gt;&lt;br /&gt;IBM Rational Purify is a runtime analysis solution designed to help developers write more reliable code. Reliability is ensured via two crucial functions: memory corruption detection and memory leak detection.For further understanding about using Rational Purify , read this &lt;a href="http://www.ibm.com/developerworks/rational/library/1499.html"&gt;article&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Suggested Video Tutorial&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="http://www.infoq.com/presentations/maintaining-production-java-apps"&gt;Maintaining Java Apps in Production Environment&lt;/a&gt;- by &lt;/span&gt;      Alexandre Rafalovitch at InfoQ&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-6060263290676867030?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/xty3_6MWB0U" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/xty3_6MWB0U/performance-management-of-java.html</link><author>noreply@blogger.com (Yaseen Khan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_VnFS8PNEOkk/R6kt1JDCABI/AAAAAAAABMc/iXTIMAofAvM/s72-c/books.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/02/performance-management-of-java.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-8586171316396030434</guid><pubDate>Thu, 31 Jan 2008 08:42:00 +0000</pubDate><atom:updated>2008-02-16T01:02:07.359-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web Services</category><title>SOA Testing-A look at products you can use</title><description>SOA is such a buzzword since late 2006 ,that it made me sit up and realize its virtue &amp;amp; importance  in Enterprise application development.And having been involved with SOA for a while now,like implementing couple of applications,somewhere down the line I was thinking about how best I can test my SOA application put together in enterprise integration.And as expected by Gartner that by mid 2009 ,nearly 80% of the enterprises development and integration budgets &amp;amp; effort will be devoted to SOA applications alone,that doubled my efforts to get to know about some products and tools for effectively(both unit &amp;amp; integration) testing my SOA applications suite,be it the front end,services layer ,message exchange(ESB layer) and database ,thats when I came across "&lt;a href="http://www.itko.com/site/lisa/"&gt;LISA&lt;/a&gt;",the product  I would like to share with everyone and give a brief overview.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.itko.com/site/default.jsp"&gt;iTKO LISA&lt;/a&gt;,The LISA 4 Complete SOA Test Platform is a comprehensive testing solution that reduces the effort and cost of SOA test creation and maintenance, while allowing your team to drastically improve quality levels over time through test reuse.LISA will carry developers, QA teams and business analysts from unit testing, to regressions, functional testing, end-to-end integration, load testing, and monitoring after deployment.LISA is a complete no-code software testing solution that supports the entire team's development lifecycle for dynamic web apps, web services, ESB messaging layers, enterprise Java, .NET, data and legacy objects, and more.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why you need LISA?&lt;br /&gt;&lt;/span&gt;&lt;p&gt;To deliver quality SOA applications, enterprises need to achieve Complete, Collaborative, and Continuous TM SOA testing (The "Three C's"):&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;b&gt;Complete&lt;/b&gt; testing of business workflows across every heterogeneous technology layer of the SOA, at both a system and component level.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Collaborative&lt;/b&gt; involvement of the whole team in quality. Enable both developers and non-programmers to define and share test cases that prove how the SOA meets business requirements during the entire application lifecycle.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Continuous&lt;/b&gt; validation of a changing SOA deployment as it is consumed at runtime, ensuring that business requirements will continue to be met as the system dynamically changes.&lt;/li&gt;&lt;/ol&gt;LISA was built to specifically meet the above criteria. &lt;ul&gt;&lt;li&gt;&lt;b&gt;Continuous testing at every phase.&lt;/b&gt; LISA can be used to automate unit and functional tests early in development, then leverage the same tests in regression builds, load tests and performance monitors that run over time. In addition to typical test data such as pass/fail or response times, LISA gives you real functional validation every time you test. So LISA gives you "black box" testing, "white box" testing, and every color "box" in between.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Every technology.&lt;/b&gt; LISA tests web applications, but can go way beyond "screen deep" in validating whether or not they are working as planned. In the same test case as your web apps, you automatically gain the protocols to directly instrument web services, messaging layers, databases, J2EE servers and more, without coding. And LISA's extensibility to test your custom apps is second to none.&lt;/li&gt;&lt;li&gt;&lt;b&gt;At any scale.&lt;/b&gt; LISA supports incredibly complex, multidimensional test workflows with drastically reduced effort and very low system overhead. Using LISA Load/Performance Server, you can schedule your tests to automatically run at any time interval, or trigger them with any system event. And LISA's efficient load engines can simulate hundreds, or 100s of thousands of users, with full functional validation and reporting of every transaction.&lt;/li&gt;&lt;/ul&gt;There are three different versions of LISA,here is an overview of each of them&lt;br /&gt;1)LISA Enterprise Edition SOA Testing -This edition provides provides a test client to directly invoke and verify business requirements at the service component level, at the integration layer, and across the entire workflow that makes up a business process.Using this,you can do functional testing of your web user interfaces and the data residing below the UI.And it does provide support for ensuring interoperability, predictable project delivery and end-to-end quality for all major integration platforms, including IBM MQ-Series, TIBCO, webMethods, Oracle FUSION, Sun JCAPS, Sonic MQ, Fiorano and other leading providers along with Business Process validation.&lt;br /&gt;2)LISA Server-LISA Server automates and schedules LISA test cases and suites, providing sophisticated staging, user simulation and continuous build and performance test orchestration capabilities for a constantly evolving SOA application environment.LISA allows for testing individual components, process, and workflows during design and development, during integration, and in deployment. Capability for Individual functional tests and system-wide business processes load testing.&lt;br /&gt;3)LISA Extension Kit(LEK)-Many complex enterprise applications, even those that are based on open standards, are built within a custom framework or developed on non-supported platforms that LISA does not yet know about. Using LEK allows LISA users to test custom systems just as natively - without writing test code - as the existing technologies that LISA tests out of the box.&lt;br /&gt;&lt;br /&gt;And coming to the benefits ,LISA provide in SOA testing,&lt;a href="http://www.itko.com/site/products/lisa/soa_platform.jsp"&gt;here&lt;/a&gt; is the brief synopsis.&lt;br /&gt;&lt;h4&gt;SOA Platform Support enhancements provided by LISA include:&lt;/h4&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;ESB Native Integrations:&lt;/b&gt; When you need to test an ESB, you should to be able to test every aspect of your integration layer - and LISA natively tests against every access point of ESB systems in ways that no other solution can, whether those are JMS messages, Web Services running on the bus, or connection databases. LISA provides out-of-the-box support for IBM MQ-Series, TIBCO, webMethods, Oracle FUSION, BEA AquaLogic, Sun JCAPS, Sonic MQ, Fiorano and other leading ESB/integration providers.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Governance Platform support:&lt;/b&gt; LISA tests provide an excellent way to check in SOA Tests as enforceable and verifiable SOA Policy example alongside services in the repository. Leading enterprise and public sector customers are using LISA as a quality certification platform to ensure trust across multiple services, and the divisions and teams that build, support, and leverage them. LISA supports both the process of Publishing services to a larger community with verifiable service levels, as well as Consuming services with well-defined requirements.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Virtual Endpoint Testing &amp;amp; Lookup:&lt;/b&gt; As SOA Governance practices evolve, the Registry/Repository is becoming a system of reference for flexibly building and managing the services that inhabit a loosely coupled environment. LISA interoperates with Type 2 and 3 UDDI registries and service repositories from leading providers such as CentraSite, Infravio, Systinet, BEA/Flashline, and others, providing a way to leverage them for lookup of the most recent services during test design, and dynamic "hookup" of services during test runs through the registry.&lt;/li&gt;&lt;/ul&gt;And it does provide support for RIA(Rich Internet Applications) testing, SOAP/WSDL testing,JMS testing to name few more benefits.&lt;br /&gt;&lt;br /&gt;Having gone through the docs and some webinars myself,I became more curious to get to know about this product and Iam in the process of evaluating this great product by &lt;span style="font-weight: bold;"&gt;iTKO &lt;/span&gt;and I do feel most of the SOA developers/architects should have a look at this product and see how best it reduces the bottlenecks and decrease head aches for SOA initiation.It does have &lt;a href="http://www.itko.com/forums/index.jspa"&gt;user forums&lt;/a&gt; and lots of white papers and documentation to make you feel at home and help you out in choosing best practices ,installation guide,faqs etc&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Note :  LISA is a java application and runs on a JRE 1.4.2.x or 1.5.x LISA has production customers on Windows, LINUX, HPUX, AIX, Solaris and OSX&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Suggested Reading&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.itko.com/site/resources/webinars.jsp"&gt;LISA Webinars&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://javaboutique.internet.com/reviews/iTKO_LISA/"&gt;Java Boutique's Article&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-8586171316396030434?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/qyw2H_9PsMI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/qyw2H_9PsMI/testing-of-multi-tier-soa-applications.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/testing-of-multi-tier-soa-applications.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-6823166139639057271</guid><pubDate>Sat, 26 Jan 2008 23:19:00 +0000</pubDate><atom:updated>2008-02-16T01:03:29.219-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JMS</category><title>Importance of "Java Messaging Service" (JMS API) in Server Side Development</title><description>According to me Server-side programming &amp;amp; developing server-side components is the most challenging area for any Java Developer.Gone are the days for simpler client/server applications,and with emerging technologies like SOA,ESB(Enterprise Service Bus),BPM(Business Process Management) being considered by many large scale companies be it in financial sector or any other domain for their applications which are mainly n-tier applications,the efforts need to be put in designing and developing middle-tier components has increased and if you see ,most of the open source frameworks main focus is on Server-side programming,being a critical component in any n-tier application.And one API which has made my life easy in that regard is Java Messaging Service(JMS).&lt;br /&gt;&lt;br /&gt;In my initial days(Iam talking about 9 years back) with Java,while working on different assignments I used different technologies like RMI,Corba and EJB for developing such applications and having seen the growth and emergence of different frameworks and APIs,I would have loved to start my IT career ,may be couple of years back but those struggling days have definitely made me sit up and realize the importance and advantages these new technologies are helping me out in design and development particularly in integration of enterprise applications in distributed computing arena with regards to developing highly scalable,reliable,loosely coupled messaging systems and providing asynchronous interactions&lt;br /&gt;among J2EE components and legacy systems capable of messaging,compared to tightly coupled integration &amp;amp; legacy I was part of in my initial days.&lt;br /&gt;&lt;br /&gt;Ok lets analyze the strides made by JMS API and the benefits &amp;amp; advantages it provides to any server side developer or architect.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is Messaging?&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Messaging is a method of communication between software components or applications.A messaging system is a peer-to-peer facility: A messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating, sending, receiving, and reading messages. Messaging enables distributed communication that is loosely coupled. A component sends a message to a destination, and the recipient can retrieve the message from the destination. However, the sender and the receiver do not have to be available at the same time in order to communicate. In fact, the sender does not need to know anything about the receiver; nor does the receiver need to know anything&lt;br /&gt;about the sender. The sender and the receiver need to know only what message format and what destination to use. In this respect, messaging differs from tightly coupled technologies, such as Remote Method Invocation (RMI) or RPC which require an application to know a remote application’s methods.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;Overview&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Enterprise messaging products (or as they are sometimes called, Message Oriented Middleware products) are becoming an essential component for integrating intra-company operations. They allow separate business components to be combined into a reliable, yet flexible, system.&lt;br /&gt;In addition to the traditional MOM vendors, enterprise messaging products are also provided by several database vendors and a number of internet related companies.Java language clients and Java language middle tier services must be capable of using these messaging systems. JMS provides a common way for Java language programs to access these systems.the JMS API defines a common set of interfaces and associated semantics that allow programs written in the Java programming language to communicate with other messaging implementations.&lt;br /&gt;And thats where JMS is useful and if you add Message Driven Beans(MDB) (combination of Session beans and JMS clients) ,introduced as part of EJB2.0 Specification,then you have an effective asynchronous messaging system in your middletier which covers areas like &lt;/span&gt;security, concurrency, transaction etc.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;The &lt;a href="http://java.sun.com/products/jms/"&gt;JMS API&lt;/a&gt; enables communication that is not only loosely coupled but also&lt;br /&gt;• Asynchronous. A JMS provider can deliver messages to a client as they arrive;a client does not have to request messages in order to receive them.&lt;br /&gt;• Reliable. The JMS API can ensure that a message is delivered once and only once. Lower levels of reliability are available for applications that can afford to miss messages or to receive duplicate messages.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why do you need JMS ?&lt;br /&gt;&lt;/span&gt;There are several reasons why you need JMS in a enterprise middleware application :&lt;br /&gt;i)Decoupling : Different parts of an application can be developed such that they are not closely tied to each other&lt;br /&gt;ii)Flexible Integration:Conversely loosely coupled systems can be put together by using MDB for wrapping existing systems.&lt;br /&gt;iii)Separation of elements involved in messaging applications,for example a logging event can be separated from ,say retrieving a customer details in a bank application.&lt;br /&gt;iv)Delivering low-level services of an application in offline-mode,meaning although the service must be provided, the main workflow doesnt have to wait for its completion,for example a logging service&lt;br /&gt;v)Delivering same information to multiple-parties&lt;/span&gt;&lt;br /&gt;vi)Most of the top J2EE application servers support messaging.Sun    provides a list of JMS vendors at &lt;a target="_blank" href="http://java.sun.com/products/jms/vendors.html"&gt;http://java.sun.com/products/jms/vendors.html&lt;/a&gt;.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Some myths &amp;amp; drawbacks about using JMS&lt;br /&gt;&lt;/span&gt;1)Additional overhead in handling messages and messaging systems&lt;br /&gt;2)Message-based system can be a single point of failure.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Different types of Messages&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;There are two main ways to send messages: point-to-point and publish-subscribe.&lt;br /&gt; A point-to-point messaging(queue) application has a single producer (usually) and a    single consumer. The producer produces messages while the consumer consumes    them.A point-to-point system can actually have multiple producers,but usually only    a single consumer. For example a print server,any machine on the    network can send a print job to a particular print server.&lt;br /&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;The publish-subscribe messaging model (&lt;i&gt;pub-sub&lt;/i&gt;) is more of a broadcast-oriented    model. Publish-subscribe is based on the idea of topics and typically has many    consumers-and potentially many producers as well.For example, subscription to any forum&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Fundamentals in JMS API&lt;br /&gt;&lt;/span&gt;The basic elements in JMS are administered objects(connection factories &amp;amp; destinations),connections,sessions,message producers,message consumers ,queues ,topics and messages.&lt;br /&gt;&lt;br /&gt;A connection factory is the object a client uses to create a connection with a provider.A connection factory encapsulates a set of connection configuration parameters that has been defined by an administrator. A pair of connection factories come preconfigured with the J2EE SDK and are accessible as soon as you start the service.Each connection factory is an instance of either the QueueConnectionFactory or the TopicConnectionFactory interface.&lt;br /&gt;&lt;br /&gt;A message producer is an object created by a session and is used for sending messages to a destination. The Point-to-Point form of a message producer implements the Queue-Sender interface. The pub/sub form implements the TopicPublisher interface.&lt;br /&gt;&lt;br /&gt;A message consumer is an object created by a session and is used for receiving messages sent to a destination. A message consumer allows a JMS client to register interest in a destination with a JMS provider. The JMS provider manages the delivery of messages from a destination to the registered consumers of the destination.The PTP form of message consumer implements the QueueReceiver interface.The pub/sub form implements the TopicSubscriber interface.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Different JMS Message Types&lt;/span&gt;&lt;br /&gt;The JMS API defines five message body formats, also called message types, which allow you to send and to receive data in many different forms and provide compatibility with existing messaging formats.&lt;br /&gt;i)TextMessage : A java.lang.String object (for example, the contents of an Extensible Markup Language file).&lt;br /&gt;ii)MapMessage : A set of name/value pairs, with names as String objects and values as primitive types in the Java programming language. The entries can be accessed sequentially by enumerator or randomly by name. The order of the entries is undefined.&lt;br /&gt;iii)BytesMessage : A stream of uninterpreted bytes. This message type is for literally encoding a body to match an existing message format.&lt;br /&gt;iv)StreamMessage: A stream of primitive values in the Java programming language,filled and read sequentially.&lt;br /&gt;v)ObjectMessage :A Serializable object in the Java programming language.&lt;br /&gt;vi)Message : Composed of header fields and properties only. This message type is useful when a message body is not required.&lt;/span&gt;&lt;p&gt;In order to use JMS, one must have a JMS provider that can manage the sessions and queues. There are &lt;a href="http://en.wikipedia.org/wiki/Free_software" title="Free software"&gt;free&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Open_source" title="Open source"&gt;open source&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Proprietary_software" title="Proprietary software"&gt;proprietary&lt;/a&gt; providers.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Articles about open source providers&lt;/b&gt;:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Apache_Software_Foundation" title="Apache Software Foundation"&gt;Apache&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/ActiveMQ" title="ActiveMQ"&gt;ActiveMQ&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/OpenJMS" title="OpenJMS"&gt;OpenJMS&lt;/a&gt; from The OpenJMS Group&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/JBoss_Messaging" title="JBoss Messaging"&gt;JBoss Messaging&lt;/a&gt; from &lt;a href="http://en.wikipedia.org/wiki/JBoss_%28company%29" title="JBoss (company)"&gt;JBoss&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/w/index.php?title=JORAM&amp;amp;action=edit" class="new" title="JORAM"&gt;JORAM&lt;/a&gt;, from &lt;a href="http://en.wikipedia.org/wiki/Objectweb" title="Objectweb"&gt;Objectweb&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://sourceforge.net/projects/mantaray/"&gt;Mantaray &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;b&gt;Articles about proprietary providers:&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/w/index.php?title=WebMethods_Broker_Server&amp;amp;action=edit" class="new" title="WebMethods Broker Server"&gt;webMethods Broker Server&lt;/a&gt; from &lt;a href="http://en.wikipedia.org/wiki/WebMethods" title="WebMethods"&gt;webMethods&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/WebSphere_Application_Server" title="WebSphere Application Server"&gt;WebSphere Application Server&lt;/a&gt; from &lt;a href="http://en.wikipedia.org/wiki/IBM" title="IBM"&gt;IBM&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/WebSphere_MQ" title="WebSphere MQ"&gt;WebSphere MQ&lt;/a&gt; from &lt;a href="http://en.wikipedia.org/wiki/IBM" title="IBM"&gt;IBM&lt;/a&gt; (formerly MQSeries)&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/SAP_NetWeaver" title="SAP NetWeaver"&gt;SAP NetWeaver&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/SAP_Web_Application_Server" title="SAP Web Application Server"&gt;WebAS&lt;/a&gt; Java JMS from &lt;a href="http://en.wikipedia.org/wiki/SAP_AG" title="SAP AG"&gt;SAP AG&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Oracle_AQ" title="Oracle AQ"&gt;Oracle AQ&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Sun_Java_System_Message_Queue" title="Sun Java System Message Queue"&gt;Sun Java System Message Queue&lt;/a&gt; ... also available as &lt;a href="http://en.wikipedia.org/wiki/Open_Source" title="Open Source"&gt;Open Source&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/BEA_Weblogic" title="BEA Weblogic"&gt;BEA Weblogic&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/TIBCO_Software" title="TIBCO Software"&gt;TIBCO Software&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Suggested Reading&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.informit.com/articles/article.aspx?p=26269"&gt;Importance of JMS &lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.informit.com/articles/article.aspx?p=26266"&gt;Benefits of JMS&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-6823166139639057271?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/gPcuKtMd96w" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/gPcuKtMd96w/importance-of-java-messaging-service.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/importance-of-java-messaging-service.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-4936317016724040664</guid><pubDate>Wed, 23 Jan 2008 22:36:00 +0000</pubDate><atom:updated>2008-02-18T21:25:36.564-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spring Framework</category><title>Aspect Oriented Programming-Spring AOP</title><description>&lt;p style="margin-bottom: 0.2in;" align="left"&gt;&lt;a name="intelliTxt1"&gt;&lt;/a&gt;In continuation of the series of articles on Spring Framework,today lets explore the possibilities and solutions that can be achieved by using Aspect Oriented Programming,AOP and in particular Spring AOP.To start with I would like to delve upon core concepts related to AOP ,the myths and realities surrounding it,benefits over OOP(Object Oriented Programming) and the areas where it can be used effectively.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;History of AOP?&lt;/b&gt;&lt;br /&gt;object-oriented programming (OOP) introduced the concept of the object, which initiated a new way to structure applications and write programs. The same idea applies to the concept of the aspect.In 1996, Gregor Kiczales and his team at the Palo Alto Research Center (PARC), a subsidiary of Xerox Corporation that is located in California, originally defined the concept of the aspect.&lt;br /&gt;&lt;b&gt;Definition of aspect&lt;/b&gt;&lt;br /&gt;An aspect is a common feature that's typically scattered across methods, classes, object hierarchies, or even entire object models. It is behavior that looks and smells like it should have structure, but you can't find a way to express this structure in code with traditional object-oriented techniques&lt;br /&gt;&lt;br /&gt;&lt;b&gt;AOP vs OOP&lt;/b&gt;&lt;br /&gt;The aim behind the development of OOP was to organize the data of an&lt;br /&gt;application and its associated processing into coherent entities. Doing so was achieved by having objects that encapsulate data along with the methods that manipulate the data and carry out the processing.From a conceptual point of view, an application is broken down according to the realworld objects that it models. In a stock-management application, for example, you might find&lt;br /&gt;supplier, article, customer, and other types of objects.By grouping together all the objects that possess the same characteristics, the concept of a class complements the concept of the object.&lt;br /&gt;OOP has undeniably improved software engineering.Developers have built more-complex programs in a simpler fashion than would have been possible through procedural programming. Furthermore, developers have written large applications in object-oriented languages. For example, the Java 2 Platform, Enterprise Edition (J2EE) application servers were programmed in the Java language. Similarly, developers have implemented complex class hierarchies to construct graphical user interfaces. The Swing API,included in Java 2 Platform, Standard Edition (J2SE), falls into this category.AOP simply adds new concepts that allow you to improve object-oriented applications by making them more modular. In addition, AOP streamlines the development process by allowing the separation of development tasks. For example, highly technical functionalities, such as security.AOP allows us to dynamically modify our static model to include the code required to fulfill the secondary requirements without having to modify the original static model&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Benefits over OOP&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0.2in;" align="left"&gt;Writing clear and elegant programs using only OOP is impossible in at least two cases when the application contains crosscutting functionalities, and when the application includes code scattering.Let us explore a bit on these limitations.&lt;/p&gt;&lt;p style="margin-bottom: 0.2in;" align="left"&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0.2in;" align="left"&gt;&lt;b&gt;Cross-cutting concerns&lt;/b&gt;&lt;br /&gt;While organizing an application into classes,the analysis must be driven by the need for separating and encapsulating the data and its associated processing into coherent entities.Although the classes are programmed independently of one another, they are sometimes behaviorally interdependent. Typically, this is the case when you implement rules of referential integrity. For example, a customer object must not be deleted while an outstanding order remains unpaid; otherwise, the program risks losing the contact details for that customer. To enforce this rule, you could modify the customer-deletion method so that it initially determines whether all the orders have been paid. However, this solution is deficient for several reasons:• Determining whether an order has been paid does not belong to customer management but to order management. Therefore, the customer class should not have to manage this&lt;br /&gt;functionality. The customer class should not need to be aware of all the data-integrity rules that other classes in the application impose. Modifying the customer class to take these data-integrity rules into account restricts the possibilities of reusing the class in other situations. In other words, once the customer class implements any functionality that is linked to a different class, customer is no longer independently reusable, in many cases. Despite the fact that the customer class is not the ideal place to implement this referential-integrity rule, many object-oriented programs work this way for lack of a better solution. You might be thinking about integrating this functionality into an order class instead,but this solution is no better. No reason exists for the order class to allow the deletion of a customer. Strictly speaking, this rule is linked to neither the customers nor the orders but cuts across these two types of entities.One of the aims of dividing the data into classes is making the classes independent from one another. However, crosscutting functionalities, such as the rules of referential integrity,appear superimposed on the division—violating the independence of the classes. In other words, OOP does not allow you to neatly implement crosscutting functionalities.&lt;/p&gt;&lt;p style="margin-bottom: 0.2in;" align="left"&gt; &lt;/p&gt;&lt;p style="margin-bottom: 0.2in;" align="left"&gt;&lt;b&gt;Code-Scattering&lt;/b&gt;&lt;br /&gt;In OOP, the principal way that objects interact is by invoking methods. In other words, an object that needs to carry out an action invokes a method that belongs to another object. (An object can also invoke one of its own methods.) OOP always entail two roles: that of the invoker and that of the invoked.When you write the code to call a method, you do not need to worry about how the service is implemented because the call interacts only with the interface of the invoked object. You need only ensure that the parameters in the call correspond to those of the method’s signature.Because methods are implemented within classes, you write each method as a block of code that is clearly delimited. To change a method, you obviously modify the file that contains the class where the method is defined. If you alter just the body of the method, the modification is transparent because the method will still be called in exactly the same way.However, if you change the method’s signature (for example, by adding a parameter),further implications arise. You must then modify all the calls to the method, hence you must modify any classes that invoke the method. If these calls exist in several places in the program,&lt;br /&gt;making the changes can be extremely time-consuming.The main point is this: Even though the implementation of a method is located in a single class, the calls to that method can be scattered throughout the application. This phenomenon of code scattering slows down maintenance tasks and makes it difficult for object-oriented applications to adapt and evolve.&lt;br /&gt;&lt;br /&gt;Ofcourse we can use design patterns like &lt;a href="http://en.wikipedia.org/wiki/Observer_pattern"&gt;Observer&lt;/a&gt; &amp;amp; &lt;a href="http://en.wikipedia.org/wiki/Decorator_pattern"&gt;Decorator&lt;/a&gt; in OOP to handle such scenerios like cross-cutting concerns and code scattering.And the advantages associated by implementing them are enhanced modularity of the code and effective testing.In general Aspects are used to implement functionalities (security, persistence, logging, and so on) within an application.An aspect allows you to integrate crosscutting functionalities and code scattering into an object-oriented application by using the new concepts of the pointcut, the joinpoint, and the advice.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Pointcut"&gt;&lt;b&gt;Pointcut&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;Its the point of execution in the application at which cross-cutting concern needs to be applied.&lt;br /&gt;In &lt;a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming"&gt;aspect-oriented&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Computer_programming"&gt;computer programming&lt;/a&gt;, a &lt;b&gt;pointcut&lt;/b&gt; is a &lt;a href="http://en.wikipedia.org/wiki/Set"&gt;set&lt;/a&gt; of &lt;a href="http://en.wikipedia.org/wiki/Join_point"&gt;join points&lt;/a&gt;. Whenever the &lt;a href="http://en.wikipedia.org/wiki/Computer_program"&gt;program&lt;/a&gt; execution reaches one of the join points described in the pointcut, a piece of &lt;a href="http://en.wikipedia.org/wiki/Code"&gt;code&lt;/a&gt; associated with the pointcut (called &lt;a href="http://en.wikipedia.org/wiki/Advice_in_aspect-oriented_programming"&gt;advice&lt;/a&gt;) is executed. This allows a programmer to describe where and when additional code should be executed in addition to an already defined &lt;a href="http://en.wikipedia.org/wiki/Behavior"&gt;behavior&lt;/a&gt;. This permits the addition of &lt;a href="http://en.wikipedia.org/wiki/Aspect_%28computer_science%29"&gt;aspects&lt;/a&gt; to existing software, or the &lt;a href="http://en.wikipedia.org/wiki/Design"&gt;design&lt;/a&gt; of &lt;a href="http://en.wikipedia.org/wiki/Software"&gt;software&lt;/a&gt; with a clear &lt;a href="http://en.wikipedia.org/wiki/Separation_of_concerns"&gt;separation of concerns&lt;/a&gt;, wherein the programmer &lt;a href="http://en.wikipedia.org/w/index.php?title=Weave_%28AOP%29&amp;amp;action=edit"&gt;weaves&lt;/a&gt; (merges) different &lt;a href="http://en.wikipedia.org/wiki/Aspect_%28computer_science%29"&gt;aspects&lt;/a&gt; into a complete &lt;a href="http://en.wikipedia.org/wiki/Application_software"&gt;application&lt;/a&gt;. In Spring the a pointcut is just a set of methods that, when called, should have advices invoked around them. This is the second important pieces of a Spring AOP aspect implementation!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Join Points&lt;/b&gt;&lt;br /&gt;A &lt;b&gt;join point&lt;/b&gt; is a point in the &lt;a href="http://en.wikipedia.org/wiki/Control_flow"&gt;control flow&lt;/a&gt; of a &lt;a href="http://en.wikipedia.org/wiki/Computer_program"&gt;program&lt;/a&gt;. In &lt;a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming"&gt;aspect-oriented programming&lt;/a&gt; a &lt;a href="http://en.wikipedia.org/wiki/Set"&gt;set&lt;/a&gt; of join points is described as a &lt;a href="http://en.wikipedia.org/wiki/Pointcut"&gt;pointcut&lt;/a&gt;. A join point is where the main program and the &lt;a href="http://en.wikipedia.org/wiki/Aspect_%28computer_science%29"&gt;aspect&lt;/a&gt; meet(such as field access, method invocation , constructor invocation, etc.). Spring's built-in AOP only supports method invocation currently.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Advice&lt;/b&gt;&lt;br /&gt;In &lt;a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming"&gt;aspect&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Functional_programming"&gt;functional programming&lt;/a&gt;, &lt;b&gt;advice&lt;/b&gt; describes a class of &lt;a href="http://en.wikipedia.org/wiki/Function"&gt;functions&lt;/a&gt; which modify other functions when the latter are run; it is a certain function, method or procedure that is to be applied at a given &lt;a href="http://en.wikipedia.org/wiki/Join_point"&gt;join point&lt;/a&gt; of a program.&lt;br /&gt;&lt;br /&gt;Here is the example ,The aspect ibelow parodies the traditional "Hello World" for AspectJ by providing an aspect that captures all calls to the &lt;tt&gt;void foo(int, String)&lt;/tt&gt; method in the &lt;tt&gt;MyClass&lt;/tt&gt; class.&lt;br /&gt;&lt;br /&gt;A simple HelloWorld aspect in AspectJ  &lt;/p&gt; &lt;pre style="text-align: left;"&gt;public aspect HelloWorld&lt;br /&gt;{&lt;br /&gt;pointcut callPointcut( ) :&lt;br /&gt; call(void foo(int, String));&lt;br /&gt;before( ) : callPointcut( )&lt;br /&gt;{&lt;br /&gt; System.out.println(&lt;br /&gt;    "Hello World");&lt;br /&gt; System.out.println(&lt;br /&gt;    "In the advice attached to the call pointcut");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/AOP-Myths-and-Realities"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/a&gt;&lt;/pre&gt;&lt;p align="left"&gt; OK having understood the history behind AOP and the terminology associated with it,lets explore the subject for today,Spring AOP&lt;/p&gt; &lt;h3 align="left"&gt;AOP basics&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;strong&gt;Aspect:&lt;/strong&gt;  A modularized implementation of a software concern that cuts across  various objects in a software implementation. Logging is a good  example of an aspect. In Spring AOP, aspects are nothing more than  regular Spring beans, which themselves are plain-old Java objects  (POJO) registered suitably with the Spring Inversion of Control  container. The core advantage in using Spring AOP is its ability to  realize the aspect as a plain Java class.   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;strong&gt;Join point:&lt;/strong&gt;  A point during program execution, such as a method executing or an  exception being handled. In Spring AOP, a join point exclusively  pertains to method execution only, which could be viewed as a  limitation of Spring AOP. However, in reality, it is enough to  handle most common cases of implementing crosscutting concerns.   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;strong&gt;Advice:&lt;/strong&gt;  Information about "when" an aspect is to be executed with  respect to the join point. Examples of types of advice are "around,"  "before," and "after." They specify when the  aspect's code will execute with respect to a particular join point.   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p align="left"&gt;&lt;strong&gt;Pointcut:&lt;/strong&gt; A declarative condition  that identifies the join points for consideration during an  execution run. Pointcut is specified as an expression. Spring AOP  uses the AspectJ pointcut expression syntax. An example pointcut  expression is: &lt;code&gt;execution(*  com.myorg.springaop.examples.MyService*.*(..))&lt;/code&gt;. Asterisks in  the expression refer to wildcards, as is conventiona&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;b&gt;Spring AOP&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The Spring Framework integrates with more powerful AOP frameworks, such as AspectJ .To use Spring AOP, you need to implement cross-cutting concerns and configure those concerns&lt;br /&gt;in your applications.Any advice written for Spring AOP is configurable in the Spring container through a simple, consistent configuration. This configuration is an important aspect of using AOP in Spring because it is the only one you need to remember for creating extension points to existing classes.For further understanding I recommend reading the following articles ,instead of me touching upon the Spring AOP concepts here again,as anyways they are self-explanatory.&lt;/p&gt;&lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;a href="http://www.onjava.com/pub/a/onjava/2004/07/14/springaop.html?page=1"&gt;Spring AOP&lt;/a&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;a href="http://www.onjava.com/pub/a/onjava/2004/07/14/springaop.html?page=1"&gt;&lt;/a&gt;&lt;a href="http://www.infoq.com/presentations/colyer-enterprise-aop"&gt;Implementing Spring AOP in Enterprise Applications&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;" align="left"&gt;&lt;a href="http://www.onjava.com/pub/a/onjava/2004/07/14/springaop.html?page=1"&gt;&lt;/a&gt;&lt;a href="http://www.javaworld.com/javaworld/jw-01-2007/jw-0105-aop.html"&gt;Implementing Cross Cutting concerns using Spring 2.0 AOP&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://www.onjava.com/pub/a/onjava/2004/07/14/springaop.html?page=1"&gt;&lt;/a&gt;&lt;a href="http://www.devx.com/Java/Article/30799/0/page/2"&gt;Implementing Logging as an Aspect using Spring AOP Framework&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/AOP-Myths-and-Realities"&gt;Suggested Video Tutorial by Ramnivas Laddad on AOP(Author of AspectJ in Action)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;GoogleTech Talks Video by Gregor Kiczales,who introduced Aspects&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre style="text-align: left;"&gt;&lt;a href="http://www.infoq.com/presentations/AOP-Myths-and-Realities"&gt;&lt;b style="font-weight: bold;"&gt;&lt;/b&gt;&lt;br /&gt;&lt;/a&gt;&lt;/pre&gt;&lt;br /&gt;&lt;object height="355" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/cq7wpLI0hco&amp;amp;rel=1"&gt;&lt;param name="wmode" value="transparent"&gt;&lt;embed src="http://www.youtube.com/v/cq7wpLI0hco&amp;amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-4936317016724040664?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/8fkV9t2dZyE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/8fkV9t2dZyE/aspect-oriented-programming-spring-aop.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/aspect-oriented-programming-spring-aop.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-2658596655867925330</guid><pubDate>Tue, 22 Jan 2008 04:20:00 +0000</pubDate><atom:updated>2008-02-16T01:04:27.463-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spring Framework</category><title>Transaction Management using Spring Framework</title><description>In the previous article of this series related to Spring Framework,we discussed how easy it is to Unit Test the POJOs  in Spring and as well little introduction on how effective is Spring in implementing Transaction Management .In continuation of that article,today we will explore more about configuring Transaction Management in Spring for different  datasources&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Transaction Management in Spring&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Sometimes the fundamental error in judgement a Java Developer makes when dealing with transactions are using global transactions instead of local transactions.First let us understand these two types of transactions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is a transaction ?&lt;/span&gt;&lt;br /&gt;A &lt;b&gt;database transaction&lt;/b&gt; is a unit of interaction with a &lt;a href="http://en.wikipedia.org/wiki/Database_management_system" title="Database management system"&gt;database management system&lt;/a&gt; or similar system that is treated in a coherent and reliable way independent of other transactions. In general, a database transaction must be &lt;a href="http://en.wikipedia.org/wiki/Atomic_transaction" title="Atomic transaction"&gt;atomic&lt;/a&gt;, meaning that it must be either entirely completed or aborted. Ideally, a &lt;a href="http://en.wikipedia.org/wiki/Database_system" title="Database system"&gt;database system&lt;/a&gt; will guarantee the properties of Atomicity, Consistency, Isolation and Durability (&lt;a href="http://en.wikipedia.org/wiki/ACID" title="ACID"&gt;ACID&lt;/a&gt;) for each transa&lt;span class="mw-headline"&gt;ction.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Purpose of Transaction&lt;/span&gt;&lt;br /&gt;&lt;/span&gt; &lt;p&gt;In &lt;a href="http://en.wikipedia.org/wiki/Database" title="Database"&gt;database&lt;/a&gt; products the ability to handle transactions allows the user to ensure that &lt;a href="http://en.wikipedia.org/wiki/Data_integrity" title="Data integrity"&gt;integrity&lt;/a&gt; of a database is maintained.&lt;/p&gt; &lt;p&gt;A single transaction might require several queries, each reading and/or writing information in the database. When this happens it is usually important to be sure that the &lt;a href="http://en.wikipedia.org/wiki/Database" title="Database"&gt;database&lt;/a&gt; is not left with only some of the queries carried out. For example, when doing a money transfer, if the money was debited from one account, it is important that it also be credited to the depositing account. Also, transactions should not interfere with each other. For more information about desirable transaction properties, see &lt;a href="http://en.wikipedia.org/wiki/ACID" title="ACID"&gt;ACID&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;In order to reflect the correct state of reality in the system, a transaction should have the following properties.&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;b&gt;A&lt;/b&gt;tomicity: This is the all-or-nothing property. Either the entire sequence of operations is successful or unsuccessful. A transaction should be treated as a single unit of operation. Completed transactions are only committed and incomplete transactions are rolled back or restored to the state where it started.  There is absolutely no possibility of partial work being committed.&lt;/li&gt;&lt;li&gt;&lt;b&gt;C&lt;/b&gt;onsistency: A transaction maps one consistent state of the resources (e.g. database) to another. Consistency is concerned with correctly reflecting the reality of the state of the resources. Some of the concrete examples of consistency are referential integrity of the database, unique primary keys in tables etc.&lt;/li&gt;&lt;li&gt;&lt;b&gt;I&lt;/b&gt;solation: A transaction should not reveal its results to other concurrent transactions before it commits. Isolation assures that transactions do not access data that is being concurrently updated. The other name for isolation is serialization.&lt;/li&gt;&lt;li&gt;&lt;b&gt;D&lt;/b&gt;urability: Results of completed transactions have to be made permanent and cannot be erased from the database due to system failure. Resource managers ensure that the results of a transaction are not altered due to system failures.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;A simple transaction is usually issued to the &lt;a href="http://en.wikipedia.org/wiki/Database_system" title="Database system"&gt;database system&lt;/a&gt; in a language like &lt;a href="http://en.wikipedia.org/wiki/Structured_Query_Language" title="Structured Query Language"&gt;SQL&lt;/a&gt; in this form:&lt;/p&gt; &lt;ol&gt;&lt;li&gt;Begin the transaction&lt;/li&gt;&lt;li&gt;Execute several queries (although any updates to the database aren't actually visible to the outside world yet)&lt;/li&gt;&lt;li&gt;Commit the transaction (updates become visible if the transaction is successful)&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;If one of the queries fails the database system may &lt;a href="http://en.wikipedia.org/wiki/Rollback_%28data_management%29" title="Rollback (data management)"&gt;rollback&lt;/a&gt; either the entire transaction or just the failed query. This behaviour is dependent on the &lt;a href="http://en.wikipedia.org/wiki/DBMS" title="DBMS"&gt;DBMS&lt;/a&gt; in use and how it is set up. The transaction can also be rolled back manually at any time before the commit.&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;Local vs Global Transactions&lt;br /&gt;&lt;/span&gt;Local transactions are specific to a single transactional resource (a JDBC  connection, for example), whereas global transactions are managed by the  container and can span multiple transactional resources.&lt;a name="1081"&gt;&lt;/a&gt;&lt;a name="beginpage."&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Unlike a centralized computing environment where application components and resources are located at a single site, and transaction management only involves a local data manager running on a single machine, in a distributed computing environment all the resources are distributed across multiple systems. In such a case transaction management needs to be done both at local and global levels. A local transaction is one which involves activities in a single local resource manager.  A distributed or a global transaction is executed across multiple systems, and its execution requires coordination between the global transaction management system and all the local data managers of all the involved systems. The Resource Manager and Transaction Manager (TM), also known as a transaction processing monitor (TP monitor), are the two primary elements of any transactional system. In centralized systems, both the TP monitor and the resource manager are integrated into the DBMS server. To support advanced functionalities required in a distributed component-based system, separation of TP monitor from the resource managers is required.&lt;/p&gt;&lt;p&gt;Local transactions are easy to manage, and because most operations work with  just one transactional resource (such as a JDBC transaction), using local  transactions is enough. However, if you are not using Spring, you still have a  lot of transaction management code to write, and if in the future the scope of  the transaction needs to be extended across multiple transactional resources,  you have to drop the local transaction management code and rewrite it to use  global transactions.&lt;/p&gt;&lt;p&gt;&lt;span id="intelliTxt"&gt;A global or distributed transaction consists of several subtransactions and is treated as a single recoverable atomic unit. The global transaction manager is responsible for managing distributed transactions by coordinating with different resource managers to access data at several different systems. Since multiple application components and resources participate in a transaction, it's necessary for the transaction manager to &lt;i&gt;establish and maintain the state of the transaction&lt;/i&gt; as it occurs.&lt;/span&gt;Global transactions in non-Spring application are, in most cases, coded using  &lt;a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Transaction4.html#63068"&gt;JTA&lt;/a&gt;, which is a complex API that depends on JNDI. This means that you have to  use a J2EE application server&lt;/p&gt;&lt;h4 class="docSection2Title" id="title-IDAORZVH"&gt;Two-Phase Commit (2PC)  Protocol&lt;/h4&gt; &lt;p class="docText"&gt;The two-phase commit protocol enables the Atomicity in a  distributed transaction scenario. The system module responsible for this  protocol is usually called a &lt;span class="docEmphStrong"&gt;transaction  manager&lt;/span&gt; or a coordinator. As the name implies, there are two phases to  the protocol. In the first phase, the coordinator asks each participant to vote  on a commit or a rollback. This is accomplished by sending a so-called  &lt;tt&gt;prepare&lt;/tt&gt; request to each participant. When a participant votes for a  commit, it loses its right to roll back independently, meaning that it has to  wait for the final outcome received from the coordinator. The first phase ends  when the coordinator receives all votes or if a timeout occurs. The second phase  starts with the final decision made by the coordinator. In the case of a timeout  or at least one "rollback" vote, the decision to roll back is sent to each  participant that voted for "commit" in the first phase. As a result, all data  modifications at all places involved are rolled back. Should all participants  vote to commit, then and only then, the coordinator decides to perform a global  commit and sends a commit notification to all participants. Consequently, all  the work at all places is committed.&lt;a name="d0e29207"&gt;&lt;/a&gt;&lt;a name="d0e29208"&gt;&lt;/a&gt;&lt;a name="d0e29209"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p class="docText"&gt;The complexity of the two-phase commit relates not only to the  distributed nature of a transaction, but also to a possible non-atomic outcome  of a transaction, i.e. heuristics. For example, the first participant may commit  changes during phase two, while the second participant encounters a hardware  failure when saving changes to the disk. Being able to roll back or at least  notify the errors to recover the system into the original state is an important  part of the process.&lt;/p&gt; &lt;p class="docText"&gt;By persisting intermediate steps of the 2PC, that is, logging  &lt;tt&gt;abort, ready to commit&lt;/tt&gt;, and &lt;tt&gt;commit&lt;/tt&gt; messages, the protocol  provides a certain degree of reliability in case the coordinator or participants  fail in the midst of transaction processing. The two-phase commit protocol can  be implemented in a synchronous or asynchronous manner with variations to its  actual execution.&lt;/p&gt;  &lt;span style="font-weight: bold;"&gt;Programmatic vs Declarative Transactions&lt;br /&gt;&lt;/span&gt;The Java EE container implements support for transactions and facilitates the  ACID properties required by the application logic. The container provides an  implementation for the two-phase commit protocol between a transaction manager  and underlying resources such as the database or messaging provider. The Java EE  container is also responsible for the transaction context propagation and  provides support for a distributed two-phase commit. With a distributed  two-phase commit, a Java EE application can modify data across multiple  application servers as if it is a single transaction.&lt;br /&gt;&lt;p class="docText"&gt;&lt;a name="d0e29531"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="docText"&gt;The decision for whether to use programmatic or &lt;a name="iddle1231"&gt;&lt;/a&gt;&lt;a name="iddle1230"&gt;&lt;/a&gt;declarative transaction support depends  on the level of transaction control and complexity required by the application  design. With the declarative transaction support boundaries  and individual properties of a transaction are specified in a deployment  descriptor &lt;a name="d0e29519"&gt;&lt;/a&gt;. With programmatic  support to a transaction application logic encapsulates transactional  characteristics in the code&lt;a name="d0e29525"&gt;&lt;/a&gt;. A POJO object has to use the programmatic transaction  demarcation. And because of Spring's Inversion of Control and dependency injection  &lt;a name="iddle1146"&gt;&lt;/a&gt;CMT is now also available for POJO applications.&lt;/p&gt;&lt;p class="docText"&gt;&lt;a name="d0e29531"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt; Container-Managed Transactions(EJB 2.1) vs. Spring’s Declarative Transaction management(Spring 1.2):&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;EJB’s Transaction attribute:&lt;br /&gt;Required&lt;br /&gt;RequiresNew&lt;br /&gt;Mandatory&lt;br /&gt;NotSupported&lt;br /&gt;Supports&lt;br /&gt;Never&lt;/p&gt; &lt;p&gt;Spring’s Progagation behavior:&lt;br /&gt;Interface org.springframework.transaction.TransactionDefinition&lt;br /&gt;PROPAGATION_MANDATORY&lt;br /&gt;PROPAGATION_NESTED&lt;br /&gt;PROPAGATION_NEVER&lt;br /&gt;PROPAGATION_NOT_SUPPORTED&lt;br /&gt;PROPAGATION_REQUIRED&lt;br /&gt;PROPAGATION_REQUIRES_NEW&lt;br /&gt;PROPAGATION_SUPPORTS&lt;/p&gt; &lt;p&gt;(b)&lt;br /&gt;EJB’s Isolation level:&lt;br /&gt;Interface java.sql.Connection&lt;br /&gt;TRANSACTION_NONE&lt;br /&gt;TRANSACTION_READ_COMMITTED&lt;br /&gt;TRANSACTION_READ_UNCOMMITTED&lt;br /&gt;TRANSACTION_REPEATABLE_READ&lt;br /&gt;TRANSACTION_SERIALIZABLE&lt;/p&gt; &lt;p&gt;Spring’s Isolation level:&lt;br /&gt;Interface org.springframework.transaction.TransactionDefinition&lt;br /&gt;ISOLATION_DEFAULT&lt;br /&gt;ISOLATION_READ_COMMITTED&lt;br /&gt;ISOLATION_READ_UNCOMMITTED&lt;br /&gt;ISOLATION_REPEATABLE_READ&lt;br /&gt;ISOLATION_SERIALIZABLE&lt;/p&gt; &lt;p&gt;(c)&lt;br /&gt;Rolling Back a Container-Managed Transaction&lt;br /&gt;There are two ways to roll back a container-managed transaction.&lt;br /&gt;First, if a system exception is thrown, the container will automatically roll back the transaction. Second, by invoking the setRollbackOnly method of the EJBContext interface, the bean method instructs the container to roll back the transaction. If the bean throws an application exception, the rollback is not automatic but can be initiated by a call to setRollbackOnly.&lt;/p&gt;  &lt;p&gt;Spring’s Roll back rules&lt;br /&gt;Transaction can be declared to roll back or not based on exceptions that are thrown during the course of the transaction.&lt;br /&gt;By default, transactions are rolled back only on runtime exceptions and not on checked exceptions.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt; Bean-Managed Transactions(EJB 2.1) vs. Spring’s Programmatic Transaction management(Spring 1.2):&lt;/strong&gt;&lt;br /&gt;In a bean-managed transaction, the code in the session or message-driven bean explicitly marks the boundaries of the transaction. An entity bean cannot have bean-managed transactions; it must use container-managed transactions instead.&lt;br /&gt;Although beans with container-managed transactions require less coding, they have one limitation: When a method is executing, it can be associated with either a single transaction or no transaction at all. If this limitation will make coding your bean difficult, you should consider using bean-managed transactions.&lt;/p&gt; &lt;p&gt;Spring provides two means of programmatic transaction management:&lt;br /&gt;Using the TransactionTemplate&lt;br /&gt;Using a PlatformTransactionManager implementation directly&lt;br /&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;Configuration of Deployment Descriptor-Spring vs EJB&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;ejb-jar.xml&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;ejb-jar&amp;gt;&lt;br /&gt;&amp;lt;enterprise-beans&amp;gt;&lt;br /&gt;&amp;lt;!– A minimal session EJB deployment –&amp;gt;&lt;br /&gt;&amp;lt;session&amp;gt;&lt;br /&gt;&amp;lt;ejb-name&amp;gt;PostingEJB&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;&amp;lt;home&amp;gt;ejbs.PostingHome&amp;lt;/home&amp;gt;&lt;br /&gt;&amp;lt;remote&amp;gt;ejbs.Posting&amp;lt;/remote&amp;gt;&lt;br /&gt;&amp;lt;ejb-class&amp;gt;ejbs.PostingBean&amp;lt;/ejb-class&amp;gt;&lt;br /&gt;&amp;lt;!– or Stateless –&amp;gt;&lt;br /&gt;&amp;lt;session-type&amp;gt;Stateful&amp;lt;/session-type&amp;gt;&lt;br /&gt;&amp;lt;transaction-type&amp;gt;Container&amp;lt;/transaction-type&amp;gt;&lt;br /&gt;&amp;lt;/session&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!– OPTIONAL, can be many.  How the container is to manage&lt;br /&gt;transactions when calling anEJB’s business methods –&amp;gt;&lt;br /&gt;&amp;lt;container-transaction&amp;gt;&lt;br /&gt;&amp;lt;!– Can specify many methods at once here –&amp;gt;&lt;br /&gt;&amp;lt;method&amp;gt;&lt;br /&gt;&amp;lt;ejb-name&amp;gt;EmployeeRecord&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;&amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;&amp;lt;/method&amp;gt;&lt;br /&gt;&amp;lt;!– NotSupported|Supports|Required|RequiresNew|Mandatory|Never –&amp;gt;&lt;br /&gt;&amp;lt;trans-attribute&amp;gt;Required&amp;lt;/trans-attribute&amp;gt;&lt;br /&gt;&amp;lt;/container-transaction&amp;gt;&lt;/p&gt; &lt;p&gt;&amp;lt;container-transaction&amp;gt;&lt;br /&gt;&amp;lt;method&amp;gt;&lt;br /&gt;&amp;lt;ejb-name&amp;gt;Payroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;&amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;&amp;lt;/method&amp;gt;&lt;br /&gt;&amp;lt;trans-attribute&amp;gt;Required&amp;lt;/trans-attribute&amp;gt;&lt;br /&gt;&amp;lt;/container-transaction&amp;gt;&lt;br /&gt;&amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;&amp;lt;/ejb-jar&amp;gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;Spring applicationcontext.xml&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&amp;lt;beans&amp;gt;&lt;br /&gt;&amp;lt;bean id=”petStore”&lt;br /&gt;class=”org.springframework.transaction.interceptor.TransactionProxyFactoryBean”&amp;gt;&lt;br /&gt;&amp;lt;property name=”transactionManager” ref=”txManager”/&amp;gt;&lt;br /&gt;&amp;lt;property name=”target” ref=”petStoreTarget”/&amp;gt;&lt;br /&gt;&amp;lt;property name=”transactionAttributes”&amp;gt;&lt;br /&gt;&amp;lt;props&amp;gt;&lt;br /&gt;&amp;lt;prop key=”insert*”&amp;gt;&lt;br /&gt;PROPAGATION_REQUIRED,-MyCheckedException&amp;lt;/prop&amp;gt;&lt;br /&gt;&amp;lt;prop key=”update*”&amp;gt;&lt;br /&gt;PROPAGATION_REQUIRED&amp;lt;/prop&amp;gt;&lt;br /&gt;&amp;lt;prop key=”*”&amp;gt;&lt;br /&gt;PROPAGATION_REQUIRED,readOnly&amp;lt;/prop&amp;gt;&lt;br /&gt;&amp;lt;/props&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;/p&gt; &lt;p&gt; &lt;strong&gt;The following are the key differences from EJB CMT&lt;/strong&gt; (from &lt;a href="http://www.theserverside.com/tt/articles/article.tss?l=SpringFramework"&gt;Introduce the Spring Framework&lt;/a&gt;)&lt;br /&gt;a. Transaction management can be applied to any POJO. We recommend that business objects implement interfaces, but this is a matter of good programming practice, and is not enforced by the framework.&lt;/p&gt; &lt;p&gt;b. Programmatic rollback can be achieved within a transactional POJO through using the Spring transaction API. We provide static methods for this, using ThreadLocal variables, so you don’t need to propagate a context object such as an EJBContext to ensure rollback.&lt;/p&gt; &lt;p&gt;c. You can define rollback rules declaratively. Whereas EJB will not automatically roll back a transaction on an uncaught application exception (only on unchecked exceptions, other types of Throwable and “system” exceptions), application developers often want a transaction to roll back on any exception. Spring transaction management allows you to specify declaratively which exceptions and subclasses should cause automatic rollback. Default behaviour is as with EJB, but you can specify automatic rollback on checked, as well as unchecked exceptions. This has the important benefit of minimizing the need for programmatic rollback, which creates a dependence on the Spring transaction API (as EJB programmatic rollback does on the EJBContext).&lt;/p&gt; &lt;p&gt;d. Because the underlying Spring transaction abstraction supports savepoints if they are supported by the underlying transaction infrastructure, Spring’s declarative transaction management can support nested transactions, in addition to the propagation modes specified by EJB CMT (which Spring supports with identical semantics to EJB). Thus, for example, if you have doing JDBC operations on Oracle, you can use declarative nested transactions using Spring.&lt;/p&gt;&lt;p class="para"&gt;You cannot control the atomicity, consistency, and durability of a transaction,  but you can control the &lt;b class="bold"&gt;transaction propagation&lt;/b&gt; and &lt;b class="bold"&gt;timeout&lt;/b&gt;, which set whether the transaction should be &lt;b class="bold"&gt;read-only&lt;/b&gt; and specify the &lt;b class="bold"&gt;isolation level&lt;/b&gt;.&lt;/p&gt; &lt;p class="para"&gt;Spring encapsulates all these settings in a &lt;span class="fixed"&gt;TransactionDefinition&lt;/span&gt; interface. This interface is used in  the core interface of the transaction support in Spring, the &lt;span class="fixed"&gt;PlatfromTransactionManager&lt;/span&gt;, whose implementations perform  transaction management on a specific platform, such as JDBC or JTA. The core  method, &lt;span class="fixed"&gt;PlatformTransactionManager.getTransaction()&lt;/span&gt;,  returns a &lt;span class="fixed"&gt;TransactionStatus&lt;/span&gt; interface, which is used to  control the transaction execution, more specifically to set the transaction  result and to check whether the transaction is read-only or whether it is a new  transaction.&lt;/p&gt; &lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;a name="1083"&gt;&lt;/a&gt;&lt;a name="wbp20Chapter12P18"&gt;&lt;/a&gt;&lt;span style="font-size:100%;"&gt;Exploring  the TransactionDefinition Interface&lt;/span&gt;&lt;/h3&gt; &lt;p class="first-para"&gt;As we mentioned earlier, the &lt;span class="fixed"&gt;TransactionDefinition&lt;/span&gt; interface controls the properties of a  transaction.&lt;br /&gt;&lt;/p&gt;&lt;div class="example"&gt;&lt;div class="formalbody"&gt;package org.springframework.transaction;&lt;br /&gt;import java.sql.Connection;&lt;br /&gt;public interface TransactionDefinition {&lt;br /&gt;int getPropagationBehavior();&lt;br /&gt;int getIsolationLevel();&lt;br /&gt;int getTimeout();&lt;br /&gt;boolean isReadOnly();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;&lt;a name="1089"&gt;&lt;/a&gt;&lt;a name="wbp20Chapter12P113"&gt;&lt;/a&gt;&lt;span style="font-size:100%;"&gt;Using the  TransactionStatus Interface&lt;/span&gt;&lt;/h3&gt; &lt;p class="first-para"&gt;This interface allows a transactional manager to control the  transaction execution. The code can check whether the transaction is a new one,  or whether it is a read- only transaction and it can initiate a rollback.&lt;br /&gt;&lt;/p&gt;&lt;p class="first-para"&gt;public interface TransactionStatus {&lt;br /&gt;boolean isNewTransaction();&lt;br /&gt;void setRollbackOnly();&lt;br /&gt;boolean isRollbackOnly();&lt;br /&gt;}&lt;/p&gt; &lt;div class="example"&gt;&lt;span class="example-title"&gt;&lt;span class="example-titlelabel"&gt;&lt;/span&gt;&lt;/span&gt;  &lt;div class="formalbody"&gt; &lt;table class="BlueLine" border="0" cellpadding="0" cellspacing="0" width="100%"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;/tr&gt;&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;div esi="i.am.akamai"&gt;&lt;div&gt;&lt;div class="chapter"&gt;&lt;div class="section"&gt;&lt;div class="section"&gt;&lt;h3 class="sect3-title"&gt;&lt;span style="font-size:100%;"&gt;&lt;a name="1091"&gt;&lt;/a&gt;&lt;a name="wbp20Chapter12P125"&gt;&lt;/a&gt;Implementations of the  PlatformTransactionManager&lt;/span&gt;&lt;/h3&gt; &lt;p class="first-para"&gt;&lt;a name="1092"&gt;&lt;/a&gt;&lt;a name="beginpage."&gt;&lt;/a&gt;This is an interface  that uses the &lt;span class="fixed"&gt;TransactionDefinition&lt;/span&gt; and &lt;span class="fixed"&gt;TransactionStatus&lt;/span&gt; interfaces to create and manage  transactions. The actual implementations of this interface must have detailed  knowledge of the transaction manager. The &lt;span class="fixed"&gt;DataSourceTransactionManager&lt;/span&gt; controls transactions performed  within a &lt;span class="fixed"&gt;DataSource;&lt;/span&gt; &lt;span class="fixed"&gt;HibernateTransactionManager&lt;/span&gt; controls transactions performed  on a Hibernate session, &lt;span class="fixed"&gt;JdoTransactionManager&lt;/span&gt; manages  JDO transactions, and &lt;span class="fixed"&gt;JtaTransactionManager&lt;/span&gt; delegates  transaction management to JTA&lt;/p&gt;&lt;p class="first-para"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Configuring Spring’s Transaction Manager for JDBC&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;To set up transaction management for your applications, you need to configure the transaction&lt;br /&gt;manager of your choice. The simplest way to start is to use the DataSourceTransactionManager. It’s suitable when working with JDBC or iBATIS.&lt;br /&gt;&lt;/p&gt;&lt;p class="first-para"&gt; Configuring DataSourceTransactionManagement&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;blockquote&gt;&amp;lt;beans&amp;gt;&lt;br /&gt;&amp;lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&lt;br /&gt;destroy-method="close"&amp;gt;&lt;br /&gt;&amp;lt;property name="driverClassName" value="${jdbc.driverClassName}"/&amp;gt;&lt;br /&gt;&amp;lt;property name="url" value="${jdbc.url}"/&amp;gt;&lt;br /&gt;&amp;lt;property name="username" value="${jdbc.username}"/&amp;gt;&lt;br /&gt;&amp;lt;property name="password" value="${jdbc.password}"/&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&amp;gt;&lt;br /&gt;&amp;lt;property name="location" value="classpath:jdbc.properties"/&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;bean id="transactionManager"&lt;br /&gt;class="org.springframework.jdbc.datasource. DataSourceTransactionManager"&amp;gt;&lt;br /&gt;&amp;lt;property name="dataSource" ref="dataSource"/&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class="first-para"&gt;In the most straightforward scenario, DataSourceTransactionManager will obtain a new Connection object from the DataSource object and bind it to the current thread when a&lt;br /&gt;transaction starts. It will remove the Connection object from the current thread when the transaction ends and commit or roll back the active transaction, as necessary, and close the Connection object.&lt;br /&gt;Configuring Spring’s Transaction Manager for JTA&lt;br /&gt;An alternative transaction-management strategy is to use a JTA transaction manager. All application servers come with such a transaction manager, although some stand-alone implementations exist.You don’t automatically need to use JTA when deploying applications in an application server.Nothing stops you from using DataSourceTransactionManager, which gives you the advantage of more independence from the deployment environment.&lt;br /&gt;However, in a minority of cases, you want to delegate transaction management to the JTA&lt;br /&gt;transaction manager of your application server. The most common reason for this is to work with distributed transactions.&lt;/p&gt;&lt;p class="first-para"&gt;Setting Up Transaction Management via JTA in Spring&lt;br /&gt;&amp;lt;beans&amp;gt;&lt;br /&gt;&amp;lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&amp;gt;&lt;br /&gt;&amp;lt;property name="jndiName" value="java:env/jdbc/myDataSource"/&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;bean id="transactionManager" class="org.springframework.jta.JtaTransactionManager"/&amp;gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;/p&gt;&lt;p class="first-para"&gt;When working with the JTA transaction manager of an application server, you must use a&lt;br /&gt;DataSource object that was obtained via JNDI from the same application server.  JtaTransactionManager needs no special configuration. This is because the JTA transaction&lt;br /&gt;manager in the application server will automatically start and end the transactions on&lt;br /&gt;Connection objects that were obtained from the JNDI DataSource object.&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;blockquote&gt;&lt;a href="http://www.itvcon.com/read/400907.htm"&gt;Bringing Advanced Transaction Capabilities to Spring Applications&lt;/a&gt;&lt;br /&gt;This article discusses Spring's transaction management facilities and the common use cases in Spring where an external transaction manager is required. A real-world application is used to illustrate the transactional aspects and features. The focus is on leveraging JTA transaction management in the Spring Framework for enterprise applications. The article shows how Spring's transaction services can seamlessly expose and interact with a Java EE application server's transaction manager such as the Oracle Application Server and the OC4JJtaTransactionManager.&lt;/blockquote&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;Coming up Next in this series related to "Spring Framework" is, Aspect Oriented Programming(AOP).&lt;br /&gt;&lt;br /&gt;Suggested Reading :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.oracle.com/technology/tech/java/spring/jta_spring_article.pdf"&gt;http://www.oracle.com/technology/tech/java/spring/jta_spring_article.pdf&lt;/a&gt;&lt;br /&gt;&lt;p class="first-para"&gt;&lt;a href="http://www.infoq.com/minibooks/JTDS"&gt;http://www.infoq.com/minibooks/JTDS&lt;/a&gt;&lt;/p&gt;&lt;p class="first-para"&gt;&lt;a href="http://books.google.com/books?id=q2PIjAJoXsAC&amp;amp;printsec=frontcover&amp;amp;dq=pro+spring&amp;amp;sig=PqeW9x0Lb570IR3Prkx8U3egdCg"&gt;Pro Spring  Book  preview &lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="first-para"&gt;&lt;a href="http://dev2dev.bea.com/pub/a/2005/07/spring_transactions.html"&gt;http://dev2dev.bea.com/pub/a/2005/07/spring_transactions.html&lt;/a&gt;&lt;/p&gt;&lt;p class="first-para"&gt;&lt;a href="http://dev2dev.bea.com/pub/a/2005/07/spring_transactions.html"&gt;&lt;/a&gt;&lt;a href="http://www.itvcon.com/read/400907_1.htm"&gt;http://www.itvcon.com/read/400907_1.htm&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;Suggested Video Tutorial&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/transaction-management-strategies"&gt;Mission Critical Transaction Management using Spring&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-2658596655867925330?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/lotJn5J5Fh4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/lotJn5J5Fh4/transaction-management-using-spring.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/transaction-management-using-spring.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-1031657111829757617</guid><pubDate>Fri, 18 Jan 2008 20:39:00 +0000</pubDate><atom:updated>2008-02-16T01:04:27.464-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spring Framework</category><title>What makes "Spring Framework" tick,and that too in a big way-Part 1</title><description>&lt;div style="text-align: justify;"&gt;The most telling aspect or area where Java Developers &amp;amp; for that matter the architects, are heavily tested is developing and designing middleware &amp;amp; server-side components.And I have developed many such kind of applications using EJB in the past.And even though there has been lot of growth from EJB2.1 to EJB3.0 specifications(particularly,annotations),the areas where personally I had a hard time using it has been unit testing the code and implementing effective transaction management.Some might argue ,Iam blaming it because I cant use it effectively and Iam not at all questioning its virtue and value and Iam still and will use it,being a standard framework defined by the Java Community Process (JCP) and supported by all major J2EE vendors,my focus is how best other lightweight solutions like Spring,Hibernate or for that matter Google Guice(even though I didnt get an opportunity to use &amp;amp; implement Guice in any enterprise applications so far),has made my life easier with respect to TDD and implementing Transaction management,security and persistence in distributed computing.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lightweight vs Heavyweight frameworks&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A &lt;span style="font-style: italic;"&gt;software framework&lt;/span&gt; is a re-usable design for a software system (or subsystem). A software framework may include support programs, code libraries, a scripting language, or other software to help develop and glue together the different components of a software project. Various parts of the framework may be exposed through an API.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lightweight framework&lt;/span&gt; : Applications developed using lightweight framework do not have to depend on framework interfaces or abstract classes to "hook" components into the application in which category frameworks like Spring,Google Guice fall into compared to &lt;span style="font-weight: bold;"&gt;Heavyweight frameworks&lt;/span&gt; ,that require the extension of framework classes or the implementation of framework interfaces in order to take advantage of their middleware features. EJB2 is probably the most popular example of a heavyweight framework(And I do know the growth and support in EJB3 for POJOs,discussed later,which makes it lightweight and starting to become popular because of EJB3 Annotations along with JPA ).EJB is a heavyweight model for objects that don’t need to offer remote access.&lt;br /&gt;&lt;br /&gt;Test first development has become much more popular in the last few years, and usually produces impressive results. Writing effective unit tests for an application isn’t just a question of putting in the time and effort; it can be severely constrained by high-level architecture. This is one of the biggest frustrations with EJB. Due to its heavy dependence on the EJB container, business logic coded in EJB is very hard to test.Code that is hard to test is usually also hard to re-engineer, reuse in different contexts, and refactor(though one might argue with me citing the existence of lightweight frameworks like &lt;a href="http://www.mockejb.org/"&gt;MockEJB&lt;/a&gt;)and considering testability is an essential characteristic of agile projects.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Spring Framework&lt;/span&gt;&lt;br /&gt;Spring is an open source project led by SpringSource &amp;amp; Interface21 and brainchild of Rod Johnson.Spring is a light-weight framework for the development of enterprise-ready applications. Spring can be used to configure declarative transaction management, remote access to your logic using RMI or web services, mailing facilities and various options in persisting your data to a database. Spring framework can be used in modular fashion, it allows to use in parts and leave the other components which is not required by the application.The Spring framework is a layered architecture consisting of seven well-defined modules.Here is a brief description of the seven modules,&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Inversion of Control (IoC) Container&lt;/span&gt;: Also called the Core Container, creates and configures application objects and wires them together. This means that resources and collaborating objects are provided to objects, so the objects do not need to look them up. This moves an important responsibility out of your code and makes it easier to write and test code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Aspect-Oriented Programming (AOP) framework&lt;/span&gt;:Works with cross-cutting concerns—one solution to a problem that’s used in multiple places. The Spring AOP framework links cross-cutting concerns to the invocation of specific methods on specific objects (not classes) in such a way&lt;br /&gt;that your code is unaware of their presence. The Spring Framework uses cross-cutting concerns and AOP to let your application deal with transactions without having a single line of transaction management code in your code base.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Data Access framework&lt;/span&gt;: Hides the complexity of using persistence APIs such as JDBC,Hibernate, and many others. Spring solves problems that have been haunting data-access developers for years: how to get hold of a database connection, how to make sure that the connection is closed, how to deal with exceptions, and how to do transaction management. When using the Spring Framework, all these issues are taken care of by the framework.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Transaction Management framework&lt;/span&gt;: Provides a very efficient way to add transaction management to your applications without affecting your code base. Adding transaction management is a matter of configuration, and it makes the lives of application developers much easier.Spring Framework simplifies it dramatically.And along with Unit Testing,this is the area I would be dwelling upon here.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Resource Abstraction framework&lt;/span&gt;: Offers a wonderful feature for conveniently locating files when configuring your applications. Chapter 2 discusses resource abstraction.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Validation framework&lt;/span&gt;: Hides the details of validating objects in web applications or rich client applications. It also deals with internationalization (i18n) and localization (l10n).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Spring Web MVC(Another significant framework,one of my fav)&lt;/span&gt;: Provides a Model-View-Controller (MVC) framework that lets you build powerful web applications with ease. It handles the mapping of requests to controllers and of controllers to views. It has excellent form-handling and form-validation capabilities, and integrates with all popular view technologies, including JSP, Velocity, FreeMarker, XSLT,JasperReports, Excel, and PDFs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Spring Web Flow&lt;/span&gt;:Makes implementing web-based wizards and complex workflow processes very easy and straightforward. Spring Web Flow is a conversation-based MVC framework.Spring Web Flow is distributed separately and can be downloaded via the Spring Framework website.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Acegi Security System&lt;/span&gt;: Adds authentication and authorization to objects in your application using AOP. Acegi can secure any web application, even those that do not use the Spring Framework.It offers a wide range of authentication and authorization options that will fit your most exotic security needs. Adding security checks to your application is straightforward and a&lt;br /&gt;matter of configuration; you don’t need to write any code, except in some special use cases.Acegi is distributed separately and can be downloaded from &lt;a href="http://acegisecurity.org/downloads.html"&gt;http://acegisecurity.org/downloads.html&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Remote Access framework&lt;/span&gt;: Adds client-server capabilities to applications through configuration.Objects on the server can be exported as remotely available services. On the client, you can call these services transparently, also through configuration. Remotely accessing services&lt;br /&gt;over the network thus becomes very easy. Spring’s Remote Access framework supports HTTPbased protocols and remote method invocation (RMI), and can access Enterprise JavaBeans as a client.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Spring Web Services&lt;/span&gt;: Takes the complexity out of web services and separates the concerns into manageable units. Most web service frameworks generate web service end points and definitions based on Java classes, which get you going really fast, but become very hard to manage as your project evolves. To solve this problem, Spring Web Services takes a layered approach and&lt;br /&gt;separates the transport from the actual web service implementation by looking at web services as a messaging mechanism. Handling the XML message, executing business logic, and generating an XML response are all separate concerns that can be conveniently managed. Spring Web Services is distributed separately and can be downloaded via the Spring Framework website&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Spring JMX&lt;/span&gt;: Exports objects via Java Management Extensions (JMX) through configuration.Spring JMX is closely related to Spring’s Remote Access framework. These objects can then be managed via JMX clients to change the value of properties, execute methods, or report statistics.&lt;br /&gt;JMX allows you to reconfigure application objects remotely and without needing to restart the application.&lt;br /&gt;&lt;br /&gt;OK lets start exploring the easiness ,robustness &amp;amp; scalability features being supported by Spring in Unit Testing and Transaction Management of the enterprise applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Test Driven Development with Spring Framework&lt;/span&gt;&lt;br /&gt;To understand its use, we need to know what a POJO(Plain Old Java Object) is,POJO is a Java Object that doesn't implement any special interfaces or call any framework classes,remember the definition of Lightweight Framework.The benefits of POJO comes from decoupling the application code from the infrastructure frameworks.POJOs accelerate development, we can test our business logic outside of the application server(important criteria in TDD) and without a database.We dont have to package the code and deploy it in the application server and also we dont have to keep the database schema constantly in sync with the object model or spend time waiting for slow-running database tests to finish.&lt;br /&gt;The Spring framework,provides services for POJOs such as transaction management,dependency injection,support for POJO remoting and security for POJOs(Acegi).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Dependency Injection&lt;/span&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Dependency_injection"&gt;Dependency Injection&lt;/a&gt; is one of the core features of Spring Framework.&lt;br /&gt;Dependency injection (DI) refers to the process of supplying an external dependency to a software component and is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed dependency.&lt;br /&gt;&lt;br /&gt;Conventionally, if an object needs to gain access to a particular service, the object takes responsibility to get hold of that service: either it holds a direct reference to the location of that service, or it goes to a known 'service locator' (in EJB2)and requests that it be passed back a reference to an implementation of a specified type of service. By contrast, using dependency injection, the object simply provides a property that can hold a reference to that type of service; and when the object is created a reference to an implementation of that type of service will automatically be injected into that property - by an external mechanism. The dependency injection approach offers more flexibility because it becomes easier to create alternative implementations of a given service type, and then to specify which implementation is to be used via a configuration file, without any change to the objects that use the service. &lt;span style="font-style: italic;"&gt;This is especially useful in unit testing, because it is easy to inject a mock implementation of a service into the object being tested&lt;/span&gt;. On the other hand, excessive use of dependency injection can make applications more complex and harder to maintain: in order to understand the application's behaviour the developer needs to look at the configuration as well as the code, and the configuration is "invisible" to IDE-supported reference analysis and refactoring unless the IDE specifically supports the dependency injection framework.To use it,you must configure Spring's bean factory&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Benefits of Dependency Injection&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It eliminates the need to call lookup APIs,because a components dependencies are passed to it,we no longer have to write tedious JNDI code and components depend mainly on interfaces rather than on concrete implementations.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Types of dependency injection&lt;/span&gt;&lt;br /&gt;Constructor injection,setter&amp;amp;getter injection and Method injection.&lt;br /&gt;&lt;br /&gt;Spring’s &lt;span style="font-weight: bold;"&gt;org.springframework.test&lt;/span&gt; package has&lt;br /&gt;number of base classes to simplify testing.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;AbstractDependencyInjectionSpringContextTests&lt;/span&gt; - can do both setter or field-based dependency injection,cached context files&lt;br /&gt;&lt;span style="font-style: italic;"&gt;AbstractTransactionalDataSourceSpringContextTests&lt;/span&gt; -&lt;br /&gt;allows you to easily clear data from tables and rolls back any data entered into the database.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Testing approaches&lt;/span&gt;&lt;br /&gt;Generally speaking, testing should be used to ensure the following aspects of an application:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Correctness&lt;/span&gt;: You want to ensure the correctness of your application. For example, suppose that you have written a calculate() method on a Calculator class. You want to make sure that certain input for this method results in a correct calculation result.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Completeness&lt;/span&gt;: Testing can be used to ensure that your application is complete by verifying that all required operations have been executed. Suppose you have a signup process that includes creating an invoice for newly signed-up members. You want to test whether a member is actually added to the database, and also if an invoice has been created for that user.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Quality&lt;/span&gt;: Testing can ensure the quality of your application, and this goes beyond software quality metrics. A well-tested piece of software creates confidence with developers. When existing code needs to be changed, it’s less likely that developers will be afraid of unintentionally&lt;br /&gt;breaking the software or reintroducing bugs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Unit Testing&lt;/span&gt;&lt;br /&gt;This so-called plain old Java object (POJO) approach to Java coding, combined with defining interfaces for important parts of your application provides the basis for thorough testing. The Spring Framework promotes exactly this approach (we could also say the Spring Framework makes this approach possible). By separating your code into well-defined interfaces and objects, you have already defined the units that are eligible for unit testing.&lt;br /&gt;One goal of unit testing is to ensure that each unit of an application functions correctly in isolation.Another goal is to define a framework, harness, or contract (all referring to a strict set of rules that must be respected) that must be satisfied by the unit test. As long as the tests can be run successfully,&lt;br /&gt;the unit is considered to work properly. (If there are bugs in the test code, the unit will function properly according to this buggy test code.)&lt;br /&gt;&lt;br /&gt;Unit testing offers a number of benefits for developers:&lt;br /&gt;Facilitate change: As previously mentioned, having a set of unit tests for a specific piece of code provides confidence in refactoring existing code. The unit tests will ensure the module continues to function correctly according to the available tests as long as the tests succeed.&lt;br /&gt;Given there are enough tests for all the code in the application, this promotes and facilitates changing implementation details of units in the application. An important aspect of facilitating change is preventing solved problems or bugs from reentering the code.&lt;br /&gt;Simplify integration: Unit testing provides a bottom-up testing approach, which ensures that low-level units function properly according to their tests. This makes it easier to write integration tests at a later stage. There is no need to have two tests for units.&lt;br /&gt;Promote well-defined separation: In order for you to be able to completely and efficiently write unit tests, your code needs to be separated into well-defined units. Each unit needs to be tested in isolation and should therefore allow the replacement of dependencies with test specific ones. Thus, writing unit tests promotes the separation of your application into well-defined units.&lt;br /&gt;&lt;br /&gt;Test-driven development (TDD) is a way of implementing code by writing a unit test before implementing the actual class.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using Spring for Testing&lt;/span&gt;&lt;br /&gt;When working with Spring for building your applications, you will typically use one or more XML configuration files for defining your application context. These configuration files are not Java files and will therefore not be compiled. Of course, if you include the Spring DTD or use Spring’s namespace support, some aspects of your configuration files will be validated. But issues such as defining a nonexisting class as the class for a bean in your application context or setting a nonexisting property on a bean definition are discovered only when you actually load the application context at runtime. This is where integration testing comes into the picture.The goal of integration testing is to test how the individually tested units of your application collaborate with each other. When working with Spring, you wire those dependencies together using Spring’s configuration files. In order to test part of your whole application, you typically want to load the Spring application context and test one or more beans configured in that application.&lt;br /&gt;&lt;br /&gt;Spring provides three convenient test base classes for integration testing of your Spring applications: AbstractDependencyInjectionSpringContextTests, AbstractTransactionalSpringContextTests, and AbstractTransactionalDataSourceSpringContextTests. These classes are discussed in the following sections.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style: italic;"&gt;org.springframework.test.AbstractDependencyInjectionSpringContextTests&lt;/span&gt; base class is the test class you will typically use when testing parts of your application that do not require access to a database or any other transactional support. You should extend this class by first implementing the getConfigLocations() method, which should return an array of application context locations to be loaded by the test. When the test is executed, the specified configurations will be loaded as an application context.&lt;br /&gt;The major advantage of using this base class is that the application context will be loaded only once for each test method. If you were to load the application yourself in the setUp() method of a test, the application context would be reloaded for every test method. This is especially useful when loading configurations that require a lot of initialization, such as a Hibernate session factory.&lt;br /&gt;&lt;br /&gt;Another convenient test base class is &lt;span style="font-style: italic;"&gt;org.springframework.test.AbstractTransactionalSpringContextTests&lt;/span&gt;, which builds on top of the functionality offered by the AbstractDependencyInjectionSpringContextTests test base class. Each test method that is executed by a subclass of  this base class will automatically participate in a transaction. Because the default is to roll back&lt;br /&gt;the transaction after each test method execution, no actual modifications will be made to any transactional resources. This makes it the perfect choice for performing integration tests using a transactional data source.&lt;br /&gt;Using this base class allows you to integration test functionality that will make modifications to the database without having to worry about the changes affecting any other test methods. It also allows you test code that requires a transactional context. And you can write data to the database without worrying about cleaning it up afterwards.As mentioned, all modifications to the database are rolled back at the end of each test method execution.&lt;br /&gt;&lt;br /&gt;A third convenient test base class is &lt;span style="font-style: italic;"&gt;org.springframework.test.AbstractTransactionalDataSourceSpringContextTests&lt;/span&gt;, which builds on top of the functionality provided by AbstractTransactional&lt;br /&gt;SpringContextTests. In order to use this base class, you need to include a DataSource definition in the application context loaded by this test. The data source is automatically injected, as explained earlier.&lt;br /&gt;The main feature offered by this base class is that it provides you with a JdbcTemplate as a protected field, which you can use to modify the data source, within the transactional context. You could, for instance, insert some data that the test needs in order to succeed. Because the statements to the JdbcTemplate are also executed within the transactional context, you do not need to worry about cleaning up the database or modifying the existing data.Another advantage of using this base class is that you can define fields for this test that are populated&lt;br /&gt;automatically by Spring based on your application context.Spring also provides support for testing your J2EE-specific application code. Because much of your web application code is very much tied to J2EE classes, it is hard to test. For instance, testing a servlet or a Spring controller implementation requires you to somehow mock the HttpServletRequest and HttpServletResponse classes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Transaction Management using Spring&lt;/span&gt;&lt;br /&gt;Two main issues make database transactions complicated for developers to work with and difficult for database vendors to implement:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Concurrency control&lt;/span&gt;: Databases need to protect against data loss or ghost data, yet allow concurrent access to the same data. Generally, developers can choose an isolation level to control the level of protection. Another form of concurrency control is protecting against lost updates.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Synchronization between transactions&lt;/span&gt;: Complex applications often need a way to synchronize two or more databases or other resources so that their local transactions are guaranteed to commit or roll back in a group. The technique used for this is called two-phase commit (or 2PC), distributed transactions, or global transactions.&lt;br /&gt;The first step in setting up transaction management with Spring is choosing a transaction management strategy. This basically means selecting which of the transaction-management APIs in Java you want to use.The main interface of this API is &lt;span style="font-style: italic;"&gt;org.springframework.transaction.PlatformTransactionManager&lt;/span&gt;.&lt;br /&gt;Spring provides a number of implementations of this interface that support the most popular transaction-management APIs in Java.Like,org.springframework.jdbc.datasource. DataSourceTransactionManager,org.springframework.orm.hibernate.HibernateTransactionManager&lt;br /&gt;org.springframework.orm.hibernate3.HibernateTransactionManager.&lt;br /&gt;The Spring Bean factory does more than simply instantiate objects.It can also wrap the objects that it creates with interceptors.These interceptors are how Spring provides a simple,yet effective AOP(Aspect-Oriented Programming)implementation.AOP is the foundation of Spring Transaction Management.To make a POJO transactional you configure the bean factory to wrap it with TransactionInterceptor.One option is to use the @Transactional annotation on the interace,implementation class or individual methods.Another option is to write XML bean definitions that explicitly apply the TransactionInterceptor to the POJO.The XML is more verbose than the annotation but has the advantage of leaving the source code unchanged.It also works with older JDKs that dont' support annotations.&lt;br /&gt;&lt;br /&gt;Spring doesn't implement transactions itself but is,instead, a wrapper around other transaction management APIs.Unlike EJB3,it gives you the flexibility of using either JTA or the transaction management APIs provided by ORM frameworks such as Hibernate.&lt;br /&gt;&lt;br /&gt;In the next article of this series,we will explore more about Transaction Management in Spring and as well as AOP(Aspect Oriented Programming).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Suggested Video Tutorial&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/spring-2-rod-johnson"&gt;Spring 2.x by Rod Johnson (Founder of Spring framework)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.infoq.com/presentations/system-integration-testing-with-spring"&gt;&lt;span style="font-weight: bold;"&gt;Integration Testing with Spring  by Rod Johnson &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.indicthreads.com/videos/1149/spring_ejb3_framework_dependency.html"&gt;Spring vs EJB3.0 by Debu Panda&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.thespringexperience.com/media.jsp?mediaId=41"&gt;&lt;br /&gt;Spring Experience Video by Adrian Colyer&lt;/a&gt; Adrian Colyer is the leader of the AspectJ open source project and a well-known industry expert on the topic of aspect-oriented programming (AOP)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;Suggested Reading:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sys-con.com/read/180374.htm"&gt;http://java.sys-con.com/read/180374.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://static.springframework.org/spring/docs/2.5.1/reference/testing.html"&gt;&lt;br /&gt;http://static.springframework.org/spring/docs/2.5.1/reference/testing.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://static.springframework.org/spring/docs/1.2.x/reference/transaction.html"&gt;&lt;br /&gt;http://static.springframework.org/spring/docs/1.2.x/reference/transaction.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mike.hostetlerhome.com/2007/07/06/easier-unit-testing-in-spring/"&gt;&lt;br /&gt;http://mike.hostetlerhome.com/2007/07/06/easier-unit-testing-in-spring/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dev2dev.bea.com/pub/a/2005/07/spring_transactions.html"&gt;&lt;br /&gt;http://dev2dev.bea.com/pub/a/2005/07/spring_transactions.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Recommended Books&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VnFS8PNEOkk/R5E5keFX8NI/AAAAAAAAArs/du1jRNCxqVM/s1600-h/spring2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_VnFS8PNEOkk/R5E5keFX8NI/AAAAAAAAArs/du1jRNCxqVM/s200/spring2.jpg" alt="" id="BLOGGER_PHOTO_ID_5156966347029606610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can get this book from  &lt;a href="http://www.amazon.com/Building-Spring-2-Enterprise-Applications/dp/1590599187/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1200699263&amp;amp;sr=8-1"&gt;Here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-1031657111829757617?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/tM13GTJaCzo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/tM13GTJaCzo/what-makes-spring-framework-tickand.html</link><author>noreply@blogger.com (Yaseen Khan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_VnFS8PNEOkk/R5E5keFX8NI/AAAAAAAAArs/du1jRNCxqVM/s72-c/spring2.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/what-makes-spring-framework-tickand.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-2164217963115098856</guid><pubDate>Wed, 16 Jan 2008 02:20:00 +0000</pubDate><atom:updated>2008-02-16T01:07:03.424-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web App</category><title>Rich Internet Applications - One more Buzz word (Adobe Flex)</title><description>Along with SOA,BPM the other buzz word with regards to J2EE Application development in Java community now-a-days is about Rich Internet Applications-RIA.&lt;br /&gt;Personally I do think strategically this is the most important aspect that needs to be covered or looked into by a seasoned Java/J2EE Architect ,that how best he can improve the usability and appearance of the corporate applications he is working on, because ultimately what matters to the users is better,scalable and enhanced GUI.Along with Web Services(SOA),Mobile Computing,BPM(Business Process Management),this is one area where Iam really focussed and I suggest every Senior Java/J2EE guys to consider having a look at.To start with,I guess every Java person ,who is interested in GUI development does try to acquaint himself with technologies with HTML,DHTML,CSS,JavaScript,Java AWT,Swing ,XHTML etc....And there is ever growing interest in building AJAX style web applications using different frameworks and technologies which I will harbor upon in this article down the line.So what is this RIA is all about?&lt;br /&gt;&lt;br /&gt;To start with the basic definition of RIA is ,Rich Internet applications (RIA) are web applications that have the features and functionality of traditional desktop applications. RIAs typically transfer the processing necessary for the user interface to the web client but keep the bulk of the data (i.e., maintaining the state of the program, the data etc) back on the application server.&lt;br /&gt;RIAs typically:&lt;br /&gt;    * run in a web browser, or do not require software installation&lt;br /&gt;    * run locally in a secure environment called a sandbox&lt;br /&gt;Compared to RIAs,traditional web applications centered all activity around a client-server architecture with a thin client. Under this system all processing is done on the server, and the client is only used to display static (in this case HTML) content. The biggest drawback with this system is that all interaction with the application must pass through the server, which requires data to be sent to the server, the server to respond, and the page to be reloaded on the client with the response. By using a client side technology which can execute instructions on the client's computer, RIAs can circumvent this slow and synchronous loop for many user interactions.&lt;br /&gt;&lt;br /&gt;All RIAs share one characteristic: they introduce an intermediate layer of code, often called a client engine, between the user and the server. This client engine is usually downloaded at the beginning of the application, and may be supplemented by further code downloads as the application progresses. The client engine acts as an extension of the browser, and usually takes over responsibility for rendering the application's user interface and for server communication.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Benefits&lt;/span&gt;&lt;br /&gt;Because RIAs employ a client engine to interact with the user, they are:&lt;br /&gt;    * Richer. They can offer user-interface behaviors not obtainable using only the HTML widgets available to standard browser-based Web applications. This richer functionality may include anything that can be implemented in the technology being used on the client side, including drag and drop, using a slider to change data, calculations performed only by the client and which do not need to be sent back to the server, for example, a mortgage calculator.&lt;br /&gt;&lt;br /&gt;    * More responsive. The interface behaviors are typically much more responsive than those of a standard Web browser that must always interact with a remote server.&lt;br /&gt;&lt;br /&gt;The most sophisticated examples of RIAs exhibit a look and feel approaching that of a desktop environment. Using a client engine can also produce other performance benefits:&lt;br /&gt;    * Client/Server balance. The demand for client and server computing resources is better balanced, so that the Web server need not be the workhorse that it is with a traditional Web application. This frees server resources, allowing the same server hardware to handle more client sessions concurrently.&lt;br /&gt;&lt;br /&gt;    * Asynchronous communication. The client engine can interact with the server without waiting for the user to perform an interface action such as clicking on a button or link. This allows the user to view and interact with the page asynchronously from the client engine's communication with the server. This option allows RIA designers to move data between the client and the server without making the user wait. Perhaps the most common application of this is prefetching, in which an application anticipates a future need for certain data, and downloads it to the client before the user requests it, thereby speeding up a subsequent response. Google Maps uses this technique to move adjacent map segments to the client before the user scrolls their view.&lt;br /&gt;&lt;br /&gt;    * Network efficiency. The network traffic may also be significantly reduced because an application-specific client engine can be more intelligent than a standard Web browser when deciding what data needs to be exchanged with servers. This can speed up individual requests or responses because less data is being transferred for each interaction, and overall network load is reduced. However, use of asynchronous prefetching techniques can neutralize or even reverse this potential benefit. Because the code cannot anticipate exactly what every user will do next, it is common for such techniques to download extra data, not all of which is actually needed, to many or all clients.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Shortcomings and restrictions&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Shortcomings and restrictions associated with RIAs are:&lt;br /&gt;&lt;br /&gt;    * Sandbox. Because RIAs run within a sandbox, they have restricted access to system resources. If assumptions about access to resources are incorrect, RIAs may fail to operate correctly.&lt;br /&gt;&lt;br /&gt;    * Disabled scripting. JavaScript or another scripting language is often required. If the user has disabled active scripting in their browser, the RIA may not function properly, if at all.&lt;br /&gt;&lt;br /&gt;    * Client processing speed. To achieve platform independence, some RIAs use client-side scripts written in interpreted languages such as JavaScript, with a consequential loss of performance. This is not an issue with compiled client languages such as Java, where performance is comparable to that of traditional compiled languages, or with Flash movies, in which the bulk of the operations are performed by the native code of the Flash player.&lt;br /&gt;&lt;br /&gt;    * Script download time. Although it does not have to be installed, the additional client-side intelligence (or client engine) of RIA applications needs to be delivered by the server to the client. While much of this is usually automatically cached it needs to be transferred at least once. Depending on the size and type of delivery, script download time may be unpleasantly long. RIA developers can lessen the impact of this delay by compressing the scripts, and by staging their delivery over multiple pages of an application.&lt;br /&gt;&lt;br /&gt;    * Loss of integrity. If the application-base is X/HTML, conflicts arise between the goal of an application (which naturally wants to be in control of its presentation and behaviour) and the goals of X/HTML (which naturally wants to give away control). The DOM interface for X/HTML makes it possible to create RIAs, but by doing so makes it impossible to guarantee correct function. Because an RIA client can modify the RIA's basic structure and override presentation and behaviour, it can cause failure of the application to work properly on the client side. Eventually, this problem could be solved by new client-side mechanisms that granted an RIA client more limited permission to modify only those resources within the scope of its application. (Standard software running natively does not have this problem because by definition a program automatically possesses all rights to all its allocated resources).&lt;br /&gt;&lt;br /&gt;    * Loss of visibility to search engines. Search engines may not be able to index the text content of the application.&lt;br /&gt;&lt;br /&gt;    * Dependence on an Internet connection. While the ideal network-enabled replacement for a desktop application would allow users to be "occasionally connected" wandering in and out of hot-spots or from office to office, today the typical RIA requires network connectivity.And I think this year will decide whether RIA are here to stay or it goes off like smoke without fire.&lt;br /&gt;&lt;br /&gt;Ok enough of talking about RIA,its benefits and shortcomings.Lets talk about what we are really concerned about, which framework or technology is the best for RIA,I think that should be the primary focus now rather than considering the potential or growth of RIA.There are many choices for us and they are:Adobe Flex/Flash,Ajax,JSF(yes it can also be used),JavaFX,Dojo,Swing,Google Web Toolkit,Google Gears,Eclipse RIA &amp; Microsoft Silverlight.I guess with so many choices,the obvious question will be which one is the most efficient and best one for RIA.&lt;br /&gt;&lt;br /&gt;Personally I do like Adobe Flex,&lt;a href="http://www.adobe.com/products/flex/downloads/"&gt;The Flex SDK&lt;/a&gt; comes with a set of user interface components including buttons, list boxes, trees, data grids, several text controls, and various layout containers. Charts and graphs are available as an add-on. Other features like web services, drag and drop, modal dialogs, animation effects, application states, form validation, and other interactions round out the application framework.I do go through its documentation like Flex 2 Developers Guide,Building &amp; Deploying Flex 2 applications,I must say this tool is here to stay.&lt;br /&gt;&lt;br /&gt;There are, however, more specific and compelling reasons to adopt Flex. Flex builds on the advances made in the Java/J2EE community over the last decade. New Java converts to the Flex programming model will find the framework, language, and tools easy to learn, as there is a familiarity in the Flex IDE and the language structures, like the Flex Collections API. The Flex development tools offer the clearest link for current Java developers. The Flex IDE is built on Eclipse, which can be used as the stand-alone Flex Builder product or as an Eclipse plug-in. Virtually all Java developers have had some exposure to the Eclipse development environment. This is a huge benefit that speeds and enhances the learning process.&lt;br /&gt;&lt;br /&gt;In addition to the IDE, Flex also has Ant Tasks for automated builds of Flex applications, whether they are integrated with a Java application or stand-alone. Once again, Ant is a technology Java developers have all been exposed to in the Java community.  With Adobe's comprehensive suite of tools, integrating Flex into your skill set is natural and enjoyable.&lt;br /&gt;&lt;br /&gt;In a multi-tiered model, Flex applications serve as the presentation tier. Unlike page-based HTML applications, Flex applications provide a stateful client where significant changes to the view don't require loading a new page. Similarly, Flex and Flash Player provide many useful ways to send and load data to and from server-side components without requiring the client to reload the view. Though this functionality offered advantages over HTML and JavaScript development in the past, the increased support for XMLHttpRequest in major browsers has made asynchronous data loading a common practice in HTML-based development too.&lt;br /&gt;&lt;br /&gt;There are frameworks ranging from testing to MVC in Adobe Flex. A good example of this is the Cairngorm MVC framework. Cairngorm is written in ActionScript 3.0 and follows many of the Core J2EE patterns. It provides Flex developers with an MVC framework for structuring their Flex presentation code and the interactions with the business services. Flex also provides API's for multiple methods of integrating with backend services, including LiveCycle Data Services ES (Data Services), Web Services, and HTTP.&lt;br /&gt;&lt;br /&gt;LiveCycle Data Services ES deploys in a Servlet/J2EE container and provides significant server-side infrastructure to Flex applications. Data Services offers a number of features, including remoting, publish/subscribe messaging, and data management (client-server synchronization, paging, notification, Hibernate adapter, etc). The simplest use allows a Java developer to expose Plain Old Java Objects (POJO's) as back-end services via a simple configuration. Objects are transferred to the client in a compact binary format called AMF3 and converted to ActionScript 3.0 classes, which is far more efficient in the transferring and rendering time than other implementations, like XML. Combining Data Services with the popular Java POJO-based frameworks, like Hibernate and Spring, creates a truly powerful combination for building enterprise applications. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Things you need to get started with Adobe Flex&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Flex Builder 2&lt;/span&gt;&lt;br /&gt;Flex Builder 2 is the new development tool that (although it is not necessary for Flex development because any text editor can be used) offers the most complete development environment for rapidly creating Flex applications. Because Flex Builder 2 has been built on top of the mature Eclipse IDE, it will be very familiar to developers who have already been developing software in other languages using Eclipse as their tool of choice. Eclipse is a development environment that was built with extendability in mind, and this can also work to the benefit of Flex developers because it can be customized to suit the needs of the Flex developer. Chapter 2 provides a more comprehensive look into Flex Builder 2.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Flex Free SDK 2&lt;/span&gt;&lt;br /&gt;The Flex Software Development Kit (SDK) is a free download from Adobe and includes the Flex framework (component class library), compiler, and debugger. Using the text editor of your choice, you can create the ActionScript and MXML files for your application, and then compile to SWF using the SDK. The SDK allows for data communication via Web services, HTTP services, and Flash remoting with ColdFusion as the back-end server. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Flex Data Services (FDS)&lt;/span&gt;&lt;br /&gt;FDS is the server version of Flex that must be installed under any Java 2 Enterprise Edition (J2EE) server. FDS is essentially the next generation of Flex 1.5, which was sold only as a server.&lt;br /&gt;&lt;br /&gt;As well as a full commercial edition, the FDS server is available in an Express edition, which is free and available for commercial use (but is limited to one CPU without clustering).&lt;br /&gt;&lt;br /&gt;FDS is made up of several components and capabilities, including the following:&lt;br /&gt;Flex Messaging Services (FMS)&lt;br /&gt;Publish-subscribe messaging&lt;br /&gt;Data push&lt;br /&gt;RPC services&lt;br /&gt;Flex Messaging Services&lt;br /&gt;FMS is one of the pieces that make up FDS, and it allows for the creation of applications that support real-time messaging, as well as collaboration. The messaging service has support for Java Message Service (JMS), as well as other existing messaging services, allowing for the creation of cross-platform chat applications.&lt;br /&gt;&lt;br /&gt;Publish-Subscribe Messaging&lt;br /&gt;FMS uses the producer/consumer publish-subscribe metaphor, which allows for the creation of co-browsing applications. To understand what is meant by a co-browser application, imagine a company’s customer service representative being able to make edits to a form on the user’s screen in real time while the user watches.&lt;br /&gt;&lt;br /&gt;Data Push&lt;br /&gt;Data push is the capability for the server to push data changes to the client without any user interaction or polling of the servers. This can be critical when an application has hundreds or thousands of users connected, and they can all see changes to business-critical data in real time. This is a feature that is available only when using the FDS server.&lt;br /&gt;&lt;br /&gt;RPC Services&lt;br /&gt;Remote procedure call (RPC) services are the suite of services used to connect to external data. They include the following:&lt;br /&gt;&lt;br /&gt;WebService - The WebService component can be used to access any Web service that complies with the WSDL 1.1 standard and returns data formatted as Simple Object Access Protocol (SOAP) messages over HTTP.&lt;br /&gt;&lt;br /&gt;HTTPService - The HTTPService component can send HTTP GET, POST, HEAD, OPTIONS, PUT, TRACE, or DELETE requests. It does not support multipart requests.&lt;br /&gt;&lt;br /&gt;RemoteObjects - The RemoteObject component uses Action Message Format (AMF) to transfer data that is a binary format and is the fastest of the RPC services. It is an ideal way to interact with server-side Java objects that are within the FDS server’s source path. It can also be used to connect to local or even remote ColdFusion servers. Both Java objects and ColdFusion components can be mapped to ActionScript objects, allowing for seamless integration between the server-side and client-side objects.&lt;br /&gt;&lt;br /&gt;The WebService and HTTPService components are included for free with the Flex SDK, whereas the RemoteObject component is available only for use with the FDS server (Commercial or Free Express Edition) or ColdFusion 7.02.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Flex Charting&lt;/span&gt;&lt;br /&gt;The Flex charting components are a set of rich charting components that enable easy development of professional dashboard and business intelligence (BI) systems. The charting components are sold as a stand-alone product or bundled with Flex Builder 2&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Flex 2 Programming Model&lt;/span&gt;&lt;br /&gt;The Flex 2 Programming Model consists of MXML, ActionScript, and the Flex class library. To build a full-fledged application, you must have a good knowledge of all these technologies. To start off, you are introduced to the basics of MXML. Then you are shown how ActionScript and MXML work together to create powerful, rich user interfaces.&lt;br /&gt;&lt;br /&gt;The third element of the programming model is the Flex 2 Framework, which contains Flex components, managers, and behaviors. This component-based development model allows developers to incorporate pre-built components, extend the component library by creating new components, or combine pre-built components to create composite components.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;MXML&lt;/span&gt;&lt;br /&gt;The first element of the programming model, MXML, is an XML language that defines the user interface for an application. MXML is also used to define non-visual aspects such as server-side data sources and bindings between the user interface and the server side. &lt;br /&gt;&lt;br /&gt;To write a Flex application, you must be able to write MXML and ActionScript. As mentioned earlier, MXML is an XML language that is used to lay out your user interface.&lt;br /&gt;&lt;br /&gt;MXML is very similar to HTML in that it provides tags for user interface elements. If you have worked with HTML, then MXML should be very familiar to you. MXML has a much broader tag set than HTML, and defines visual components such as data grids, buttons, combo boxes, trees, tab navigators, and menus, as well as non-visual components, Web service connections, data binding, and effects.&lt;br /&gt;&lt;br /&gt;The biggest difference between HTML and MXML is the MXML-defined file that is compiled into a Shockwave file (SWF) and rendered by the Flash Player. MXML can be written in a single file or in multiple files. MXML requires that you close off every tag that you declare in your Flex application. Otherwise, the Flex compiler will throw an error.&lt;br /&gt;&lt;br /&gt;The &lt;mx:Application&gt; tag is always the root tag of a Flex application. The &lt;mx:Panel&gt; tag defines a Panel container that includes a title, title bar, status message, border, and an area for its children (that is, the &lt;mx:Label&gt; control). The &lt;mx:Label&gt; tag is a Label control that simply displays text.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;ActionScript&lt;/span&gt;&lt;br /&gt;The second element of the programming model, ActionScript, extends the functionality of a Flex application. ActionScript provides control and object-manipulation features that are not available in strict MXML.&lt;br /&gt;&lt;br /&gt;The ActionScript programming language is used in Adobe’s Flash Player. Included are built-in objects and functions that allow you to create your own objects and functions like many object-oriented programming (OOP) languages.&lt;br /&gt;&lt;br /&gt;ActionScript 3.0 offers a robust programming model that is more familiar to developers with basic knowledge of OOP. ActionScript is executed by the ActionScript Virtual Machine (AVM), which is part of the Flash Player. The code is compiled into a bytecode format by the compiler, such as the one built into Flex Builder 2.&lt;br /&gt;&lt;br /&gt;ActionScript and JavaScript are very similar, so being familiar with JavaScript will make your life easier when using ActionScript. JavaScript is derived from The European Computers Manufacturers Association (ECMA) document ECMA-262, which is the international standard for the JavaScript language. ActionScript is based upon the ECMA-262 Edition 4 specification, so this is where the similarities come in between the two languages.&lt;br /&gt;&lt;br /&gt;ActionScript 3.0 contains a lot of new features, such as run-time exceptions, run-time types, sealed classes, method closures, ECMAScript for XML (E4X), regular expressions, namespaces, and new primitive types. All these new features allow the developer to speed up the development process.&lt;br /&gt;&lt;br /&gt;One important point to note is that Flex Builder 2 converts all MXML files into ActionScript before the code is compiled into bytecode for use with the AVM.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;ActionScript in MXML&lt;/span&gt;&lt;br /&gt;Flex developers will find that ActionScript extends the capabilities of Flex when developing applications. In ActionScript, you can define event listeners, create new classes, handle callback functions, and define getters and setters, packages, and components.&lt;br /&gt;&lt;br /&gt;Following are some of the ways that ActionScript can be used in Flex applications:&lt;br /&gt;&lt;br /&gt;ActionScript is inserted between the &lt;mx:Script&gt; tags. This code can be comprised of new functions, error handling, or events, and can perform any other tasks your Flex application may require.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Create new components in ActionScript&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Create new components and compile into SWC files (which are external components compiled to be reused in many applications).&lt;br /&gt;Extend existing components with ActionScript classes.&lt;br /&gt;Take advantage of ActionScript support for OOP concepts such as code reuse, inheritance, encapsulation, and polymorphism.&lt;br /&gt;Use global ActionScript functions that are available in any part of an SWF file where ActionScript is used, or in any user-defined class.&lt;br /&gt;Use the standard Flex components that comprise the Flex Class Libraries. All the components and libraries are written in ActionScript.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Overview of ActionScript Compilation Process&lt;/span&gt;&lt;br /&gt;A Flex application can consist of MXML files, ActionScript classes, SWF files, and SWC files.&lt;br /&gt;&lt;br /&gt;The Flex compiler transforms the main MXML file and its children into a single ActionScript class linking in all the reference-imported classes. Once the transformation is complete, the end result is a single SWF file that can be deployed on the server.&lt;br /&gt;&lt;br /&gt;Every time you make changes to your application, a new SWF file is generated. You may find it more convenient to remove the reusable components and compile those into SWC files, which can be included in a library path for your application.&lt;br /&gt;&lt;br /&gt;Statements and expressions must be wrapped in functions; otherwise, you will receive a compiler error. Also, you cannot define classes or interfaces in the &lt;mx:Script&gt; tag, because the MXML file you have defined is a class in itself.&lt;br /&gt;&lt;br /&gt;You may have noticed the odd CDATA construct. This is used to tell the compiler not to interpret the script block as XML, but rather as ActionScript. The &lt;mx:Script&gt; tag must be located at the top-level component tag of the MXML file. Multiple &lt;mx:Script&gt; tags can be defined, but for readability, it’s recommended to have them in one location.&lt;br /&gt;&lt;br /&gt;In MXML, you can use ActionScript to refer to visual or non-visual components. You do this by specifying the id property of the component in MXML. Then you use id to refer to the component in ActionScript.&lt;br /&gt;&lt;br /&gt;If you want to access the &lt;mx:Label&gt; control, you must refer to the id property in ActionScript. To do this, the following code must be used: &lt;br /&gt;var str:String = lbl1.text;&lt;br /&gt;&lt;br /&gt;The code gets the value from the Label control named lbl1.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Import and Include&lt;/span&gt;&lt;br /&gt;There is a noticeable difference between the terms “importing” and “including” in reference to ActionScript. Importing is adding a reference to a class file or package so that you can access the objects and properties of the external classes, as shown in the following example: &lt;br /&gt;&lt;br /&gt;import mx.controls.TextInput;&lt;br /&gt;&lt;br /&gt;Including ActionScript is copying the lines of code of an external ActionScript file into another. This can either be done in the &lt;mx:Script&gt; tag using the include directive, or the &lt;mx:Script source="filename"&gt; tag to add the ActionScript into your Flex applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Introduction to ActionScript Components&lt;/span&gt;&lt;br /&gt;This section provides a brief overview of how to create reusable components using ActionScript. Later in this book, you will build more complex components using MXML and ActionScript.&lt;br /&gt;&lt;br /&gt;Custom components can contain graphical elements, define some kind of business logic, or extend existing components in the Flex framework. Defining your own components in ActionScript has several advantages:&lt;br /&gt;&lt;br /&gt;Divide your application into individual models that can be developed and maintained separately.&lt;br /&gt;&lt;br /&gt;Implement commonly used logic within the components.&lt;br /&gt;&lt;br /&gt;Build a collection of components that can be reused among all your Flex applications.&lt;br /&gt;&lt;br /&gt;When creating custom components, you may find it useful to extend the component from the Flex class hierarchy. This allows you to inherit functionality already built into the Flex components.&lt;br /&gt;&lt;br /&gt;As shown in the following example, you can define a custom TextInput and derive it from the Flex TextInput control:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;package myComponents&lt;br /&gt;{&lt;br /&gt;    public class MyTextInput extends TextInput&lt;br /&gt;    {&lt;br /&gt;        public function MyTextInput()&lt;br /&gt;        {&lt;br /&gt;            ...&lt;br /&gt;        }&lt;br /&gt;        ...&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The filename of the control MyTextInput must be in a filename called MyTextInput.as and stored at the root of your Flex application in a subdirectory name myComponents. As you may have already picked up, the package name reflects the location of the component, myComponents.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Flex Class Library&lt;/span&gt;&lt;br /&gt;The Flex 2 Framework contains Flex managers, components, and behaviors. The component-based model allows developers to incorporate pre-built components, create new ones, or combine components into composite components.&lt;br /&gt;&lt;br /&gt;The following lists some of the common packages that you will use in your Flex application:&lt;br /&gt;mx.controls - Flex user interface controls&lt;br /&gt;&lt;br /&gt;mx.collections - Flex collection components &lt;br /&gt;&lt;br /&gt;mx.charts - Flex charting components&lt;br /&gt;&lt;br /&gt;mx.utils - Flex utility classes&lt;br /&gt;&lt;br /&gt;flash.events - Flex event classes&lt;br /&gt;&lt;br /&gt;flash.net - Flex classes for sending and receiving from the network, such as URL downloading and Flash Remoting&lt;br /&gt;&lt;br /&gt;Just have a look at the Adobe Developer Connection,&lt;a href="http://www.adobe.com/devnet/ria/"&gt;http://www.adobe.com/devnet/ria/&lt;/a&gt; and you will surely agree that it is the most useful tool and for samples visit here,&lt;a href="http://www.adobe.com/devnet/flex/index.html?tab:samples=1"&gt;http://www.adobe.com/devnet/flex/index.html?tab:samples=1&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-2164217963115098856?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/QtJm3bPWBaY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/QtJm3bPWBaY/rich-internet-applications-one-more.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/rich-internet-applications-one-more.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-7802969736464814672</guid><pubDate>Tue, 15 Jan 2008 00:51:00 +0000</pubDate><atom:updated>2008-02-16T01:07:03.425-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web App</category><title>Implementing "Drag and Drop" feature in Web Applications</title><description>Today I would like to shed some light on how best can we implement drag n feature in web applications.Gone are the days of lame users who used to browse web sites just to     gather some information,send mails,watch movies,online shopping etc.Now-a-days users want more and more interaction and savvy stuff to be seen on the websites.With the advent of new technologies,users tastes have also changed and so to their needs and demands.I personally like the liveliness of new Yahoo mail,Personal google mail or iGoogle.This makes me wonder about the sleekness of drag and drop feature implementation in these sites and how easy it has become to implement such scenarios using frameworks &amp; APIs like Yahoo UI(very informative),Google Web Toolkit(my personal best),Ajax,Dojo,SWT,&lt;span style="font-style:italic;"&gt;Scriptaculous&lt;/span&gt; or for that matter the cumbersome JavaScript(JavaScript is not everyone's language of choice),phew so many choices and options.&lt;br /&gt;If you are a Web Developer,now a days it has become a de-facto standard or necessity for you to have experience in implementing drag and drop features in the web applications you are dealing at customer sites.Here I would like to present different solutions that can be used(&amp; how) to develop drag and drop features in a website.&lt;br /&gt;&lt;br /&gt;First, the basic definition of Ajax is ,AJAX (Asynchronous JavaScript and XML), or Ajax, is a group of inter-related web development techniques used for creating interactive web applications. A primary characteristic is the increased responsiveness and interactiveness of web pages achieved by exchanging small amounts of data with the server "behind the scenes" so that the entire web page does not have to be reloaded each time the user performs an action. This is intended to increase the web page's interactivity, speed, functionality, and usability.&lt;br /&gt;&lt;br /&gt;AJAX is asynchronous in that extra data is requested from the server and loaded in the background without interfering with the display and behavior of the existing page. JavaScript is the scripting language in which AJAX function calls are usually made.[1] Data is retrieved using the XMLHttpRequest object that is available to scripting languages run in modern browsers. There is, however, no requirement that the asynchronous content be formatted in XML.&lt;br /&gt;&lt;br /&gt;AJAX is a cross-platform technique usable on many different operating systems, computer architectures, and web browsers as it is based on open standards such as JavaScript and the DOM. There are free and open source implementations of suitable frameworks and libraries.&lt;br /&gt;&lt;br /&gt;To start with let us learn how can we implement AJAX style drag and drop using &lt;span style="font-weight:bold;"&gt;Scriptaculous&lt;/span&gt;,is a collection of Web 2.0 style JavaScript libraries that help web developers to easily add visual and ajax effects to projects.It provides easy-to-use cross-browser support user interface Javascript libraries.For example visit here,&lt;a href="http://demo.script.aculo.us/shop"&gt;Demo&lt;/a&gt;.&lt;br /&gt;First &lt;a href="http://script.aculo.us/dist/scriptaculous-js-1.8.1.zip"&gt;download&lt;/a&gt; the latest version and extract it folder of your choice and then put prototype.js, scriptaculous.js, builder.js, effects.js, dragdrop.js, slider.js and controls.js in a directory of your website, e.g. /javascripts and then provide a link to the scripts in the head of your document like,&lt;br /&gt;&lt;br /&gt; script src="javascripts/prototype.js" type="text/javascript"&lt;br /&gt; script src="javascripts/scriptaculous.js" type="text/javascript"&lt;br /&gt;&lt;br /&gt;By default, scriptaculous.js loads all of the other javascript files necessary for effects, drag-and-drop, sliders, and all of the other script.aculo.us features. &lt;br /&gt;You can also use effects inside event handlers and you can pass extra options to the effect like ‘duration’, ‘fps’ (frames per second), and ‘delay’.&lt;br /&gt; "div onclick="new Effect.BlindUp(this, {duration: 16})"&lt;br /&gt;    For the source code for implementing a simple shopping cart using Script.aculo.us,visit &lt;a href="http://www.ajaxlessons.com/2006/02/19/ajax-workshop-3-shopping-cart-using-scriptaculous/"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2)Next in line is &lt;span style="font-weight:bold;"&gt;&lt;a href="http://dojotoolkit.org/"&gt;DOJO&lt;/a&gt;&lt;/span&gt;,Dojo is an Open Source toolkit that allows you to easily build dynamic capabilities into web pages and any other environment that supports JavaScript. Dojo provides components that let you make your sites more useable, responsive, and functional. With Dojo you can build degradeable user interfaces more easily, prototype interactive widgets quickly, animate transitions, and build AJAX-based requests simply. Dojo layers these capabilities onto a lightweight packaging system which forms the core of Dojo. When you write scripts with Dojo, you can include as few or as many of the available APIs as you need, and your app will only include what it uses.&lt;br /&gt;Easily extensible Drag and Drop support in DOJO is provided by this API,dojo.dnd.*&lt;br /&gt;For the list of classes and methods in this API , visit &lt;a href="http://manual.dojotoolkit.org/dnd.html"&gt;http://manual.dojotoolkit.org/dnd.html&lt;/a&gt;&lt;br /&gt;For a simple example on implementing drag and drop using DOJO,visit &lt;a href="http://dojomanual.jot.com/WikiHome/DojoDotBook/Book117"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;3)&lt;span style="font-weight:bold;"&gt;&lt;a href="http://developer.yahoo.com/yui/dragdrop/"&gt;Yahoo UI -Drag &amp; Drop&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;The Yahoo! User Interface (YUI) Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. The YUI Library also includes several core CSS resources. All components in the YUI Library have been released as open source under a BSD license and are free for all uses.&lt;br /&gt;&lt;a href="http://developer.yahoo.com/yui/download/"&gt;Download YUI version 2.4.1&lt;/a&gt;, including full API documentation and more than 230 functional &lt;a href="http://developer.yahoo.com/yui/examples/"&gt;examples&lt;/a&gt; from Sourceforge.&lt;br /&gt;For an example to implement drag and drop using Yahoo UI , visit &lt;a href="http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4)And finally,&lt;span style="font-weight:bold;"&gt;Google Web Toolkit(my fav)&lt;/span&gt;&lt;br /&gt;Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don't speak browser quirks as a second language. &lt;br /&gt;With GWT, you can develop and debug AJAX applications in the Java language using the Java development tools of your choice. When you deploy your application to production, the GWT compiler translates your Java application to browser-compliant JavaScript and HTML.Download GWT from &lt;a href="http://code.google.com/webtoolkit/download.html"&gt;here&lt;/a&gt;.&lt;br /&gt;Here's the GWT development cycle:&lt;br /&gt;   1. Use your favorite Java IDE to write and debug an application in the Java language, using as many (or as few) GWT libraries as you find useful.&lt;br /&gt;   2. Use GWT's Java-to-JavaScript compiler to distill your application into a set of JavaScript and HTML files that you can serve with any web server.&lt;br /&gt;   3. Confirm that your application works in each browser that you want to support, which usually takes no additional work.&lt;br /&gt;Some of the benefits of developing with &lt;a href="http://code.google.com/webtoolkit/overview.html"&gt;GWT&lt;/a&gt;:&lt;br /&gt;    * You can use all of your favorite Java development tools (Eclipse, IntelliJ, JProfiler, JUnit) for AJAX development.&lt;br /&gt;    * Static type checking in the Java language boosts productivity while reducing errors.&lt;br /&gt;    * Common JavaScript errors (typos, type mismatches) are easily caught at compile time rather than by users at runtime.&lt;br /&gt;    * Code prompting/completion is widely available.&lt;br /&gt;    * Automated Java refactoring is pretty snazzy these days.&lt;br /&gt;    * Java-based OO designs are easier to communicate and understand, thus making your AJAX code base more comprehensible with less documentation&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/gwt-dnd/"&gt;http://code.google.com/p/gwt-dnd/&lt;/a&gt;,is GWT extension library which adds drag-and-drop support to new or existing applications built with the Google Web Toolkit (GWT).Visit &lt;a href="http://code.google.com/p/gwt-dnd/wiki/GettingStarted"&gt;here&lt;/a&gt; to know how to add GWT to Eclipse IDE.And sample source code is &lt;a href="http://allen-sauer.com/com.allen_sauer.gwt.dnd.demo.DragDropDemo/DragDropDemo.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Other options are,&lt;a href="http://www.mochikit.com/doc/html/MochiKit/DragAndDrop.html"&gt;Mochikit&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also read this article for implementing drag and drop using Java 2.&lt;br /&gt;&lt;a href="http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html"&gt;http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;span style="font-style:italic;"&gt;Suggested Video Tutorial&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Google Web Toolkit&lt;/span&gt;&lt;br /&gt;&lt;object width="400" height="350"&gt;&lt;param name="movie" value="http://www.youtube.com/v/NvRa-CxkpZI&amp;rel=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/NvRa-CxkpZI&amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-7802969736464814672?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/wHmVHEJnlU0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/wHmVHEJnlU0/implementing-drag-and-drop-feature-in.html</link><author>noreply@blogger.com (Yaseen Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/implementing-drag-and-drop-feature-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-701490274833023197.post-3200726457375974022</guid><pubDate>Sat, 12 Jan 2008 06:54:00 +0000</pubDate><atom:updated>2008-02-16T01:12:32.119-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Miscellaneous</category><title>Tata Nano-just $2500 car unveiled in India</title><description>The Tata’s world’s cheapest Rs 1-lakh($2500) car was launched(unveiled) recently at the 9th Auto Expo in New Delhi by Chairman Ratan Tata. The car is named as “NANO”&lt;br /&gt;&lt;br /&gt;&lt;object width="450" height="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/uzxJTCv8SqE&amp;rel=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/uzxJTCv8SqE&amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="450" height="320"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Mr. Ratan Tata said that this car meets all safety and emission norms and emissions are lower than 2 wheelers. The car has 21% more interior space than much popular Maruti 800, which makes it more special. The car would be indeed launched at a price 1 lakh + VAT + Transportation.&lt;br /&gt;&lt;br /&gt;Speaking at the unveiling ceremony at the 9th Auto Expo in New Delhi, Mr. Ratan N. Tata said,“I observed families riding on two-wheelers , the father driving the scooter, his young kid standing in front of him, his wife seated behind him holding a little baby. It led me to wonder whether one could conceive of a safe, affordable, all-weather form of transport for such a family. Tata Motors  Engineers and Designers gave all their energy and efforts for about four years to realise this goal. Today, we indeed have a People’s Car, which is affordable and yet built to meet safety requirements and emission norms, to be fuel efficient and low on emissions. We are happy to present the People’s Car to India and we hope it brings the joy, pride and utility of owning a car to many families who need personal mobility.”&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Specifications and features of 1 lakh car Nano:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;    *&lt;span style="font-weight:bold;"&gt; Stylish, comfortable&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Yet with a length of 3.1 metres, width of 1.5 metres and height of 1.6 metres, with adequate ground clearance, it can effortlessly manoeuvre on busy roads in cities as well as in rural areas. Its mono-volume design, with wheels at the corners and the powertrain at the rear, enables it to uniquely combine both space and manoeuvrability, which will set a new benchmark among small cars.&lt;br /&gt;&lt;br /&gt;When launched, the car will be available in both standard and deluxe versions. Both versions will offer a wide range of body colours, and other accessories so that the car can be customised to an individual’s preferences.&lt;br /&gt;&lt;br /&gt;    * &lt;span style="font-weight:bold;"&gt;Fuel-efficient engine&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The People’s Car has a rear-wheel drive, all-aluminium, two-cylinder, 623 cc, 33 PS, multi point fuel injection petrol engine. This is the first time that a two-cylinder gasoline engine is being used in a car with single balancer shaft. The lean design strategy has helped minimise weight, which helps maximise performance per unit of energy consumed and delivers high fuel efficiency. Performance is controlled by a specially designed electronic engine management system.&lt;br /&gt;&lt;br /&gt;    * &lt;span style="font-weight:bold;"&gt;Meets all safety requirements&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The People’s Car’s safety performance exceeds current regulatory requirements. With an all sheet-metal body, it has a strong passenger compartment, with safety features such as crumple zones, intrusion-resistant doors, seat belts, strong seats and anchorages, and the rear tailgate glass bonded to the body. Tubeless tyres further enhance safety.&lt;br /&gt;&lt;br /&gt;    * &lt;span style="font-weight:bold;"&gt;Environment-friendly&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The People’s Car’s tailpipe emission performance exceeds regulatory requirements. In terms of overall pollutants, it has a lower pollution level than two-wheelers being manufactured in India today. The high fuel efficiency also ensures that the car has low carbon dioxide emissions, thereby providing the twin benefits of an affordable transportation solution with a low carbon footprint.&lt;br /&gt;(For more information visit www.tatapeoplescar.com )&lt;br /&gt;&lt;br /&gt;Nano, the world’s cheapest car, is expected to be commercially launched in the second half of 2008.&lt;br /&gt;&lt;br /&gt;The 1 lakh car was a major concern for the environmentalists and other who raised concern about the pollution and concession caused by the car if it was wide accepted in the market. The target audience of the car is basically two wheeler buyers who would like to own a car and also second hand small car buyers. Mr Tata refuted these claims and said that the car would be least polluting and as far as congestion is concerned, something that needs to be acted upon is the infrastructure. Stopping someone from making a car that would be affordable to common people nation wide is not an answer.&lt;br /&gt;&lt;br /&gt;The car if successful will definitely revolutionize the four wheeler segment in the country and around the world.&lt;br /&gt;&lt;br /&gt;Some pictures of "Nano"&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VnFS8PNEOkk/R4hmP-FX7eI/AAAAAAAAAk8/IFYA9I4Cjqw/s1600-h/tatanano.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_VnFS8PNEOkk/R4hmP-FX7eI/AAAAAAAAAk8/IFYA9I4Cjqw/s200/tatanano.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5154482198075141602" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VnFS8PNEOkk/R4hmbOFX7fI/AAAAAAAAAlE/Q9TVuNGQXmk/s1600-h/tatanano2.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_VnFS8PNEOkk/R4hmbOFX7fI/AAAAAAAAAlE/Q9TVuNGQXmk/s200/tatanano2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5154482391348669938" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701490274833023197-3200726457375974022?l=yaseen-javaj2ee.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/HGid/~4/xU34gfjUIlU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/blogspot/HGid/~3/xU34gfjUIlU/tata-nano-just-2500-car-unveiled-in.html</link><author>noreply@blogger.com (Yaseen Khan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_VnFS8PNEOkk/R4hmP-FX7eI/AAAAAAAAAk8/IFYA9I4Cjqw/s72-c/tatanano.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://yaseen-javaj2ee.blogspot.com/2008/01/tata-nano-just-2500-car-unveiled-in.html</feedburner:origLink></item></channel></rss>

