You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by Apache Wiki <wi...@apache.org> on 2012/03/20 15:57:01 UTC

[Jackrabbit Wiki] Update of "Jsop" by JulianReschke

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki" for change notification.

The "Jsop" page has been changed by JulianReschke:
http://wiki.apache.org/jackrabbit/Jsop?action=diff&rev1=38&rev2=39

  == Jsop ==
- 
  <<TableOfContents>>
  
  == Overview ==
- 
  "Jsop" is the idea of a lightweight HTTP protocol for manipulating JSON-based object models.
  
- See [[http://www.slideshare.net/uncled/jsop | David NĂ¼scheler's slides]] for an initial proposal.
+ See [[http://www.slideshare.net/uncled/jsop|David NĂ¼scheler's slides]] for an initial proposal.
  
  This protocol would include
  
@@ -20, +18 @@

  
   * one or more formats expression changes in a JSON structure
  
- 
  == JCR-JSON mapping ==
- 
  TBD.
  
  == Identifier Notation ==
- 
  TBD (I believe raw JCR paths work as they subset JSON names and never need the "/"; but what about namespace prefixes? The current use is compact but doesn't necessarily yield stable identifiers )
  
  === IETF Work on Identifier Notation ===
- 
  Internet Draft:
  
-  * a pointer syntax for identifying objects in an object tree: http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer  (note that this uses "/" as separator, and "^" as escape character so that a "/" can be part of a name; if we used that syntax we'd still need to treat "^" as escape character even though we would never need it to escape "/")
+  * a pointer syntax for identifying objects in an object tree: http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer (note that this uses "/" as separator, and "^" as escape character so that a "/" can be part of a name; if we used that syntax we'd still need to treat "^" as escape character even though we would never need it to escape "/")
  
  == HTTP binding ==
- 
  It needs to be defined how JCR nodes and JCR events are mapped to HTTP URIs; this includes the name mapping, the granularity, and more.
  
  For instance:
@@ -56, +49 @@

  TODO: describe the current implementation in jcr-server
  
  == Diff Formats ==
- 
  === IETF Work on Diff Formats ===
- 
  Internet Draft:
  
   * a model for patch operations and an associated syntax in JSON: http://tools.ietf.org/html/draft-ietf-appsawg-json-patch -- this captures patch operations inside a JSON container (not a custom format as discussed below)
@@ -72, +63 @@

  Both these issues have been raised as potential enhancements on the IETF apps-discuss mailing list.
  
  === Draft Implementations: JSOP-Diff ===
- 
- The definitions below are based on the format used by [[http://svn.apache.org/viewvc/jackrabbit/tags/2.3.2/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/JcrRemotingServlet.java?view=markup|JCR Server]] but diverge in some areas. This is still work in progress and definitions may change at anytime. 
+ The definitions below are based on the format used by [[http://svn.apache.org/viewvc/jackrabbit/tags/2.3.2/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/JcrRemotingServlet.java?view=markup|JCR Server]] but diverge in some areas. This is still work in progress and definitions may change at anytime.
  
   * [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/|Jackrabbit Microkernel]]
  
   * DavExRemoting in Jackrabbit WebDAV
- 
  
  ==== Compact Syntax ====
  {{{
@@ -105, +94 @@

  STRING   ::= /* See RFC 4627, Section 2.5 */
  NUMBER   ::= /* See RFC 4627, Section 2.4 */
  }}}
- 
- A [[http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsopParser.java?view=markup | parser]], and a simple [[http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/json/JsopParserTest.java?view=markup | test case]] for this syntax is available from the sandbox. 
+ A [[http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsopParser.java?view=markup|parser]], and a simple [[http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/json/JsopParserTest.java?view=markup|test case]] for this syntax is available from the sandbox.
  
- Also available are a [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java?view=markup | tokenizer]], a [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java?view=markup | builder]], and a [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java?view=markup | Jsop writer / reader]]. Those implementations are token based, and therefore not limited to the JSOP format described here.
+ Also available are a [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java?view=markup|tokenizer]], a [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java?view=markup|builder]], and a [[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java?view=markup|Jsop writer / reader]]. Those implementations are token based, and therefore not limited to the JSOP format described here.
  
  ==== Syntax ====
- 
  '''jsop:'''
+ 
   * diff
   * diff jsop
  
  A Jsop string contains one or multiple Jsop diff lines.
  
  '''diff:'''
+ 
   * addNodeDiff
   * addPropertyDiff
   * setPropertyDiff
@@ -132, +121 @@

  A diff line can contain the information about adding nodes (possibly multiple nested nodes), adding a property to a node, setting a property, moving a node, or removing a node or property. There is a special metadata diff line.
  
  '''addNodeDiff:'''
+ 
   * + pathString: object
  
  The added node may contain child nodes. The order of child node is preserved, that means, when requesting the object, the child nodes will appear in the same order as they appear when the node was added. This only applies to child nodes however; it does not apply to the order of properties. For example, an implementation may sort the properties by name.
  
  '''addPropertyDiff:'''
+ 
   * + pathString: propertyValue
  
  '''setPropertyDiff:'''
+ 
   * ^ pathString: propertyValue
  
  '''moveNodeDiff:'''
+ 
   * > pathString: newPathString
   * > pathString: { positionString: newPathString }
  
  '''copyNodeDiff:'''
+ 
   * * pathString: newPathString
   * * pathString: { positionString: newPathString }
  
  '''positionString:'''
+ 
   * "before"
   * "after"
  
  '''removeNodeDiff:'''
+ 
   * - pathString
  
  '''removePropertyDiff:'''
+ 
   * ^ pathString: null
  
  Setting the value to null will remove the property.
  
  '''propertyValue:'''
+ 
   * string
   * number
   * array
@@ -172, +170 @@

  A property value can be any value, except for a object itself.
  
  '''testProperty:'''
+ 
   * = pathString: { propertyValue | null }
  
+ Before applying the rest of patch, the value is verified. If it does not match, then the subsequent line(s) will not be applied. The exact semantics are not yet defined however and will most likely be implementation specific - for example it is undefined whether a mismatch will result in an exception or not, and whether all following lines of the commit belong to the same atomic operation or not. This addition allows to construct atomic commits.
- Before applying the rest of patch, the value is verified. If it does not match,
- then the subsequent line(s) will not be applied. The exact semantics are
- not yet defined however and will most likely be implementation specific -
- for example it is undefined whether a mismatch will result in an exception
- or not, and whether all following lines of the commit belong to the same
- atomic operation or not. This addition allows to construct atomic commits.
  
  '''metaData:'''
+ 
   * @ object
  
+ The metadata line contains metadata about the following diff lines. Metadata typically includes the timestamp (when did the change occur), the user, the commit message. A jsop object can contain multiple metadata lines. It depends on the implementation whether or not metadata is used, and how it is used.
- The metadata line contains metadata about the following diff lines. Metadata typically includes the timestamp (when did the change occur),
- the user, the commit message. A jsop object can contain multiple metadata lines. It depends on the implementation whether or not metadata is used, and how it is used.
  
  '''object:'''
+ 
   * {}
   * { members }
  
  '''members:'''
+ 
   * pair
   * pair, members
  
  '''pair:'''
+ 
   * string: value
  
  '''array:'''
+ 
   * []
   * [ elements ]
  
  '''elements:'''
+ 
-  * value 
+  * value
   * value, elements
  
  '''value:'''
+ 
   * string
   * number
   * object