Package org.waveprotocol.wave.model.wave.data

Examples of org.waveprotocol.wave.model.wave.data.ReadableWaveletData


   *
   * @throws IllegalStateException if the delta history is bad
   */
  private static WaveletAccess createWaveletAccess(DeltaStore.DeltasAccess deltasAccess)
      throws PersistenceException {
    ReadableWaveletData wavelet;
    wavelet = deltasAccess.isEmpty() ? null : buildWaveletFromDeltaReader(deltasAccess);
    return new DeltasAccessBasedWaveletAccess(deltasAccess, wavelet);
  }
View Full Code Here


      checkStateOk();
      // ParticipantId will be null if the user isn't logged in. A user who isn't logged in should
      // have access to public waves once they've been implemented.
      // If the wavelet is empty, everyone has access (to write the first delta).
      // TODO(soren): determine if off-domain participants should be denied access if empty
      ReadableWaveletData snapshot = waveletState.getSnapshot();
      return WaveletDataUtil.checkAccessPermission(snapshot, participantId, sharedDomainParticipantId);
    } finally {
      releaseReadLock();
    }
  }
View Full Code Here

  public boolean hasParticipant(ParticipantId participant) throws WaveletStateException {
    awaitLoad();
    acquireReadLock();
    try {
      checkStateOk();
      ReadableWaveletData snapshot = waveletState.getSnapshot();
      return snapshot != null && snapshot.getParticipants().contains(participant);
    } finally {
      releaseReadLock();
    }
  }
View Full Code Here

    return sharedDomainParticipantId;
  }

  @Override
  public ParticipantId getCreator() {
    ReadableWaveletData snapshot = waveletState.getSnapshot();
    return snapshot != null ? snapshot.getCreator() : null;
  }
View Full Code Here

      committedSnapshot = waveletProvider.getSnapshot(waveletName);
    } catch (WaveServerException e) {
      throw new IOException(e);
    }
    if (committedSnapshot != null) {
      ReadableWaveletData snapshot = committedSnapshot.snapshot;
      if (waveref.hasDocumentId()) {
        // We have a wavelet id and document id. Find the document in the
        // snapshot and return it.
        DocumentSnapshot docSnapshot = null;
        for (String docId : snapshot.getDocumentIds()) {
          if (docId.equals(waveref.getDocumentId())) {
            docSnapshot = SnapshotSerializer.serializeDocument(snapshot.getDocument(docId));
            break;
          }
        }
        serializeObjectToServlet(docSnapshot, dest);
      } else if (waveref.hasWaveletId()) {
        // We have a wavelet id. Pull up the wavelet snapshot and return it.
        serializeObjectToServlet(SnapshotSerializer.serializeWavelet(snapshot,
            snapshot.getHashedVersion()), dest);
      } else {
        // Wrap the conv+root we fetched earlier in a WaveSnapshot object and
        // send it.
        WaveViewSnapshot waveSnapshot = WaveViewSnapshot.newBuilder()
            .setWaveId(ModernIdSerialiser.INSTANCE.serialiseWaveId(waveref.getWaveId()))
            .addWavelet(SnapshotSerializer.serializeWavelet(snapshot, snapshot.getHashedVersion()))
            .build();
        serializeObjectToServlet(waveSnapshot, dest);
      }
    } else {
      dest.sendError(HttpServletResponse.SC_FORBIDDEN);
View Full Code Here

    ListenableFutureTask<Void> task = ListenableFutureTask.create(new Callable<Void>() {

      @Override
      public Void call() throws Exception {
        ReadableWaveletData waveletData;
        try {
          waveletData = waveletDataProvider.getReadableWaveletData(waveletName);
          updateIndex(waveletData);
        } catch (WaveServerException e) {
          LOG.log(Level.SEVERE, "Failed to initialize index for " + waveletName, e);
View Full Code Here

    ListenableFutureTask<Void> task = ListenableFutureTask.create(new Callable<Void>() {

      @Override
      public Void call() throws Exception {
        ReadableWaveletData waveletData;
        try {
          waveletData = waveletDataProvider.getReadableWaveletData(waveletName);
          LOG.fine("commit " + version + " " + waveletData.getVersion());
          if (waveletData.getVersion() == version.getVersion()) {
            updateIndex(waveletData);
          }
        } catch (WaveServerException e) {
          LOG.log(Level.SEVERE, "Failed to update index for " + waveletName, e);
          throw e;
View Full Code Here

    try {
      if (perWavelet.getIfPresent(waveId) == null) {
        LoadingCache<WaveletId, PerWavelet> wavelets = perWavelet.get(waveId);
        for (WaveletId waveletId : waveletProvider.getWaveletIds(waveId)) {
          ReadableWaveletData wavelet =
              waveletProvider.getSnapshot(WaveletName.of(waveId, waveletId)).snapshot;
          // Wavelets is a computing map, so get() initializes the entry.
          PerWavelet waveletInfo = wavelets.get(waveletId);
          synchronized (waveletInfo) {
            waveletInfo.currentVersion = wavelet.getHashedVersion();
            if(LOG.isFineLoggable()) {
              LOG.fine("frontend wavelet " + waveletId + " @" + wavelet.getHashedVersion().getVersion());
            }
            waveletInfo.explicitParticipants.addAll(wavelet.getParticipants());
          }
        }
      }
    } catch (ExecutionException ex) {
      throw new RuntimeException(ex);
View Full Code Here

      committedSnapshot = waveletProvider.getSnapshot(waveletName);
    } catch (WaveServerException e) {
      throw new IOException(e);
    }
    if (committedSnapshot != null) {
      ReadableWaveletData snapshot = committedSnapshot.snapshot;
      if (waveref.hasDocumentId()) {
        // We have a wavelet id and document id. Find the document in the
        // snapshot and return it.
        DocumentSnapshot docSnapshot = null;
        for (String docId : snapshot.getDocumentIds()) {
          if (docId.equals(waveref.getDocumentId())) {
            docSnapshot = SnapshotSerializer.serializeDocument(snapshot.getDocument(docId));
            break;
          }
        }
        serializeObjectToServlet(docSnapshot, dest);
      } else if (waveref.hasWaveletId()) {
        // We have a wavelet id. Pull up the wavelet snapshot and return it.
        serializeObjectToServlet(SnapshotSerializer.serializeWavelet(snapshot,
            snapshot.getHashedVersion()), dest);
      } else {
        // Wrap the conv+root we fetched earlier in a WaveSnapshot object and
        // send it.
        WaveViewSnapshot waveSnapshot = WaveViewSnapshot.newBuilder()
            .setWaveId(ModernIdSerialiser.INSTANCE.serialiseWaveId(waveref.getWaveId()))
            .addWavelet(SnapshotSerializer.serializeWavelet(snapshot, snapshot.getHashedVersion()))
            .build();
        serializeObjectToServlet(waveSnapshot, dest);
      }
    } else {
      dest.sendError(HttpServletResponse.SC_FORBIDDEN);
View Full Code Here

      checkStateOk();
      // ParticipantId will be null if the user isn't logged in. A user who isn't logged in should
      // have access to public waves once they've been implemented.
      // If the wavelet is empty, everyone has access (to write the first delta).
      // TODO(soren): determine if off-domain participants should be denied access if empty
      ReadableWaveletData snapshot = waveletState.getSnapshot();
      return WaveletDataUtil.checkAccessPermission(snapshot, participantId, sharedDomainParticipantId);
    } finally {
      releaseReadLock();
    }
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.wave.data.ReadableWaveletData

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.