I'm trying to modify blips on the server side.
The server seems to work just fine, connecting to the default
webclient works and I can add/edit blips and waves using its gui.
In an attempt to understand the process I added a "addblip" function
to the interface of WebClient.java.
I simply wanted this button to be able to modify a arbitary blip on
the server, changing it to fixed string value.
This is the code I added to "WebClient.java" (cleaned up slightly);
(thats is org.waveprotocol.wave.examples.client.webclient.client.WebClient.java)
AddBlip.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// try to edit a blip
//loop over all blips in wave and display their key and contents in
the log (this seems to work);
LOG.info("___trying to get all blips__");
Iterator<? extends ObservableConversationBlip> blips =
waveView.getConversationView().getRoot().getRootThread().getBlips().iterator();
while (blips.hasNext()){
ObservableConversationBlip currentblip = blips.next();
LOG.info("___KEY_=_"+currentblip.getId());
LOG.info("___SIZE_=_"+currentblip.getContent().size());
LOG.info("___CONTENT_=_"+currentblip.getContent().getDocumentElement().toString());
LOG.info("___CONTENT2_=_"+currentblip.getContent().toString());
}
//fixed values for now (taken from the above, these blips exist)
String tempwaveletid = "atresica.nl!conv+root";
String tempblipid = "b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYE";
String tempwave = "atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA";
WaveletId currentWaveletID = (WaveletId.deserialise(tempwaveletid));
CoreWaveletData waveletData =
waveView.getWaveViewService().getWavelet(currentWaveletID);
Map<String, BufferedDocOp> documentMap = waveletData.getDocuments();
Iterator<String> docIDs = documentMap.keySet().iterator();
//try to look at keys (again, just to help debug)
LOG.info("__Number of_KEYs_=_"+documentMap.keySet().size() );
while (docIDs.hasNext()){
LOG.info("___KEY_=_"+docIDs.next());
}
//now attempt to modify the blip
try {
// LOG.info("___Modifying document "+tempblipid);
BufferedDocOp newtext =
WebClientUtils.createTextInsertion("<doc><body><line/><l:p>'MEEEEEEEEEEEEEP'</l:p></body></doc>",
0, 4);
//waveletData.modifyDocument(tempblipid, newtext);
//LOG.info("___Modifying document 2"+tempblipid);
//newtext =
WebClientUtils.createTextInsertion("<body><line/><l:p>'MEEEEEEEEEEEEEP'</l:p></body>",
0, 4);
//waveletData.modifyDocument(tempblipid, newtext);
LOG.info("___Modifying document 3"+tempblipid);
newtext =
WebClientUtils.createTextInsertion("<body><line/><l:p>'MEEEEEEEEEEEEEP'</l:p></body></doc><div><ul><div>'123456'</div></ul></div>",
0, 4);
waveletData.modifyDocument(tempblipid, newtext);
} catch (OperationException e) {
LOG.info("failed to modify:"+e.getMessage());
}
}
});
This is the output of the LOG in the webclient from selecting the wave
to clicking the button. Note the illegal composition error at the end;
==================================================================================
Fri Oct 15 14:44:36 CEST 2010[INFO] IndexWave update received
hasDeltas=false hasWaveletSnapshot=false
Fri Oct 15 14:44:36 CEST 2010[INFO] WaveList refreshing due to index update
Fri Oct 15 14:44:36 CEST 2010[INFO] IndexWave update received
hasDeltas=true hasWaveletSnapshot=false
Fri Oct 15 14:44:36 CEST 2010[INFO] WaveList refreshing due to index update
Fri Oct 15 14:44:36 CEST 2010[INFO] received JSON message
{"version":1,"sequenceNumber":0,"messageType":"ProtocolWaveletUpdate","messageJson":"{\"1\":\"wave://indexwave/indexwave/dummy+root\",\"2\":[],\"6\":true}"}
Fri Oct 15 14:44:36 CEST 2010[INFO] Wavelet update for
wave://indexwave/indexwave/dummy+root
Fri Oct 15 14:44:36 CEST 2010[INFO] handling wavelet update
Fri Oct 15 14:44:36 CEST 2010[INFO] Received update for
wave://indexwave/indexwave/dummy+root
Fri Oct 15 14:44:36 CEST 2010[INFO] wavelet name decoding
wave://indexwave/indexwave/dummy+root -> [WaveletName
indexwave!indexwave indexwave!dummy+root]
Fri Oct 15 14:44:36 CEST 2010[INFO] applied wavelet update for
indexwave!dummy+root
Fri Oct 15 14:44:36 CEST 2010[INFO] Have a WaveViewServiceImpl for
[WaveId indexwave!indexwave]
Fri Oct 15 14:45:17 CEST 2010[INFO] WaveList changing selection to
[WaveId atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]
Fri Oct 15 14:45:17 CEST 2010[INFO] WaveView opening wavelet [WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]
Fri Oct 15 14:45:17 CEST 2010[INFO] getWaveView for [WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]
Fri Oct 15 14:45:17 CEST 2010[INFO] Opening wave [WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA] for prefix ""
Fri Oct 15 14:45:18 CEST 2010[INFO] Sending JSON data {"version":1,
"sequenceNumber":1, "messageType":"ProtocolOpenRequest",
"messageJson":"{\"1\":\"[email protected]\",\"2\":\"atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA\",\"3\":[\"\"]}"}
Fri Oct 15 14:45:18 CEST 2010[INFO] LB: Multiplexer reconnecting wave
[WaveId atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]
Fri Oct 15 14:45:18 CEST 2010[INFO] LB: connect: new view channel initialized
Fri Oct 15 14:45:18 CEST 2010[INFO] viewOpen called on [WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA] with
IdFilter[prefixes=[]]
Fri Oct 15 14:45:18 CEST 2010[INFO] Added new history token state
Fri Oct 15 14:45:18 CEST 2010[INFO] received JSON message
{"version":1,"sequenceNumber":1,"messageType":"ProtocolWaveletUpdate","messageJson":"{\"1\":\"wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/conv+root\",\"2\":[],\"3\":{\"1\":16,\"2\":\"1mFk1IZoXU4RLYsVMbkzLyKrJhA\u003d\"},\"4\":{\"1\":16,\"2\":\"1mFk1IZoXU4RLYsVMbkzLyKrJhA\u003d\"},\"5\":{\"1\":\"atresica.nl!conv+root\",\"2\":[\"[email protected]\"],\"3\":[{\"1\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYE\",\"2\":{\"1\":[{\"3\":{\"1\":\"body\",\"2\":[]}},{\"3\":{\"1\":\"line\",\"2\":[]}},{\"4\":true},{\"4\":true}]},\"3\":\"[email protected]\",\"4\":[\"[email protected]\"],\"5\":15,\"6\":1287146159707},{\"1\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYB\",\"2\":{\"1\":[{\"3\":{\"1\":\"body\",\"2\":[]}},{\"3\":{\"1\":\"line\",\"2\":[]}},{\"4\":true},{\"2\":\"123\"},{\"4\":true}]},\"3\":\"[email protected]\",\"4\":[\"[email protected]\"],\"5\":8,\"6\":1287146148590},{\"1\":\"conversation\",\"2\":{\"1\":[{\"3\":{\"1\":\"conversation\",\"2\":[]}},{\"3\":{\"1\":\"blip\",\"2\":[{\"1\":\"id\",\"2\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYB\"}]}},{\"4\":true},{\"3\":{\"1\":\"blip\",\"2\":[{\"1\":\"id\",\"2\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYC\"}]}},{\"4\":true},{\"3\":{\"1\":\"blip\",\"2\":[{\"1\":\"id\",\"2\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYD\"}]}},{\"4\":true},{\"3\":{\"1\":\"blip\",\"2\":[{\"1\":\"id\",\"2\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYE\"}]}},{\"4\":true},{\"4\":true}]},\"3\":\"\u003cnobody\u003e\",\"4\":[\"[email protected]\"],\"5\":16,\"6\":1287146159707},{\"1\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYD\",\"2\":{\"1\":[{\"3\":{\"1\":\"body\",\"2\":[]}},{\"3\":{\"1\":\"line\",\"2\":[]}},{\"4\":true},{\"4\":true}]},\"3\":\"[email protected]\",\"4\":[\"[email protected]\"],\"5\":13,\"6\":1287146157657},{\"1\":\"b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYC\",\"2\":{\"1\":[{\"3\":{\"1\":\"body\",\"2\":[]}},{\"3\":{\"1\":\"line\",\"2\":[]}},{\"4\":true},{\"4\":true}]},\"3\":\"[email protected]\",\"4\":[\"[email protected]\"],\"5\":10,\"6\":1287146151850}],\"4\":{\"1\":16,\"2\":\"1mFk1IZoXU4RLYsVMbkzLyKrJhA\u003d\"},\"5\":1287146159707,\"6\":\"[email protected]\",\"7\":1287146138740},\"6\":false,\"7\":\"ch6\"}"}
Fri Oct 15 14:45:18 CEST 2010[INFO] Wavelet update for
wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/conv+root
Fri Oct 15 14:45:18 CEST 2010[INFO] handling wavelet update
Fri Oct 15 14:45:18 CEST 2010[INFO] Received update for
wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/conv+root
Fri Oct 15 14:45:18 CEST 2010[INFO] wavelet name decoding
wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/conv+root
-> [WaveletName atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA
atresica.nl!conv+root]
Fri Oct 15 14:45:18 CEST 2010[INFO] applying snapshot
Fri Oct 15 14:45:18 CEST 2010[INFO] applied wavelet update for
atresica.nl!conv+root
Fri Oct 15 14:45:18 CEST 2010[INFO] Have a WaveViewServiceImpl for
[WaveId atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]
Fri Oct 15 14:45:18 CEST 2010[INFO] Publishing snapshot update
Fri Oct 15 14:45:24 CEST 2010[INFO] publishing snapshot for
[WaveletName atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA
atresica.nl!conv+root]
Fri Oct 15 14:45:24 CEST 2010[SEVERE] saw channelId ch6
Fri Oct 15 14:45:24 CEST 2010[INFO] LB: New delta channel created
Fri Oct 15 14:45:24 CEST 2010[INFO] LB: Delta channel reset
Fri Oct 15 14:45:24 CEST 2010[INFO] XXX Saw conversation atresica.nl!conv+root
Fri Oct 15 14:45:24 CEST 2010[INFO] conversation
id;WaveletBasedConversation([WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA][WaveletId
atresica.nl!conv+root])
Fri Oct 15 14:45:24 CEST 2010[INFO] creating
blip;b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYB: in wave :[WaveletId
atresica.nl!conv+root]
Fri Oct 15 14:45:24 CEST 2010[INFO] conversation
id;WaveletBasedConversation([WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA][WaveletId
atresica.nl!conv+root])
Fri Oct 15 14:45:24 CEST 2010[INFO] creating
blip;b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYC: in wave :[WaveletId
atresica.nl!conv+root]
Fri Oct 15 14:45:24 CEST 2010[INFO] conversation
id;WaveletBasedConversation([WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA][WaveletId
atresica.nl!conv+root])
Fri Oct 15 14:45:24 CEST 2010[INFO] creating
blip;b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYD: in wave :[WaveletId
atresica.nl!conv+root]
Fri Oct 15 14:45:25 CEST 2010[INFO] conversation
id;WaveletBasedConversation([WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA][WaveletId
atresica.nl!conv+root])
Fri Oct 15 14:45:25 CEST 2010[INFO] creating
blip;b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYE: in wave :[WaveletId
atresica.nl!conv+root]
Fri Oct 15 14:45:25 CEST 2010[INFO]
org.waveprotocol.wave.model.conversation.waveletbasedconversationthrea...@1f3a147
Fri Oct 15 14:45:25 CEST 2010[INFO] LB: Delta channel connecting,
wavelet id [WaveId
atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]/[WaveletId
atresica.nl!conv+root], version 16
Fri Oct 15 14:45:25 CEST 2010[INFO] LB: All signatures in CC queue
matched on reconnection to server.
Fri Oct 15 14:45:25 CEST 2010[INFO] LB: Nothing to send
Fri Oct 15 14:45:25 CEST 2010[INFO] LB: Releasing message Committed(16, 16)
Fri Oct 15 14:45:25 CEST 2010[INFO] LB: onCommit: version =16
serverpathsize =0 any unacknowledged ? true
Fri Oct 15 14:45:25 CEST 2010[INFO] received JSON message
{"version":1,"sequenceNumber":1,"messageType":"ProtocolWaveletUpdate","messageJson":"{\"1\":\"wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/dummy+root\",\"2\":[],\"6\":true}"}
Fri Oct 15 14:45:25 CEST 2010[INFO] Wavelet update for
wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/dummy+root
Fri Oct 15 14:45:25 CEST 2010[INFO] handling wavelet update
Fri Oct 15 14:45:25 CEST 2010[INFO] Received update for
wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/dummy+root
Fri Oct 15 14:45:25 CEST 2010[INFO] wavelet name decoding
wave://atresica.nl/w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA/dummy+root
-> [WaveletName atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA
atresica.nl!dummy+root]
Fri Oct 15 14:45:25 CEST 2010[INFO] applied wavelet update for
atresica.nl!dummy+root
Fri Oct 15 14:45:25 CEST 2010[INFO] Have a WaveViewServiceImpl for
[WaveId atresica.nl!w+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYA]
Fri Oct 15 14:46:38 CEST 2010[INFO] setting location
Fri Oct 15 14:46:38 CEST 2010[INFO] ___trying to get all blips__
Fri Oct 15 14:46:38 CEST 2010[INFO]
___KEY_=_b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYB
Fri Oct 15 14:46:38 CEST 2010[INFO] ___SIZE_=_7
Fri Oct 15 14:46:38 CEST 2010[INFO] ___CONTENT_=_AgentAdapter: <doc>
<body>
<line/>
<l:p>
'123'
</l:p>
</body>
</doc> / <div>
<ul>
<div>
'123'
</div>
</ul>
</div>
Fri Oct 15 14:46:38 CEST 2010[INFO]
___CONTENT2_=_MutableDocumentProxy(mutabl...@3e4015[<body><line/>aaa</body>])
Fri Oct 15 14:46:38 CEST 2010[INFO]
___KEY_=_b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYC
Fri Oct 15 14:46:38 CEST 2010[INFO] ___SIZE_=_4
Fri Oct 15 14:46:39 CEST 2010[INFO] ___CONTENT_=_AgentAdapter: <doc>
<body>
<line/>
<l:p/>
</body>
</doc> / <div>
<ul>
<div>
<br/>
</div>
</ul>
</div>
Fri Oct 15 14:46:39 CEST 2010[INFO]
___CONTENT2_=_MutableDocumentProxy(mutabl...@80bf6d[<body><line/></body>])
Fri Oct 15 14:46:39 CEST 2010[INFO]
___KEY_=_b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYD
Fri Oct 15 14:46:39 CEST 2010[INFO] ___SIZE_=_4
Fri Oct 15 14:46:39 CEST 2010[INFO] ___CONTENT_=_AgentAdapter: <doc>
<body>
<line/>
<l:p/>
</body>
</doc> / <div>
<ul>
<div>
<br/>
</div>
</ul>
</div>
Fri Oct 15 14:46:39 CEST 2010[INFO]
___CONTENT2_=_MutableDocumentProxy(mutabl...@731904[<body><line/></body>])
Fri Oct 15 14:46:39 CEST 2010[INFO]
___KEY_=_b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYE
Fri Oct 15 14:46:39 CEST 2010[INFO] ___SIZE_=_4
Fri Oct 15 14:46:39 CEST 2010[INFO] ___CONTENT_=_AgentAdapter: <doc>
<body>
<line/>
<l:p/>
</body>
</doc> / <div>
<ul>
<div>
<br/>
</div>
</ul>
</div>
Fri Oct 15 14:46:39 CEST 2010[INFO]
___CONTENT2_=_MutableDocumentProxy(mutabl...@1ddaf92[<body><line/></body>])
Fri Oct 15 14:46:39 CEST 2010[INFO] __Number of_KEYs_=_0
Fri Oct 15 14:46:39 CEST 2010[INFO] ___Modifying document
3b+ZGVtb0BhdHJlc2ljYS5ubDEyODcxNDYxMjYyOTYE
Fri Oct 15 14:46:39 CEST 2010[INFO] failed to modify:Illegal composition
===========================================================================================
I dont see any updates on the server-side, so I assume my operation is
failing a check on the client due to formating and not sending
anything.
Any help/pointers would be appreciated,
Thanks,
Thomas
On 15 October 2010 11:18, Lennard de Rijk <[email protected]> wrote:
>
> Can you code up a minimum example which fails and also show us a more
> detailed stacktrace? Because I'm having trouble parsing your description. Are
> you trying to edit a blip on the server side or client side?
> Greetings,
> Lennard
>
> On Fri, Oct 15, 2010 at 10:11 AM, ThomasWrobel <[email protected]> wrote:
>>
>> Ive been looking at the code from the simplewebclient in an attempt to
>> modify/make my own client.
>>
>> Currently I'm trying to programmaticaly edit a blip on the wave
>> server. (so, effectively, what the Editors do already).
>>
>> I think I'm supposed to use;
>>
>> waveletData.modifyDocument( BlipID, DocOp)
>>
>> But I keep getting "illegal composition" errors.
>>
>> I assume this is due to a badly formated DocOp?
>>
>> I'm generating it with;
>>
>> DocOp = WebClientUtils.createTextInsertion("MEEP", 0, 4);
>>
>> or
>>
>> DocOp = WebClientUtils.createTextInsertion("<doc><body><line/
>> ><l:p>'MEEP'</l:p></body></doc>", 0, 4);
>>
>> or even
>>
>> DocOp = WebClientUtils.createTextInsertion("<body><line/
>> ><l:p>'MEEEEEEEEEEEEEP'</l:p></body></doc><div><ul><div>'123456'</
>> div></ul></div>", 0, 4);
>>
>> But all give the same result.
>>
>> As you can see, I wasn't sure of the formating. (The last one came
>> from me examine the incoming contents of
>> "currentblip.getContent().getDocumentElement().toString()" when
>> incoming blips are added to the waveview)
>>
>> Am I even vaguely on the right tracks? or am I doing something
>> completely wrong?
>>
>> waveletData currently comes from;
>>
>> String tempwaveletid = "atresica.nl!conv+root";
>> WaveletId currentWaveletID = (WaveletId.deserialise(tempwaveletid));
>> CoreWaveletData waveletData =
>> waveView.getWaveViewService().getWavelet(currentWaveletID);
>>
>> Yours wavely,
>> Thomas
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Wave Protocol" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/wave-protocol?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Wave Protocol" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/wave-protocol?hl=en.
--
You received this message because you are subscribed to the Google Groups "Wave
Protocol" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/wave-protocol?hl=en.