Package com.google.wave.api

Examples of com.google.wave.api.InvalidRequestException


      waveId = ApiIdSerializer.instance().deserialiseWaveId(
        OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVE_ID));
      waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
        OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVELET_ID));
    } catch (InvalidIdException ex) {
      throw new InvalidRequestException("Invalid id", operation, ex);
    }
    startVersion = getVersionParameter(operation, ParamsProperty.FROM_VERSION);
    endVersion = getVersionParameter(operation, ParamsProperty.TO_VERSION);
    WaveletName waveletName = WaveletName.of(waveId, waveletId);
    getDeltas(context, waveletName, participant, startVersion, endVersion, new RawDeltasListener() {
View Full Code Here


          operation, parameter);
    ProtocolHashedVersion protoVersion;
    try {
      protoVersion = ProtocolHashedVersion.parseFrom(bytes);
    } catch (InvalidProtocolBufferException ex) {
      throw new InvalidRequestException("Invalid version " + parameter.key(), operation, ex);
    }
    return CoreWaveletOperationSerializer.deserialize(protoVersion);
  }
View Full Code Here

        OperationUtil.getOptionalParameter(operation, ParamsProperty.MODIFY_QUERY);

    DocumentHitIterator hitIterator;
    if (range != null) {
      if (index != null || query != null) {
        throw new InvalidRequestException(
            "At most one parameter out of RANGE, INDEX and MODIFY_QUERY must be specified",
            operation);
      }
      // Use the specified range
      hitIterator = new DocumentHitIterator.Singleshot(range);
    } else if (index != null) {
      if (query != null) { // range is null.
        throw new InvalidRequestException(
            "At most one parameter out of RANGE, INDEX and MODIFY_QUERY must be specified",
            operation);
      }
      // Use exactly the location of the index
      hitIterator = new DocumentHitIterator.Singleshot(new Range(index, index + 1));
View Full Code Here

      OperationRequest operation, Document doc, int start, int end, String key, String value)
      throws InvalidRequestException {
    try {
      doc.setAnnotation(start, end, key, value);
    } catch (IndexOutOfBoundsException e) {
      throw new InvalidRequestException(
          "Can't set annotation for out of bounds indices " + e.getMessage(), operation, e);
    }
  }
View Full Code Here

        // Can't delete the first new line.
        start = 1;
      }

      if (start >= end) {
        throw new InvalidRequestException(
            "Invalid range specified, " + start + ">=" + end, operation);
      }

      // Delete using the view.
      view.delete(start, end);
View Full Code Here

  public static <T> T getRequiredParameter(OperationRequest operation, ParamsProperty property)
      throws InvalidRequestException {
    Object parameter = operation.getParameter(property);
    Class<T> clazz = (Class<T>) property.clazz();
    if (parameter == null || !clazz.isInstance(parameter)) {
      throw new InvalidRequestException("property " + property + " not found", operation);
    }
    return clazz.cast(parameter);
  }
View Full Code Here

    String proxyAddress =
        OperationUtil.getOptionalParameter(operation, ParamsProperty.PROXYING_FOR);
    try {
      return toProxyParticipant(participant, proxyAddress);
    } catch (InvalidParticipantAddress e) {
      throw new InvalidRequestException(
          participant.getAddress()
          + (proxyAddress != null ? "+" + proxyAddress : ""
              + " is not a valid participant address"), operation);
    }
  }
View Full Code Here

    String waveIdStr = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVE_ID);
    WaveId waveId = null;
    try {
      waveId = ApiIdSerializer.instance().deserialiseWaveId(waveIdStr);
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid WAVE_ID parameter: " + waveIdStr, operation, e);
    }
    OpBasedWavelet udw = context.openWavelet(waveId, udwId, participant);

    PrimitiveSupplement udwState = WaveletBasedSupplement.create(udw);
View Full Code Here

  @Override
  public final OperationService getServiceFor(OperationType opType) throws InvalidRequestException {
    OperationService service = operationMap.get(opType);
    if (service == null) {
      throw new InvalidRequestException("No OperationService found for " + opType);
    }
    return service;
  }
View Full Code Here

      // TODO(anorth): Remove this round-trip when the API instead talks about
      // opaque conversation ids, and doesn't use legacy id serialization.
      conversationId = WaveletBasedConversation.idFor(
          ApiIdSerializer.instance().deserialiseWaveletId(waveletId));
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid conversation id", operation, e);
    }
    ObservableConversation conversation = conversationView.getConversation(conversationId);

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
View Full Code Here

TOP

Related Classes of com.google.wave.api.InvalidRequestException

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.