You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "René Cordier (Jira)" <se...@james.apache.org> on 2020/03/09 08:59:00 UTC

[jira] [Updated] (JAMES-2889) Implement jmap protocol POJO and serialization

     [ https://issues.apache.org/jira/browse/JAMES-2889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

René Cordier updated JAMES-2889:
--------------------------------
    Description: 
The idea would be to deserialize the invocation data-type [1] as well as the request object [2] for the echo method using **play-json** library.

{code:java}
 {
 "using": [ "urn:ietf:params:jmap:core"],
 "methodCalls": [
 [ "Core/echo",
{ "arg1": "arg1data", "arg2": "arg2data" }
, "c1" ]
 ]
 }
{code}
 
[1] [https://jmap.io/spec-core.html#the-invocation-data-type]
 [2] [https://jmap.io/spec-core.html#the-request-object]

The **MethodArguments** will be a sealed trait.

Deserialisation of Requestobject will be done with pattern matching: 
 `JsArray(Seq(JsString(methodName), JsObject, JsString(methodCallId))`

Also we will need to serialize the response object [3]:

{code:java}
 {
 "methodResponses": [
 [ "Core/echo",

{ "arg1": "arg1data", "arg2": "arg2data" }

, "c1" ]
 ],
 "sessionState": "75128aab4b1b"
 }
{code}

[3] [https://jmap.io/spec-core.html#the-response-object]

**DOD** demonstrate serialization / deserialization in unit tests in `jmap-rfc-8620` maven module

  was:
JAMES-2888 bootstrap a jmap server, but with jmap-draft protocol structure.

The goal of this ticket is to match RFC-2860 protocol structure:

Request:

{code:java}
{
  "using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ],
  "methodCalls": [
    [ "method1", {
      "arg1": "arg1data",
      "arg2": "arg2data"
    }, "c1" ],
    [ "method2", {
      "arg1": "arg1data"
    }, "c2" ],
    [ "method3", {}, "c3" ]
  ]
}
{code}

Response:

{code:java}
{
  "methodResponses": [
    [ "method1", {
      "arg1": 3,
      "arg2": "foo"
    }, "c1" ],
    [ "method2", {
      "isBlah": true
    }, "c2" ],
    [ "anotherResponseFromMethod2", {
      "data": 10,
      "yetmoredata": "Hello"
    }, "c2"],
    [ "error", {
      "type":"unknownMethod"
    }, "c3" ]
  ],
  "sessionState": "75128aab4b1b"
}
{code}


Update echo integration tests accordingly.

        Summary: Implement jmap protocol POJO and serialization  (was: `jmap` should match RFC-8620 protocol structure - request/response)

> Implement jmap protocol POJO and serialization
> ----------------------------------------------
>
>                 Key: JAMES-2889
>                 URL: https://issues.apache.org/jira/browse/JAMES-2889
>             Project: James Server
>          Issue Type: Sub-task
>          Components: JMAP
>            Reporter: Benoit Tellier
>            Assignee: Antoine Duprat
>            Priority: Major
>
> The idea would be to deserialize the invocation data-type [1] as well as the request object [2] for the echo method using **play-json** library.
> {code:java}
>  {
>  "using": [ "urn:ietf:params:jmap:core"],
>  "methodCalls": [
>  [ "Core/echo",
> { "arg1": "arg1data", "arg2": "arg2data" }
> , "c1" ]
>  ]
>  }
> {code}
>  
> [1] [https://jmap.io/spec-core.html#the-invocation-data-type]
>  [2] [https://jmap.io/spec-core.html#the-request-object]
> The **MethodArguments** will be a sealed trait.
> Deserialisation of Requestobject will be done with pattern matching: 
>  `JsArray(Seq(JsString(methodName), JsObject, JsString(methodCallId))`
> Also we will need to serialize the response object [3]:
> {code:java}
>  {
>  "methodResponses": [
>  [ "Core/echo",
> { "arg1": "arg1data", "arg2": "arg2data" }
> , "c1" ]
>  ],
>  "sessionState": "75128aab4b1b"
>  }
> {code}
> [3] [https://jmap.io/spec-core.html#the-response-object]
> **DOD** demonstrate serialization / deserialization in unit tests in `jmap-rfc-8620` maven module



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org