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() );
        }