Open main menu

CDOT Wiki β

Changes

JSON Integration Adapter

5,587 bytes removed, 11:39, 10 August 2011
no edit summary
== Project Goal==
To create an adapter for the NexJ Core similar in methodology and design of existing message adapters (XML, Fixed, CSV etc.) but using the JSON format
 
===Contributors===
* [[User:Gbatumbya|Grace Batumbya]]
* [[User:Brianlim | Brian Lim]]
 
== Current Status==
 
Changes being implemented as requested from first code review.
 
== Code Review 1 Results ==
 
Code review took place on August 9th, 2011 at NexJ with Grace Batumbya, Brian Lim and Andrew Borzenko in attendance.
 
=== Major changes include: ===
# Allowing modes for all message parts, not just the root.
# Refactoring methods to check for != right condition instead of checking for the wrong condition to throw an exception. (whitelist instead of blacklist)
# Formatting all primitives before writing or storing them, particularly timestamps and other format sensitive strings.
# Creating a RootJSONMessagePartMapping extending JSONMessagePartMapping
 
=== Code Review Notes ===
==== General ====
{| border="2" style="text-align:center"
! Issue
! Description
! Status
! Class
! Priority
|-
| Exception TODO
| Complete exceptions marked by TODO
| Incomplete
| All Classes
!
|-
| Document methods fully in javadoc style
| Document every method fully in javadoc style. Also document parameters, and use full English sentences. Make sure special settings like root mode or mode are well documented enough to use
| Incomplete
| All classes
!
|-
| Make sure exceptions output the correct message part.
| Make sure exceptions output the correct message part, for example the inner part, rather than always the root part. More specific is better.
| Incomplete
| All classes
!
|-
| Remove spaces after new Object[]{(remove space here)}
| Remove spaces after the curly brackets for all exceptions.
| Incomplete
| All classes
!
|-
| Add a newline after creating each object or after each decision construct.
| Add newlines to conform to NexJ coding style.
| Incomplete
| All classes
!
|-
| Space before break keyword.
| Put a space before all break keywords.
| Incomplete
| All classes
!
|}
 
==== JSONMessagePartMapping ====
 
{| border="2" style="text-align:center"
! Issue
! Description
! Status
! Class
! Priority
|-
| Use Hashholder instead of HashSet
| Use HashHolder in the XMLJSONMessagePartLoader instead of HashSet and whenever appropriate replace HashSet with HashHolder
| Incomplete
| JSONMessagePartMapping
!
|-
| Change 0x000 for byte
| For root modes, change 0xXXX to a cast to byte. Also do not use leading zeroes.
| Incomplete
| JSONMessagePartMapping, RootJSONMessagePartMapping
!
|-
| Remove StringParsre from JSONMessagePartMapping
| Either remove StringParser from the mapping, or use it in formatting primitives. Do not leave it in if it is not used.
| Incomplete
| JSONMessagePartMapping
!
|-
| Create class called RootJSONMessagePartMapping
| Create a class called RootJSONMessagePartMapping for each CompositeMessagePart. This root JSON mapping will handle the "mode" for each CompositeMessagePart.
| Incomplete
| JSONMessagePartMapping, RootJSONMessagePartMapping
!
|-
| Allow root modes for each CompositeMessagePart
| Rename root mode to mode, so that each CompositeMessagePart can use every type of mode.
| Incomplete
| JSONMessagePartMapping, RootJSONMessagePartMapping
!
|-
| Rename m_sFormat
| Rename the variable m_sFormat if not used (or use it and keep the name).
| Incomplete
| JSONMessagePartMapping
!
|}
 
==== JSONMessageParser ====
{| border="2" style="text-align:center"
! Issue
! Description
! Status
! Class
! Priority
|-
| Remove/Use InvocationContextAware
| Do not implement the invocation context aware interface if not used by the class. Or, use the interface for formatting of primitives.
| Incomplete
| JSONMessageParser
!
|-
| Name methods XXXPart, not XXXNode
| Rename methods to be XXXPart, for example as writeCompositeMessagePart, instead of writeCompositeMessageNode.
| Incomplete
| JSONMessageParser
!
|-
| Wrap fail
| Wrap all instances of fail with IntegrationException.
| Incomplete
| JSONMessageParser
!
|-
| Override JSONParse
| Override parse method of JSONParser in the JSONMessageParser class. Do this to avoid changing JSONParser.
| Incomplete
| JSONMessageParser
!
|-
| Use primitive formatter when reading.
| When reading information in from a stream in the formatter, use primitive formatter to determine the correct format of a primitive.
| Incomplete
| JSONMessageParser
!
|}
 
==== JSONMessageFormatter ====
{| border="2" style="text-align:center"
! Issue
! Description
! Status
! Class
! Priority
|-
| Format primitive values before outputting to writers.
| Use the StringFormatter to format primitive values before outputting to the writer. For example, timestamps must be formatted before outputting to the writer.
| Incomplete
| JSONMessageFormatter
!
|-
| Pass enumerations into formatMessageRoot
| Do not use member/class variables for storing information unless absolutely necessary. Prefer to pass parameters around so that objects do not grow large as the parser/formatter iterates.
| Incomplete
| JSONMessageFormatter
!
|-
| Change design document to note that MessageTable only supports one message.
| Design document should reflect all special settings of JSON parser and formatter. Specifically, any normally standard features which are not implemented by the JSON parser/formatter should be noted.
| Incomplete
| Design Document
!
|}
==Project Phases==
Phase 6. Apply Changes from Code Review 1
JSON Integration Adapter Phases  ===Phase I1. Research (DONE)=== 
# Complete Fundamentals of NexJ Studio tutorial
# Complete NexJ Integration tutorial
# Install NexJ Studio Express from source
 ===Phase II2. Design Proposal (DONE)=== 
# Receive general approval for project
# Receive approval for JSON encoding options
# [https://docs.google.com/document/d/1ecNB98sOqjMcGjEjrmRl5aBt1WSmLNotCxTRvZ6M0h4/edit?hl=en_US Final Project Proposal]
===Phase 3. Create Classes (DONE)===
# JSONMessagePartMapping
# XMLJSONMessageMappingLoader
# JSONMessageFormatter
# JSONMessageParser
# JSONMessageFormatterTest
===Phase III4. Message Formatter (DONE)=== # Add JSON to .XSD base types# Create sample JSON .message # Parse sample JSON .message with JUnit Test# Create first set of unit tests for Message Formatter# Internal Code Message Formatter first draft# Resolve issues with first set of unit tests# Create second set of unit tests# Resolve issues with second set of unit tests# Refactor and code message formatter  ===Phase IV. Message Parser Review (DONE) === # Discover how to connect JSON RPC parser with Message Parser# Create first set of trivial unit tests for Message Parser# Code Message Parser skeleton# Pass first set of trivial unit tests# Create second set of unit tests (non-trivial) for Message Parser# Code Message Formatter first draft# Resolve issues with second set of unit tests# Refactor  ===Phase V. Integration and Stress Tests (IN PROGRESS)=== # Test Message Formatter and Message Parser with integration and stress tests# Test through NexJ Studio Express GUI (manual testing)  ===Phase VI. Internal Code Review=== 
# Internally review code at CDOT
===Phase 5. Code Review 1 (DONE)===
# August 9, 2011
# Code review took place at NexJ with [[User:Gbatumbya|Grace Batumbya]], [[User:Brianlim | Brian Lim]] and Andrew Borzenko (NexJ Developer) in attendance.
===Phase VII6. OptimizationApply Changes from Code Review 1===# Estimated Duration: 3 Weeks (August 29, 2011)
====Summary====# Find more code optimizations relevant Allowing modes for all Composite message parts, not just the root.# Refactoring methods to check for != right condition instead of checking for the wrong condition to Enterprise environmentsthrow an exception. (whitelist instead of blacklist)# Formatting all primitives before writing or storing them (e.g. timestamps, decimal numbers.)# Creating a RootJSONMessagePartMapping extending JSONMessagePartMapping
===Phase 7. Code Review 2===
# Proposed Date: Week of August 29
===Phase VIII. First Code Review at NexJ===
 
# Date TBA
 
 
===Phase IX. Code Rewrite===
 
# Rewrite code to conform with NexJ suggestions and standards
 
 
===Phase X. Second Code Review at NexJ===
 
# Date TBA
 
 
===Phase XI. Project Completion===
== Project Repository ==
 
BitBucket : https://bitbucket.org/b_lim/nexj-express-json-integration-adapter/
 
 
== Technical Notes ==
 
1
edit