Open main menu

CDOT Wiki β

Changes

JSON Integration Adapter

1,661 bytes added, 14:00, 5 July 2011
m
Added Project Overview (Requested by Professors).
[[category: NexJ Current Projects]]
[[category: NexJ Express JSON Message Adapter]]
 
== Overview ==
{| class="wikitable" border="1"
|-
! Term
! Description
|-
| Formatter
| Turns data into JSON
|-
| Parser
| Turns JSON into data
|-
| Message
| The metadata to be used when formatting and parsing a message. The grammar. It is a tree-like structure.
|-
| MessageInstance
| The information to be parsed or formatted
|}
 
The goal of JSON Integration Adapter is to give the NexJ Express Integration Layer the ability to work with JSON data.
 
The Integration layer allows a Model to interact with external applications asynchronously. A description / grammar of the data to be exchanged between the two systems is defined using a Message in the Model.
 
Formatting is turning internal NexJ representation of a MessageInstance into JSON. The formatter is given a Message (the grammar), MessageInstance (the data), and a pipe. This accomplished by walking the Message tree-like structure while validating the data in the MessageInstance and streaming JSON format to the pipe. If the data in the MessageInstance does not conform to the Message, the formatter throws an exception.
 
The parser turns JSON representation of a MessageInstance into an internal NexJ representation of a MessageInstance. The parser is given a Message (the grammar) and an input stream. First the input stream is parsed for JSON using a JSONParser which returns either an Object or an Array. The formatter walks the Message building the structure of the MessageInstance and adding validated values in the object returned by the JSONParser to the MessageInstance. If the data from the input stream does not match the expected input at any time, the parser throws an exception.
== Project Repository ==
1
edit