Friday, December 30, 2011

Enabling logging for various components in WSO2 BPS

This blog post explains how to log the messages come into and sent out from WSO2 BPS server.
This feature is extensively used in BPEL development to figure out the problems in the message sequences and in latency analysis during BPEL process invocations.

Tested Environment
     wso2bps-2.1.2

Instructions
  1. Add the following entries to the $CARBON-HOME/lib/log4j.properties
        log4j.logger.org.apache.ode.bpel.messagetrace=TRACE
        log4j.logger.org.wso2.carbon.bpel.messagetrace=TRACE
  2. Then the preferred log4j appender should be configured such that it has a threshold of TRACE level. If CARBON_LOGFILE is the log4j appender, it should be changed as follows. By default this is set to DEBUG.
        eg - log4j.appender.CARBON_LOGFILE.threshold=TRACE
  3. Then re-start the WSO2 BPS server.
  4. The log files can be found as $CARBON-HOME/repository/logs/wso2carbon.log 
Note - You can configure this via Management console as well.

Sunday, December 18, 2011

Customizing the email subject for RegistryEvents in WSO2 Carbon

Recently I used org.wso2.carbon.registry.common.eventing.RegistryEvent in WSO2 G-Reg 4.1.0 (based on Carbon 3.2.2) to generate custom email notifications based on different events. Though it was possible to customize the email body, it was not possible to customize the email subject due to a missing feature. In the upcoming Carbon releases this feature will be available and you can set the subject as a parameter with the key "MailConstants.MAIL_HEADER_SUBJECT" for the event as follows.

Versailles

Last-night I watched this comedy, "Midnight in Paris" and there were some nice scenes which were shot around Versailles where I went with few of my friends. Here are some of the pics from my visit.
Once Versailles was the capital of France over a century and still it's renowned for the Palace of Versailles.


On the way to the Palace...




Statue of Louis XIV

Immature panorama :)




Interior court, Palace of Versailles

Saturday, December 17, 2011

Engineering to take over the world

The most interesting presentation from WSO2Con 2011 :). This presentation done by Samisa, is about how WSO2’s approach to engineering and its secret ingredients to the company’s success. You can hear some inspirational thoughts here and there like “We don’t call people, resources. People are people”. Hope you’ll find it interesting as well.

Saturday, December 3, 2011

The Last Supper - Santa Maria delle Grazie

The Last Supper

The Last Supper is one of the most famous paintings by Leonardo da Vinci. He painted the Last Supper at the rear of a dining hall at Santa Maria delle Grazie in Italy.
If you're gonna visit it, make sure to reserve a ticket far ahead as quite a few people are allowed to visit the church, a day.





Saturday, October 22, 2011

Business Process Hosting in the Cloud

I wrote an OT article named "Business Process Hosting in the Cloud". This article discusses multi-tenancy aspect in a cloud computing environment and some of the concerns of hosting business processes in the cloud. WSO2 Business Process as a Service supports development and easy deployment of business processes modeled using the WS-BPEL standard in a multi-tenanted environment. Also it provides functionality for business process management and hosting in the cloud.

Saturday, September 17, 2011

Introduction and Advanced Concepts of BPEL

Waruna and I held a tutorial session for WSO2Con-2011 post conference tutorials. We basically explained and demonstrated on what the WS-BPEL constructs are and how to write a simple WS-BPEL process. And also we discussed some advanced concepts related to WS-BPEL as well. Here I have attached the slide-deck we presented.

Hm... it's been quite a messed-up week after all. Tomorrow I'm going for some snorkeling+diving with some of my friends :). Have a nice week-end!.

Related post: http://ddweerasiri.blogspot.com/2011/08/advanced-concepts-in-ws-bpel-20.html

WSO2Con-2011 Day 03

For the last day of the conference, keynote speakers for the morning sessions were Gregor Hohpe from Google Inc. and Narendra Nathmal from Cognizant Technologies. Gregor Hohpe discussed about his experience on enterprise integration patterns and its past, present and future. Narendra Nathmal talked on "SOA & Beyond: Using Open Source Technologies".
During the last day of the conference, several speakers told their stories on their work related to WSO2.
It was amazed to see how people use open source software and build new stuff and contribute back to the community back. One of my favorite project was "Advanced Business Process Instance Monitoring in WSO2 Carbon" by David Schumm who is a research assistant from Institute of Architecture of Application Systems (IAAS), Germany.

Thursday, September 15, 2011

WSO2Con-2011 Day 02

During the day 02 at WSO2Con-2011, I was able to join some of the sessions. Today the keynote speaker was Sastry Malladi who is a distinguished architect from eBay. The speech was about Service Orientation and how eBay has successfully been able to pioneer and leverage service orientation.

Azeez talked about "Open source middleware for Clouds" and elaborated the underneath architecture in WSO2 StrtosLive PaaS. Also he described how cloud-native attributes like Cloud native attributes like distributed/dynamically wired, elastic, multi-tenant, self-service, granularly metered and billed, incrementally deployed and tested enabled in Stratos.

Shankar did a very comprehensive demonstration on creating an applications for StratosLive. Demonstration included most of the features like creating tenants, user import, web-app/service development and deployment, securing web-apps, creating SaaS on top of StratosLive etc.
Also the demonstration included features related WSO2 Relational Storage Service (RSS).

Wednesday, September 14, 2011

WSO2Con-2011 Day 01

Today, WSO2Con-2011 was officially kicked-off after lighting the traditional oil lamp at Waters Edge, Colombo. The very first event was a show from a variety of drummers which brought a fresh start for the event. Then Dr. Sanjiva talked about the "Causing Trouble" which was a talk on past, present and future of WSO2 and its culture. Then Dr. C. Mohan deliverred his key-note speech on IBM Global Technology Outlook - 2011. After then the speakers from WSO2 and guest speakers presented their topics in two different tracks. Then there was a panel discussion moderated by Paul Fremantle. Panelists were Sastry Malladi, Afkham Azeez, Brad Svee and Narendra Nathmal.
Finally the day 01 concluded with a nice elephant ride and a cultural show in Lobby area, Waters Edge.

Multi-tenancy: Winning formula for a PaaS

Today at WSO2Con-2011, Dr. Srinath Perera discussed about what's multi-tennacy and the multi-tenant architecture of WSO2 Carbon platform. Also he talked about multi-tennacy matuarity models and how each of them has different garualarity of sharing and isolation. Then he went through the design and implementation of data isolation, execution isolation and performance isolation in WSO2 Stratos which is the cloud platform for enterprise applications. Finally he discussed about the performance over-haed on multi-tenant applications compared with its normal counterpart.


Wednesday, September 7, 2011

Writing a BPEL compensation handler

Compensation handling plays an important role in Business Process Management. It specifies how to undo a particular task which is not completed due to some error. Let’s take an example.
eg - Take a simple travel booking process which includes three parallel sub-tasks as follows.
Travel Booking Process

Now let’s assume hotel and taxi booking were successful. But couldn't book the flight. Now the “Book Hotel” and “Book Taxi” sub tasks should be compensated in order to mitigate the loss.

In WS-BPEL 2.0, compensation handling is specified using <compensationHandler/>. And <compensateScope/> or <compensate/> can be used to trigger the <compensationHandler/>.

Let’s take a look at the how a compensation handler can be implemented.

Friday, September 2, 2011

How to send email notifications via BPELs

When business process modeling, there can be requirements to send notifications to some external parties regarding the run-time state of the business process. One general example would be when a particular task is completed, the relevant parties is sent a email.
This functionality is supported by WSO2 BPS via Axis2 mail transport.  So using a activity you can send a request to a particular email address.

There 3 steps involved in setting up the environment.
  • Configure Axis2 mail transport in BPS_HOME/repository/conf/axis2.xml
  • Create WSDL which has mail address as the service address
  • Implement the BPEL process with a invoke activity which sends a mail to configured e-mail address

Configuring Axis2 Mail Transport
In this process we only use mail sending functionality, so we don't want to configure transport receiver. To configure mail transport sender first open up the axis2.xml file which resides in BPS_HOME/repository/conf directory in a text editor and add the following mail transport sender configuration to axis2.xml. Place this after other transport sender configurations.
In the above configuration we have used gmail account we have created for testing purposes. But in production deployment you have to use your own e-mail account.

After you save the axis2.xml after adding above configuration, mail transport configuration is done. Now you can use addresses in mailto: format to as the service endpoint address in WSDL and use Axis2 client API to send e-mails.


Create WSDL which has mail address as the service address
So you can create a partner WSDL which has a service endpoint to a email address. As mail sending act as out-only operation, make sure to modify the portType for sending mails accordingly.


Implement the BPEL process with a invoke activity which sends a mail to configured e-mail address
Now you can use an activity to invoke email sending operation with relevant portType and partner-Links.

Avoiding network overhead when interacting a partner services via BPEL

If you have deployed your BPEL process and it’s partner services on the same WSO2 Carbon instance, you can avoid the network overhead using usePeer2Peer=”false” for the particular partner interaction in deploy.xml. The default value is “true”. Here’s a sample.

Business Process hosting in Cloud

Introduction
In this post I’m going to discuss about some concerns of hosting business processes in cloud. First we’ll discuss around the concept of multi-tenancy and a multi-tenancy architecture for business process executions. Then we’ll move on to our main topic of hosting business processes in cloud and the concerns wrapped around it.
WSO2 Stratos BPS is a WS-BPEL compliant business process run-time PaaS whose architecture supports multi-tenancy in the cloud. So the users can host the enterprise level WS-BPEL business processes in WSO2 Stratos BPS and manage them. So we’ll refer it to elaborate more on some of the following sections.

Table of Content
  • Introduction
  • Terminology
  • Multi-tenancy
    • What’s multi-tenancy?
    • Virtualization
    • Goals?
    • Importance
    • What’s in it for business processes?
  • Hosting business processes in cloud
    • Advantages
    • Concerns
      • QoS
        • Throttling
        • Security
    • Billing, Metering, Logging and Business intelligence for Business Processes
      • Billing and Metering
      • Logging
    • Tooling support
  • References

Wednesday, August 31, 2011

Advanced Concepts in WS-BPEL 2.0

Waruna and I’ll be doing a post-conference tutorial session on “Advanced Concepts in WS-BPEL” in WSO2 Con 2011.
Summary of the session is as follows.

BPEL is the de-facto standard for modeling executable Web services orchestrations. It is an XML-based language used for the definition and execution of business, as well as scientific work flows using Web services. WSO2 Business Process Server (WSO2 BPS) and Apache Orchestration Director Engine(ODE) are two WS-BPEL compliant business process executable work-flow engines, which support composition of Web services by orchestrating service interactions.
In this tutorial, Warauna and I will elaborate on some advanced concepts in WS-BPEL 2.0 and extensibility in WSO2 BPS like
  • fault handling
  • compensation handling
  • event processing   
  • selective event processing
  • multiple event processing
  • concurrent event processing
  • message correlation
  • parallel processing
  • Introduction to ODE extensions
  • Future improvements with extensions

Introducing New Sample Guide for BPS 2.1.0

From WSO2 BPS 2.1.0 onwards, we have introduced a new sample guide and documentation which explain some of the basic concepts involved in WS-BPEL 2.0. You can find the documentation over here .

Also we have introduced few samples for complex BPEL scenarios like
  • Compensation handlers - SampleCompensationHandlers
    • This samples demonstrates a flight reservation process with the functionality of with a basic compensation handler will work. Also it involves the which are required in compensation handling.
  • Event-handlers - SampleEventHandlers
    • This sample has an event-handler implementation is capable verifying the functionality and reliability of construct.
  • Asynchronous processes SampleAsynchronousProcess
    • This sample contains two processes. One acts as a client (Async-Client.zip) for the server (Async-Server.zip). Message correlation is used to maintain the asynchronous interaction between client and server.
     
 We will add the documentation to explain those scenarios as well. You can find those other samples over here.

Saturday, August 20, 2011

SSL enabled JConsole to monitor a WSO2 Carbon Server Securely

WSO2 Products like WSO2 AS, ESB, BPS etc. are MBeans enabled servers such that they can be monitored via JMX clients. JConsole is a graphical JMX monitoring client which comes as a part of JDK.
Recently I had to securely monitor a remote WSO2 carbon server.
But the problem is, now any remote user can implement a MBean on the target server and use System.exit() from the client end to kill the Carbon server. So we need to harden  (or secure and restrict) the communication between client and server.
So I used jConsole via a SSL tunnel which enforces client authentication and RMI-registry authentication. Here’re the steps I took to solve the problem.
Note - Feel free to shout back in case you need more clarifications. In some steps I assumed the audience is aware of JMX, public key cryptography etc.

Content

Friday, August 19, 2011

Join us at WSO2Con-2011

WSO2Con 2010 was started last year as a part of WSO2’s 5th year anniversary. This year, WSO2Con 2011 is to be held from Sept 12-16, Waters Edge, Colombo, Sri Lanka. This year’s agenda includes more than 30 speakers from 10 countries.

Keynote Speakers are


IBM Global Technology Outlook – 2011
Dr. C Mohan
Fellow, IBM Research


Service Orientation – Why is it good for your business
Sastry Malladi
Distinguished Architect, eBay


Enterprise Integration Patterns: Past, Present and Future
Gregor Hohpe
Google


SOA & Beyond using open source technologies
Narendra Nethmal
Chief Architect, Cognizant Technologies


WSO2: Disrupting the middleware industry
Dr. Sanjiva Weerawarana
Chairman, Founder & CEO, WSO2 Inc.


WSO2 Vision and Roadmap
Paul Fremantle
Founder & CTO WSO2 Inc.
In a summary the conference will be all about
  • Customer experiences describing how WSO2 products are being used to build enterprise and SaaS apps in financial services, government, mobile, telecom and other industries.
  • Best practices for leading enterprise architecture initiatives, managing SOA projects and moving beyond SOA and open source.
  • Tutorials on a broad range of middleware technologies by WSO2 developers and Apache committers with real world experience working with customers around the world.

Happy 6th birthday WSO2!

This month, August is the summer vacation period for WSO2. Also last August 4th was WSO2’s 6th birthday. A small party was organized in both US and LK offices on the birthday. On the same day, a day-out was organized for school kids who were from Sigiriya area. They were brought to visit WSO2 and few places in Colombo like Zoo, World Trade Center, Museum and Galle Face Green etc. Here are some snapshots that I really liked of the day. Thanks, Chinthana Wilamuna and Harindu Alwis for sharing them. Happy birthday WSO2!



Sunday, June 19, 2011

WSO2 BPS 2.1.0 Available for Download


The WSO2 Business Process Server(BPS) team is pleased to announce the release of 2.1.0 version of the Open Source Business Process server. WSO2 BPS 2.1.0 is based on WSO2 Carbon 3.2.0 which is the OSGi-based component framework allows the complete set of WSO2 products to leverage shared components, ensuring a consistent set of features between products, a consistent user experience, and reusing of identical components. You can find the release note for WSO2 BPS 2.1.0 from here.

Two fresh products; WSO2 MB and WSO2 CEP also were released with the existing set of products.

Few excerpts from the WSO2 BPS 2.1.0 release note...
  • WSO2 Business Process Server (BPS) is an easy-to-use Open Source Business Process Server that executes business processes written following WS-BPEL standard. WS-BPEL is emerging as the defacto standard for composing multiple synchronous and asynchronous web services into collaborative and transactional process flows which increase the flexibility and agility of your Service Oriented Architecture. WSO2 BPS is powered by Apache ODE and available under Apache Software License v2.0. WSO2 BPS provides a complete Web based graphical console to deploy, manage and monitor business process and process instances.
  • WSO2 BPS is developed on top of the revolutionary Carbon platform (Middleware a' la carte), and is based on the OSGi framework to achieve the better modularity for you SOA. Carbon platform contains lots of new features and many other optional components that can be used to customize or enhance the functionalities provided by BPS to suits you SOA needs. In addition to installing optional components you can uninstall unwanted features without any trouble.
    WSO2 team recently released 3.2.0 version of WSO2 Carbon platform which is the OSGi-based component framework allows the complete set of products to leverage shared components, ensuring a consistent set of features between products, a consistent user experience, and reusing of identical components.
  • An open source product, WSO2 BPS is available under the Apache Software License (v2.0) . This includes all of the extra integration and management functionality as well.

Tuesday, June 14, 2011

Off-season Sri Padha(Adam's peak) hike


Recently five friends at WSO2 and I hiked-up Sri Padha(Adam's Peak) during the off-season. It was my 2nd hike to that mountain during the off-season. During the off-season the site was very much peaceful as usually pilgrims don't walk up the mountain due to heavy raining, strong wind, lightning and thick mist.
Adam's peak is an important pilgrimage site especially for Buddhists. Unlike in pilgrimage season (December to May), we had to take precautions and we had to prepare and bring all the food and stuff required up to the peak of the mountain. As there's no electricity until the peak of the mountain, we prepared for that as well. We climbed-up the mountain via a shorter path which is Hatton route and climbed-down via a longer path which is Rathnapura route. We started to climb-up the mountain around 2pm and it took around four hours. While climbing-up, it was raining all most all the time, but we didn't experience much of a wind. We were the only team to stay there for that night. And the next morning we worshiped and walked around the peak. We couldn't see the sun-rise due to thick mist. Only for few seconds we saw very far away mountains but those views were vanished in seconds when thick clouds covered the peak. Then we climbed-down via Rathnapura route and we experienced some strong wind. Though Rathnapura route was quite longer it was more beautiful as it was lead through a lush green jungle.


At the peak

Carbon 3.2.0 - One checkout One build in 3-4 hours


Recently I had a memory upgrade to my office laptop. So I felt to build very recently released WSO2 Carbon 3.2.0 branch and compare the build time while watching a movie :). Previously it took around 8-9 hours to build the complete carbon product stack which consist of around 4941kSLOC. But now it takes around 3-4 hours. During the build, I managed to keep the swap usage in a minimum level (maximum up-to 10MB) by configuring the JVM options such that Build system utilizes the maximum physical memory while underneath OS has enough physical memory left for its tasks. Normally in Ubuntu 10.04 (Kernel Linux 2.6.32-24-generic), from the moment physical memory is fully utilized, the swap space starts to increase continuously even though there's available physical memory after sometime. So swap usage doesn't decrease for a long time. So if the JVM options are not set properly overall performance get decreased drastically. Seems tuning JVM based on available physical memory can preserve a lot of CPU time.

Saturday, April 23, 2011

Monitoring multiple WSO2 server instances via a single front-end

Any WSO2 product like WSO2 BPS, WSO2 AS, WSO2 ESB etc is based on WSO2 Carbon platform. One inherent characteristic of this platform is, it's easily front-end and back-end separated.
As well this is an interesting deployment pattern which is very useful in many scenarios. In this post what I tried to do is monitor two WSO2 back-end server instances (ESB and BPS) via a single front-end server instance.


Table of Content

Saturday, April 16, 2011

SOA Security and Identity Workshop - European Tour


This is the second run on a series of workshops on a crosscutting concern of SOA-Security. Four workshops will be conducted in Paris, London, Zurich and Frankfurt from 3rd to 11th of May.


With data protection at the peak of scrutiny, identity and security are fundamental tools in the management of enterprise web applications.

This full-day interactive workshop will highlight the growing challenges of identity and security management. We will demonstrate how enterprise architects and developers may overcome these challenges and gain insight in to key security standards and identity management for SOA.

Topics to be covered :
  • Identity, Single sign-on, SAML2, OpenID, OAuth, Information Card
  • Entitlement and Authorization – XACML
  • How Governance affects your Security?
  • Best practices for securing your SOA, REST and Cloud (Patterns)
  • Summary/ QA
For more info - http://wso2.com/events/workshops/2011-may-europe-securitygatewaysolution-workshop/

Thursday, April 14, 2011

Wishing you a very happy new year


First of all I like to Wish a very happy new year to everyone. This is the festive season of Sinhala and Hindu new year all for Sri Lankans. So is the WSO2 team also celebrating the new year dawn with their loved ones except for few guys at on-site work in US.
Before starting the vacation we stayed few days at Heritance Kandalama Hotel. The climate was kinda calm but hot as Colombo. So I spent the afternoons swimming and during morning I spent on sightseeing around the hotel and the lake. Evening time was almost spent on playing cricket with friends.
I went to this hotel when I was a kid, but I think now it's more greener and more closer to wildlife. (Don't put anything in balcony unnoticed as monkeys are gonna drag them away definitely :))




As well the hotel is renowned for its grand architecture which is well blended with the natural environment by Geoffrey Bawa.
After the trip, I moved back to home. I'm happy that my family still respect new year rituals.
And I’m happy as all my family get together after a long time.

Related links - Happy new year Sri Lanka!

Monday, March 7, 2011

Memory Growth - FireFox vs. Chrome


This is very quick and silly test you can try to analyse on the memory usage of Mozilla Firefox and Google Chrome.

Used environment
  • Firefox 3.6.9
  • Google Chromium 7.0.517
  • Ubuntu 10.04

Method
  • Choose a list of 10 random very frequently used web pages which consisting a mixture of dynamic and static content. 
  • Then measure the memory growth due to each new tab in both browsers.
  • During the test, a snapshot of cumulative memory growth due to new tab was measured using operating system level resource statistics.
  • Memory overhead due to add-ons was added to "Empty Tab" column.



Thursday, March 3, 2011

How to deploy WSO2-BPS in Apache Tomcat


This blog post explains how to deploy WSO2-BPS in Apache Tomcat servlet container with a few configuration steps. Even for any other WSO2 product these steps will be compatible.

Tested Environment
- Ubuntu 10.04
- WSO2BPS-2.0.2
- Apache-Tomcat-6.0.12
- Java version "1.6.0_21"

Step 1
  • Extract the downloaded distribution of wso2bps-2.0.2 into a directory.
  • Copy repository and resources directories in to a new folder. Say it is carbon-repo (i.e:- /opt/temp-svn/products/carbon-repo)
Step 2
  • Extract the downloaded distribution of apache-tomcat-6.0.32 into a directory, CATALINA_HOME.
  • Go to CATALINA_HOME\webapps directory and create a new folder, bps
  • Copy wso2bps-2.0.2/lib/core/WEB-INF to CATALINA_HOME/webapps/bps
Step 3
  • We need to enable https in tomcat. Therefore, edit CATALINA_HOME\conf\server.xml by adding the following entry.
<connector maxhttpheadersize="8192" port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true" SSLEnabled="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile = "/opt/temp-svn/products/carbon-repo/resources/security/wso2carbon.jks"
keystorePass="wso2carbon" />
  • Make sure to give the exact location of wso2carbon.jks as highlighted above.
    Step 4
    • We have done the configurations required in tomcat. Now, we must do the necessary configurations in a set of configuration files shipped with WSO2 BPS. We will update carbon.xml, axis2.xml, registry.xml and user-mgt.xml which can be found at carbon-repo\repository\conf directory.
    • First, open carbon.xml and update the ServerURL and WebContextRoot elements as follows. It is required to change the WebContextRoot to match with the web application directory name we have given in step2. In our case, it is bps.
    <ServerURL>https://localhost:8443/bps/services/</ServerURL>
    
    <WebContextRoot>/bps</WebContextRoot>
    
    • Note that we have configured tomcat to run on 8443 port. Save and close carbon.xml.
    • Open registry.xml and update DB URL as follows.
    <dbConfig name="wso2registry">
    <url>jdbc:h2:/opt/temp-svn/products/carbon-repo/repository/database/WSO2CARBON_DB</url>
          <userName>wso2carbon</userName>
          <password>wso2carbon</password>
          <driverName>org.h2.Driver</driverName>
          <maxActive>50</maxActive>
          <maxWait>60000</maxWait>
          <minIdle>5</minIdle>
      </dbConfig>
    
    
    • Open user-mgt.xml and update database URL as follows.
    <Property name="url">jdbc:h2:/opt/temp-svn/products/carbon-repo/repository/database/WSO2CARBON_DB</Property>
    
    • Make sure to specify the absolute path of the WSO2CARBON_DB in both of the above elements.
    • Open axis.xml and change the ports in the http and https transport receivers as follows.
    <transportReceiver name="http" class="org.wso2.carbon.core.transports.http.HttpTransportListener">
       <parameter name="port">8080</parameter>
    </transportReceiver>
    
    <transportReceiver name="https"
    class="org.wso2.carbon.core.transports.http.HttpsTransportListener">
       <parameter name="port">8443</parameter>
    </transportReceiver>

    Step 5
    • Add the jars included in CARBON_HOME/lib/endorsed to CATALINA_HOME/lib.
    • Now, open a new command window and change the directory to CATALINA_HOME/bin.
    • Define an environment variable called CARBON_HOME and set the path to your carbon-repo directory.
                 eg - export CARBON_HOME=/opt/temp-svn/products/carbon-repo
    • Start the Tomcat server and access https://localhost:8443/bps/services/ in browser.

    Saturday, February 26, 2011

    How to setup a BPEL project in Carbon Studio from an existing BPEL artifact


    In this blog post is about how to setup a WSO2 Carbon Studio BPEL project from an existing BPEL artifact.
    Suppose there's a BPEL process, and you need to edit it via WSO2 Carbon Studio. We can't directly open a BPEL process via Carbon Studio. First you need to create a BPEL project and import the BPEL process to that BPEL project.

    How to create Carbon Studio BPEL project from an existing BPEL process
    • Start Eclipse Carbon Studio. Here you need to make sure you have installed Carbon Studio in Eclipse version you use.
    • In the menu bar goto File -> New -> Other -> BPEL Project . Then the following dialog will appear.

    • Click on Next. Then the following dialog will appear.

    • Add a Project name .Under Configuration click on Modify and put a check on BPEL 2.0 Facet. Click OK.


    • Then click Finish in “New BPEL Project” dialog box.
    • Now the Carbon Studio BPEL project has been created. And now we need to import the process files to this project.
    • For that; first extract a process we have provided. 
    • Then in Carbon Studio; Right click on the project in the “Project Explorer” Window -> Import... Then the following wizard will pop up. Choose “File System”, then click Next.


    • Then the following dialog will appear. And give the location of the previously extracted BPEL process in 7. Then add all the files in that BPEL process. Then Click on Finish.

    • Now the Carbon Studio project is created and you can edit the BPEL process via our editor.


    How to deploy and run BPEL projects
    • In Carbon Studio goto File -> Export. Then in the appearing dialog choose "WSO2 BPS BPEL Artifact". Then export the project.
     
    • Add the created BPEL artifact to WSO2 BPS via Web UI.

    Friday, February 25, 2011

    Java Iterator - Best practices


    In a recent code review at WSO2, Afkham Azeez mentioned some java best practices. This was something I didn't knew before. There are two ways to use a java iterator. One method is using a While-loop. The other way is to use For-loop. But the first method can drive you into errors if not correctly handled. Look at the following code.
    List<String> list = new ArrayList<String>();
        list.add("1");
        list.add("2");
        list.add("3");
    
    Iterator<String> iter = list.iterator();
        while ( iter.hasNext() ){
          System.out.println( iter.next() );
        }
    
    System.out.println(iter.next());
    

    If you see carefully, now the iterator can been used outside the while-loop and it might throw NoSuchElementException as iter.hasNext() is not called, in each iter.next() call.

    By using a for-loop we can avoid this by restricting the iterator to be accessed only inside the for-loop scope.

    eg -
    List<String> list = new ArrayList<String>();
        list.add("1");
        list.add("2");
        list.add("3");
    
    for ( Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
          System.out.println( iter.next() );
        }
    

    Saturday, January 29, 2011

    Create Business Processes, Human Tasks, with many other features


    Suppose you need to write a business process/human task with some quality of service features like security, throttling caching etc. Or suppose you need inject ESB characteristics like service mediation, routing, load balancing, message enrichment etc. to incoming and outgoing message sequences.
    Now what if you can do all these stuff with one server instance without using different products for different requirements, isn't it great?
    WSO2 Carbon is capable on this due to its component architecture. Not only that you can do these stuff using Carbon UI very easily.
    Due to WSO2 Carbon's OSGi based component architecture, you can customize WSO2 products based on your requirements.

    Here I'm writing about how those stuff can be done in a very high level.

    1. Security, Caching, Throttling to Business processes/Human tasks.
    WSO2 BPS is inherently support this, and you can use the BPS Web UI to configure, monitor and maintain business processes with these features. The more interesting thing is; the whole set of WSO2 carbon products, have this unique interface. So once you get familiar with one product, you can use other products very easily. As an example, to enable throttling to service mashup, data service or SOAP service etc, user sees an unique interface.

    Here are some screen-shots of the service dashboard.

    Main service dashboard

    Security configuration

    Throttling configuration

    Caching configuration

    Try-it configuration


    2. How to embed ESB like features
    How to install ESB features - To use WSO2 ESB features what you need to do is install ESB related features to BPS. But I would prefer install BPS features into ESB as the number of BPS features are less than ESB features. As any WSO2 product is a set of OSGi components; there is no any difference in installing BPS features to ESB product and installing ESB features to BPS product.

    Here is a screen-shot of feature management page


    Now if you are already familiar with WSO2 ESB; using ESB features on business processes/ human tasks is no different from using ESB features on any other service.
    eg - writing a proxy service for a business process and use message mediation in in-sequence and out-sequence. etc

    Friday, January 28, 2011

    How to reuse Eclipse EMF.edit to write GEF editors


    If you are into Eclipse Plugin development you’ve definitely heard of Eclipse Modeling Framework (EMF).
    EMF provides a framework to define, code-generate, extend etc, for user-defined structured data models.
    There are various ways to define the data model. One example would be using a define data model in XSD and use EMF to code generation.
    EMF handles the code-generation of the model as well it also generate a general GEF based editor to manipulate the model instances using a tree-view, list-view, table-view etc.
    Apart from it EMF provides many features to seamlessly extend the model.

    This blog-post talks about the basic initial steps to implement a eclipse editor using EMF.edit package. If you are not that much familiar with EMF.edit refer this documentation.

    Few features provided by EMF.edit is
    1. Content provider and Label provider
    2. Property Source
    3. Command framework
    4. Change notifier
    1. Content provider and Label provider
    These classes are used to represent data to the end-user. Here I’m not going much deeper. I’ll show you a code snippet that can be used on top of EMF.edit code and reuse the content and label providers used by the EMF framework.

    adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new NamespaceItemProviderAdapterFactory());
    
    TableViewer notificationsTableViewer;
    notificationsTableViewer = new TableViewer(parent, SWT.SINGLE);
    notificationsTableViewer.setContentProvider(new AdapterFactoryContentProvider(adaptorFactory));
    notificationsTableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adaptorFactory));
    notificationsTableViewer.setInput(notifications);
    

    2. Property Source
    Property source provider is used to represent the properties involved with a particular model object. In EMF.edit the item provider classes implements org.eclipse.emf.edit.provider.IItemPropertySource.
    Here is a code snippet that can be used to integrate property source providers generated from EMF framework.

    propertySheetPage =new PropertySheetPage ();
    propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
    

    If you go into provider classes generated from EMF.edit, you’ll see those classes have three methods, that implement the interface IItemPropertySource.

    List getPropertyDescriptors(Object object);
    IItemPropertyDescriptor getPropertyDescriptor(Object object, Object propertyID);
    Object getEditableValue(Object object);
    

    So you can reuse/study the above three method implementations to represent properties for each element.

    3. Command Framework
    If you have heard of Eclipse Command Framework, you’ve already realized how it is easy and cool to use eclipse commands to edit the EMF model objects.
    Here’s a sample code to add a new element to the parent. This code is not general for all commands. So you may need to refer some documentations on this.

    Group group = _200803Factory.eINSTANCE.createGroup();
    group.setName(“Group Name”);
    List<group> list = new BasicEList<group>();
    list.add(group);
     
    Command addGroup= AddCommand.create(domain, group, _200803Package.eINSTANCE.getGroups_Group(), list);
    if(addGroup.canExecute()){
      domain.getCommandStack().execute(addGroup);
    }else {
      System.out.println("Cannot execute");
    }
    

    4. Change notifier
    In EMF.edit framework item provider adapters extends ItemProviderAdapter class which extends AdapterImpl. The method NotifyChange() is implemented in order to notify the viewers related to changes occurred to a model.

    public void notifyChanged(Notification notification) {
      updateChildren(notification);
      switch (notification.getFeatureID(TExtensibleElements.class)) {
        case _200803Package.TEXTENSIBLE_ELEMENTS__DOCUMENTATION:
        case _200803Package.TEXTENSIBLE_ELEMENTS__ANY:
        case _200803Package.TEXTENSIBLE_ELEMENTS__ANY_ATTRIBUTE:
        fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
      return;
      }
      super.notifyChanged(notification);
    }
    

    Take a look at the code of this method, you will find, fireNotifyChange() method is called with a parameter ViewerNotification, this method is defined in ItemProviderAdapter which implements the interface “IChangeNotifier”, both the viewers and property sheets are the listener of the IChangeNotifier (using addListener and removeListener method provided by ItemProviderAdapter to register as a listener of the item provider), and in the changeNotifier.fireNotifyChanged(notification) method will called all the listener’s notifyChange() method.

    public void fireNotifyChanged(Notification notification) {
      if (changeNotifier != null) {
        changeNotifier.fireNotifyChanged(notification);
      }
    
      if (adapterFactory instanceof IChangeNotifier) {
        IChangeNotifier changeNotifier = (IChangeNotifier)adapterFactory;
        changeNotifier.fireNotifyChanged(notification);
      }
    }
    

    Saturday, January 15, 2011

    WSO2 Annual Award Ceremony 2010


    WSO2 Annual Award Ceremony 2010; was held at Kings Court, Cinnamon Lakeside, Colombo on 14th January 2011. The most tremendous contributors in WSO2 were honored. I personally congratulate all of them for a better future. You can Google them if you wanna know more about them :).
    • Afkham Azeez
    • Supun Kamburugamuwa
    • Thilina Mahesh Buddhika
    • Milinda Pathirage
    • Saminda Wijerathne
    • Chathuri Wimalasena
    • Hiranya Jayathilaka
    • Prabath Siriwardena
    • Kasun Indrasiri
    • Asanka Abeysinghe
    • Sumedha Rubasinghe
    • Selvaratnam Uthaiyashankar
    • Samisa Abeysinghe
    • Senaka Fernando
    • Charitha Kankanamge
    • Evanthika Amarasiri
    • Krishantha Samaraweera
    • Chamith Kumarage
    • Nirosh Perera
    • Janath Sivayoganathan
    • Hasmin AbdulCader
    • Udeshika Ratnavira
    • Devaka Randeniya
    • Padmika Dissanaike
    As well I congratulate all the WSO2 team members who are very supportive to each other.