Chapter 6. Location Aware Services application development 217
19.Finally the MappingService is used to request the map specifying the bounds,
the mapping options, and the overlay. The Map object represents a map that
includes image data, width, height, and format, and the geographical area
covered by the map.
Example 6-9 Requesting the map
Map map = mappingService.getMap(bounds, options, overlays);
20.The Map.getData() returns the map as a byte array. This can be used to
render the map on a canvas, save it as a GIF file and render it as an HTML
and so on.
6.4 Developing a Location Aware Services adapter
Location Aware Services uses adapters that can be dynamically plugged in for
enabling services from service providers. Service providers should write custom
adapters that communicate with their infrastructure to provide the necessary
service. Location Aware Services provides adapters for several service
providers. See Chapter 5, “Location Aware Services” on page 155 for a list of
supported service providers.
In order to enable Location Aware Services to use your custom adapter to
provide the service, you should develop the adapter in accordance with the
interfaces defined and register the adapter for the specific service.
All service adapters for Location Aware Services must extend the
com.ibm.atlas.adapters.LocationServiceAdapter class.
The LocationServiceAdapter class is an abstract class that contains the following
methods:
public void init(LocationServiceConfig config)
public LocationServiceConfig getConfig()
public void setClientOptions(ServiceRequestOptions options)
public abstract ServiceCapabilities getCapabilities()
The Location Service Factory calls the init method when the adapter is first
created. The adapter can override this method to perform any required
initialization procedures, including authentication if it is session-based, or testing
communication with the remote provider's site. If the adapter overrides this
method, it should call super.init first. The setClientOptions method sets the
clientName, clientPassword and userLanguagePreference properties in the
ServiceRequestOptions object to values given in the adapter's init properties or,