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

Examples of org.waveprotocol.wave.model.document.operation.automaton.DocOpAutomaton.ViolationCollector


  @Override
  public void consume(DocOp m) throws OperationException {
    checkConsistent();

    ViolationCollector v = new ViolationCollector();
    DocOpValidator.validate(v, schemaConstraints, this, m);
    if (!v.isValid()) {
      throw new OperationException("Validation failed: " + v);
    }

    inconsistent = true;
View Full Code Here


      return;
    }

    DocumentSchema schema = getSchema();

    ViolationCollector vc = new ViolationCollector();
    if (!DocOpValidator.validate(vc, schema, op).isValid()) {
      logger.error().log("That content does not conform to the schema", vc);
      return;
    }
View Full Code Here

    if (checkWellFormed) {
      try {
        if (!DocOpValidator.isWellFormed(null, value)) {
          // Check again, collecting violations this time.
          ViolationCollector v = new ViolationCollector();
          DocOpValidator.isWellFormed(v, value);
          throw new InvalidInputException("Attempt to build ill-formed operation ("
              + v + "): " + value);
        }
      } catch (MessageWrapperDocOp.DelayedInvalidInputException e) {
View Full Code Here

  }

  public void maybeThrowOperationExceptionFor(DocOp op) throws OperationException {
    if (!DocOpValidator.validate(null, schemaConstraints, autoDoc, op).isValid()) {
      // Validate again to collect diagnostics (more expensive)
      ViolationCollector vc = new ViolationCollector();
      DocOpValidator.validate(vc, schemaConstraints, autoDoc, op);

      throw new OperationException(vc);
    }
  }
View Full Code Here

    return nindoCursor.finish2();
  }

  @Override
  public void maybeThrowOperationExceptionFor(Nindo op) throws OperationException {
    ViolationCollector vc = NindoValidator.validate(this, op, schemaConstraints);
    if (!vc.isValid()) {
      // TODO(danilatos): reconcile the two validation methods
      throw new OperationException(vc);
    }
  }
View Full Code Here

   * @throws IllegalStateException if the op is ill-formed
   */
  private static void checkWellformedness(DocOp value) {
    if (!DocOpValidator.isWellFormed(null, value)) {
      // Check again, collecting violations this time.
      ViolationCollector v = new ViolationCollector();
      DocOpValidator.isWellFormed(v, value);
      Preconditions.illegalState("Attempt to build ill-formed operation (" + v + "): " + value);
    }
  }
View Full Code Here

      IndexedDocument<N, E, T> doc,
      Nindo m, DocumentSchema schema) {
    Preconditions.checkNotNull(schema, "Schema constraints required, if not, " +
        "use DocumentSchema.NO_SCHEMA_CONSTRAINTS");
    final NindoAutomaton<N, E, T> a = new NindoAutomaton<N, E, T>(schema, doc);
    final ViolationCollector v = new ViolationCollector();
    try {
      m.apply(new NindoCursor() {

        @Override
        public void begin() {
View Full Code Here

  @Override
  public void consume(DocOp m) throws OperationException {
    checkConsistent();

    ViolationCollector v = new ViolationCollector();
    DocOpValidator.validate(v, schemaConstraints, this, m);
    if (!v.isValid()) {
      throw new OperationException("Validation failed: " + v);
    }

    inconsistent = true;
View Full Code Here

   * parameters, and schema.
   */
  public static Nindo generate(RandomProvider r, Parameters p,
      DocumentSchema s, IndexedDocument<Node, Element, Text> doc) {
    Nindo m = new Generator(r, p, s, doc).generate();
    ViolationCollector v = NindoValidator.validate(doc, m, s);
    assert !v.isIllFormed();
    assert p.getValidity() == v.isValid();
    return m;
  }
View Full Code Here

      return;
    }

    DocumentSchema schema = getSchema();

    ViolationCollector vc = new ViolationCollector();
    if (!DocOpValidator.validate(vc, schema, op).isValid()) {
      logger.error().log("That content does not conform to the schema", vc);
      return;
    }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.automaton.DocOpAutomaton.ViolationCollector

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.