Developing Java ME applications using Rational Team Concert in an agile way
Ayushman Jain, IBM; Dhandapani Shanmugam, IBM
Last updated: July 4, 2011
Build basis: Rational Team Concert 3.0, Mobile Tools for Java 1.1.2
In Developing applications for Android™ using IBM Rational Team Concert in an agile way, we learned how to leverage Rational Team Concert’s collaborative software development features which integrate work item tracking, source control management, continuous builds, and iteration planning to develop Android applications.
Even though platforms such as Android, iOS™, and Blackberry® have become increasingly popular, the devices on which they run are still relatively costly and not affordable to everyone. Especially in developing countries such as India, people still own phones based on older platforms that, at best, have Java support. This is illustrated by a 2010 survey, Developer Economics 2010 and Beyond, whose findings are summarized here. According to the survey, Java ME as a platform still has an installed base of 3,000 million devices, which is 150 times that of Android and 50 times that of iOS. Therefore, a large number of developers still spend a lot of time and energy developing, testing and maintaining Java ME applications.
Java ME applications can be easily developed using Eclipse with the help of a plugin called Mobile Tools for Java (MTJ), previously known as MobileMe. This can help leverage Eclipse’s rich features like content assist, Java search, open resources, and different views and perspectives for developing a Java ME app. Add to this the power of RTC collaboration, process, and source control, and you get the ultimate product for developing and managing Java ME apps throughout their lifecycle in a geographically distributed team.
Required downloads and installation
- OS: Windows® x86 / Linux x86
- IBM Rational Team Concert: Download/buy from Jazz.net. If you are using an existing Eclipse installation to install RTC, make sure you have Eclipse 3.5 or lower (Eclipse 3.6 is not yet supported for Android development). RTC can also be installed directly on Eclipse 3.5.x. See Tip: Installing the Rational Team Concert client into Eclipse 3.5.x.
- Mobile Tools for Java Plugin: In the RTC Eclipse client, go to Help> Install New Software and add the update site for MTJ (http://download.eclipse.org/mtj/updates/1.1.2/stable). Choose all plugins as shown below and click next.
- Sun Java Wireless Toolkit (WTK): Download the Sun Java WTK from here (version 2.5.2 is used in this article) and install it on your machine. Note your install location to reference later.
- In the RTC Eclipse client, go to Window> Preferences and click Java ME preferences. If this option is not available, check the installation of MTJ, and re-install if necessary. In the WTK root, enter the WTK installation directory. Next, expand the Java ME preferences in the left pane and click Device Management. Click Manual Install, and in specify search directory, once again enter the WTK install directory. MTJ automatically searches for the available emulators and shows the list. Click Finish when done. (This step has to be repeated for a fresh workspace)
Project setup for this article
The project area and team setup for this article is the same as the one described in the RTC Android article in the “Project Setup” section. The only difference is that instead of creating an Android project, the project manager/ lead creates and shares a Java ME project with the team. To do this, click File> New> Project and choose MIDlet project in the Java ME category. In the new Midlet Project wizard, name the project “ContactsMidlet” and choose an emulator configuration in the configuration section. This emulator will be used by all developers to test the application. The Project area where the administrator can change the roles, permissions, time lines, iterations, and establish prerequisites is shown below.
Using RTC source control and planning to develop an android application
For this article, we will develop a simple Java ME application which allows the user to add contacts with their name, phone number and address, and search for a particular contact by name. The project manager assigns the task (work item) for developing the “add contacts” functionality to a developer, Chris, and that of developing the search functionality to developer, Jamie. Testers can also be assigned work items to write JMUnit tests.
Implementing the “add contact” functionality
Chris sees the task assigned to him, implement “add contact” functionality, when he next logs in. To do so, he first creates a Java ME Midlet class in the src folder of the project. (You can do this via New> Java ME> Java ME Midlet by right clicking on the project). A class extending the javax.microedition.midlet.MIDlet is created with stubs for startApp() , destroyApp() , and pauseApp() methods. Chris also needs to have the new Midlet Class implement javax.microedition.lcdui.CommandListener since the application needs to listen for user clicks on the device keys. He then writes the code to implement the “add contact” feature. To run this application on the emulator, he creates a new run configuration by clicking the Emulated Java ME Midlet category and then clicks New.
He now runs the application on the emulator and tests it. In turn, he sees the Pending changes view as shown below, indicating the changes he made for adding the new text.
He checks in these changes to his local workspace, and then delivers them to the RTC Android Demo Stream. As soon as he checks them in (right click> Check in), he sees a new work item created. (Alternatively, you can create a patch with these changes and attach it to a bug being fixed by right clicking and selecting New> Patch). He can associate this change set to task number 71 that was assigned to him, and resolve the work item by delivering the change set. To do this, he right clicks on the new work item where it says <Enter a Comment>, and clicks associate work item. He selects work item 71, and then delivers the change set. Additionally, to capture the UI as seen in the emulator, he uses the RTC snapshot tool to attach a snapshot of the app working in the emulator to the work item so that anybody can instantly see what was done.
The resolved work item now looks like the screen capture below.
Implementing the “search contact” functionality
Now lets see how Jamie implements the search functionality. Note that Chris can continue making changes or improvements to the add contact functionality and Jamie will independently be able to implement the new feature. The following image shows how Jamie sees the incoming changes (completed by Chris) when he logs in to his workspace.
All Jamie needs to do is right click the change sets and click Accept. The code for the "add contact" feature is now available to Jamie. Jamie follows similar steps to those performed by Chris, and adds the "search contact" functionality as well. This is how the application looks when Jamie is finished.
Note: You should build the Midlet class manually once you’ve accepted the incoming changes, because by default RTC source control will not share the .class files from Chris’ workspace. Launching may fall because the class file is not found.
Jamie also delivers his changes, resolves the work item and attaches screenshots. The source code for the application can be downloaded here.
Creating new work items pertaining to UI features using the RTC snapshot tool
The snapshot tool comes in very handy for requirements specification when creating a work item asking a developer to develop a UI feature. Very often the application needs to have different layouts for different locales, languages and even different handset configurations (e.g. portrait, landscape). A snapshot image of how the layout should look in each of these different configurations can enable the developer to replicate the same in the application.
For information about other RTC features that come in handy when developing Java ME mobile apps (e.g. testing the application using JMUnits, setting up automatic builds, using git for source control) please refer to Developing applications for Android™ using IBM Rational Team Concert in an agile way.
For more information:
- Mobile Tools for Java website
- Getting started with Rational Team Concert
- Build a smart J2ME mobile application
- Developing J2ME applications with EclipseME
- Developing applications for Android™ using IBM Rational Team Concert in an agile way
About the authors
Ayushman is a committer on the Java Development Tools process in Eclipse, and an Eclipse evangelist. He works at IBM India Software Labs and is the pioneer of the Eclipse campus programme (http://eclipse.org/campus/). He is a fan of Rational Team Concert and is passionate about mobile platforms in general, and Android, in particular.
Dhandapani Shanmugam is a solutions architect in the Industry Solutions team at IBM India Software Labs, focusing on Telecom and Mobility solutions.
© Copyright 2011 IBM