Examples of ObservableWaveletData


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

      Collection<KnownWavelet> knownWavelets) {
    Map<WaveletId, List<HashedVersion>> signatures =
      new HashMap<WaveletId, List<HashedVersion>>();
    for (KnownWavelet knownWavelet : knownWavelets) {
      if (knownWavelet.accessibility.isReadable()) {
        ObservableWaveletData snapshot = knownWavelet.snapshot;
        WaveletId waveletId = snapshot.getWaveletId();
        List<HashedVersion> sigs = Collections.singletonList(snapshot.getHashedVersion());
        signatures.put(waveletId, sigs);
      }
    }
    return signatures;
  }
View Full Code Here

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

   */
  public static ObservableWaveletData buildWaveletFromFirstDelta(WaveletName waveletName,
      TransformedWaveletDelta delta) throws OperationException {
    Preconditions.checkArgument(delta.getAppliedAtVersion() == 0,
        "first delta has non-zero version: %s", delta.getAppliedAtVersion());
    ObservableWaveletData wavelet =
        createEmptyWavelet(
            waveletName,
            delta.getAuthor(), // creator
            HashedVersion.unsigned(0), // garbage hash, is overwritten by first delta below
            delta.getApplicationTimestamp()); // creation time
View Full Code Here

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

   *        from version zero.
   */
  public static ObservableWaveletData buildWaveletFromDeltas(WaveletName waveletName,
      Iterator<TransformedWaveletDelta> deltas) throws OperationException {
    Preconditions.checkArgument(deltas.hasNext(), "empty deltas");
    ObservableWaveletData wavelet = buildWaveletFromFirstDelta(waveletName, deltas.next());
    while (deltas.hasNext()) {
      TransformedWaveletDelta delta = deltas.next();
      applyWaveletDelta(delta, wavelet);
    }
    return wavelet;
View Full Code Here

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

          CoreWaveletOperationSerializer.deserialize(document.getDocumentOperation());
      coreWavelet.modifyDocument(document.getDocumentId(), op);
    }

    HashedVersion hashedVersion = CoreWaveletOperationSerializer.deserialize(version);
    ObservableWaveletData immutableWaveletData =
        DataUtil.fromCoreWaveletData(coreWavelet, hashedVersion, SchemaCollection.empty());

    ObservableWaveletData wavelet = WaveletDataUtil.copyWavelet(immutableWaveletData);

    for (String participant : snapshot.getParticipantIdList()) {
      wavelet.addParticipant(new ParticipantId(participant));
    }

    return wavelet;
  }
View Full Code Here

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

    ParticipantId author = ParticipantId.of(snapshot.getCreator());
    WaveletId waveletId = ModernIdSerialiser.INSTANCE.deserialiseWaveletId(snapshot.getWaveletId());
    long creationTime = snapshot.getCreationTime();

    ObservableWaveletData wavelet = factory.create(new EmptyWaveletSnapshot(waveId, waveletId,
        author, CoreWaveletOperationSerializer.deserialize(snapshot.getVersion()), creationTime));

    for (String participant : snapshot.getParticipantIdList()) {
      wavelet.addParticipant(getParticipantId(participant));
    }

    for (DocumentSnapshot document : snapshot.getDocumentList()) {
      addDocumentSnapshotToWavelet(document, wavelet);
    }

    wavelet.setVersion(snapshot.getVersion().getVersion());
    wavelet.setLastModifiedTime(snapshot.getLastModifiedTime());
    // The creator and creation time are set when the empty wavelet template is
    // created above.

    return wavelet;
  }
View Full Code Here

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

    ParticipantId author = ParticipantId.of(snapshot.getCreator());
    WaveletId waveletId =
        ModernIdSerialiser.INSTANCE.deserialiseWaveletId(snapshot.getWaveletId());
    long creationTime = snapshot.getCreationTime();

    ObservableWaveletData wavelet = factory.create(new EmptyWaveletSnapshot(waveId, waveletId,
            author, WaveletOperationSerializer.deserialize(snapshot.getVersion()),
            creationTime));

    for (String participant : snapshot.getParticipantId()) {
      wavelet.addParticipant(ParticipantId.of(participant));
    }

    for (DocumentSnapshot document : snapshot.getDocument()) {
      addDocumentSnapshotToWavelet(document, wavelet);
    }

    wavelet.setVersion((long) snapshot.getVersion().getVersion());
    wavelet.setLastModifiedTime(snapshot.getLastModifiedTime());
    // The creator and creation time are set when the empty wavelet template is
    // created above.

    return wavelet;
  }
View Full Code Here

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

        } else {
          throw new InvalidRequestException("Wavelet " + waveletName + " couldn't be retrieved");
        }
       
      } else {
        ObservableWaveletData obsWavelet = FACTORY.create(snapshot.snapshot);
        wavelet = new RobotWaveletData(obsWavelet, snapshot.committedVersion);
      }
      openedWavelets.put(waveletName, wavelet);
    }
    return wavelet.getOpBasedWavelet(participant);
View Full Code Here

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

    // TODO(ljvderijk): Proper schemas need to be enforced here.

    DocumentFactory<?> docFactory =
        ObservablePluggableMutableDocument.createFactory(SchemaCollection.empty());

    ObservableWaveletData perAuthorWavelet =
        WaveletDataImpl.Factory.create(docFactory).create(snapshot);

    SilentOperationSink<WaveletOperation> executor =
        SilentOperationSink.Executor.<WaveletOperation, WaveletData>build(perAuthorWavelet);
    // Build sink that gathers these ops
    CapturingOperationSink<WaveletOperation> output =
        new CapturingOperationSink<WaveletOperation>();

    BasicWaveletOperationContextFactory contextFactory =
        new BasicWaveletOperationContextFactory(opAuthor);
    OpBasedWavelet w =
        new OpBasedWavelet(perAuthorWavelet.getWaveId(), perAuthorWavelet, contextFactory,
            ParticipationHelper.DEFAULT, executor, output);

    // Store the new sink and wavelet
    sinkMap.put(opAuthor, output);
    waveletMap.put(opAuthor, w);
View Full Code Here

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

        deltas.getEndVersion();
    Preconditions.checkArgument(snapshot.getVersion() == endVersion.getVersion(),
        String.format("Version of snapshot %s doesn't match the end version %s",
            snapshot.getVersion(), endVersion));

    ObservableWaveletData preDeltaWavelet = WaveletDataUtil.copyWavelet(snapshot);
    rollback(preDeltaWavelet, deltas);
    ObservableWaveletData postDeltaWavelet = WaveletDataUtil.copyWavelet(snapshot);
    return new WaveletAndDeltas(preDeltaWavelet, postDeltaWavelet, deltas);
  }
View Full Code Here

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

  @Override
  public OpBasedWavelet create(WaveId waveId, WaveletId waveletId, ParticipantId creator) {
    long now = System.currentTimeMillis();
    HashedVersion v0 = HashedVersion.unsigned(0);
    ObservableWaveletData waveData = holderFactory
        .create(new EmptyWaveletSnapshot(waveId, waveletId, creator, v0, now));
    lastContextFactory = new MockWaveletOperationContextFactory().setParticipantId(author);
    lastAuthoriser = new MockParticipationHelper();
    SilentOperationSink<WaveletOperation> executor =
        Executor.<WaveletOperation, WaveletData>build(waveData);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.