Tuesday, October 20, 2009

JAIN SLEE Example, How to implement a Resource Adaptor

Hello!
I am proud of share this new tutorial about how to implement Resource Adaptors into our JAIN SLEE projects. This tutorial explains how to implement the SIP-RA. This is the last starter tutorial, and I hope it will be helpful. I will continue editing new tutorial about more complex thematics soon.


Also you can see the complete tutorial in slides at:


http://docs.google.com/fileview?id=0B3DLDwLo_7WOOTliODkxNDEtMDQzNy00ZWIwLThlZmUtOTNiNGMzYjhhM2Y4&hl=en


To follow this tutorial you need:


ECLIPSE: Version: 3.3.1.1 Build id: M20071023-1652


EclipSLEE plugin v.1.2.4 - http://people.redhat.com/vralev/eclipslee/update/
Mobicents JAIN SLEE Server 1.2.5-GA - http://sourceforge.net/projects/mobicents/files/
Mobicents JAIN SLEE Resources SIP-RA-1.2.5
SIP Stack I have used the Ericsson Service Development Studio (SDS) that has a SIP client with a SIP stack that I knew.


ATTENTION! The EclipSlee plugin do not run correctly on other Eclipse versions, I strictly
recommend the version 3.3.1.1. Also there is a new version of EclipSlee (1.2.5) that runs over
eclipse 3.4 and 3.5 but still having some bugs.


NOTES:
Use the same RA that is included in the resources folder of JAIN SLEE Server zip file. If you use
JAIN SLEE 1.2.5 use the SIP-RA-1.2.5.jar


Let's start!



1 – Creating JAIN SLEE PROJECT
NEW – Project… – JAIN SLEE – JAIN SLEE PROJECT
Put the name of the project and Finish


2-Adding Resource Adaptor into JAIN SLEE Project
On the project Name in eclipse do right mouse button, properties, JAIN SLEE, ADD DU, and select the SIP-RA-1.2.5-GA.jar and Accept.





3 – Creating a Service Building Block (SBB)
Create a package on src, and do New - Other - JAIN SLEE - Service Bulding Block.
In the event selection you will find a list of events defined by the SIP-RA. In this case we choose a SIP INVITE and we modify the event selecting Event direction: Receive, choosing it as initial event and Initial event selector: Activity context.

Finally we select the JAIN SIP Type Binding.

Once we have created the SBB we find an onInvite funciton in the SBB.java where we implement our code that will be executed when the Server receive a SIP INVITE.
Our code is:
System.out.println("A SIP INVITE HAS BEEN RECEIVED!!!!!");


4 - Configuring the RA binding.
Before the creation of the Deployable Unit we have to create the RA bindings.
Over the Sbb.java right button, Modify Service Building Block, Resource Adaptor Bindings...
Put the factory name: slee/resources/jainsip/1.2/acifactory
Click on Edit binding, and click ADD
Object name: slee/resources/jainsip/1.2/provider
Entity Link: SipRA

Once we have created the entity we have to create the service and Deployable unit of the project.


5 - Preparing the Server
First of all, start the JAIN SLEE Server. Then, we have to deploy the Resource Adaptor (SIP-RA).
Once the RA is deployed you have to go to RESOURCES - click on JAINSIPRESOURCE ADAPTOR.
Create entity: SipRA and make click on Create
Then will appear the SipRA entity INACTIVE, click on SipRA name.

Edit properties and change the 127.0.0.1 ip by the private ip address, for example 192.168.x.x



Finally, bind a entity link: SipRA
Come back to Resources, and Activate the SipRA entity.


Now you can deploy the project DU, and activate the service