@Override public void waveletCommitted(WaveletName waveletName, HashedVersion version) { for (ParticipantId participant : waveletInfo.getWaveletParticipants(waveletName)) { waveletInfo.getUserManager(participant).onCommit(waveletName, version); } }
@Override public void onSuccess(int operationsApplied, HashedVersion hashedVersionAfterApplication, long applicationTimestamp) { listener.onSuccess(operationsApplied, hashedVersionAfterApplication, applicationTimestamp); waveletInfo.getUserManager(author).submitResponse(channelId, waveletName, hashedVersionAfterApplication); }
@Override public void onFailure(String error) { listener.onFailure(error); waveletInfo.getUserManager(author).submitResponse(channelId, waveletName, null); } });
/** * Sends new deltas to a particular user on a particular wavelet. * Updates the participants of the specified wavelet if the participant was added or removed. * * @param waveletName the waveletName which the deltas belong to. * @param participant on the wavelet. * @param newDeltas newly arrived deltas of relevance for participant. Must * not be empty. * @param add whether the participant is added by the first delta. * @param remove whether the participant is removed by the last delta. */ private void participantUpdate(WaveletName waveletName, ParticipantId participant, DeltaSequence newDeltas, boolean add, boolean remove) { if(LOG.isFineLoggable()) { LOG.fine("Notifying " + participant + " for " + waveletName); } if (add) { waveletInfo.notifyAddedExplicitWaveletParticipant(waveletName, participant); } waveletInfo.getUserManager(participant).onUpdate(waveletName, newDeltas); if (remove) { waveletInfo.notifyRemovedExplicitWaveletParticipant(waveletName, participant); } }
@Override public void submitRequest(ParticipantId loggedInUser, final WaveletName waveletName, final ProtocolWaveletDelta delta, final String channelId, final SubmitRequestListener listener) { final ParticipantId author = new ParticipantId(delta.getAuthor()); if (!author.equals(loggedInUser)) { listener.onFailure("Author field on delta must match logged in user"); return; } waveletInfo.getUserManager(author).submitRequest(channelId, waveletName); waveletProvider.submitRequest(waveletName, delta, new SubmitRequestListener() { @Override public void onSuccess(int operationsApplied, HashedVersion hashedVersionAfterApplication, long applicationTimestamp) { listener.onSuccess(operationsApplied, hashedVersionAfterApplication, applicationTimestamp); waveletInfo.getUserManager(author).submitResponse(channelId, waveletName, hashedVersionAfterApplication); } @Override public void onFailure(String error) { listener.onFailure(error); waveletInfo.getUserManager(author).submitResponse(channelId, waveletName, null); } }); }
UserManager userManager = waveletInfo.getUserManager(loggedInUser); WaveViewSubscription subscription = userManager.subscribe(waveId, waveletIdFilter, channelId, openListener);