Difference between revisions of "Nexjexpress/JSON Adapter"

From CDOT Wiki
Jump to: navigation, search
(Created page with '== JSON Adapter == === Goal=== Add ability to access NexJ Server objects as JSON via a RESTful web service <br/>'''current implementation''' <blockquote><pre> <?xml version="1.0"…')
 
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== JSON Adapter ==
+
{{Admon/obsolete}}
=== Goal===
 
Add ability to access NexJ Server objects as JSON via a RESTful web service
 
<br/>'''current implementation'''
 
<blockquote><pre>
 
<?xml version="1.0" encoding="utf-8"?>
 
<_Collection xmlns="http://www.nexj.com/xml" xmlns:xs="http://www.w3.org/2001/XMLSchema"
 
              xmlns:xi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="http://www.nexj.com/xml">
 
  <item xi:type="Person">
 
    <_version>0</_version>
 
    <_oid>104C083E8A4E8A4AD2BAF3011B6A393C97</_oid>
 
    <_keys>primaryTelcom</_keys>
 
    <_keys>primaryLanguage</_keys>
 
    <_keys>initials</_keys>
 
    <_values xi:nil="true"/>
 
    <_values xi:nil="true"/>
 
    <_values xi:nil="true"/>
 
    <lastName>Bar</lastName>
 
    <locking>0</locking>
 
    <firstName>Foo</firstName>
 
    <company>
 
      <_version>0</_version>
 
      <_oid>10209394A0D92641BC9E0FCF36DDAD1C23</_oid>
 
    </company>
 
  </item>
 
</_Collection>
 
</pre></blockquote>
 
'''JSON implementation'''
 
<blockquote><pre>
 
{
 
    "_Collection": {
 
        "item": {
 
            "_keys": ["primaryTelcom", "primaryLanguage", "initials"],
 
            "type": "Person",
 
            "locking": 0,
 
            "_oid": "104C083E8A4E8A4AD2BAF3011B6A393C97",
 
            "_version": 0,
 
            "_values": [
 
{"nil": true},
 
{"nil": true},
 
{"nil": true}
 
    ],
 
            "firstName": "Foo",
 
            "company": {
 
                "_oid": "10209394A0D92641BC9E0FCF36DDAD1C23",
 
                "_version": 0
 
            },
 
            "lastName": "Bar"
 
        },
 
    }
 
}
 
</pre></blockquote>
 
  
===Plan===
+
== Project Goal==
=== Phase 1: Design Proposal ===
+
Develope an adapter to expose NexJ Express Server objects using JSON
 +
 
 +
== Current Status==
 +
'''Phase 10: Apply Changes as per Code Review 4''' <br/>
 +
Ongoing...
 +
<br/>
 +
 
 +
==Project Phases==
 +
=== Phase 1: Design Proposal (Done) ===
 
* Get requirements from NexJ
 
* Get requirements from NexJ
 
* Incorporate requirements from NexJ into Design of JSON Adapater
 
* Incorporate requirements from NexJ into Design of JSON Adapater
 
* Proposal proposal for review, make changes as by NexJ until approved
 
* Proposal proposal for review, make changes as by NexJ until approved
  
====Phase 2: Coding ====
+
===Phase 2: Coding (Done) ===
 
* JSONMarshaller
 
* JSONMarshaller
 
** Develop marshaller to transform NexJ Server Objects into JSON representation
 
** Develop marshaller to transform NexJ Server Objects into JSON representation
Line 73: Line 30:
 
** Create Server objects
 
** Create Server objects
  
====Phase 3: Code Review 1 ====
+
===Phase 3: Code Review 1 (Done)===
 
* Send patch to NexJ for review
 
* Send patch to NexJ for review
  
====Phase 4: Make Changes as per Code Review 1 ====
+
===Phase 4: Make Changes as per Code Review 1 (Done)===
 
* Refactor JSONSever and TextServer to inherit from GenericCharacterStreamHTTPServer
 
* Refactor JSONSever and TextServer to inherit from GenericCharacterStreamHTTPServer
 
* Optimize marshaling of nested Pair objects
 
* Optimize marshaling of nested Pair objects
 
* Rename variables and methods as per NexJ Developer's Guide
 
* Rename variables and methods as per NexJ Developer's Guide
  
====Phase 5: Code Review 2 ====
+
===Phase 5: Code Review 2(Done) ===
 +
* Send patch to NexJ for review
 +
 
 +
===Phase 6: Apply Changes per Code Review 2 (Done) ===
 +
* Minor Clean Up
 +
** Removed unnecessary files
 +
** Ensure all files use CRLF line-endings
 +
* Add Servlet Mapping to cert/web.xml
 +
* GenericCharacterStreamServer
 +
** Use <code>abstract String getType()</code> for creating error codes
 +
** Use <code>getLogger()</code> for lazy initialization of logger
 +
* TextServer
 +
** Members should be protected
 +
* JSONWriter
 +
** Methods names should start with "write"
 +
* JSONMarshaller
 +
** Remove unused methods
 +
** Remove visReferencable()</code>, do lookup in TransferObject Marshaller
 +
* JSONUnmarshaller
 +
** Use <code>JSONLookup</code> to find unmarshllers
 +
** Create <code>DetachableByteArrayOutputStream</code>
 +
** Change logic in <code>Base64Util.decode(String)</code>
 +
** Use <code>Base64Util.decode(String)</code> to decode 64 streams
 +
** Only TO unmarshaller should use <code>remove()</code> otherwise use <code>get()</code> on m_jsonMap
 +
** Change instances of <code>Collection.toArray()</code> to use <code>toArray(new Object[size])</code>
 +
 
 +
===Phase 7: Code Review 3 (Done) ===
 
* Send patch to NexJ for review
 
* Send patch to NexJ for review
 +
===Phase 8: Apply Changes per Code Review 3 (DONE)===
 +
 +
 +
----
 +
  
===Status===
+
:::'''The JSON Adapter Project has been successfully completed'''
Phase 1: done
 
Phase 2: done
 
Phase 3: done
 
Phase 4: done
 
Phase 5: On-going
 
  
===Links===
+
----
 +
 
 +
==Links==
 
'''JSON''' <br/>
 
'''JSON''' <br/>
 
http://www.json.org <br/>
 
http://www.json.org <br/>
 
===Current Tasks===
 

Latest revision as of 19:52, 26 January 2014

Important.png
This page may be obsolete.
It contains historical information.

Project Goal

Develope an adapter to expose NexJ Express Server objects using JSON

Current Status

Phase 10: Apply Changes as per Code Review 4
Ongoing...

Project Phases

Phase 1: Design Proposal (Done)

  • Get requirements from NexJ
  • Incorporate requirements from NexJ into Design of JSON Adapater
  • Proposal proposal for review, make changes as by NexJ until approved

Phase 2: Coding (Done)

  • JSONMarshaller
    • Develop marshaller to transform NexJ Server Objects into JSON representation
  • JSONUnmarshaller
    • Develop an marshaller to transform JSON representation into NexJ Server Objects
  • JSON Server
    • Develop a JSON Server to expose NexJ Server objects in JSON
  • Demo application that interacts with the Server using JSON
    • Read Server Objects
    • Update Server Objects
    • Create Server objects

Phase 3: Code Review 1 (Done)

  • Send patch to NexJ for review

Phase 4: Make Changes as per Code Review 1 (Done)

  • Refactor JSONSever and TextServer to inherit from GenericCharacterStreamHTTPServer
  • Optimize marshaling of nested Pair objects
  • Rename variables and methods as per NexJ Developer's Guide

Phase 5: Code Review 2(Done)

  • Send patch to NexJ for review

Phase 6: Apply Changes per Code Review 2 (Done)

  • Minor Clean Up
    • Removed unnecessary files
    • Ensure all files use CRLF line-endings
  • Add Servlet Mapping to cert/web.xml
  • GenericCharacterStreamServer
    • Use abstract String getType() for creating error codes
    • Use getLogger() for lazy initialization of logger
  • TextServer
    • Members should be protected
  • JSONWriter
    • Methods names should start with "write"
  • JSONMarshaller
    • Remove unused methods
    • Remove visReferencable()</code>, do lookup in TransferObject Marshaller
  • JSONUnmarshaller
    • Use JSONLookup to find unmarshllers
    • Create DetachableByteArrayOutputStream
    • Change logic in Base64Util.decode(String)
    • Use Base64Util.decode(String) to decode 64 streams
    • Only TO unmarshaller should use remove() otherwise use get() on m_jsonMap
    • Change instances of Collection.toArray() to use toArray(new Object[size])

Phase 7: Code Review 3 (Done)

  • Send patch to NexJ for review

Phase 8: Apply Changes per Code Review 3 (DONE)



The JSON Adapter Project has been successfully completed

Links

JSON
http://www.json.org