mirror of
https://github.com/corda/corda.git
synced 2025-06-22 00:57:21 +00:00
CORDA-1709 - The MVP blob inspector, able to inspect network service blobs (#3503)
* Cleanup and improvements to the serialisation format of JacksonSupport (needed for CORDA-1238) (#3102) Also deprecated all the public members that shouldn't have leaked into the public API. (cherry picked from commit3bb95c3
) * CORDA-1238: Updated JacksonSupport to support SerializedBytes, CertPath, X509Certificate and the signature classes (#3145) SerializedBytes are first converted to the object it represents before being serialised as a pojo. These changes will be needed to support the the blob inspector when it will output to YAML/JSON. (cherry picked from commitb031e66
) * Cherry picked part of commit824adca
to port over *only* the JackSupport refactoring. * CORDA-1238: Moved the blob inspector out of experimental and wired it to JackonSupport (#3224) The existing output format was not complete and so was deleted to avoid it becoming a tech debt. We can always resurrect it at a later point. (cherry picked from commit4e0378d
) * Added back support for parsing OpaqueBytes as UTF-8 strings in JacksonSupport (#3240) (cherry picked from commitd772bc8
) * Cleaned up blob inspector doc (#3284) (cherry picked from commitb7fbebb
) * Blobinspector: trace level logging with --verbose (#3313) (cherry picked from commit6a2e50b
) * Cherry picked part of commit3046843
to fix issue with --version * Fixes to the api file
This commit is contained in:
committed by
Katelyn Baker
parent
00c9b8ce49
commit
9fc108aa1e
67
docs/source/blob-inspector.rst
Normal file
67
docs/source/blob-inspector.rst
Normal file
@ -0,0 +1,67 @@
|
||||
Blob Inspector
|
||||
==============
|
||||
|
||||
There are many benefits to having a custom binary serialisation format (see :doc:`serialization` for details) but one
|
||||
disadvantage is the inability to view the contents in a human-friendly manner. The blob inspector tool alleviates this issue
|
||||
by allowing the contents of a binary blob file (or URL end-point) to be output in either YAML or JSON. It uses
|
||||
``JacksonSupport`` to do this (see :doc:`json`).
|
||||
|
||||
The latest version of the tool can be downloaded from `here <https://www.corda.net/downloads/>`_.
|
||||
|
||||
To run simply pass in the file or URL as the first parameter:
|
||||
|
||||
``java -jar blob-inspector.jar <file or URL>``
|
||||
|
||||
Use the ``--help`` flag for a full list of command line options.
|
||||
|
||||
When inspecting your custom data structures, there's no need to include the jars containing the class definitions for them
|
||||
in the classpath. The blob inspector (or rather the serialization framework) is able to synthesis any classes found in the
|
||||
blob that aren't on the classpath.
|
||||
|
||||
SerializedBytes
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
One thing to note is that the binary blob may contain embedded ``SerializedBytes`` objects. Rather than printing these
|
||||
out as a Base64 string, the blob inspector will first materialise them into Java objects and then output those. You will
|
||||
see this when dealing with classes such as ``SignedData`` or other structures that attach a signature, such as the
|
||||
``nodeInfo-*`` files or the ``network-parameters`` file in the node's directory. For example, the output of a node-info
|
||||
file may look like:
|
||||
|
||||
|
||||
**-\\-format=YAML**
|
||||
::
|
||||
|
||||
net.corda.nodeapi.internal.SignedNodeInfo
|
||||
---
|
||||
raw:
|
||||
class: "net.corda.core.node.NodeInfo"
|
||||
deserialized:
|
||||
addresses:
|
||||
- "localhost:10005"
|
||||
legalIdentitiesAndCerts:
|
||||
- "O=BankOfCorda, L=London, C=GB"
|
||||
platformVersion: 4
|
||||
serial: 1527851068715
|
||||
signatures:
|
||||
- !!binary |-
|
||||
VFRy4frbgRDbCpK1Vo88PyUoj01vbRnMR3ROR2abTFk7yJ14901aeScX/CiEP+CDGiMRsdw01cXt\nhKSobAY7Dw==
|
||||
|
||||
**-\\-format=JSON**
|
||||
::
|
||||
|
||||
net.corda.nodeapi.internal.SignedNodeInfo
|
||||
{
|
||||
"raw" : {
|
||||
"class" : "net.corda.core.node.NodeInfo",
|
||||
"deserialized" : {
|
||||
"addresses" : [ "localhost:10005" ],
|
||||
"legalIdentitiesAndCerts" : [ "O=BankOfCorda, L=London, C=GB" ],
|
||||
"platformVersion" : 4,
|
||||
"serial" : 1527851068715
|
||||
}
|
||||
},
|
||||
"signatures" : [ "VFRy4frbgRDbCpK1Vo88PyUoj01vbRnMR3ROR2abTFk7yJ14901aeScX/CiEP+CDGiMRsdw01cXthKSobAY7Dw==" ]
|
||||
}
|
||||
|
||||
Notice the file is actually a serialised ``SignedNodeInfo`` object, which has a ``raw`` property of type ``SerializedBytes<NodeInfo>``.
|
||||
This property is materialised into a ``NodeInfo`` and is output under the ``deserialized`` field.
|
Reference in New Issue
Block a user