ShowTable of Contents
This article explains, step by step, how to access IBM® Lotus® Quickr™ content from the Google Android mobile platform, using Lotus Quickr Representational State Transfer (REST) services. Also included is all the source code
for the example used.
The ability and accessibility to data anytime, anywhere is growing exponentially with OS platforms, BlackBerry, Windows Mobile, and iPhone. The expectation is that access to an organization's information should be available from multiple sources, especially through mobile smartphones.
The first open-source mobile OS, Google Android, now presents limitless possibilities. Access to documents housed within an organization's Lotus Quickr infrastructure through an Android phone is just the beginning of the possibilities for an organization's mobile employees to maintain productivity through their smartphone.
We explain how to access Lotus Quickr content anywhere with the Google Android mobile OS and discuss the tools you can use to begin developing your own Lotus Quickr solutions for Android, using IBM Rational® Application Developer.
To get the most from this article, you should have a good understanding of Java™ and Web 2.0 programming. To use the sample code, you need a basic understanding of the Eclipse framework, the Atom feed, and the Google Android Software Development Kit (SDK).
We used the following tools:
- Rational Software Architect 7.5.4 (Eclipse 3.4 or later standalone is fine)
- Google Android SDK
- Android Eclipse plug-in for Eclipse
- Lotus Quickr 8.2 (Lotus Greenhouse Deployment, if no Quickr servers are available within your organization)
- IBM Java Runtime Environment (JRE) 1.6 – with Rational Application Developer
Before you begin
If you don't have access to an internal (or external-facing server within your company), sign up for an account at the Lotus Greenhouse. The Lotus Greenhouse site is a great way to test drive, and experience first hand, the latest and greatest offerings from IBM Lotus.
Its is assumed that you have created a Quickr Place and that Rational Software Architect or Eclipse is installed and set up on your workstation. Also, the other tools mentioned above, and whose documentation is in this article's Resources section, should be installed, including the easy-to-install Android plug-in for Eclipse.
Installing the Eclipse plugin for Android
The steps below demonstrate how to install the Eclipse plug-in, officially known as Android Developer Tools. Note that alternative installation directions are available from the Android Web site (refer to the Resources section for more information).
Figure 1. New Update Site window
1. Run the "Find and Install" feature in Eclipse, located under the Help > Software Updates menu.
2. Select the “Search for new features to install” option and select New Remote Site.
3. In the New Update Site window (see figure 1) give the site a name, such as "Android Developer Tools,” and use the URL https://dl-ssl.google.com/android/eclipse to obtain the Android Eclipse SDK Plug-in. Note the “https” in the URL; this is a secure download.
4. A new entry is added to the list and is checked by default. Click Finish. The search results display the Android Developer Tools. Select the Developer Tools and click Next.
5. After reviewing and accepting the license agreement, click Next. Note that the license agreement includes a special requirement for use of the Google Maps API.
6. Review and accept the installation location; click Finish. The plug-in is now downloaded and installed.
7. Click the Install All button, and then restart Eclipse.
8. Open up Eclipse or Rational Software Architect and create a new Android project (see figure 2); we named our project “qkrandroid” and filled in the required fields as follows:
Package name: com.ibm.android.quickr
Activity name: Think of this as the main "form"or screen of the application “- .apis.ApiDemo”
Application name: apis.ApiDemosApplication
Figure 2. New Android Project window
The Package Explorer
The Package Explorer (located in the Java perspective in Eclipse) displays all the
components of the sample Android application (see figure 3).
Figure 3. Package Explorer
The package includes the following elements:
Contains the package for the sample application, namely, com.ibm.android.quickr.
gen folder – contains R.java
This file is created automatically by the Android Developer Tools and represents the constants needed to access various resources of the Android application. For more on the relationship between the R class and resources, refer to the developerWorks® tutorial, “Develop Android Applications with Eclipse”.
This is the implementation of the application's primary activity class and several other Java files that perform work within our application.
Contains android.jar, which is the Android runtime class .jar file, found in the
Android SDK. Also, this is where we created the user-defined libraries that include the following:
- the Simple API for XML (SAX) parser
- jatomrss.jar, which is an open source Atom RSS reader
- an Apache codec library
Codec is composed of a modest set of utilities and a simple framework for encoding and decoding both textual and binary data.) Finally, the library includes log4ji-1.2.15, which is for logging various messages within our application.
Contains the resources for the application, including:
- Drawable Folders (contains graphics for the project)
- Values (contains style and layout files)
- XML (contains default_values.xml, which tells the application the default preferences for the application)
This is the deployment descriptor of the sample application.
Implementing the application
The application itself has several files, but we cover only the main highlights, leaving it to the reader to build on this to create their own applications.
Main application classes
The class called ApiDemosApplication.java functions is a superclass that holds two main methods, onCreate() and on Terminate(), and extends the Application class. Our application contains the class titled QuickrMainDialog.java and is found in the package com.ibm.android.quickr.apis.app. The implementation of the onCreateOptionsMenu method will create the menu object, per the code snippet in listing 1.
Listing 1. Code snippet of Quickr Main Dialog class
This also renders the Quickr icon to the device, generating the view shown in figure 4.
Figure 4. Main view of application on a device
Clicking the Quickr icon displays the menu that allows you to configure the Quickr server, including settings to authenticate and customize the views (see figure 5).
Figure 5. Configuration settings for Authentication and Views
When you select the Authentication menu choice, the configuration fields are filled in with the server name, user name, and password as shown in figure 6.
Figure 6. Server configuration
The Quickr Atom and REST packages
The Atom and REST packages contain classes responsible for connecting, authenticating, and presenting the requested documents to the end user from the Quickr Spaces. The classes used in these two packages are shown in figure 7.
Figure 7. Package Explorer with Quickr Atom and REST packages
We leave it to you to build upon the QuickrDocuments class, but we did include the import statements to aid in development of this class.
The RESTHttp java class
The RESTHttp.Java class provides the default handler method and the methods to connect to the Quickr server and grab the information to be used by the QuickrRest class. Listing 2 shows the complete code, with the constructor and default handler methods.
Listing 2. Code for RESTHttp class
The QuickrIntrospectionHandler class calls the Quickr server and provides the library and places feeds, parsing these using a SAX parser from the XML file returned. Listing 3 shows the start and end document methods.
Listing 3. Partial code for QuickrIntrospectionHandler.java
The display from the results is shown in figure 8.
Figure 8. Quickr Main Menu – Authenticated User
The Quickr REST class calls the AtomReader and cycles through the services feeds to get the data that the user is authorized to view. Listing 4 shows the partial code listings of the class that include the Library Feed and Places Feed methods.
Listing 4. Partial code of the QuickrRest Class – Library Feed method
Figures 9 and 10 are the resulting displays on the device when you select Option 2. Library from the main menu.
Figure 9. Library Main View – Authenticated User
Figure 10. Library List submenu – Authenticated User
Listing 5. Partial code for the QuickrRest Class – Places Feed method
Figure 11. Places Main View – Authenticated User
Figure 12. Places List from submenu – Authenticated User
We have described how to access your Lotus Quickr infrastructure using the Android platform, presenting a very high-level introductory discussion of the various classes and the setup of the project in Rational Software Architect. Our hope is that this article will excite the development and proliferation of additional Quickr applications targeted at the Android platform.
About the authors
Senior IT Specialist (Accelerated Value Leader)
IBM Software Group, ISSL
Jeff Smith is a Senior Accelerated Value Leader for ISSL. He has over 14 years of IT experience, specializing in the Lotus Collaboration and Messaging products. He is in his last semester of graduate work at the University of Pittsburgh for his MS in Information Science. He can be reached at firstname.lastname@example.org.
IBM Global Business Services
Kishorekumar Neelamegam is a senior Java specialist for the Build and Packaging Tools System z group at IBM. He brings more than 13 years of software development experience with a strong focus in object-oriented construction. In his current role he integrates software into the Rational platform. You can reach Kishore at email@example.com.