The importance of the collection pattern for OneM2M architecture Group Name: ARC/PRO Source: Mahdi Ben Alaya, LAAS-CNRS,

Slides:



Advertisements
Similar presentations
Reinventing using REST. Anything addressable by a URI is called a resource GET, PUT, POST, DELETE WebDAV (MOVE, LOCK)
Advertisements

Is a Node or not Node? ARC Node_resolution Group Name: ARC Source: Barbara Pareglio, NEC, Meeting Date: ARC#9.1 Agenda.
Thoughts on Architecture for the Internet of Things Group Name: Working Group 2 - Architecture Source: Nicolas Damour, Sierra Wireless
Introduction to Databases Transparencies
REST API versioning Group Name: ARC/PRO
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
Discussion on oneM2M HTTP Binding Interoperability Test Spec.
LHCbPR V2 Sasha Mazurov, Amine Ben Hammou, Ben Couturier 5th LHCb Computing Workshop
Introduction to Databases Transparencies 1. ©Pearson Education 2009 Objectives Common uses of database systems. Meaning of the term database. Meaning.
Introduction to UDDI From: OASIS, Introduction to UDDI: Important Features and Functional Concepts.
Device Management using mgmtCmd resource
Device Management using mgmtCmd resource Group Name: WG2/WG5 Source: InterDigital Communications Meeting Date: Agenda Item: TBD.
Method of Converting Resource definitions into XSD Group Name: WG3 (PRO) Source: Shingo Fujimoto, FUJITSU, Meeting Date:
Open Data Protocol * Han Wang 11/30/2012 *
Searching: Binary Trees and Hash Tables CHAPTER 12 6/4/15 Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education,
In-Band Access Control Framework Group Name: WG4 SEC Source: Qualcomm Meeting Date: Agenda Item:
Announcement Resources ARC Announcement_Issues Group Name: WG2 Source: Barbara Pareglio, NEC Meeting Date: Agenda Item: Input Contribution.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
PRO R01-URI_mapping_discussion Discussion on URI mapping in protocol context Group Name: PRO and ARC Source: Shingo Fujimoto, FUJITSU,
REST - Introduction Based on material from InfoQ.com (Stefan Tilkov) And slides from MindTouch.com (Steve Bjorg) 1.
Lecture # 3 & 4 Chapter # 2 Database System Concepts and Architecture Muhammad Emran Database Systems 1.
In-Band Access Control Framework Group Name: WG4 SEC Source: Qualcomm Meeting Date: Agenda Item:
Management of CMDH Policies Group Name: WG5-MAS Source: Wolfgang Granzow, Qualcomm, Meeting Date: Agenda Item: Management.
TS0001 Identifiers way forward Group Name: WG2 Source: Elloumi, Foti, Scarrone, Lu (tbc), Jeong (tbc) Meeting Date: Agenda Item: ARC11/PRO11.
Hypermedia Design for Machine APIs Web Scale Architecture for the Web of Things Michael J Koster 14 September 2015.
Considerations on M2M URIs Group Name: WG2(ARC) Source: Yong-Suk Park, Sung-Chan Choi, Jaeho Kim, KETI, Meeting Date:
Supporting long polling Group Name: ARC WG Source: SeungMyeong, LG Electronics, Meeting Date: x-xx Agenda Item: TBD.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
Customized Resource Types MAS Group Name: MAS + ARC + PRO WGs Source: Wolfgang Granzow, Qualcomm Inc., Meeting Date:
C. Huc/CNES, D. Boucon/CNES-SILOGIC Producer-Archive Interface Specification.
© 2008 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Lesson # 9 HP UCMDB 8.0 Essentials.
Discussion on XSD implementation conventions (document number PRO R01) Group Name: PRO Source: Wolfgang Granzow, Meeting.
Supporting Time Series Data Group Name: WG2 Source: Qi Yu, Mitch Tseng- Huawei Technologies, Co. LTD. Meeting Date: Work Item :WI-0033.
Device Management using mgmtCmd resource Group Name: WG2/WG5 Source: InterDigital Communications Meeting Date: Agenda Item: TBD.
Web Technologies Lecture 10 Web services. From W3C – A software system designed to support interoperable machine-to-machine interaction over a network.
CSE300 EAIusing EJB & XML CSE Enterprise Application Integration Using EJB and XML by Prithwis Sett Mumtaz Lohawala Nayana Paranjape.
M2M Service Subscription Profile Discussion Group Name: oneM2M TP #19.2 Source: LG Electronics Meeting Date: Agenda Item:
PRO/ARC and TST/PRO joint sessions at TP20 Group Name: oneM2M TP20 Source: Peter Niblett, IBM Meeting Date:
OIC INTERWORKING Resource mapping
Protocol Issues related to Plugtest Group Name: TST Source: Wolfgang Granzow, Qualcomm Inc., Meeting Date: Agenda.
LWM2M Interworking Proxy Procedures ARC Considerations
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
Issues of Current Access Control Rule and New Proposal Introduction Group Name: ARC 21 Source: Wei Zhou, Datang, Meeting Date:
Adding Non-blocking Requests Contribution: oneM2M-ARC-0441R01R01 Source: Josef Blanz, Qualcomm UK, Meeting Date: ARC 7.0,
Authorization Architecture Discussion Group Name: SEC WG Source: Seongyoon Kim, LG Electronics, Meeting Date: 28 MAY, 2014 Agenda.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
Resource subscription using DDS in oneM2M
Lesson # 9 HP UCMDB 8.0 Essentials
oneM2M interop 3 issues and optimizations
CSE Retargeting to AE, IPE, and NoDN Hosted Resources
CSE Retargeting to AE, IPE, and NoDN Hosted Resources
Thoughts on Architecture for the Internet of Things
Better RESTFul API – Best Practices
2nd Interoperability testing issues
Issues of <locationPolicy> Discussion
Proposed design principles for modelling interworked devices
Discussions on Heterogeneous Identification Service
Proximal IoT Interworking solution discussion
TS-0004 Data Representation Proposal Discussion
oneM2M Versioning Next Steps
LWM2M Interworking with <mgmtObj> Resources
Discussion on XSD open issues
Teaching slides Chapter 8.
Data Model.
Summary of the MAF and MEF Interface Specification TS-0032
Week 05 Node.js Week 05
oneM2M interop 6 action point
Chengyu Sun California State University, Los Angeles
Presentation transcript:

The importance of the collection pattern for OneM2M architecture Group Name: ARC/PRO Source: Mahdi Ben Alaya, LAAS-CNRS, Thierry Monteil, LAAS-CNRS, Khalil Drira, LAAS-CNRS, Meeting Date:

Introduction Collection is a pattern for RESTful architecture. Why collections are removed from the OneM2M architecture? – To reduce the size of the resource URIs ? – To provide a flexible resource tree structure? – To reduce server processing overload ? In this presentation we clarify a set of wrong assumptions about collections. Examples are used to demonstrate that: – Collections URIs are short and non hierarchal. – Collections resources do not cause a rigidness to the tree structure. – Collections do not overload the server. © 2014 oneM2M Partners 2

Introduction Collections provide essential features with a direct impact on the OneM2M architecture design, implementation, and performance. 1.Design: Collection simplifies the resource structure and make it easy to consume Collection URIs are required for POST request to be compliant with REST/HATEOAS constraints. 2.Performance: Collection decreases resource representation size and response time. Collection removes redundant resource type tags Collection size is controlled by paging links. 3.Implementation: Collections provides separate URIs for each resource type, thus the server knows the resource type just by looking to the request URI. © 2014 oneM2M Partners 3

Design (1/4) Collection is a pattern for RESTful architecture REST/HATEOAS constraint decouples client and server in a way that allows the server functionality to evolve independently. Hypermedia and links should be used to find your way through the API. (Follow-Your-Nose strategy). Servers must instruct clients on how to construct appropriate URIs without using out-of-band information. Leonard Richardson, inventor of HATEOAS, and author of “RESTful Web APIs” book dedicated the chapter 6 of his book to the collection pattern: Collection is a well known pattern for RESTful API. Example of existing HATEOAS media type supporting the collection pattern: Collection+JSON, AtomPub, HAL, JSON-LD, Siren © 2014 oneM2M Partners 4

Design (2/4) Flexible resource tree with short and flat URIs © 2014 oneM2M Partners 5 Example 1 (GET): The client retrieves a Container resource starting from the CSEBase URI making use of Collections pattern. Resource representations are small so it is easy for the client to use provided links to change the application state. Collection URIs are short and flat. Resource tree is flexible. An optional resource type prefix is used to identify resources e.g. “/a/a1” and “/c/c1”. – We have a unique resource name per each resource type. – For All requests, the server knows the resource type just by looking to the URI. NRequestResponse 1)GET /csebase … 2)GET /a … 3)GET /a/a1 … 4)GET /a/a1/c … 5)GET /c/c1 …

Design (3/4) Collection URIs are required for POST request © 2014 oneM2M Partners 6 Example 2 (POST): The client creates a ContentInstance resource on the retrieved container making use of Collections pattern. The server use collections URIs to instruct the client on how to CREATE a new resource. The server return back a flat and short URI for the new application. NRequestResponse 1)GET /c/c1 … 2)POST /c/c1/i xxx Location: i/i5 xxx … 3)GET /i/i5 xxx …

Design (4/4) Flat URIs without resource type prefixes © 2014 oneM2M Partners 7 NRequestResponse 1)GET /csebase … 2)GET /a … 3)GET /a1 … 4)GET /a1/c … 5)GET /c1 … NRequestResponse 1)GET /c1 … 2)POST /c1/i xxx Location: /i5 xxx … 3)GET /i5 xxx … No prefix is used to identify resources e.g. “/a1” and “/c1”. We must have a global unique resource name per CSE. For GET, PUT, and DELETE requests, the server must check the resource ID before to find the resource type. For POST requests, the server uses the Collection URI to find the resource type. Example 2 (POST) Example 1 (GET)

In the current architecture, the resource representation contains big number of links to all child resources which considerably increases the size of the payload. Collections organize resources of the same type in separate representations. The resource representation become small because it contains only few collections links instead of big number of mixed resource links. Without CollectionWith Collection … … … …. Performance (1/3) Collections reduce the representation size © 2014 oneM2M Partners 8

In the current architecture, each resource contains mixed resource links, so each link must contain its own type tag, which increases the payload size. Collections contain resources of the same type, so all redundant type tags can be factorized in one tag (the collection type tag), which decreases the payload size. Without CollectionWith Collection … … … … Performance (2/3) Collections remove redundant resource type tags © 2014 oneM2M Partners 9

Collections are designed to contain a big number of items. To limit collections size, it is recommenced to use collection paging. Technically the server returns the representation including a limited number of items, with "next" and "previous“ links. Example: … Performance (3/3) Collection size can be controlled with paging links © 2014 oneM2M Partners 10

When the server receives a resource, it validates the representation using the corresponding XSD schema file, and then parses it. In the current architecture, we define the same URI to create resources of different type. In the following examples, “/CSEBase” is the same URI for the 3 requests: To create a AE, the client send POST to /CSEBase with AE representation. To create a Container the client send POST to /CSEBase with AE representation. To create a Goup, the client send POST to /CSEBase with AE representation. The server will not be able to determine the type of the received resource. There is two possible workarounds: 1.The server will look inside the received representation to find the resource type tag, before validating the representation. (overload) 2.The server will try the XSD schemas one by one till it finds the correct one, if validation is ok, then it parses the representation. (overload) With collections, we have separate links for each resource type. The server knows the resource type just by looking to the request URI. Implementation (1/2) Resource type technical problem © 2014 oneM2M Partners 11

With collections, we have separate links for each resource type. Let’s consider the CSEBase representation: … We have now a different URI for each resource creation request: To create a AE, the client send POST to /a with AE representation. To create a Container the client send POST to /c with Container representation. To create a Goup, the client send POST to /g with AE representation. The server knows the resource type just by looking to the request URI. This is the natural way to solve the resource type issue. Implementation (2/2) Collection URIs solve the resource type problem © 2014 oneM2M Partners 12

Collection items next 0..1 prev 0..1 … … 0..n Attribute 0..1 Collection resource type structure Collection resource XML example Generic Collection resource structure The Collection resource could have a specific structure depending on the items type. (Example ETSI M2M collections) The collection could also have a generic structure supporting all item types. Example: © 2014 oneM2M Partners 13

Resource Type Short DescriptionChild Resource Types Parent Resource Types Clause Content Instance Represents a data instance in the container resourcesubscriptioncontainer9.6.7 AEStores information about the AE. It is created as a result of successful registration of an AE with the registrar CSE subscription, container, group, accessControlPolicy, mgmtObj, commCapabilities, pollingChannel remoteCSE, CSEBase containerShares data instances among entities. Used as a mediator that takes care of buffering the data to exchange "data" between AEs and/or CSEs.(…) container, contentInstance, subscription, application, container, remoteCSE, CSEBase CSEBaseThe structural root for all the resources that are residing on a CSE. It shall store information about the CSE itself remoteCSE, node, application, container, group, accessControlPolicy, subscription, mgmtObj, mgmtCmd, locationPolicy, statsConfig None9.6.3 Table Resource Summary Figure : Structure of resource Impact on ARC Child resource types must contain collections resources (e.g. AEs, Containers, etc.) Collection cardinality must set to 1. RemoteCses AEs Containers Groups AccessPolicies Subscriptions MgmtCmd LocationPolicies StatsConfigs StatsCollects CSEBase resource including collections example © 2014 oneM2M Partners 14 Figure 9.5-1: representation convention

Table ‑ 4: Reference of child resources Child Resource Type Name MultiplicityRef. to in Resource Type Definition remoteCse(variable)0..n7.3.1 node(variable)0..n AE (variable)0..n7.3.3 container(variable)0..n7.3.4 group(variable)0..n accessControlPolicy0..n subscription(variable)0..n7.3.6 mgmtCmd(variable)0..n locationPolicy(variable)0..n7.3.8 statsConfig(variable)0..n statsCollect(variable)0..n C.2. Container resource that conforms to the Schema in C.1 C.1.XML Schema for container resource type Impact on PRO Child resource types must contain collections resources (e.g. AEs, Containers, etc.) XSDs and XML file must be updated to have collection. © 2014 oneM2M Partners 15

The collection pattern should be integrated into the OneM2M platform to be compliant with REST architecture constraints, to improve system performance and to solve the resource type technical problem. To integrate collections to OneM2M, several changes should done on ARC and PRO specifications: – For each resource, same type child resources must be replaced with one collection link. – A new Collection resource must be defined. The collection structure can be generic. Conclusion © 2014 oneM2M Partners 16

References « RESTful Web APIs » book - Leonard Richardson, Mike Amundsen, Sam Ruby. Septembre ISBN: (See chapter 6: the collection pattern). Leonard Richardson Maturity Model ( REST APIs must be hypertext-driven – Roy T. Fielding ( HATEOAS and the PayPal REST Payment API ( hateoas-links) hateoas-links « RESTful Web services » book - Leonard Richardson, Sam Ruby. May ISBN:

Thank you for your attention

(Annex) Does the discovery mechanism solve the problem ? The discovery mechanism cannot solve this architectural problem: – Discovery enables only to find URIs of a specific resources quickly based on some filter criteria, like a search engine. But, starting from the discovered link, a client should be able to traverse the API by reading media type and following link. – Rely only on the discovery mechanism to use the API is not HATEOAS or even REST. – In addition, to be HATEOAS, servers must instruct clients on how to construct appropriate URIs even for discovery requests by he mean of URI template, etc. © 2014 oneM2M Partners 19