Skip to content

Adapter - Mapping Data

This page describes version 2.0.11 of the adapter.

Overview

Some adapters need to store data in addition to the adapter configuration data. This data is referred to as Persistent data.

e.g. Kiosk adapter can have a mapping between kiosk id and neoface camera id. This data is a name value pair that maps each kiosk uniquely to a camera location.

Mapping data adapter provides a way to read such data from configured Mongo database.

As of now, the user is responsible for setting up Mongo database and importing data into it.

This adapter simply reads the data. The data is stored as name/value pairs. Each data/mapping has a unique name.

  • This database is completely separate from Mongo database used by WFE.
  • Multiple instances of this adapter can run and connect to different Mongo databases.
  • On StartUp, if the adapter is not able to establish connection with Mongo successfully, the adapter is set to a faulted state.

Mongo Database

The data is stored in a mongo collection (mappingdata by default). The collection has 3 columns: Id, key and value.

The value could be a simple value such as int, bool, string or complex object such as array, json data etc.

Sample data:

{
    "_id" : ObjectID("5b6b158e219625a5853691e6"),
    "key" : "status3",
    "value" : "stepped away"
}
{
    "_id" : ObjectId("5b6b1b27219625a5853691e7"),
    "key" : "array",
    "value" : [
        1,
        2,
        3,
        4
    ]
}
{
    "_id" : ObjectId("5b6b1b68219625a5853691e8"),
    "key" : "complexdata",
    "value" : {
        "folder" : "test",
        "path" : "mypath"
    }
}



Properties

Name Display Is Required Comments Type Default Value Maximum Value Minimum Value Maximum Length Minimum Length
databasetype Database Type True The database type (default: mongo) string mongo 50 1
connectionstring Database Connection String True The database connection string (example: mongodb://myserver.example.com:27017/workflowmappingdata) string mongodb://yourdatabase:27017/workflowmappingdata 1024 1
collectionname Mapping Data Collection Name True The database collection name to use string mappingdata 1024 1



Commands

Get (getMapping)

Reads and returns the data for a given key.

Request Properties

Name Display Description Is Required Type
collectionname Collection Name If specified, this collection name will override the adapter collection name. False string
key Key The key associated with the data to be looked up. True string

Response Properties

Name Description Type
value The value read from the database. If either the key or the collection do not exist, then it returns null. string
status 'true' if the value was succesfully read, otherwise 'false' string

Set (setMapping)

Inserts or updates the data for a given key.

Request Properties

Name Display Description Is Required Type
collectionname Collection Name If specified, this collection name will override the adapter collection name. False string
key Key The key associated with the data to be set. If the key does not exist yet, data is inserted; otherwise, data is updated. True string
value Value The value written to the database True string

Response Properties

Name Description Type
status 'true' if the value was succesfully updated or inserted, otherwise 'false' string

Delete (deleteMapping)

Deletes the data for a given key.

Request Properties

Name Display Description Is Required Type
collectionname Collection Name If specified, this collection name will override the adapter collection name. False string
key Key The key associated with the data that must be deleted. True string

Response Properties

Name Description Type
status 'true' if the value has been succesfully deleted, otherwise 'false' string

Release History

Version Type Description Tracking # Date
2.0.1 Initial First release in the Adapter Type store.
2.0.9 Maintenance Updated third-party components and improved maintainability. NAP-11518
2.0.10 Maintenance Updated third-party components and improved maintainability. NAP-23945 2022-11-29
2.0.11 Maintenance Updated third-party components and improved maintainability. NAP-27635 2024-07-31

Categories