DITAS Creating Services for a VDC Use Case The DITAS Project What - - PowerPoint PPT Presentation

ditas
SMART_READER_LITE
LIVE PREVIEW

DITAS Creating Services for a VDC Use Case The DITAS Project What - - PowerPoint PPT Presentation

DITAS Creating Services for a VDC Use Case The DITAS Project What is trying to solve? Current applications are eager to acquire and consume more and more amounts of data Data is coming from distributed heterogeneous devices (IoT and


slide-1
SLIDE 1

DITAS

Creating Services for a VDC Use Case

slide-2
SLIDE 2

The DITAS Project

 What is trying to solve?

 Current applications are eager to acquire and consume more and more

amounts of data

Data is coming from distributed heterogeneous devices (IoT and mobile applications)

Need to deal with data in an effective, fast, agile, and secure manner.

 What it offers?

 Optimal combination of edge nodes and cloud services  Abstraction from data management  Tools to enable developers easily create and deploy data intensive

applications

slide-3
SLIDE 3

DITAS Toolset

 DITAS SDK

DITAS SDK provides extensions of popular tools such as Node-RED to define applications. The key element of this tool is to allow developers to design applications by specifying Virtual Data Containers (VDC s) and constraints/preferences for Cloud & Edge resources to be exploited.  Virtual Data Container VDC

VDCs provide an abstraction layer for developers so they can focus only on data, what they want to use and why, forgetting about implementation details. With VDCs applications can easily access required data, in the desired format and with the proper quality level, rather than directly searching for and accessing them among various data infrastructure providers  DITAS Execution Environment

DITAS EE is based on our powerful execution engine capable of managing a distributed architecture and taking care of data movement and computation, maintaining coordination with other resources involved in the same application.

slide-4
SLIDE 4

Example of Cloud deployed Application

slide-5
SLIDE 5

VDC Use Case

 A VDC in order to support all of its functionality, it heavily uses

communication between services that may be deployed in different environments.

 Today we will see how to design and deploy services and establish a protocol

for their communication

 What we will see?

 What is Spring and Spring Boot (The tool based on which we will build our services)  What is REST API (communication between services)  Hands-on coding example

slide-6
SLIDE 6

Spring Framework Overview

 What is Spring Framework?

 Spring is the most popular application development framework for

enterprise Java.

 Open source JAVA platform since 2003  Spring supports all major application servers and JEE standards  Spring handles the infrastructure so you can focus on your application

 Key Features of Spring Framework

 Dependency Injection (DI) and Inversion Of Control (IoC)  Aspect Oriented Programming (AOP)  Spring Modules

slide-7
SLIDE 7

DI & IoC

 Dependency Injection (DI)

 An injection is the passing of a dependency (a service) to a dependent object

(client). Passing the service to the client, rather than allowing client to build or find the service, is the fundamental requirement of the pattern

 Inversion of Control (IoC)

 In software engineering, Inversion of Control describes a design in witch custom-

written portion of a computer program receive the flow of control from a generic, reusable library.

 By contrast with traditional programming, in which our custom code makes calls to

a library, IoC enables a framework to take control of the flow of a program and make calls to our custom code. DI is merely one concrete example of IoC

 Spring IoC Container

 The container will create the objects, wire them together, configure them and

manage their complete lifecycle from creation till destruction.

slide-8
SLIDE 8

Spring Framework Runtime

slide-9
SLIDE 9

Spring Framework Ecosystem

slide-10
SLIDE 10

Spring Boot

 Why Spring Boot ?

 Stand-alone Spring applications  No XML Configuration by developers  Auto Configuration  Uses project management tools such as MAVEN or GRADLE  Starter Dependencies  Embedded Tomcat or Jetty  Fast development and production-ready environment

 Documentation

 https://docs.spring.io/spring-boot/docs/current/reference/html/index.html

slide-11
SLIDE 11

RESTful APIs

 What is REST ?

 Stands for REpresentational State Transfer  It is an architectural style which is based on web-standards and the HTTP protocol.  In a REST based architecture everything is a Resource.  Resources are identified by global IDs (URIs or URLs)  A Resource is accessed via common interface based on the HTTP standard methods

(GET, POST, PUT, DELETE etc.)

 You typically have a REST server (producer) which provides access to the

resources and a REST client (consumer) which accesses and modifies REST resources.

 The most common representation for REST resources is JSON.  REST is stateless by nature. Excellent for distributed systems.

slide-12
SLIDE 12

HTTP Methods for REST

HTTP Methods CRUD Operation Description GET SELECT Fetches a resource POST INSERT Adds to an existing resource PUT UPDATE Overrides existing resource DELETE DELETE Deletes a resource

  • Example of REST request

GET http://ditas/blueprints/5cb99cf1763d081d2656624f/?section=INTERNAL_STRUCTURE

slide-13
SLIDE 13

What are we building?

 A RESTful API using Spring and Spring Boot  The server will expose resources through REST API for retrieving, adding,

updating and deleting users from a mock application

 The REST server will be deployed (localhost) using the Spring Boot’s

embedded Tomcat

 Finally we will test the API

slide-14
SLIDE 14

The Rest API we’ll build

GET GET /user/getAll Gets all users GET GET /user/get/{id} Gets the user of the specified id POST POST /user/add Adds new user PUT PUT /user/update/{id} Updates the user of the specified id DELET DELETE /user/delete/{id} Deletes the user of the specified id

slide-15
SLIDE 15

Tools we will use

 Spring Tool Set 4 (STS 4)

 https://spring.io/tools

 Java 11

 https://www.oracle.com/technetwork/java/javase/downloads/jd

k11-downloads-5066655.html

 Gradle 3.x

 https://gradle.org/install/ (optional)

slide-16
SLIDE 16

Creating a Spring Boot project

slide-17
SLIDE 17

The project’s structure

slide-18
SLIDE 18

The entity User

slide-19
SLIDE 19

The User’s Controller

slide-20
SLIDE 20

The User’s Service

slide-21
SLIDE 21

Testing the API

 GET

GET /user/get/1 (1)

RESPONSE

{ "userId": 1, "username": “thodfl", "fullname": “Thodoris Florakis", "email": “thodoris@email.com " }  PO

POST ST /user/add (2)

BODY

{ "userId": 3, "username": “alexps", "fullname": “Alex Psychas", "email": “alex@email.com " } RESPONSE {}  GET

GET /user/getAll (3)

RESPONSE

[{ "userId": 1, "username": “thodfl", "fullname": “Thodoris Florakis", "email": “thodoris@email.com " }, { "userId": 2, "username": “vretml", "fullname": “Vrettos Moulos", "email": “vrettos@email.com " }, { "userId": 3, "username": “alexps", "fullname": “Alex Psychas", "email": “alex@email.com " }]

slide-22
SLIDE 22

What’s next

 Add persistence (MySQL, MongoDB, etc.)  Add ORM (JPA, Hibernate)  Create Response Entities  Secure the API (Authentication, API Key)

slide-23
SLIDE 23

Questions ?

slide-24
SLIDE 24

Thank you!