public class DiffMatchPatchServerSynchronizer extends Object implements ServerSynchronizer<String,DiffMatchPatchEdit>
ServerSynchronizer implementation that can handle text documents.| Constructor and Description |
|---|
DiffMatchPatchServerSynchronizer() |
DiffMatchPatchServerSynchronizer(DiffMatchPatch diffMatchPatch) |
| Modifier and Type | Method and Description |
|---|---|
DiffMatchPatchEdit |
clientDiff(Document<String> document,
ShadowDocument<String> shadowDocument)
Is called to produce an
Edit of changes coming from a client. |
PatchMessage<DiffMatchPatchEdit> |
createPatchMessage(String documentId,
String clientId,
Queue<DiffMatchPatchEdit> edits)
Creates a new
PatchMessage with the with the type of Edit that this
synchronizer can handle. |
Document<String> |
documentFromJson(com.fasterxml.jackson.databind.JsonNode json)
Converts the
JsonNode into a Document instance. |
Document<String> |
patchDocument(DiffMatchPatchEdit edit,
Document<String> document)
Called when the document should be patched.
|
PatchMessage<DiffMatchPatchEdit> |
patchMessageFromJson(String json)
Creates a {link PatchMessage} by parsing the passed-in json.
|
ShadowDocument<String> |
patchShadow(DiffMatchPatchEdit edit,
ShadowDocument<String> shadowDocument)
Called when the shadow should be patched.
|
DiffMatchPatchEdit |
serverDiff(Document<String> document,
ShadowDocument<String> shadowDocument)
The first step in a sync is to produce a an edit for the changes.
|
public DiffMatchPatchServerSynchronizer()
public DiffMatchPatchServerSynchronizer(DiffMatchPatch diffMatchPatch)
public DiffMatchPatchEdit clientDiff(Document<String> document, ShadowDocument<String> shadowDocument)
ServerSynchronizerEdit of changes coming from a client.clientDiff in interface ServerSynchronizer<String,DiffMatchPatchEdit>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 DiffMatchPatchEdit serverDiff(Document<String> document, ShadowDocument<String> shadowDocument)
ServerSynchronizerserverDiff in interface ServerSynchronizer<String,DiffMatchPatchEdit>document - the document containingshadowDocument - the document shadow.Edit the edit representing the diff between the document and it's shadow document.public ShadowDocument<String> patchShadow(DiffMatchPatchEdit edit, ShadowDocument<String> shadowDocument)
ServerSynchronizerpatchShadow in interface ServerSynchronizer<String,DiffMatchPatchEdit>edit - The edits.shadowDocument - the ShadowDocument to patchShadowDocument a new patched shadow document.public Document<String> patchDocument(DiffMatchPatchEdit edit, Document<String> document)
ServerSynchronizerpatchDocument in interface ServerSynchronizer<String,DiffMatchPatchEdit>edit - the edit to use to path the documentdocument - the document to be patched.Document a new patched document.public PatchMessage<DiffMatchPatchEdit> createPatchMessage(String documentId, String clientId, Queue<DiffMatchPatchEdit> edits)
ServerSynchronizerPatchMessage with the with the type of Edit that this
synchronizer can handle.createPatchMessage in interface ServerSynchronizer<String,DiffMatchPatchEdit>documentId - the document identifier for the PatchMessageclientId - the client identifier for the PatchMessageedits - the Edits for the PatchMessagePatchMessage the created {code PatchMessage}public PatchMessage<DiffMatchPatchEdit> patchMessageFromJson(String json)
ServerSynchronizerpatchMessageFromJson in interface ServerSynchronizer<String,DiffMatchPatchEdit>json - the json representation of a PatchMessagePatchMessage the created {code PatchMessage}public Document<String> documentFromJson(com.fasterxml.jackson.databind.JsonNode json)
ServerSynchronizerJsonNode into a Document instance.documentFromJson in interface ServerSynchronizer<String,DiffMatchPatchEdit>json - the JsonNode to convertDocument the document representing the contents of the JsonNode instance.Copyright © 2015 JBoss by Red Hat. All Rights Reserved.