Authentication – Pitney Bowes MapXtreme User Manual

Page 514

Advertising
background image

Appendix D: Extensible Data Providers

Advanced Topics / Important Considerations

MapXtreme v7.1

521

Developer Guide

For additional information and examples, consult the MapXtreme Developer Reference (online
Help), the

SpatiaLite Sample Data Provider

presented in this appendix, and other data provider

examples located on the

MapXtreme Code Exchange

.

Authentication

Many Data Providers require authentication when opening a Data Source or Table where the details
of the authentication are kept secure and unavailable from a publicly accessible and shared
workspace file.

To support run-time authentication of the OpenDataSource and OpenTable processing, the
MapXtreme Extensible Data Provider model provides a new interface called the
IDataProviderCallback with support for user-defined callback methods that the Extensible Data
Provider can use to resolve data source and table definitions that are insufficient in some way that
prevents the opening of a data source or table.

For the simplest implementation, the client code for a custom Data Provider would contain a class
that implements the IDataProviderCallback interface and provides implementations of the
IDataSourceDefinition and/or ITableDefinition callback methods that are then used directly to open
the data source or table.

For most users, however, it will be necessary to load a separate assembly containing the
IDataProviderCallback initialization and load the assembly as part of the MapXtreme Session
initialization. See

ISessionEventHandlers

. This would be required when you are attempting to

resolve data source or table definitions at the time a default workspace is loading. Web-based
applications, for example, will require the session initialization support for callbacks.

How Are Data Provider Callbacks Used?

How the callback methods are invoked is handled by your Data Provider implementation;
MapXtreme manages support for the collection of callback methods and passes it to the Data
Provider via the defined interfaces,. It does not invoke any of the IDataProviderCallbacks.

The IDataProviderCallback instances are managed by a DataProviderCallbacksCollection on the
MapXtreme Session Catalog. This collection of callback collections associates callback objects to a
System.Type, and supports multiple callbacks per each Type association. The
DataProviderCallbacksCollection may be managed in several ways: during Session initialization
(see SessionEventHandler/DataProvider load section); during application initialization, and, for very
simple usage, immediately prior to an explicit OpenTable call from the client application.

MapXtreme queries the Session Catalog for the callbacks associated with the OpenDataSource or
OpenTable method, and provides a reference to the collection to the DataProvider. The
IDataProvider interface supports a reference to an IEnumerator that iterates over a collection of
IDataProviderCallback[s] during the OpenDataSource and OpenTable operations. The DataProvider
class may use any callback referenced by the IEnumerator to implement the appropriate logic
required for resolving an OpenDataSource or OpenTable failure, if the failure is addressable by
modifying the input DataSourceDefinition or TableDefinition. Or the DataProvider may implement a
well-known strategy for completing a definition object which is insufficient by design.

Advertising