Level: Intermediate Shruti Gandhi, developer, IBM
16 Jan 2007 Updated 17 Jan 2007 In this article, we show you how we created an IBM Lotus Sametime Connect plug-in that retrieves the latest news from the Australian Open Tennis Championship and how you can install that plug-in for a limited time from the IBM DEMOnet Web site. You can also download the plug-in from this article.
[Editor's note: For Lotus Sametime Connect V7.5 users interested in installing the plug-in, skip ahead to the section To install the RSS feed plug-in. For the duration of the Australian Open 2007 Tennis Championships, you can install the plug from the IBM DEMOnet servers.
For Sametime plug-in developers, the rest of the article describes how the plug-in was created. You can download the RSS feed plug-in from this article.]
The Australian Open 2007 Tennis Championships is underway in Melbourne, Australia from January 15 to 28, 2007. Even if you are not in attendance this year, you can keep up with the latest tournament news with the new RSS feed plug-in for IBM Lotus Sametime Connect V7.5. The RSS feed plug-in checks for updates on the Australian Open event using RSS feed technology and displays the latest news headlines in the mini-app area of your Lotus Sametime Connect client.
This article explains how you can subscribe to an RSS feed and provide the RSS data to the plug-in to check for real-time updates (in this case, related to the Australian Open). The plug-in checks periodically for news updates and displays changes in the mini-app area in your Contacts list (see figure 1).
Figure 1. Australian Open News in the mini-app area
Getting started
To build the RSS feed plug-in, you need to make your environment plug-in ready for Lotus Sametime. These are the basic steps you take to develop any plug-in for Lotus Sametime:
- Download the Eclipse SDK 3.2.1 and install the J9 Java Development Tools (JDT) launch plug-in for Eclipse.
- Configure your runtime to use J9.
- Configure the Eclipse compiler settings for the Java Developer Kit (JDK) 1.4.
- Specify Lotus Sametime as the target platform in Eclipse.
You can download the Eclipse SDK 3.2.1 from the Eclipse Web site. The first three steps in this procedure are explained in more detail in the Lotus Sametime SDK documentation, which is available with the Lotus Sametime SDK, so we will not cover them in this article.
NOTE: You can download the Lotus Sametime SDK from the developerWorks Lotus Toolkits page.
Making Lotus Sametime your target platform in Eclipse
To use Eclipse to create plug-ins for Lotus Sametime, you must specify Lotus Sametime as the target platform. In Eclipse, choose Window - Preferences to open the Preferences dialog box. In the left pane, select Plug-in Development - Target Platform.
In the Location field, browse to the installation location of your Lotus Sametime Connect client, for example, C:\Program Files\IBM\Sametime, and then click Reload (see figure 2).
Figure 2. Preferences dialog box
Now, you are ready to write a plug-in that demonstrates how to use RSS information to provide updates right to the user.
Create a new plug-in
In Eclipse, to create a plug-in, you need to begin with a project. To do so, follow these steps:
- Choose File - New Project.
- In the New Project dialog box, open the Plug-in Development folder, select Plug-in Project, and then click Next.
- In the New Plug-in Project wizard, name your project: com.ibm.collaboration.realtime.ausopen, and then click Next.
- In the next wizard panel, complete the following fields:
- Plug-in ID: com.ibm.collaboration.realtime.ausopen (or something similar)
- Plug-in Version: 1.0.0
- Plug-in Name: com.ibm.collaboration.realtime.ausopen (make the same as the plug-in ID)
- Plug-in Provider: Enter your company name.
- Classpath: ausopen.jar
- Select the "Generate an activator, a Java class that controls the plug-in's life cycle" and the "This plug-in will make contributions to the UI" options. When you select the latter option, the Activator class extends the AbstractUIPlugin, which extends the Plugin class.
- Click Finish when done.
Plug-in dependencies
The RSS feed plug-in is dependent upon other plug-ins to extend the Lotus Sametime Connect user interface. Follow these steps to add required plug-ins:
- In Eclipse, open META-INF MANIFEST.MF in the Manifest Editor.
- Select the Dependencies tab.
- Add the following plug-ins in the Required Plug-ins section (see figure 3):
- org.eclipse.ui
- org.eclipse.core.runtime
- com.ibm.collaboration.realtime.application
- com.ibm.collaboration.realtime.core
- com.ibm.collaboration.realtime.ui
- com.ibm.collaboration.realtime.imhub
- com.ibm.collaboration.realtime.browser
Figure 3. Dependencies tab
Adding the plug-in to the mini-app area
To view the RSS feed content in the mini-app area as shown in figure 1, edit the plugin.xml file in Eclipse to add the following extension as shown in listing 1.
Listing 1. Plugin.xml file extension
<plugin>
<extension
point="com.ibm.collaboration.realtime.imhub.miniApps">
<miniApp
category="shelf.applications"
class="com.ibm.collaboration.realtime.ausopen.views.NewsView"
displayName="Australian Open News"
icon="icons/tennis_ball.JPG"
id="com.ibm.webahead.ausopen.views.NewsView"
maxHeight="80"/>
</extension>
</plugin>
|
NewsView is the class that you need to implement to view your feeds in the mini-app area. This class creates the composite to display the feed data.
Alternatively, you can add the NewsView class through the Extensions tab in MANIFEST.MF by following these steps:
- In Eclipse, open MANIFEST.MF in the Manifest Editor.
- Select the Extensions tab.
- Click the Add button.
- In the New Extension dialog box, select com.ibm.collaboration.realtime.imhub.miniApps, and then click Finish.
The extension should look like figure 4.
Figure 4. NewsView Class added to extension
Creating a class that extends AbstractMiniApp
A plug-in can contribute to the mini-app area using the com.ibm.collaboration.realtime.imhub.miniApps extension point. The class that allows creating a control in the lower half of the Contacts list extends the AbstractMiniApp class. This class defines required methods, including the createControl method, which is called when the mini-app area is loaded.
You implement the createControl method, which is called to create and render an org.eclipse.swt.widgets.Control for this mini-app, as shown in listing 2.
Listing 2. createControl method
public class NewsView extends AbstractMiniApp {
public NewsView() {
}
public Control createControl(Composite arg0) {
// TODO Auto-generated method stub
}
public void init() throws Exception {
// TODO Auto-generated method stub
}
}
|
For the Australian Open, we use a Browser widget to display a customized view of the RSS feed data. In this plug-in, you retrieve the feed data from http://www.australianopen.com/en_AU/news/rss/ausopen.rss.
NOTE: This article assumes that an RSS feed to which you want to subscribe already exists. The RSS feed can be created in many ways. Although you can create a feed manually, there are tools, such as the FeedCreator or RSS Creator, to generate an XML feed page. A feed page is an XML page with the standard RSS fields populated: pubdate, title, description, link, and so on. (For more information, see the "What is RSS" article on XML.com.)
Now, let's see how you receive changes to the feed. To keep track of changes to the feed, the RSS feed plug-in polls the feed page periodically for updates. In your plug-in, you create an org.eclipse.core.runtime.jobs.Job that runs every 60 minutes and fetches all the items from the feed to check for updates. You get the items from the page by parsing the feed data. Because the RSS feed format is widely known, there are several parsers available to retrieve the individual items. You can even write a parser manually, but in this sample, we use a parser from Sun Microsystems (com.sun.cnpi.rss.parser.RssParser). For this plug-in, you extract fields, such as title, link, and pubDate, from each item.
Those fields are displayed in a Browser widget for a customized view as shown in listing 3.
Listing 3. Browser widget
<a href=link>
<font size=2 color='blue'>
<b>title</b>
</font>
</a>
<font size=0.5 color='black'>
pubdate
</font>
|
You add a location listener to the browser to launch a new browser each time a news entry in the mini-app area is clicked. This Browser widget is then returned to the createControl method so that it can be displayed in the mini-app area as you see in figure 1.
To install the RSS feed plug-in
You can download the plug-in from the Downloads section of this article and install the plug-in on a local update site if one is available. You can find out how to create your own update site in the developerWorks Lotus article, "Creating an update site for your IBM Lotus Sametime Connect plug-ins."
NOTE: This section assumes that you use an update site to install and update your Sametime plug-ins. In our example, we show you how to connect to an IBM update site hosted by the IBM DEMOnet Web site. This site is available for only a temporary time during the Australian Open 2007, after which you can download the plug-in from this article and install it on your own update site.
Make sure that Lotus Sametime Connect V7.5 is open. In the system tray, right-click your Lotus Sametime icon, and choose Manage Updates - Download plugins. Alternatively, you can choose File - Manage Updates - Download plugins from Lotus Sametime Connect if you open the client.
In the Install/Update dialog box, select the "Search for new features to install" option, and then click Next.
Figure 5. Install/Update dialog box
In the "Update sites to visit" dialog box, click the New Remote Site button to create a new remote site from which to download plug-ins. For a limited time, you can download the RSS feed plug-in from the IBM DEMOnet Web site. In the New Update Site dialog box (see figure 6), enter the site name and URL. To connect to the IBM DEMOnet site, you can enter the following name and URL:
- Name: http://stdemo3.dfw.ibm.com/plugins/ausopen/site.xml
- URL: http://stdemo3.dfw.ibm.com/plugins/ausopen/site.xml
Figure 6. New Update Site dialog box
In the "Update sites to visit" dialog box, you see the remote site that you just created (see figure 7). Select the site and click Next.
Figure 7. Update sites to visit dialog box with new remote site
If you are using the IBM DEMOnet Web site, in the Installation dialog box, select the FeatureAusOpen 1.0.0, accept the terms of the license agreement, and then click Finish.
When the Verification window opens, click Install to install the plug-in. After you install the plug-in, you need to restart Lotus Sametime Connect. When prompted to restart your client, click Yes.
The next time you open Lotus Sametime the RSS feed plug-in appears in the mini-apps area in your Contacts list, and it displays the latest news from the Australian Open event as shown in figure 1.
Conclusion
We developed the RSS feed plug-in specifically for this year's Australian Open, but you can take this plug-in and use it for any existing RSS feed. Implement the plug-in in your Sametime environment and turn your Lotus Sametime Connect client into more than an instant messaging client!
Acknowledgement
The RSS feed plug-in for the Australian Open is based on the Sametime News plug-in written by Konrad Lagarde of IBM and deployed internally within IBM.
Download | Description | Name | Size | Download method |
|---|
| Sample RSS feed plug-in | com.ibm.collaboration.realtime.ausopen_1.0.0.jar | 77 KB | HTTP |
|---|
Resources Learn
Get products and technologies
Discuss
About the author  | |  | Shruti Gandhi is the lead architect for location-based services for real-time collaboration. She was a developer on the IBM Lotus Sametime Connect V7.5 client. She is in the process of finishing her Masters of Science in Computer Science at Columbia University. |
Rate this page
|