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="http://wso2.org/bps/config">
...
<extensionBundles>
<runtimes>
<runtime>org.wso2.bps.samples.extension</runtime>
</runtimes>
</extensionBundles>
...
</bps>
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:process...>

<bpel:extensions>
<bpel:extension namespace="#extension-namespace#" 
                        mustUnderstand="yes|no"/>
</bpel:extensions>

...
</bpel:process>
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
<extensionActivity>
<anyElementQName standard-attributes>
standard-elements
</anyElementQName>
</extensionActivity>
You can find a sample BPEL process at TestExtensionActivity.zip

References:

[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 wso2server.sh 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: carbon-dev@wso2.org

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

Training
---------------
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


Support
--------------
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 http://wso2.com/support/

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:
<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.datepicker.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#datepicker").datepicker({showOn: 'button', buttonImage: '/images/search.gif', buttonImageOnly: true});
});
</script>
</head>
<body>

<div class="demo">

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

</div>

</body>
</html>

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.

<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-surefire-plugin</artifactid>
<configuration>
<!-- skip unit tests in the test phase, since it is required to run integration tests -->
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<configuration>
<skip>false</skip>
<!--forkMode>pertest</forkMode-->
<argline>-enableassertions</argline>
<testfailureignore>true</testfailureignore>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<plugin>
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.

<dependencies&
...

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

</dependencies>
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
Therefore,
sudo apt-get install amarok

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

For further details refer - http://nomad.ca/blog/2009/apr/3/amarok-14-jaunty-ubuntu-904/

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");
document.getElementById('svg').appendChild(dom.documentElement);
}

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

Apache Batik can be used to generate SVG