Version 6

    This tutorial demos the typical setup for the environment used to develop JAIN SLEE components for the Mobicents JAIN SLEE container, using the Eclipse IDE and some Apache tools.

     

    Note, the tutorial was done with Mac OSX, which is based on UNIX, thus all shell commands should work for any Linux distribution. Any Windows user is welcome to edit and complete the article with instructions for such operating system.

     

    Table of Contents

     

    Basic Setup

     

    To begin download Mobicents JAIN SLEE and the 3rd party tools:

     

     

    Now create a mobicents directory, and set it as shown below (move the downloads to the respective child directories):

     

     

    01-basic-setup.png

     

     

    Now extract each archive, and your mobicents directory should look as the picture below. Rename the mobicents binary extracted directory to the version, 2.4.0.FINAL in the picture, to simplify further steps:

     

     

    02-basic-setup.png

     

     

    To complete the basic setup, a few shell environment variables must be configured, the following entries should be added to the shell profile, to ensure that for each shell these are previously set:

     

    {code}

    # replace this path with the absolute path to the mobicents directory created

    export MOBICENTS_HOME=/Users/martins/mobicents

    # tools home definition

    export ANT_HOME=$MOBICENTS_HOME/tools/apache-ant-1.8.2

    export M2_HOME=$MOBICENTS_HOME/tools/apache-maven-2.2.1

    export JBOSS_HOME=$MOBICENTS_HOME/slee/binary/2.4.0.FINAL/jboss-5.1.0.GA

    # path setup, including the bin folders of each tool

    export PATH=$ANT_HOME/bin:$M2_HOME/bin:$JBOSS_HOME/bin:$PATH

    # java and maven opts configuration, essential for proper Mobicents and Maven execution, -Xmx param should be configured with typical max available RAM

    export JAVA_OPTS="-Xmn256m -XX:CMSInitiatingOccupancyFraction=80 -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -XX:MaxPermSize=256M -Xmx7000M -Xms512M -XX:+UseConcMarkSweepGC"

    export MAVEN_OPTS=$JAVA_OPTS

    {code}

     

    A quick test for the shell environment, execute the following commands, and confirm that both Maven and Ant are executed:

     

    {code}

    [21:46:50][macbookpro:mobicents]mvn -v

    Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)

    Java version: 1.6.0_24

    Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

    Default locale: en_US, platform encoding: MacRoman

    OS name: "mac os x" version: "10.6.7" arch: "x86_64" Family: "mac"

    [21:46:58][macbookpro:mobicents]ant -v

    Apache Ant(TM) version 1.8.2 compiled on December 20 2010

    Trying the default build file: build.xml

    Buildfile: build.xml does not exist!

    Build failed

    {code}

     

    Eclipse IDE Setup

     

    The Eclipse IDE is the Java IDE used by the Mobicents team, for which a plugin is available to assist on the development of JAIN SLEE components.

     

    Adding M2_REPO Variable to Eclipse

     

    Before starting it, let's use a shell to add a M2_REPO variable, pointing to Apache Maven's local repository. In the mobicents directory execute:

     

    {code}

    [21:47:58][macbookpro:mobicents]mvn -Declipse.workspace=ide/workspace eclipse:add-maven-repo

    [INFO] Scanning for projects...

    [INFO] Searching repository for plugin with prefix: 'eclipse'.

    [INFO] ------------------------------------------------------------------------

    [INFO] Building Maven Default Project

    [INFO]    task-segment: [eclipse:add-maven-repo] (aggregator-style)

    [INFO] ------------------------------------------------------------------------

    [INFO] [eclipse:add-maven-repo {execution: default-cli}]

    [INFO] ------------------------------------------------------------------------

    [INFO] BUILD SUCCESSFUL

    [INFO] ------------------------------------------------------------------------

    [INFO] Total time: 2 seconds

    [INFO] Finished at: Tue May 03 21:55:37 WEST 2011

    [INFO] Final Memory: 11M/486M

    [INFO] ------------------------------------------------------------------------

    {code}

     

    Note: Maven may do a few downloads when executing the command above, if the needed components are not yet in the local repository, don't worry.

     

    The M2_REPO is needed, because all project classpaths will refer jars on the local Maven repository.

     

    Selecting the workspace

     

    Now lets start Eclipse, with a double click in the file with the Eclipse icon (Eclipse.app in Mac OSX, eclipse.exe in Windows), inside the ide/eclipse directory. A dialog (shown below) should appear asking what is the path for the workspace (the usual place holder for development projects), select the ide/workspace directory, and activate the option to not ask again:

     

     

    03-eclipse-workspace-setup.png

     

     

    Configuring Mobicents server in Eclipse

     

    The IDE starts with a welcome page, close it, and let's setup the Mobicents server, so it can be started and debugged from Eclipse. Click on the icon left to Java EE and select the Debug perspective, the IDE should now change look and show the Servers tab, right click on it as shown in the picture below:

     

     

    04-eclipse-server-setup.png

     

     

    Select New > Server and a dialog window now asks for the server type, expand JBoss and select JBoss v5.0 as in the picture below:

     

     

    05-eclipse-server-setup.png

     

     

    Click next and use the Browse button to set the server location, which is the slee/binary/.../jboss-5.1.0.GA directory:

     

     

    06-eclipse-server-setup.png

     

     

    Click the Finish button and the server should now be listed in the Servers tab, double click on it and the server Overview should now appear, expand Timeouts and change both values to a big number, let's say 9999 (the edit field shows a single digit but it accepts big values), the server may take some time to start, if it has many components deployed, especially when debugging:

     

     

    07-eclipse-server-setup.png

     

     

    Click the Save button (the floppy disk icon) and click the Open launch configuration link, a Edit Configuration window shows up, select the Source tab:

     

     

    08-eclipse-server-setup.png

     

     

    Let's add the archive containing the Java sources for the SLEE release, this will allow to debug the server code. Click the Add button, select External Archive, and select the slee/binary/.../sources.zip file. Click Open, then Ok to close the server launch configuration. That's it, the server can now be run and debugged with Eclipse, let's test that all is good, right click on the server (Servers tab) and choose Debug, the console should now show the server starting, and after a minute or so, it should show a successful startup:

     

     

    09-eclipse-server-setup.png

     

     

    To stop the server you either click the red square icon in the Servers tab, which starts the server shutdown process, or the same red square icon in the Console tab, which terminates the JVM without shutdown. Typically you should use the one that starts the shutdown process...

     

    EclipSLEE Setup

     

    EclipSLEE is an Eclipse Plugin, which purpose is to simplify the development of JAIN SLEE components of all types. It is bundled in the Mobicents JAIN SLEE binary release, in the slee/binary/.../tools/eclipslee directory, but it is also available from an online Eclipse Update Site.

     

    Before install check the plugin documentation, in the slee/binary/docs/tools/eclipslee directory, for what is the Eclipse version needed, and if any other plugin, for instance M2E, is required too.

     

    To install the plugin, ensure Eclipse is closed, then simply copy its jar to ide/eclipse/plugins.

     

     

    10-eclipse-server-setup.png

     

    SVN

     

    Mobicents JAIN SLEE, as all Mobicents projects, uses a SVN repository for source storage and version control. The public anonymous SVN URL is http://mobicents.googlecode.com/svn

     

    Trunk Checkout

     

    To checkout the Mobicents JAIN SLEE project trunk (sources under development) a SVN client is required. Open a shell in slee/svn and execute:

     

    {code}

    svn checkout http://mobicents.googlecode.com/svn/trunk/servers/jain-slee trunk

    {code}

     

    The SVN client will download the project to the slee/svn/trunk directory, the folder structure is similar to the binary release.

     

    Release Checkout

     

    TODO The SLEE binary release should include a script to setup a local repository with the released sources/projects.

     

    Adding Mobicents project to Eclipse

     

    Mobicents JAIN SLEE is a big project, it would be nearly impossible to handle its development with a single Eclipse project, thus each component (the SLEE core, each RA, each example) has its own. Setting each is extremely easy, open a shell on the component directory, for instance slee/svn/trunk/core and execute:

     

    {code}

    mvn mobicents:eclipse -Pmaven-release

    {code}

     

    An Eclipse project will be generated, which can then be imported in Eclipse.