Hexagon Geospatial
MENU

Developers Knowledge Base

Mobile and field solutions function as an extension of the overall enterprise, and include the ability to access, create, review and update geospatial data and asset information in real-time in the field.
Showing results for 
Search instead for 
Do you mean 

Developing MMW Service Plugin Tutorial

by Technical Evangelist ‎02-08-2017 02:07 AM - edited ‎02-08-2017 02:14 AM (1,151 Views)

Introduction

The MMW Service is used by the MMW application to:

  • authenticate users
  • authorize users' access to configurations
  • get the app configurations

The default implementation is based on retrieving user data and configurations from an SQL CE database. If it isn't enough for your needs, you can inject your own implementation with a MMW Service plugin.

Implementing plugin

Before you start, please ensure that your development environment is correct. Please visit: System Requirements.

 

To implement your own MMWServicePlugin you should either create a new class library project and create a new class that implements IMMWServicePlugin interface, or use a Sample Project as a starting point.

 

The IMMWServicePlugin plugin interface is:

string Authenticate(string credentials);

IEnumerable<ConfigurationMetadata> GetConfigurationsMetadata(string token);

string GetConfiguration(string configurationId, string token);

 

Interface contains three methods:

  • Authenticate – method should authenticate a user. If authentication is successful a token as string should be returned. If authentication is unsuccesful Exception should be thrown. It accepts one parameter which is credentials. The MMW login control sends credentials in form: username:password.
  • GetConfigurationsMetadata – method should return a collection of configuration metadata per user. Configuration metadata includes configurationId and configuration name. The method accepts a token, which is the same token, which was returned by the Authenticate method. If operation is unsuccesful Exception should be thrown.
  • GetConfiguration – method should return a configuration, which is valid with WebGis configuration schema. Returned configuration must be string object. The method accepts two parameters. First is configurationId, which is the configuration picked by a user (to be done) and second is token, which is the same token, which was returned by the Authenticate method. If operation is unsuccesful Exception should be thrown.

Importing plugin to MMW Service

In order to import your plugin to MMW Service:

  1. Copy your plugin output *.dll files to the bin folder in MMW Service catalog.
  2. Find "unity" section in the service web.config file and replace it with your own.

    Configuration for the sample plugin mentioned earlier

    <unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <container>
    <register type="Hexagon.Geospatial.Mobile.MMWServicePlugin.IMMWServicePlugin, Hexagon.Geospatial.Mobile.MMWServicePlugin" mapTo="Hexagon.Geospatial.Mobile.SampleMMWServicePlugin.SampleMMWServicePlugin, Hexagon.Geospatial.Mobile.SampleMMWServicePlugin"/>
    </container>
    </unity> 

     

     

    If you need more information about the Unity container, please visit: Unity

  3. Restart of the service Application Polls is recommended.
Overview
Contributors