Package org.waveprotocol.wave.model.document.operation

Examples of org.waveprotocol.wave.model.document.operation.DocOp


      Event e = randomEvent();
      out.println("\n" + iter + " " + e + " ========");
      eventCounts.put(e, (eventCounts.containsKey(e) ? eventCounts.get(e) : 0) + 1);
      switch (e) {
      case CLIENT_OP:
        DocOp op = randomOp(client);
        q.clientOp(op);
        break;
      case CLIENT_SEND:
        if (!q.hasUnacknowledgedClientOps() && q.hasQueuedClientOps()) {
          server.sendToServer(q.revision(), q.pushQueuedOpsToUnacked());
View Full Code Here


    throw new AssertionError("Bug");
  }

  private DocOp randomOp(Doc doc) throws OperationException {
    DocOp op = RandomDocOpGenerator.generate(r, p, doc.autoDoc);
    doc.consume(op);
    return op;
  }
View Full Code Here

  public StringMap<DocOp> deserializeDocumentsDiffs(WaveletDiffSnapshot diffSnapshot)
      throws MessageException {
    StringMap<DocOp> docOps = CollectionUtils.createStringMap();
    try {
      for (DocumentDiffSnapshot docDiff : diffSnapshot.getDocument()) {
        DocOp op;
        if (docDiff.getDiff() == null) {
          op = null;
        } else {
          op = OperationFactory.createDocumentOperation(docDiff.getDiff());
        }
View Full Code Here

      Preconditions.checkArgument(lastReadVersion >= intermediateVersion
          || lastReadVersion == 0 || lastReadVersion >= document.getLastModifiedVersion(),
          "intermediate wavelet %s is newer (@%s) than last read version %s of doc %s",
          waveletId, intermediateVersion, lastReadVersion, documentId);

      DocOp state = document.getContent().asOperation();
      docDiff.addOperation(documentId, 0, state);

      documentDiffMap.put(documentId, docDiff);
    }
View Full Code Here

          docDiff.addAllAddedContributor(Collections.<String> emptyList());
          docDiff.addAllRemovedContributor(Collections.<String> emptyList());
          docDiff.setLastModifiedVersion(document.getLastModifiedVersion());
          docDiff.setLastModifiedTime(document.getLastModifiedTime());
          docDiff.setState(OperationSerializer.createMutationOp(diffState.getState()));
          DocOp diffOp = diffState.getDiff();
          if (diffOp != null) {
            docDiff.setDiff(OperationSerializer.createMutationOp(diffOp));
          }
          result.add(docDiff);
        }
View Full Code Here

    /**
     * @return the state. never null.
     */
    DocOp getState() {
      DocOp op = state.composeAll();
      return op != null ? op : EMPTY_OP;
    }
View Full Code Here

   * @return The created operation.
   */
  private static DocOp createDocumentOperation(
      final DocOpMessageProvider input, boolean checkWellFormed) throws InvalidInputException {

    DocOp value = new MessageWrapperDocOp(input, checkWellFormed);

    if (checkWellFormed) {
      try {
        if (!DocOpValidator.isWellFormed(null, value)) {
          // Check again, collecting violations this time.
View Full Code Here

                DocumentHistoryConverter docConverter = docConverters.get(documentId);
                if (docConverter == null) {
                  docConverter = new DocumentHistoryConverter(documentId, nindoConverter);
                  docConverters.put(documentId, docConverter);
                }
                DocOp converted;
                try {
                  converted = docConverter.convertAndApply(blipOp.getContentOp());
                } catch (OperationException e) {
                  throw new InvalidInputException("OperationException converting " + waveletOp, e);
                }
View Full Code Here

    this.participants = new ArrayList<ParticipantId>();
    this.documents = new HashMap<String, DocOp>();
  }

  private DocOp getOrCreateDocument(String documentId) {
    DocOp doc = documents.get(documentId);
    if (doc == null) {
      doc = EMPTY_DOC_OP;
      documents.put(documentId, doc);
    }
    return doc;
View Full Code Here

  }

  @Override
  public boolean modifyDocument(String documentId, DocOp operation)
      throws OperationException {
    DocOp newDoc = Composer.compose(getOrCreateDocument(documentId), operation);
    if (OpComparators.SYNTACTIC_IDENTITY.equal(newDoc, EMPTY_DOC_OP)) {
      documents.remove(documentId);
    } else {
      documents.put(documentId, newDoc);
    }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.DocOp

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.