Chapter 6. Location Aware Services application development 219
6.4.1 Location Aware Services Adapter coding
The following steps are necessary for developing a custom adapter. This
example develops a dummy mapping adapter using WebSphere Studio Site
Developer.
1. Open WebSphere Studio Site Developer and click New Project. Select a
Java project and click Next.
2. Enter a project name and click Next.
3. In the Java Settings pane, click the Libraries tab and select Add External
JARS. Add the atlas.jar file, which you can find in the
<WebSphere>/LAS/las/lib folder. Click Finish.
4. Click your project and create a new Java Class. Set the super class as
com.ibm.atlas.adapters.LocationServiceAdapter. Set the interface as
com.ibm.atlas.adapters.MappingServiceAdapter. Click Finish.
5. You should get skeleton code as shown in Example 6-11. Modify the GetMap
methods to return the map. The MapOverlay object contains the necessary
information about the location and the details required for the map.
Example 6-11 Dummy map adapter
package com.dummy
import com.ibm.atlas.ServiceCapabilities;
import com.ibm.atlas.ServiceFailureException;
import com.ibm.atlas.ServiceRequestException;
import com.ibm.atlas.adapters.LocationServiceAdapter;
import com.ibm.atlas.adapters.MappingServiceAdapter;
import com.ibm.atlas.geometry.Box;
import com.ibm.atlas.geometry.PointCircle;
import com.ibm.atlas.mapping.Map;
import com.ibm.atlas.mapping.MapOverlay;
import com.ibm.atlas.mapping.MappingCapabilities;
import com.ibm.atlas.mapping.MappingOptions;
import com.ibm.atlas.system.ServiceRegistry;
public class MappingService extends LocationServiceAdapter implements
MappingServiceAdapter {
public ServiceCapabilities getCapabilities() {
ServiceRegistry serviceRegistry = config.getFactory().getServiceRegistry();
java.util.Properties serviceProperties =
serviceRegistry.getServiceProperties(config.getName());
return new MappingCapabilities(serviceProperties);
}
public Map getMap(Box arg0, MappingOptions arg1, MapOverlay[] arg2) throws
ServiceFailureException, ServiceRequestException {
Map map=new Map();

Get IBM WebSphere Everyplace Access V5 Handbook for Developers and Administrators Volume IV: Advanced Topics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.