M2MLabs Mainspring is an application framework for building machine-to-machine applications like vehicle tracking or machine remote monitoring. In such applications typically a remote device equipped with sensors (e.g. gps, temperature, pressure) and actors communicates with a server application that is running the device communication protocol, device configuration, storage of data sent by the devices as well as the application business logic and the presentation layer.
Mainspring takes care of device communication, configuration as well as data storage and retrieval so that application developers can focus on business logic purely. M2M applications can be prototyped in hours rather than weeks and finally transferred to a high performance execution environment built on top of a standard J2EE server and the highly scalable Apache Cassandra database.
It covers common functionalities required by M2M applications
- flexible modeling of devices, their parts and their characteristics: devices represent a physical device and contains sensors and actors. Each sensor has a set of attributes which correspond to the data sent by the sensor, e.g. temperature sensor may send an indoor and an outdoor attribute. Data for each attribute is time stamped so that one value represents a measurement at a certain point in time.
- device configuration: each device holds a set of key-value pairs representing the configuration of the device, e.g. sensor ranges or metadata such as units of measurement for a device
- communication between device and application: devices send data according to a defined REST webservice, see the Api description. This is fine if the device is developed together with the application. If the device is not modifiable and sends data via arbitrary HTTP GET or POST messages an adaptation script in Groovy translates the message to the standard format.
- validation and normalization of the data: reception of new data triggers the execution of Groovy scripts to perform boundary checking of data, interpolation or threshold supervision.
- long term storage of data sent by devices: all measurements are stored as time series of values in a very compact format with minimum overhead. Meta information such as units of measurements are stored separately in the device and sensor models.
- data retrieval functions for external applications using REST Api: give the business logic access to the data. Each access provides a set of values for a set of entities and a time interval.
The framework is written in Java and runs on a standard J2EE6 application servers like glassfish 3.1 and JBoss 6.0. Data storage is provided by the extremely scalable noSQL database from the Apache Cassandra project.