Package org.waveprotocol.wave.model.id

Examples of org.waveprotocol.wave.model.id.WaveId


            DaysSinceEpoch.fromYMD(2013, 1, 1),
            autoImportSettings));
    } else if ("importwavelet".equals(action)) {
      SourceInstance instance =
          sourceInstanceFactory.parseUnchecked(requireParameter(req, "instance"));
      WaveId waveId = WaveId.deserialise(requireParameter(req, "waveid"));
      WaveletId waveletId = WaveletId.deserialise(requireParameter(req, "waveletid"));
      ImportWaveletTask task = new ImportWaveletTaskGsonImpl();
      task.setInstance(instance.serialize());
      task.setWaveId(waveId.serialise());
      task.setWaveletId(waveletId.serialise());
      ImportSettings settings = new ImportSettingsGsonImpl();
      if ("private".equals(requireParameter(req, "sharingmode"))) {
        settings.setSharingMode(ImportSettings.ImportSharingMode.PRIVATE);
      } else if ("shared".equals(requireParameter(req, "sharingmode"))) {
View Full Code Here


  private List<RemoteConvWavelet> expandPrivateReplies(SourceInstance instance,
      RobotSearchDigest digest) throws IOException {
    RobotApi api = robotApiFactory.create(instance.getApiUrl());
    ImmutableList.Builder<RemoteConvWavelet> wavelets = ImmutableList.builder();
    WaveId waveId = WaveId.deserialise(digest.getWaveId());
    // The robot API only allows access to waves with ids that start with "w".
    if (!waveId.getId().startsWith(IdUtil.WAVE_PREFIX + "+")) {
      log.info("Wave " + waveId + " not accessible through Robot API, skipping");
    } else {
      log.info("Getting wave view for " + waveId);
      List<WaveletId> waveletIds = api.getWaveView(waveId);
      log.info("Wave view for " + waveId + ": " + waveletIds);
View Full Code Here

  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String domain = request.getHeader("domain");
    WaveId waveId = WaveId.deserialise(request.getHeader("waveId"));
    WaveletId waveletId = WaveletId.deserialise(request.getHeader("waveletId"));
    final StringWriter error = new StringWriter();
    boolean somethingProcessed = false;
    boolean somethingSkipped = false;
    try {
      JSONObject exp = new JSONObject(readToString(request.getReader()));
      JSONArray rawDeltas = exp.getJSONObject("data").getJSONArray("rawDeltas");
      if (rawDeltas.length() != 0) {
        List<ProtocolAppliedWaveletDelta> deltas = new LinkedList<ProtocolAppliedWaveletDelta>();
        for (int i = 0; i < rawDeltas.length(); i++) {
          deltas.add(ProtocolAppliedWaveletDelta.parseFrom(Base64.decode(rawDeltas.getString(i))));
        }
        WaveletName waveletName = WaveletName.of(waveId, waveletId);
        LocalWaveletContainerImpl wavelet = (LocalWaveletContainerImpl) waveMap.getLocalWavelet(waveletName);
        Set<ParticipantId> participants = new HashSet<ParticipantId>();
        if (wavelet != null) {
          participants.addAll(wavelet.accessSnapshot().getParticipants());
        }
        for (ProtocolAppliedWaveletDelta appliedDelta : deltas) {
          ProtocolWaveletDelta delta = ProtocolWaveletDelta.parseFrom(
              appliedDelta.getSignedOriginalDelta().getDelta());
          long currentVersion = 0;
          if (wavelet != null) {
            currentVersion = wavelet.getCurrentVersion().getVersion();
          }
          if (currentVersion == delta.getHashedVersion().getVersion()) {
            ProtocolWaveletDelta newDelta = convertDelta(delta, domain, wavelet, waveletName,
                participants);

            waveletProvider.submitRequest(waveletName, newDelta,
                new WaveletProvider.SubmitRequestListener() {

                  @Override
                  public void onSuccess(int operationsApplied, HashedVersion hashedVersionAfterApplication,
                      long applicationTimestamp) {
                  }

                  @Override
                  public void onFailure(String errorMessage) {
                    error.write(errorMessage);
                  }
                });
            if (error.getBuffer().length() != 0) {
              break;
            }
            if (wavelet == null) {
              wavelet = (LocalWaveletContainerImpl) waveMap.getLocalWavelet(waveletName);
            }
            somethingProcessed = true;
          } else {
            somethingSkipped = true;
          }
        }
      }
    } catch (Exception ex) {
      LOG.log(Level.SEVERE, "waveId " + waveId.toString() + ", waveletId " + waveletId.toString(), ex);
      throw new IOException(ex);
    }
    response.setStatus(HttpServletResponse.SC_OK);
    if (error.getBuffer().length() != 0) {
      response.getOutputStream().write(("error : " + error.getBuffer()).getBytes());
View Full Code Here

      new CopyOnWriteArraySet<PerUserWaveViewBus.Listener>();

  @Override
  public void waveletUpdate(ReadableWaveletData wavelet, DeltaSequence deltas) {
    WaveletId waveletId = wavelet.getWaveletId();
    WaveId waveId = wavelet.getWaveId();
    WaveletName waveletName = WaveletName.of(waveId, waveletId);
    // Find whether participants were added/removed and update the views
    // accordingly.
    for (TransformedWaveletDelta delta : deltas) {
      for (WaveletOperation op : delta) {
View Full Code Here

    }

    // 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);
View Full Code Here

  @Override
  public void popupLink(BlipView blipUi) {
    ConversationBlip blip = views.getBlip(blipUi);
    // TODO(Yuri Z.) Change to use the conversation model when the Conversation
    // exposes a reference to its ConversationView.
    WaveId waveId = blip.hackGetRaw().getWavelet().getWaveId();
    WaveletId waveletId;
    try {
      waveletId = DualIdSerialiser.MODERN.deserialiseWaveletId(blip.getConversation().getId());
    } catch (InvalidIdException e) {
      Window.alert(
View Full Code Here

    // Make sure that participant list is not null;
    if (participants == null) {
      participants = Collections.emptySet();
    }

    WaveId waveId;
    WaveletId waveletId;
    try {
      waveId = ApiIdSerializer.instance().deserialiseWaveId(
          String.format(TEMP_WAVE_ID_FORMAT, domain, ID_GENERATOR.nextInt()));
      waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
View Full Code Here

   * @param waveletData the wavelet data to be deserialized.
   * @return an instance of {@link Wavelet}.
   */
  public static Wavelet deserialize(OperationQueue operationQueue, Map<String, Blip> blips,
      Map<String, BlipThread> threads, WaveletData waveletData) {
    WaveId waveId;
    WaveletId waveletId;
    try {
      waveId = ApiIdSerializer.instance().deserialiseWaveId(waveletData.getWaveId());
      waveletId = ApiIdSerializer.instance().deserialiseWaveletId(waveletData.getWaveletId());
    } catch (InvalidIdException e) {
View Full Code Here

      // second operation, since makeRpc prepends the robot.notify() operation.
      JsonRpcResponse response = this.submit(newWavelet, rpcServerUrl).get(1);
      if (response.isError()) {
        throw new IOException(response.getErrorMessage());
      }
      WaveId waveId = ApiIdSerializer.instance().deserialiseWaveId(
          (String) response.getData().get(ParamsProperty.WAVE_ID));
      WaveletId waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
          (String) response.getData().get(ParamsProperty.WAVELET_ID));
      String rootBlipId = (String) response.getData().get(ParamsProperty.BLIP_ID);
View Full Code Here

  public synchronized void remakeIndex() throws WaveletStateException, WaveServerException {
    waveMap.loadAllWavelets();

    ExceptionalIterator<WaveId, WaveServerException> witr = waveletProvider.getWaveIds();
    while (witr.hasNext()) {
      WaveId waveId = witr.next();
      for (WaveletId waveletId : waveletProvider.getWaveletIds(waveId)) {
        WaveletName waveletName = WaveletName.of(waveId, waveletId);

        // Required to call this method to load the wavelet into memory.
        waveletProvider.getSnapshot(waveletName);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.id.WaveId

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.