Working on OpenESB core and components with Netbeans


Introduction

Often, when meeting OpenESB advanced users, people complain about OpenESB component build complexity. It stops them to fix and improve components and, as such, they cannot provide the community with new features and improvement. Indeed, for historical reasons, due to the hasty end of Sun Microsystems support, OpenESB code and the builds were not very easy to comprehend, understand, modify and build. In order to remove this impediment, we worked very hard to improve OpenESB code infrastructure.
Our first objective was to move the code from SVN to Git. Today (2013 Q1) OpenESB code is available on Bitbucket (https://bitbucket.org/openesb/) .
The second is to propose an easy way to set up a development infrastructure on your personal development machine. This paper explains how to set up a complete environment based on Netbeans to improve, debug and build OpenESB component. Some steps are required to set up tools and Netbeans configuration. Each step is easy and requires little knowledge. So, today you are able to download, debug test and build the complete OpenESB code.
There are three parts in OpenESB code: The core, the components and the Netbeans plugins. In this paper, we explain how to build the core and the component. Another document about the plugin will be issued soon.
This document is dedicated to advanced Java developers and do not target OpenESB users.
We hope this simple guide will make easier OpenESB access code and promote community involvement in OpenESB Evolution.


At the first glance
The picture below describes the main steps to setup a build environment.

The best way to success is to complete successfully each step at a time.

Software installation

To setup your OpenESB component development context, you must install on your machine the following applications.

Application

Version

Comment

JDK

Version 1.6 or >

OpenESB new version compile easily with JDK starting from 1.6.

However, if you want to compile using JDK 6, you have to set your endorsed libraries with JAXWS-API and JAXB-API using version 2.2. Download JAXB-API 2.2.4 and JAXWS-API 2.2.5 and save to $JAVA_HOME/jre/lib/endorsed/

 

Maven

2.2.1

Use Version 2.2.1

OpenESB Version

>= 2.3

OpenESB for Glassfish 2 server

Install and set up JDK

Install JDK 1.6 or newer to build OpenESB components. We double checked the process provided in this document with the JDK 1.7_9 64 bits. Don't forget to set your JAVA_HOME environment variable accurately. However, to compile correctly OpenESB project, you MUST set up "Source and Binaries" with 1.6. See more details below.

Install and set up Maven

Use Maven version 2.2.1 (A migration to maven 3 is planed). When maven installation is finished, change your Maven settings.xml and add the following options:
In setting.xml, <profiles> section add OpenESB profile

<profile>
<id>openesb</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror --> 
<repositories>
<repository>
<id>openesb-snapshot</id>
<url>http://build2.open-esb.net:8081/nexus/content/repositories/openesb-snapshot/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>openesb-release</id>
<url>http://build2.open-esb.net:8081/nexus/content/repositories/openesb-release/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile> 


Add OpenESB as <active profile>

<activeProfiles>
<activeProfile>openesb</activeProfile>
</activeProfiles> 


Save settings.xml

Install and set up OpenESB

Install OpenESB V2.3 or above with Glassfish application server. Running OpenESB with JDK 1.7 or 1.8 is not an issue since we can set Netbeans to use JDK 1.6 for building task.

Setting OpenESB

Open Netbeans. From the main menu, select Tools > Option > Java > Maven


Change Maven Home and select the directory where Maven 2.2.1 is installed.
Netbeans settings is done.

Download OpenESB component source code

The best practice is you to create your own git repository and fork the component code then download the code from you own repository. Then you will be able create pull request to the community repository. In the document we download the code directly from OpenESB repository.
From Netbeans main menu select Team->Git->Clone


Repository URL for OpenESB component is : https://bitbucket.org/openesb/openesb-components.git . Enter your login/password if required and click Next.


Select the master branch. Click Next.


Fill the Parent Directory. Let the clone name unchanged.
Click on finish. Netbeans starts cloning OpenESB components project on your machine. On my machine it takes around 30 minutes. Be patient. (Moreover, Netbeans does not log what it does when cloning).

Set up the main project

OpenESB components top project is named for historical reasons alaska-top. Before proper building it; you have to set it up first. Open it without opening the required projects.


On alaska-top click right, choose properties and select Sources.


Set Sources/Binary Format at 1.6.

On alaska-top click right,choose properties and select "Actions".


Select "Clean project" action and add the following properties:

maven.test.skip=true 
Env.JV_SRCROOT=THE DIRECTORY WHERE OpenESB-COMPONENT IS (Ex: Env.JV_SRCROOT=G:\OpenESB-Git-Components\openesb-components} 
Env.JV_GFBASE=THE DIRECTORY WHERE GLASSFISH APPLICATION SERVER IS INSTALLED (Ex:Env.JV_GFBASE=F:/OpenESB-v2.3/glassfish)
Env.MAVEN_OPTS=-Xmx1024m
maven.repo.local=MAVEN DEFAULT REPOSITORY (By default on Windows ~/.m2/repository. However you can use another directory but set it in Maven setting.xml) (Ex: maven.repo.local=G:\OpenESB-repository\repository) 




Redo exactly the same thing for"Build project" action.


Then click on OK.
If you start Netbeans with a JDK 1.6 or less, you must specify that components are compiled with a JDK 1.7 platform.

Clean Top Project

The next step cleans the top project. Click right on "Alaska project" and select "Clean".


Clean task takes around 5-10 minutes on my Laptop. Please check in the "output" windows, the clean task log and wait for the message "Build Successful". If Clean is successful, don't replay this task again. Do a clean just once, there is no need to do another clean or a clean and build.

Build Top Project

After cleaning, we build the top project. Click right on "Alaska project" and select "Build".


On my laptop Build task takes between 15 to 30 minutes. Please check in the "output" windows, the build task log and wait for the message "Build Sucessful".
At that stage, you are ready to work with your component source code.

Open a specific project

After building the top project, you can easily modify the code of one component.

  • Close "Alaska-top" and open "bpelse-top" project.
  • Right-click on "bpelse-top" and select properties
  • Set up "bpelse-top" Clean and Build Actions as you did for "alaska-top"




Click OK to save your configuration.
Don't forget to set up the compiling platform to JDK 1.6.

Modify your project

Let's you modify BPEL code. In this document, we modify "bpelcore" project. A priori, you must have no error in you java code. In that case, try to build your project again (bpelse-top) before any modification.
Modify your code, check if there is no error and save it. You can note that your modified class name colour has changed.

Build your project

Build top projects only. In our case, even if we change the code in bpelcore, we start the build from "bpelse-top". This action builds you component and generates a jar file you can deploy.

For our case, click right on "bpelse-top" and select build.

After a while the build finishes successfully.



The resulting Jar file generated by the Build action can be found in the local repository defined in Maven setting.xml: ~/open-jbi-component/… In our case bpelse installer is located in my machine at: G:\OpenESB-repository\repository\open-jbi-components\bpelse-installer\2.3.0-SNAPSHOT

Deploy your component

There are many way to deploy or update your component. For me, the easiest way to do it at the development level is to use Netbeans again.
Start your application server. Go to the component you want to upgrade shut it down and upgrade it


Check the application server log if the upgrade has been successful.


Start your component and enjoy your build.

Build OpenESB Core

OpenESB core is the name given to the bus and OpenESB framework source code. The process to build the bus is really similar to the process used for the component.
Download OpenESB component source code

The address to download the source code is https://bitbucket.org/openesb/openesb-core.git
Core source code is lighter than for the components, so you need to allow around 15 minutes at least for getting your code.

Set up the main project
Open the main project named "open-esb-top"


On open-esb-top click right and choose properties and select "Compile".


Set Sources/Binary Format at 1.6.
On open-esb-top click right and choose properties and select "Actions".
Select "Clean project" action and add the following properties:

maven.test.skip=true 
Env.JV_SRCROOT=THE DIRECTORY WHERE OpenESB-CORE IS (Ex: Env.JV_SRCROOT=G:\OpenESB-Git-Core\openesb-core} 
Env.JV_GFBASE=THE DIRECTORY WHERE GLASSFISH APPLICATION SERVER IS INSTALLED (Ex:Env.JV_GFBASE=F:/OpenESB-v2.3/glassfish) 
Env.JV_AS8BASE = the same value as JV_GFBASE (Ex:Env.JV_AS8BASE=F:/OpenESB-v2.3/glassfish) 
Env.AS8BASE : the same value as JV_GFBASE (Ex:Env.AS8BASE=F:/OpenESB-v2.3/glassfish)
Env.MAVEN_OPTS=-Xmx1024m
maven.repo.local=MAVEN DEFAULT REPOSITORY (By default on Windows ~/.m2/repository. However you can use another directory but set it in Maven setting.xml) (Ex: maven.repo.local=G:\OpenESB-repository\repository) 




Redo exactly the same thing for "Build project" action.



Conclusion

This document gives you a simple process to easily fix or improve OpenESB components and the core. After a simple setup of your environment you can use Netbeans to modify components code. At this stage, the modifications you make are just implemented locally. To publish them you have to push the modification in your own Git (local or remote) repository and then create a pull request to the repository of the community.
We hope this document will be useful to you. Please feel free to send your feedback at paul. perez(at)pymma.com or contact(at)pymma.com