Friday, November 20, 2009

How to write a BPEL extension for WSO2 BPS 1.1.0 and Apache ODE

You may always wanted to write your own BPEL activity to handle your scenario. This article will go through step by step process to implement a simple BPEL extension activity for WSO2 BPS and Apache ODE.
WSO2 Business Process Server (BPS) is an easy-to-use open source business process server that executes business processes written using the WS-BPEL standard. It is powered by Apache ODE (open source BPEL engine) and provides a complete Web-based graphical console to deploy, manage and view processes in addition to managing and viewing process instances.

Implementation of Extension Bundle

Create a class by implementing one of the ExtensionOperation interfaces which are available at [1]. The run* method of this class should contain the implementation of the extension activity. You can find a sample implementation of this class at [2].
Then You have to create a class by implementing AbstractExtensionBundle interface. Within this class, the above implemented ExtensionOperation class should be registered. A sample implementation can be found at [3].

Configure WSO2 BPS

There are two methods to expose the extension classes to BPS.
  • Creating a jar.

    Copy the jar to BPS_HOME/repository/components/lib directory.
  • Creating an OSGI bundle

    Copy the bundle to BPS_HOME/repository/components/dropins directory.
Add the following configuration entry to the bps.xml file in BPS_HOME/conf directory. Repalce org.wso2.bps.samples.extension by your extension class name.
Note: By default, the sample extension bundles shipped with WSO2 BPS are copied to BPS_HOME/repository/components/lib. You have to add the following configuration to get them registered in BPS.
<bps xmlns="">
Now, restart WSO2 BPS sever, and you are ready to use the new extension in your BPEL.

The process is almost the same for Apache ODE. But there is a separate configuration file to register the extension. Please refer ODE extensions documentation for more details.

Using the Extension activity in your BPEL

The extension must be declared before, it is used.

<bpel:extension namespace="#extension-namespace#" 

If the mustUnderstand attribute is set to yes, then the extension should be registered in BPS server in order to deploy the BPEL process. Otherwise, it will throws an error at the compilation stage of the process. If the mustUnderstand attribute is set to no, then the BPEL process will be deployed without checking whether there is an extension registered in the server.

Using the activity. According to the sample anyElementQName should be equal to b4ptest
<anyElementQName standard-attributes>
You can find a sample BPEL process at


[1] - extension

WSO2 Business Process Server 1.1.0 is Released

WSO2 Business Process Server (WSO2 BPS) team is pleased to announce the release of version 1.1.0 of the easy-to-use open source business process server that executes business processes written following WS-BPEL standard.

WSO2 BPS v1.1.0 is available for download at [1].

The WSO2 BPS v1.1.0 is developed on top of the revolutionary Carbon platform[2] (Middleware a' la carte), and is based on the OSGi framework to achieve the better modularity for you SOA.

An open source product, WSO2 BPS v1.1.0 is available under the Apache Software License (v2.0) . This includes all of the extra integration and management functionality as well.

New Features in WSO2 BPS v1.1.0
- Apache ODE trunk is used as the BPEL Engine
- New WSO2 Carbon integration layer for Apache ODE
- BPEL Process Versioning Support
- Support for invoking secured(Using WS-Security) partner services.
- Experimental clustering support
- Invoke activity recovery support through management console
- E4X based data manipulation support for BPEL assignments
- BPEL Extension support for extending WS-BPEL language
- Equinox P2 based provisioning support - extend your BPS instance by installing new P2 features [5].

Other Key Features
- Deploying Business Processes written in compliance with WS-BPEL 2.0 Standard and BPEL4WS 1.1 standard.
- Ability deploy BPEL event listeners
- Managing BPEL packages, processes and process instances.
- WS-Security support for business processes.
- Ability to use external data base system as the BPEL engine's perssitence storage
- Caching support for business processes.
- Throttling support for business processes.
- Transport management.
- Internationalized web based management console.
- System monitoring.
- Try-it for business processes.
- SOAP Message Tracing.
- Web Services tooling support such as WSDL2Java, Java2WSDL and WSDL Converter.
- Customizable server - You can customize the WSO2 BPS to fit into your exact requirements, by removing certain features or by adding new optional features.

How to Run
1. Extract the downloaded zip.
2. Go to the bin directory in the extracted folder.
3. Run the or wso2server.bat as appropriate.
4. Point your browser to the URL https://localhost:9443/carbon
5. Use "admin", "admin" as the user name and password.
6. If you need to start the OSGi console with the server use the
property -DosgiConsole when starting the server

Known issues
All the known issues have been filed here [3]. Please report any other
issues you find as JIRA entries.

Contact us
WSO2 Business Process Server developers can be contacted via the mailing lists:
For Developers:

Alternatively, questions can also be raised in the Business Process Server forum

WSO2 Inc. offers a variety of professional Training Programs, including
training on general Web services as well as WSO2 Business Process Server,
Apache Axis2, Data Services and a number of other products. For
additional support information please refer to

WSO2 Inc. offers a variety of development and production support
programs, ranging from Web-based support up through normal business
hours, to premium 24x7 phone support. For additional support information
please refer to

For more information on WSO2 Business Process Server, visit the WSO2 Oxygen Tank[4].

Thank you for your interest in WSO2 Business Process Server.

-The WSO2 Business Process Server team

Saturday, November 14, 2009

jQuery DatePicker with icon

It is always quite convenient to use an icon to pop-up the date picker in onclick of an icon. It is a very easy task with jQuery date picker. Try following code:
<link type="text/css" href="" rel="stylesheet" />
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$("#datepicker").datepicker({showOn: 'button', buttonImage: '/images/search.gif', buttonImageOnly: true});

<div class="demo">

<p>Date: <input type="text" id="datepicker"></p>



But when you use the above code, the DatePicker will not be popped-up when clicked in the text box, but on the icon. Please be kind enough to make a comment if you happend to find the solution for that.

Friday, November 13, 2009

Install pidgin-facebookchat 1.62 in Ubuntu

I tried to install pidgin-facebookchat 1.62 in Ubuntu 9.04. But it gave me an error mentioning that it requires a version of libjson-glib-1.0-0 >= 0.7.6

But you will not be able to install libjson-glib-1.0-0 version >= 0.7.6 using synaptic package manager or apt-get. Therefore, the first thing you have to do is uninstall the old pidgin-facebookchat plugin. Then install libjson-glib-1.0-0 version 0.7.6 from here

Wednesday, September 16, 2009

Maven Surefire for Integration Tests in JUnit

It is quite convenient to use maven-surefire-plugin to run tests using Maven. It enables generating reports in txt, XML as well as HTML. By default surefire tests are executed in the test phase of Maven build lifecycle. Therefore it enables to run unit tests, but not integration tests which should be executed after package phase.
It is just a matter of configuring the surefire plugin, in order to run integration tests. The configuration given below can be used to change the phase of the surefire plugin.

<!-- skip unit tests in the test phase, since it is required to run integration tests -->
In addition, we need to add the junit dependancy to the pom's dependancy list. This should be added in a manner that it resolves only for the testing.



The version may change depending on your requirements.

Tuesday, August 4, 2009

Installing Amarok in Ubuntu 9.04

There are problems in Amarok 2.0 in Ubuntu :(
Only work around is to use Amarok version 1.4
sudo apt-get install amarok

does not work. Instead use
sudo apt-get install amarok14

For further details refer -

Tuesday, July 7, 2009

SVG string inline with HTML

Have you ever wondered how to display the SVG string that you have generated from your program, inline with HTML. I did try this and searched for a lot, but could not find a proper solution. Instead of that, I was redirected to some JavaScript libraries which are used to generate SVG.

If I clearly mention the problem again; There is a SVG as a string, if it is included in a div element it will not be displayed. But if it is saved in a file with the extension ".svg" and open it with FireFox browser, it is displayed correctly.

If the above paragraph mentions the problem you got, then this is the exact place where you get the exact solution :D

Say, there is a div element with the id "svg", then the following JavaScript function can be used to obtain your objective.

drawSVG = function(svgStr) {
var parser = new DOMParser();
var dom = parser.parseFromString(svgStr, "text/xml");

It is very simple solution, but it took sometime to reach for the solution.

Apache Batik can be used to generate SVG

Tuesday, June 30, 2009

Deploy Intalio Tempo in Apache Tomcat 5

Now you can try WSO2 BPS 2.0.0 which offers you to deploy human tasks written in WS-HumaTasks standard as well as Business  Processes written in WS-BPEL standard. You can also integrate human tasks within the business  processes according to WS-BPEL4People standard. You can start the server as a stand-alone server, so that no need to go through hard configuration stuff. WSO2 BPS 2.0.0 is open source product. Check release note

Recently, I tried to deploy Intalio Tempo in standalone Apache Tomcat 5.5.xx. Tempo provides a ruby build script (tempo_builder.rb) to provide a Tempo integrated in to a Apache Tomcat server. But, what I required was different scenario. I needed to deploy Tempo in my own Tomcat server.
It took few days for me to deploy Tempo in a standalone Tomcat server. Therefore, I thought of sharing the experience I gained, in-order to minimise the pain of people who are in need of deploying Tempo in Tomcat.
Please note well, this document may not be the best way to deploy Tempo in Tomcat. Therefore, please let me know, if you got to know a better way.

First of all, make sure that all the required software are properly installed. Refer INSTALL.txt to find the required software. If you intend to build Apache ODE, then you have to aware about the Buildr and the Java version. In case if you need help on this, refer this post. Make sure that you install the Buildr version 1.3.3 instead of 1.3.2 to support both ODE and Tempo.

checkout the source of Tempo
git clone git://

Build the Tempo (according to the building instructions of Tempo )
buildr package

In case, if you have installed Buildr in both Ruby and jRuby, make sure to prefix jruby -S or ruby -S to select between the installed Buildrs.

Build the Tempo (to build the dependency jars, BPEL processes and axis2 services)
run the script TEMPO_CHECKOUT/rsc/scripts/tempo_builder.rb
refer INSTALL.txt for further details

From this onwards:
TEMPO_TOMCAT refers to the Tomcat directory created by the tempo_builder.rb script.
TOMCAT_HOME refers to the standalone Tomcat server in which Tempo should be deployed.

Copy the following

Edit TOMCAT_HOME/conf/context.xml and add the following in to the <context> element
<resourcelink global="jdbc/BPMSDB" name="jdbc/BPMSDB" type="javax.sql.DataSource"/>
<resourcelink global="DeployRegistry" name="registry/DeployRegistry" type="org.intalio.deploy.registry.Registry"/>
<transaction factory="">TomcatGeronimoTxFactory" />

Edit TOMCAT_HOME/conf/server.xml and add the following to the <globalnamingresources> element
<resource name="jdbc/BPMSDB" auth="Container" type="javax.sql.DataSource" maxactive="100" maxidle="30" maxwait="10000" username="root" password="password" driverclassname="jdbc.Driver" url="jdbc:mysql://localhost:3306/bpms?relaxAutoCommit=true"/>
<resource name="registry/DeployRegistry" auth="Container" type="registry.Registry" factory="org.intalio.deploy.registry.RegistryObjectFactory" />

Edit TOMCAT_HOME/conf/web.xml and add the following to the element <web-app>

Install MySQL Server and create the database "bpms" and create the schema as in TEMPO_TOMCAT/bpms.sql
create database bpms;
use bpms;
source TEMPO_HOME/bpms.sql;

Copy the MySQL connector jar to TOMCAT_HOME/common/lib

Copy the additional jars in the TEMPO_TOMCAT/common/lib to the TOMCAT_HOME/common/lib

Deploy Axis2 (1.4.1) and ODE (1.3.2) in your standalone Tomcat Server

Deploy the following web services which are in the TEMPO_CHECKOUT's respective target directories, in Axis2.

Also deploy the following web services which can be found in TEMPO_TOMCAT/webapps/axis2/WEB-INF/

Copy the following jars in TEMPO_TOMCAT/webapps/ode/WEB-INF/lib to the TOMCAT_HOME/webapps/ode/WEB-INF/lib

Then deploy the following .war files that can be found in respective target directories of TEMPO_CHECKOUT directory.

Then Deploy the xFormsManager.war. It is possible to build it from the source (git clone git:// or download the war file

Now you are ready to use Tempo in your Tomcat server. Please feel free to point out the mistakes in this post as well as your problems regarding deployment.

Tempo-div thread - Is it possible to deploy tempo on tomcat 5.5 and use its runtime
Tempo Installation Guide - INSTALL.txt
Tempo Building Guide - Building
Install Buildr - Buildr for ODE and Tempo
Tempo-div thread which I used to get help - Problem on deploying fds & ui-fw

Saturday, June 27, 2009

Building Apache ODE

I found it little bit hard to build Apache ODE for the first time. I followed the steps in the Building ODE guide as it is. But I was not able to build the ODE source. The appeared error was

Permission denied - Permission denied - /tmp/axis2-adb-1.4.1.jar.16179.53314 or /home/.../.m2/repository/org/apache/axis2/axis2-adb/1.4.1/axis2-adb-1.4.1.jar
Buildr aborted!
Failed to download org.apache.axis2:axis2-adb:jar:1.4.1, tried the following repositories:

(Note well, this error only appears, if you build the ODE for the first time or build it with a cleaned repository.)
Therefore, I tried my best to grant the permission to the relevant directories, but, it did not help. I tried to build it as a super user, then it worked. But, it will not help because all the dependencies are copied to the root's .m2 repository.

Actually there was not a single clue to find the fault. After trying out several tests, I was able to figure out that the root cause is the version of the Apache Buildr. Let me explain in detail, how I installed Buildr.

Installing Apache Buildr in jRuby
First of all I downloaded the jRuby 1.2.0. After following the steps in the Guide, I use the following command to install Apache Buildr in jRuby.

jruby -S gem install buildr

The above command installed the Buildr version 1.3.4 which caused me immense trouble. To solve the problem, I uninstalled the Buildr version 1.3.4 using the command:

jruby -S gem uninstall buildr -v 1.3.4

Then re-installed the older version 1.3.2 again, which relieved me a lot. I still could not figure out the exact wrong with the Buildr version 1.3.4, even though, I posted about the problem in the Buildr dev mailing list. Finally I made my mind by assuming it was a bug in Buildr version 1.3.4. This is a serious because the Buildr version 1.3.4 is not backword compatible :(

There is another important fact about installing Buildr in jRuby instead of Ruby. Quoting Apache ODE Building Guide,

Note that for now, even though ODE can run on JDK 1.6.x, building ODE only works with JDK 1.5.x. So before building, make sure you JAVA_HOME points to a JDK 1.5.x installation

The above statement valid only when using Buildr which installed in Ruby. If You installed the Buildr in jRuby, JDK 1.6.x can be used to build ODE.

Happy ODEing...

Wednesday, June 24, 2009

Sign in to yahoo by PIDGIN

These days Pidgin does not allow to connect to yahoo. It is due to some maintenance or upgrade of their servers. This is a really annoying experience to pidgin-yahoo users. The simple solution is to upgrade the Pidgin version to 2.5.7 (newest). the instructions are given in the pidgin site.

Tuesday, June 9, 2009

Disk Partition strategy for Ubuntu

A newie-bee to Ubuntu may tend to install it in to a single partion ("/"). But it is always advisable to create few more partitions in order make our lives easier, when it is required to re-install Ubuntu as well as when you required to retain the user accounts, their configuration and the softwares insatalled.
In order to achive this, it is required to create atleast another home partition ("/home"). According to the interest, a "/opt" partion can be created in order to install softwares.
Say, You have to re-install Ubuntu due to a inevitable reason, then it is only require to format the root ("/") partion only, other partions can be left intact. You required to create the same user accounts to activate the old user accounts.
In this way, it is possible to re-install Ubuntu without wasting much to configure it again.

Saturday, May 23, 2009

Configure SSH to connect without entering password

This blog post is not about hacking into another's machine without the proper authorization of the owner. If you are looking for that, this is not the right place.

This is about configuring the SSH without entering the password, but, with the proper authorisation of the machine owner :). In cluster computing quite often, it is required to do this. This article describes how to do it by using "DSA" encryption algorithm. It is quite possible to use "RSA" encryption too.

Say there are two machines called A and B. Now we are going to configure machine A to connect to machine B without entering the password of machine B.

Generate private and public keys for the machine A.
ssh-keygen -t dsa

The ssh-keygen command will ask you to enter a passphrase. In this case it should be empty in order to connect without entering a password to the machine B.

The above command will place the private key file (id_dsa) and the public key file ( in the ".ssh" directory in the home directory of your user account.
Then copy the public key of machine A to the ".ssh/authorized_keys" file resides in the home directory of the machine B.

Now, you can connect to the ssh server of machine B from machine A without entering a password/passphrase.
In a cluster environment, you have to configure ssh in such a way that it enables to connect each others' ssh servers.

NOTE: It is not recommended to leave a passphrase empty when creating the keys. But, for the situations like clusters who comunicates via ssh, passphrase should be kept empty.

Get MySQL Cluster data nodes started after an unexpected shutdown

This article relates to MySQL version 5.1 and NDB Cluster version 6.x

When you are new to the MySQL Cluster, quite frequently, you face to the the problem of getting the data nodes attached to the cluster. Although some data nodes are started using the ndbd command, the management console shows it as disconnected. You know that there cannot be any configuration problms/errors, because you have started the cluster successfully few hours ago or the previous attempt.
In this kind of situation, most of the time, the root cause of the problem is that the cluster was ended in a improper way, in the previous time. The simple solution is starting the data nodes with the --initial option.

ndbd --initial

Reference: MySQL documentation

Add multiple jars to classpath

In java (in UNIX like platform), it is not enough just to include the directory, in which the jar dependencies of your application reside, to the classpath. It is required to include path of each and every dependant jars to the classpath. If your application only depends on few jars this is not a problem. But, what if your application depends on several jars say 20, it will be an annoying task to add all the paths of jars to the classpath manually.
It is possible to use a simple shell script to accomplish the above mentioned task. The script can be customized to suit your application very easily.

export JAR_HOME=path to directory which includes jars

for f in $JAR_HOME/*.jar




#the next line will print the JAR_CLASSPATH to the shell.
echo the classpath $JAR_CLASSPATH

java -classpath $JAR_CLASSPATH Name of the programme

Say your jars are in several diferent folders, then you will have to use a for loop per each directory and finally concaternate to a single variable.

Saturday, April 18, 2009

How to re-recover your files (mp3, etc...) after recovering from a bad damage

The recovery mentioned above means to crop out the excessive bits added to the begining of the file, probably after a system recovery. This was a true experience, that I had about an year back. I had a hard disk crash, so that all the data is gone. Finally I was able to recover the files, but with some arbitrary size of bits appended front of some (majority of) files.
There is a simple and more straight forward solution. That is to use a hex editor, and open each file with the editor, then delete the junk bits and save the file. It will be hell a lot of pain, if you are going to follow above method, since there may be several thousands of files to be edited. (Actually in the first place, I was determined to follow this method. Eventually I realised the silliness after couple of days :D)
Therefore I came up with a simple C++ programme to get the job done. I thought of sharing it with you, so that it may help you out in some case :). The programme was implemented to be used in Windows platform, but it could be worked out to run on UNIX without much of a pain.
In the current version, the executable should be moved to the directory that contains the set of corrupted files and directories containing them. Then run the programme using command prompt. It will recover the files in the current directory as well as iteratively the sub-directories.
The programme is written in such a way that it will remove all the bits before the file type's header tag. In this case it will cure only one file type at a run. But feel free to change the code according to your wish and to make your own recovery programme.
You can get the source code from here

Thursday, April 16, 2009

High Performance Computing for Financial Mathematics (HPC4Finance)

Most of the mathematical models in finance are highly resource intensive, when it comes to processing. Therefore, it is encouraging to go for a High Performance Computing resolution. As a result, We, Damitha, Nilendra, Thilina and myself (Waruna) came up with a system which consists of a computational cluster, database cluster and an Excel plug-in to speed-up the financial calculations as well as to add more user convenience by providing a user interface as an Excel plug-in. Hence your results are only a click away.

The system is developed in such a way that other financial models can be integrated to the system dynamically by the user (in this case the developers). In the latest release of HPC4Finance has inbuilt support for three (3) short rate models, namely Geometric Brownian Motion (GBM), Vasicek Model and Cox-Ingersoll-Ross model (CIR).

MPICH2 (1.0.8) cluster which is an implementation of MPI 2.0 specification, is used to implement the computational cluster. The cluster is built on UNIX environment. But it is available for other platforms as well (i.e. Windows even though its not tested enough). The two major problems, we faced with the MPICH2 cluster are load balancing and the fault tolerance. A simple resolution is introduced to improve load balancing by using a round robin algorithm to resolve the jobs (tasks) and their respective execution nodes. Say, that 2 jobs where both are supposed to
run in 10 machines (nodes), are submitted to the cluster where there are 20 machines. Then, in default case, both the jobs will run in the same set of nodes and there are 10 nodes idling. This is a huge waste of resources. Therefore, as our resolution, the jobs are explicitly submitted to the next (available) set of nodes in a round robin manner. Unfortunately, we could not come up with an straight forward mechanism to fault tolerance and fail over management which should be a functionality of the cluster itself. But we provide a logging system which enables to track the fault and restore or restart the job.

MySQL cluster is used to implement the database cluster. The data is automatically replicated through the cluster. The cluster support data node fail-over,
but not SQL (API) node fail-over.

Excel plug-in is the most important component which adds a great deal of value to the system. It enables financial professionals who are not keen in programming and computer clusters to run their financial models by using just a few mouse clicks. The results are drawn on a graph and presented to the user with the other relevant information. The plug-in enables users to import and update financial data through a web service or form a .csv file.

The user is also facilitated with a ribbon, to change and the set the preferences and settings of the plug-in.
The user also equiped with ability to stop (kill) jobs any time which enables users to terminate jobs whose parameters are entered incorrectly.

The system (HPC4Finance) is just an insight to the possibilities of High Performance Computing to the field of Finance with great deal of extendibility and user convenience.


T.P. Dampahala, H.D.D.D. Premadasa, P.W.W. Ranasinghe, J.N.P. Weerasinghe, K.A.D.N.K. Wimalawarne, "Efficient High Performance Computing Framework for Short Rate Models," ams, pp.608-613, 2009 Third Asia International Conference on Modelling & Simulation, 2009

Can be found at -
Efficient High Performance Computing Framework for Short Rate Models -

List of published papers in
the 3rd Asia International Conference on Modeling & Simulation

Wednesday, March 4, 2009

Yeah! exams are over :)

I have just finished my final exam yesterday :)
But it was a quite sad day, due to the attack of Sri Lankan cricket team at Lahore, Pakistan. :(
It is very pathetic situation, to destroy someone who is innocent in order to gain political or other kind of advantage. We as Sri Lankans should stand against terrorism and lead the world to a terrorism less place

Thursday, February 5, 2009

Hi all.........

I just thought of having a blog and I'm getting interested to blogs :D
Gonna continue as soon as exams are over... :)