示例#1
0
    protected WaveViewImpl<OpBasedWavelet> createWave() {
      WaveViewData snapshot = getWaveData();
      // The operationalizer makes the wavelets function via operation control.
      // The hookup with concurrency-control and remote operation streams occurs
      // later in createUpgrader().
      final WaveletOperationalizer operationalizer = getWavelets();
      WaveletFactory<OpBasedWavelet> waveletFactory =
          new WaveletFactory<OpBasedWavelet>() {
            @Override
            public OpBasedWavelet create(WaveId waveId, WaveletId id, ParticipantId creator) {
              long now = System.currentTimeMillis();
              ObservableWaveletData data =
                  new WaveletDataImpl(
                      id,
                      creator,
                      now,
                      0L,
                      HashedVersion.unsigned(0),
                      now,
                      waveId,
                      getDocumentRegistry());
              return operationalizer.operationalize(data);
            }
          };
      WaveViewImpl<OpBasedWavelet> wave =
          WaveViewImpl.create(
              waveletFactory,
              snapshot.getWaveId(),
              getIdGenerator(),
              getSignedInUser(),
              WaveletConfigurator.ADD_CREATOR);

      // Populate the initial state.
      for (ObservableWaveletData waveletData : snapshot.getWavelets()) {
        wave.addWavelet(operationalizer.operationalize(waveletData));
      }
      return wave;
    }
示例#2
0
 protected WaveletOperationalizer createWavelets() {
   return WaveletOperationalizer.create(getWaveData().getWaveId(), getSignedInUser());
 }