public class JsonMergePatchServerSynchronizer extends Object implements ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
ServerSynchronizer
implementation that can handle JsonNode
objects.Constructor and Description |
---|
JsonMergePatchServerSynchronizer() |
Modifier and Type | Method and Description |
---|---|
static String |
checksum(com.fasterxml.jackson.databind.JsonNode content) |
JsonMergePatchEdit |
clientDiff(Document<com.fasterxml.jackson.databind.JsonNode> document,
ShadowDocument<com.fasterxml.jackson.databind.JsonNode> shadowDocument)
Is called to produce an
Edit of changes coming from a client. |
PatchMessage<JsonMergePatchEdit> |
createPatchMessage(String documentId,
String clientId,
Queue<JsonMergePatchEdit> edits)
Creates a new
PatchMessage with the with the type of Edit that this
synchronizer can handle. |
Document<com.fasterxml.jackson.databind.JsonNode> |
documentFromJson(com.fasterxml.jackson.databind.JsonNode json)
Converts the
JsonNode into a Document instance. |
Document<com.fasterxml.jackson.databind.JsonNode> |
patchDocument(JsonMergePatchEdit edit,
Document<com.fasterxml.jackson.databind.JsonNode> document)
Called when the document should be patched.
|
PatchMessage<JsonMergePatchEdit> |
patchMessageFromJson(String json)
Creates a {link PatchMessage} by parsing the passed-in json.
|
ShadowDocument<com.fasterxml.jackson.databind.JsonNode> |
patchShadow(JsonMergePatchEdit edit,
ShadowDocument<com.fasterxml.jackson.databind.JsonNode> shadowDocument)
Called when the shadow should be patched.
|
JsonMergePatchEdit |
serverDiff(Document<com.fasterxml.jackson.databind.JsonNode> document,
ShadowDocument<com.fasterxml.jackson.databind.JsonNode> shadowDocument)
The first step in a sync is to produce a an edit for the changes.
|
public JsonMergePatchEdit clientDiff(Document<com.fasterxml.jackson.databind.JsonNode> document, ShadowDocument<com.fasterxml.jackson.databind.JsonNode> shadowDocument)
ServerSynchronizer
Edit
of changes coming from a client.clientDiff
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
document
- the server side document .shadowDocument
- the document shadow containing the client changes.Edit
the edit representing the diff between the document and it's shadow document.public JsonMergePatchEdit serverDiff(Document<com.fasterxml.jackson.databind.JsonNode> document, ShadowDocument<com.fasterxml.jackson.databind.JsonNode> shadowDocument)
ServerSynchronizer
serverDiff
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
document
- the document containingshadowDocument
- the document shadow.Edit
the edit representing the diff between the document and it's shadow document.public ShadowDocument<com.fasterxml.jackson.databind.JsonNode> patchShadow(JsonMergePatchEdit edit, ShadowDocument<com.fasterxml.jackson.databind.JsonNode> shadowDocument)
ServerSynchronizer
patchShadow
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
edit
- The edits.shadowDocument
- the ShadowDocument
to patchShadowDocument
a new patched shadow document.public Document<com.fasterxml.jackson.databind.JsonNode> patchDocument(JsonMergePatchEdit edit, Document<com.fasterxml.jackson.databind.JsonNode> document)
ServerSynchronizer
patchDocument
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
edit
- the edit to use to path the documentdocument
- the document to be patched.Document
a new patched document.public PatchMessage<JsonMergePatchEdit> createPatchMessage(String documentId, String clientId, Queue<JsonMergePatchEdit> edits)
ServerSynchronizer
PatchMessage
with the with the type of Edit
that this
synchronizer can handle.createPatchMessage
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
documentId
- the document identifier for the PatchMessage
clientId
- the client identifier for the PatchMessage
edits
- the Edit
s for the PatchMessage
PatchMessage
the created {code PatchMessage}public PatchMessage<JsonMergePatchEdit> patchMessageFromJson(String json)
ServerSynchronizer
patchMessageFromJson
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
json
- the json representation of a PatchMessage
PatchMessage
the created {code PatchMessage}public Document<com.fasterxml.jackson.databind.JsonNode> documentFromJson(com.fasterxml.jackson.databind.JsonNode json)
ServerSynchronizer
JsonNode
into a Document
instance.documentFromJson
in interface ServerSynchronizer<com.fasterxml.jackson.databind.JsonNode,JsonMergePatchEdit>
json
- the JsonNode
to convertDocument
the document representing the contents of the JsonNode
instance.public static String checksum(com.fasterxml.jackson.databind.JsonNode content)
Copyright © 2015 JBoss by Red Hat. All Rights Reserved.