Package com.google.wave.api

Examples of com.google.wave.api.InvalidRequestException


      context.constructErrorResponse(operation, "Unable to retrieve account data");
      return;
    }

    if (account == null || !account.isRobot()) {
      throw new InvalidRequestException("Can't exectute robot.notify for unknown robot "
          + robotAccountId);
    }

    RobotAccountData robotAccountData = account.asRobot();
    RobotCapabilities capabilities = robotAccountData.getCapabilities();
View Full Code Here


    List<ParticipantId> participants = Lists.newArrayList(participant);
    for (String address : waveletData.getParticipants()) {
      try {
        participants.add(ParticipantId.of(address));
      } catch (InvalidParticipantAddress e) {
        throw new InvalidRequestException(
            address + " is not a valid participant address", operation);
      }
    }

    WaveletName waveletName = context.getConversationUtil().generateWaveletName();
    RobotWaveletData newWavelet = createEmptyRobotWavelet(participant, waveletName);
    OpBasedWavelet opBasedWavelet = newWavelet.getOpBasedWavelet(participant);

    WaveletBasedConversation.makeWaveletConversational(opBasedWavelet);

    ObservableConversationView conversation =
        context.getConversationUtil().buildConversation(opBasedWavelet);
    ObservableConversationBlip rootBlip = conversation.getRoot().getRootThread().appendBlip();

    for (ParticipantId newParticipant : participants) {
      opBasedWavelet.addParticipant(newParticipant);
    }

    // Store the temporary id of the wavelet and rootblip so that future
    // operations can reference it.
    try {
      WaveId waveId = ApiIdSerializer.instance().deserialiseWaveId(waveletData.getWaveId());
      WaveletId waveletId =
          ApiIdSerializer.instance().deserialiseWaveletId(waveletData.getWaveletId());
      context.putWavelet(waveId, waveletId, newWavelet);
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid id", operation, e);
    }
    context.putBlip(waveletData.getRootBlipId(), rootBlip);

    String message = OperationUtil.getOptionalParameter(operation, ParamsProperty.MESSAGE);
    WaveletCreatedEvent event =
View Full Code Here

    // Create JSON-RPC success response.
    try {
      constructResponse(operation, EventSerializer.extractPropertiesToParamsPropertyMap(event));
    } catch (EventSerializationException e) {
      LOG.severe("Internal Error occurred, when serializing events", e);
      throw new InvalidRequestException("Unable to serialize events", operation);
    }
  }
View Full Code Here

          // opens a wavelet for the first time. However, if the wavelet is
          // fetched for the first time with Robot/Data API - user data should be
          // created here.
          wavelet = createEmptyRobotWavelet(participant, waveletName);
        } else {
          throw new InvalidRequestException("Wavelet " + waveletName + " couldn't be retrieved");
        }

      } else {
        ObservableWaveletData obsWavelet = FACTORY.create(snapshot.snapshot);
        wavelet = new RobotWaveletData(obsWavelet, snapshot.committedVersion);
View Full Code Here

          OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVE_ID));
      WaveletId waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
          OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVELET_ID));
      return openWavelet(waveId, waveletId, participant);
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid id", operation, e);
    }
  }
View Full Code Here

          OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVE_ID));
      WaveletId waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
          OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVELET_ID));
      return openConversation(waveId, waveletId, participant);
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid id", operation, e);
    }
  }
View Full Code Here

    // We might need to look up the blip id for new blips.
    String actualBlipId = blipId.startsWith(TEMP_ID_MARKER) ? tempBlipIdMap.get(blipId) : blipId;

    ConversationBlip blip = conversation.getBlip(actualBlipId);
    if (blip == null) {
      throw new InvalidRequestException(
          "Blip with id " + blipId + " does not exist or has been deleted");
    }

    return blip;
  }
View Full Code Here

        if (waveletProvider.checkAccessPermission(waveletName, participant)) {
          waveletIds.add(waveletId);
        }
      }
    } catch (InvalidIdException ex) {
      throw new InvalidRequestException("Invalid id", operation, ex);
    } catch (WaveServerException e) {
      LOG.severe("Error of access to wave", e);
    }
    return ImmutableSet.copyOf(waveletIds);
  }
View Full Code Here

  @Override
  public CommittedWaveletSnapshot getWaveletSnapshot(WaveletName waveletName, ParticipantId participant)
      throws InvalidRequestException {
    try {
      if (!waveletProvider.checkAccessPermission(waveletName, participant)) {
        throw new InvalidRequestException("Access rejected");
      }
      return waveletProvider.getSnapshot(waveletName);
    } catch (WaveServerException ex) {
      LOG.severe("Error of access to wavelet " + waveletName, ex);
      return null;
View Full Code Here

  public void getDeltas(WaveletName waveletName, ParticipantId participant,
      HashedVersion fromVersion, HashedVersion toVersion, Receiver<TransformedWaveletDelta> receiver)
          throws InvalidRequestException {
    try {
      if (!waveletProvider.checkAccessPermission(waveletName, participant)) {
        throw new InvalidRequestException("Access rejected");
      }
      Preconditions.checkState(fromVersion.compareTo(toVersion) <= 0);
      if (fromVersion.equals(toVersion)) {
        return;
      }
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.