Package org.waveprotocol.box.common.comms.proto

Examples of org.waveprotocol.box.common.comms.proto.WaveletSnapshotProtoImpl


      throw new InvalidRequestException("Invalid id", operation, ex);
    }
    WaveletName waveletName = WaveletName.of(waveId, waveletId);
    CommittedWaveletSnapshot snapshot = context.getWaveletSnapshot(waveletName, participant);
    WaveletSnapshot protoSnapshot = SnapshotSerializer.serializeWavelet(snapshot.snapshot, snapshot.snapshot.getHashedVersion());
    WaveletSnapshotProtoImpl protoSnapshotImpl = new WaveletSnapshotProtoImpl(protoSnapshot);
    String jsonSnapshot = gson.toJson(protoSnapshotImpl.toGson(null, gson));
    Map<ParamsProperty, Object> data =
      ImmutableMap.<ParamsProperty, Object> of(ParamsProperty.RAW_SNAPSHOT, jsonSnapshot);
    context.constructResponse(operation, data);
  }
View Full Code Here


        }
        Console.println("Exporting wave " + waveId.serialise()
            + " (" + (i + 1) + " of " + waves.size() + ") ...");
        new File(fileNames.getWaveDirPath(waveId)).mkdir();
        for (WaveletId waveletId : api.retrieveWaveletIds(waveId, rpcServerUrl)) {
          WaveletSnapshotProtoImpl snapshot = exportSnapshot(waveId, waveletId);
          Set<AttachmentId> attachmentIds = new HashSet<AttachmentId>();
          try {
            exportDeltas(waveId, waveletId, snapshot.getVersion().getPB(), attachmentIds);
          } catch (IOException ex) {
            errorOccured = true;
            Console.error("Export of deltas error.", ex);
          }
          if (!attachmentIds.isEmpty()) {
View Full Code Here

    new File(fileNames.getWaveletDirPath(waveId, waveletId)).mkdir();
    Console.println("  wavelet " + waveletId.serialise());
    Console.print("    getting snapshot ...");
    String snapshotJSon = api.exportRawSnapshot(waveId, waveletId, rpcServerUrl);
    writeSnapshotToFile(waveId, waveletId, snapshotJSon);
    WaveletSnapshotProtoImpl snapshot = new WaveletSnapshotProtoImpl();
    try {
      snapshot.fromGson(jsonParser.parse(snapshotJSon), gson, null);
    } catch (GsonException ex) {
      throw new IOException(ex);
    }
    Console.println(" Ok, version " + (long)snapshot.getVersion().getVersion());
    return snapshot;
  }
View Full Code Here

  @Override
  public void copyFrom(WaveViewSnapshot message) {
    setWaveId(message.getWaveId());
    clearWavelet();
    for (WaveletSnapshot field : message.getWavelet()) {
      addWavelet(new WaveletSnapshotProtoImpl(field));
    }
  }
View Full Code Here

  @Override
  public List<WaveletSnapshotProtoImpl> getWavelet() {
    switchToProto();
    List<WaveletSnapshotProtoImpl> list = new ArrayList<WaveletSnapshotProtoImpl>();
    for (int i = 0; i < getWaveletSize(); i++) {
      WaveletSnapshotProtoImpl message = new WaveletSnapshotProtoImpl(proto.getWavelet(i));
      list.add(message);
    }
    return list;
  }
View Full Code Here

  }

  @Override
  public WaveletSnapshotProtoImpl getWavelet(int n) {
    switchToProto();
    return new WaveletSnapshotProtoImpl(proto.getWavelet(n));
  }
View Full Code Here

  /** Get or create a WaveletSnapshotProtoImpl from a WaveletSnapshot. */
  private WaveletSnapshotProtoImpl getOrCreateWaveletSnapshotProtoImpl(WaveletSnapshot message) {
    if (message instanceof WaveletSnapshotProtoImpl) {
      return (WaveletSnapshotProtoImpl) message;
    } else {
      WaveletSnapshotProtoImpl messageImpl = new WaveletSnapshotProtoImpl();
      messageImpl.copyFrom(message);
      return messageImpl;
    }
  }
View Full Code Here

    if (jsonObject.has("2")) {
      JsonElement elem = jsonObject.get("2");
      {
        JsonArray array = elem.getAsJsonArray();
        for (int i = 0; i < array.size(); i++) {
          WaveletSnapshotProtoImpl payload = new WaveletSnapshotProtoImpl();
          GsonUtil.extractJsonObject(payload, array.get(i), gson, raw);
          addWavelet(payload);
        }
      }
    }
View Full Code Here

      setResultingVersion(new ProtocolHashedVersionProtoImpl(message.getResultingVersion()));
    } else {
      clearResultingVersion();
    }
    if (message.hasSnapshot()) {
      setSnapshot(new WaveletSnapshotProtoImpl(message.getSnapshot()));
    } else {
      clearSnapshot();
    }
    if (message.hasMarker()) {
      setMarker(message.getMarker());
View Full Code Here

  }

  @Override
  public WaveletSnapshotProtoImpl getSnapshot() {
    switchToProto();
    return new WaveletSnapshotProtoImpl(proto.getSnapshot());
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.box.common.comms.proto.WaveletSnapshotProtoImpl

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.