Package org.waveprotocol.wave.model.id

Examples of org.waveprotocol.wave.model.id.WaveletName


        if (waveRefStr == null) {
          resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "No wave reference in request.");
          return;
        }

        WaveletName waveletName = waveRef2WaveletName(waveRefStr);
        ParticipantId user = sessionManager.getLoggedInUser(req.getSession(false));
        boolean isAuthorized = waveletProvider.checkAccessPermission(waveletName, user);
        if (!isAuthorized) {
          resp.sendError(HttpServletResponse.SC_FORBIDDEN);
          return;
View Full Code Here


      } catch (WaveServerException e1) {
        waveletIds = Sets.newHashSet();
        LOG.warning("Failed to retrieve visible wavelets for " + loggedInUser, e1);
      }
      for (WaveletId waveletId : waveletIds) {
        WaveletName waveletName = WaveletName.of(waveId, waveletId);
        // Ensure that implicit participants will also receive updates.
        // TODO (Yuri Z.) If authorizing participant was removed from the wave
        // (the shared domain participant), then all implicit participant that
        // were authorized should be unsubsrcibed.
        waveletInfo.notifyAddedImplcitParticipant(waveletName, loggedInUser);
        // The WaveletName by which the waveletProvider knows the relevant deltas

        // TODO(anorth): if the client provides known wavelets, calculate
        // where to start sending deltas from.

        CommittedWaveletSnapshot snapshotToSend;

        // Send a snapshot of the current state.
        // TODO(anorth): calculate resync point if the client already knows
        // a snapshot.
        try {
          snapshotToSend = waveletProvider.getSnapshot(waveletName);
        } catch (WaveServerException e) {
          LOG.warning("Failed to retrieve snapshot for wavelet " + waveletName, e);
          openListener.onFailure("Wave server failure retrieving wavelet");
          return;
        }

        LOG.info("snapshot in response is: " + (snapshotToSend != null));
        if (snapshotToSend == null) {
          // Send deltas.
          openListener.onUpdate(waveletName, snapshotToSend, DeltaSequence.empty(),
              null, null, channelId);
        } else {
          // Send the snapshot.
          openListener.onUpdate(waveletName, snapshotToSend, DeltaSequence.empty(),
              snapshotToSend.committedVersion, null, channelId);
        }
      }

      WaveletName dummyWaveletName = createDummyWaveletName(waveId);
      if (waveletIds.size() == 0) {
        // Send message with just the channel id.
        LOG.info("sending just a channel id for " + dummyWaveletName);
        openListener.onUpdate(dummyWaveletName, null, DeltaSequence.empty(), null, null,
            channelId);
View Full Code Here

  public void waveletUpdate(ReadableWaveletData wavelet, DeltaSequence newDeltas) {
    if (newDeltas.isEmpty()) {
      return;
    }

    WaveletName waveletName = WaveletName.of(wavelet.getWaveId(), wavelet.getWaveletId());
    waveletInfo.syncWaveletVersion(waveletName, newDeltas);

    Set<ParticipantId> remainingparticipants =
        Sets.newHashSet(waveletInfo.getWaveletParticipants(waveletName));
    // Participants added during the course of newDeltas.
View Full Code Here

    }
  }

  @VisibleForTesting
  static WaveletName createDummyWaveletName(WaveId waveId) {
    final WaveletName dummyWaveletName =
      WaveletName.of(waveId, WaveletId.of(waveId.getDomain(), "dummy+root"));
    return dummyWaveletName;
  }
View Full Code Here

  }

  @Override
  public void submit(RpcController controller, ProtocolSubmitRequest request,
      final RpcCallback<ProtocolSubmitResponse> done) {
    WaveletName waveletName = null;
    try {
      waveletName = ModernIdSerialiser.INSTANCE.deserialiseWaveletName(request.getWaveletName());
    } catch (InvalidIdException e) {
      LOG.warning("Invalid id in submit", e);
      controller.setFailed(e.getMessage());
View Full Code Here

          @Override
          public Map<WaveletId, PerWavelet> apply(final WaveId waveId) {
            return new MapMaker().makeComputingMap(new Function<WaveletId, PerWavelet>() {
              @Override
              public PerWavelet apply(WaveletId waveletId) {
                WaveletName waveletName = WaveletName.of(waveId, waveletId);
                return new PerWavelet(waveletName, hashedVersionFactory
                    .createVersionZero(waveletName));
              }
            });
          }
View Full Code Here

      ParticipantId loggedInUser) throws WaveServerException {
    Set<WaveletId> visible = Sets.newHashSet();
    Set<Entry<WaveletId, PerWavelet>> entrySet =
        perWavelet.get(subscription.getWaveId()).entrySet();
    for (Entry<WaveletId, PerWavelet> entry : entrySet) {
      WaveletName waveletName = WaveletName.of(subscription.getWaveId(), entry.getKey());
      if (subscription.includes(entry.getKey())
          && waveletProvider.checkAccessPermission(waveletName, loggedInUser)) {
        visible.add(entry.getKey());
      }
    }
View Full Code Here

    }
  }

  @Override
  public void putWavelet(WaveId waveId, WaveletId waveletId, RobotWaveletData newWavelet) {
    WaveletName waveletName = newWavelet.getWaveletName();
    Preconditions.checkArgument(!openedWavelets.containsKey(waveletName),
        "Not allowed to put an already open wavelet in as a new wavelet");

    // New wavelets are indicated by the temporary marker in their waveId.
    if (waveId.getId().startsWith(TEMP_ID_MARKER)) {
View Full Code Here

  }

  @Override
  public OpBasedWavelet openWavelet(WaveId waveId, WaveletId waveletId, ParticipantId participant)
      throws InvalidRequestException {
    WaveletName waveletName;
    if (waveId.getId().startsWith(TEMP_ID_MARKER)) {
      WaveletName tempWaveletName = WaveletName.of(waveId, waveletId);
      waveletName = tempWaveletNameMap.get(tempWaveletName);
    } else {
      waveletName = WaveletName.of(waveId, waveletId);
    }
View Full Code Here

  }

  @Override
  public ObservableConversationView openConversation(WaveId waveId, WaveletId waveletId,
      ParticipantId participant) throws InvalidRequestException {
    WaveletName waveletName = WaveletName.of(waveId, waveletId);

    if (!openedConversations.containsKey(waveletName)) {
      openedConversations.put(
          waveletName, Maps.<ParticipantId, ObservableConversationView> newHashMap());
    }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.id.WaveletName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.