Package org.apache.jackrabbit.oak.json
Class JsonNodeBuilder
- java.lang.Object
-
- org.apache.jackrabbit.oak.json.JsonNodeBuilder
-
public class JsonNodeBuilder extends Object
A utility class to persist a configuration that is in the form of JSON into the node store.This is used to persist a small set of configuration nodes, eg. index definitions, using a simple JSON format.
The node type does not need to be set on a per-node basis. Where it is missing, the provided node type is used (e.g. "nt:unstructured")
A "jcr:uuid" is automatically added for nodes of type "nt:resource".
String, string arrays, boolean, blob, long, and double values are supported. Values that start with ":blobId:...base64..." are stored as binaries. "str:", "nam:" and "dat:" prefixes are removed.
"null" entries are not supported.
-
-
Constructor Summary
Constructors Constructor Description JsonNodeBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddOrReplace(NodeStore nodeStore, String targetPath, String nodeType, String jsonString)Add or replace a node in the node store, including all child nodes.
-
-
-
Method Detail
-
addOrReplace
public static void addOrReplace(NodeStore nodeStore, String targetPath, String nodeType, String jsonString) throws CommitFailedException, IOException
Add or replace a node in the node store, including all child nodes.- Parameters:
nodeStore- the target node storetargetPath- the target path where the node(s) is/are replacednodeType- the node type of the new node (eg. "nt:unstructured")jsonString- the json string with the node data- Throws:
CommitFailedException- if storing the nodes failedIOException- if storing a blob failed
-
-