Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The file names in the case of FileCacheStore are just signed 32-bit integers, so the usual and maximum length of file names is 10 or 11 characters. The file names (i.e. integers) are generated by calculating the Java hashcode of the node's UUID string (prefixed with root node UUID and masking it by a 22 fixed bit mask). For example, for root node, file -891938816 gets generated, specifying the root node children. 

  • Each of the files contain serialized ModeShape nodes. Although the generated files are binary, using a tool (a simple utility is under development) can help in reading the contents of the file (It does not seem possible to read these files using mongoDB bsondump). For example, for our root node file (-891938816) , this tool would represent the root node data in JSON as following:

    Code Block
    languagejs
    { "properties" : { "http://www.jcp.org/jcr/1.0" : { "primaryType" : { "$name" : "mode:root" } , "uuid" : "87a0a8c7505d64/" } } ,
     "children" : [ { "key" : "87a0a8c317f1e7jcr:system" , "name" : "jcr:system" } , 
    { "key" : "7c366d9-25bc-4e2d-9e53-4428fe7b8152" , "name" : "greetings_en" } ] ,
     "childrenInfo" : { "count" : 2 } }

    As an aside, this tool also proposes to show the full file-to-content mapping: 

    Code Block
    -891938816  UUID    87a0a8c7505d64 mode:root
    -1857312768 UUID    7c366d9-25bc-4e2d-9e53-4428fe7b8152 greetings_en
    328781824   UUID    7e84184d-3a8e-4f57-8e49-a550f1c19b3a greetings_en/ds0
    39043072    UUID    fc859bab-6f7b-46de-9b4c-f40dfe28643c hello, world!         
  • The serialization is done by the JBoss serialization library, not JDK's native object serialization machinery. For this reason the generated serialized files look different from an ordinary JDK serialized file. JBoss Marshalling can be configured to use custom serialization classes that read and write content in the format of their choosing (in this case BSON)

  • The data is encoded in Binary JSON (BSON). If the file containing the root node (referencing the node 'greetings_en') is opened up in a hex editor, you would see /u0002 preceding strings (such as "name","key"); /u0004 preceding an array (representing sub-nodes; /u0003 representing the UUID -- in accordance with the BSON spec.

...