Giter Club home page Giter Club logo

plugin_rest's Introduction

KMF Addons: Rest Gateway

Introduction

This addon, designed for any KMF offers a generic way to interact with model (read/write) using a classic but efficient REST API. This addon is implemented as a server that can be embedded in any Java project (JS version to come in NodeJS soon).

The goal of such Rest Server is to offers a standard way to interact with model for devices that cann't run for technical reasons KMF API. For instance, Arduino or ESP 8266 based devices (AVR processor) can't for memory reason load the fll KMF stack. However, they are powerful enough to load an HTTP stack and theirfore they can through such connection push data to a model. Such usage make particular sense because Arduino like devices host usually sensors, they should be considered as edges in IoT networks.

The following picture give a short overview about the target architecture. In a nutshell, HTTP Path are mapped to KMF Queries to retreive or select KMF Objects, and the payload follows the JSON format for get and put operations.

BigPicture

In particular this REST offers the ability to manipulated model according to time and universes of KMF. It interesting to notice that every REST HTTP get and put request start by two long attribute /0/10 the first one is the universe ID (virtually a working space) the second is simply a timestamp to reflect the time of the measurement. The KMF semamtic will return the closest well know time in case of GET and will update the current time for the

Compilation

No particular dependency to compile, tested on Java 8.

mvn clean install

Usage

Simply add the plugin to your Maven project.

        <dependency>
            <groupId>org.kevoree.modeling.plugin</groupId>
            <artifactId>rest</artifactId>
            <version>4.27.0</version>
        </dependency>

Then in you main or any kind of place of your Java platform, wrap the model into a Rest Gateway server and start it.

RestGateway gateway = RestGateway.expose(cloudModel, 8050);
gateway.start();

Replace the 8050 by the expected port where you want to expose your HTTP server.

Reference Rest API

TODO

Credits

This plugin leverage the great Undertow library in order to implement the HTTP server.

plugin_rest's People

Contributors

dukeboard avatar

Watchers

Manuel Leduc avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.