Examples of OpBasedWavelet


Examples of org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet

    Map<ParticipantId, ObservableConversationView> conversations =
        openedConversations.get(waveletName);

    if (!conversations.containsKey(participant)) {
      OpBasedWavelet wavelet = openWavelet(waveId, waveletId, participant);
      conversations.put(participant, conversationUtil.buildConversation(wavelet));
    }
    return conversations.get(participant);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet

    CapturingOperationSink<WaveletOperation> output =
        new CapturingOperationSink<WaveletOperation>();

    BasicWaveletOperationContextFactory contextFactory =
        new BasicWaveletOperationContextFactory(opAuthor);
    OpBasedWavelet w =
        new OpBasedWavelet(perAuthorWavelet.getWaveId(), perAuthorWavelet, contextFactory,
            ParticipationHelper.DEFAULT, executor, output);

    // Store the new sink and wavelet
    sinkMap.put(opAuthor, output);
    waveletMap.put(opAuthor, w);
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet

    lastContextFactory = new MockWaveletOperationContextFactory().setParticipantId(author);
    lastAuthoriser = new MockParticipationHelper();
    SilentOperationSink<WaveletOperation> executor =
        Executor.<WaveletOperation, WaveletData>build(waveData);
    SilentOperationSink<WaveletOperation> out = new VersionIncrementingSink(waveData, sink);
    return new OpBasedWavelet(waveId, waveData, lastContextFactory, lastAuthoriser, executor, out);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet

   * @throws InvalidRequestException if the wave id provided in the operation is
   *         invalid.
   */
  public static SupplementedWave buildSupplement(OperationRequest operation,
      OperationContext context, ParticipantId participant) throws InvalidRequestException {
    OpBasedWavelet wavelet = context.openWavelet(operation, participant);
    ConversationView conversationView = context.getConversationUtil().buildConversation(wavelet);

    // TODO (Yuri Z.) Find a way to obtain an instance of IdGenerator and use it
    // to create udwId.
    WaveletId udwId = buildUserDataWaveletId(participant);
    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);

    SupplementedWave supplement =
      SupplementedWaveImpl.create(udwState, conversationView, participant, DefaultFollow.ALWAYS);
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet

      // This robot is proxying so set the proxy field.
      messages.setProxyingFor(robotName.getProxyFor());
    }

    // Sending any operations will cause an exception.
    OpBasedWavelet wavelet =
        new OpBasedWavelet(snapshot.getWaveId(), snapshot,
            // This doesn't thrown an exception, the sinks will
            new BasicWaveletOperationContextFactory(null),
            ParticipationHelper.DEFAULT, SilentOperationSink.VOID, SilentOperationSink.VOID);

    ObservableConversation conversation = getRootConversation(wavelet);

    if (conversation == null) {
      return messages;
    }

    // Start listening
    EventGeneratingConversationListener conversationListener =
        new EventGeneratingConversationListener(conversation, capabilities, messages, robotName);
    conversation.addListener(conversationListener);
    EventGeneratingWaveletListener waveletListener =
        new EventGeneratingWaveletListener(capabilities);
    wavelet.addListener(waveletListener);

    Map<String, EventGeneratingDocumentHandler> docHandlers = Maps.newHashMap();
    try {
      for (TransformedWaveletDelta delta : waveletAndDeltas.getDeltas()) {
        // TODO(ljvderijk): Set correct timestamp and hashed version once
        // wavebus sends them along
        long timestamp = 0L;
        conversationListener.deltaBegin(delta.getAuthor(), timestamp);

        for (WaveletOperation op : delta) {
          // Check if we need to attach a doc handler.
          if ((op instanceof WaveletBlipOperation)) {
            attachDocHandler(conversation, op, docHandlers, capabilities, messages,
                delta.getAuthor(), timestamp);
          }
          op.apply(snapshot);
        }
        conversationListener.deltaEnd();
      }
    } catch (OperationException e) {
      throw new IllegalStateException("Operation failed to apply when generating events", e);
    } finally {
      conversation.removeListener(conversationListener);
      wavelet.removeListener(waveletListener);
      for (EventGeneratingDocumentHandler docHandler : docHandlers.values()) {
        docHandler.doc.removeListener(docHandler);
      }
    }
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet

    BasicWaveletOperationContextFactory CONTEXT_FACTORY =
        new BasicWaveletOperationContextFactory(participant);

    SilentOperationSink<WaveletOperation> executor =
        SilentOperationSink.Executor.<WaveletOperation, WaveletData>build(waveletData);
    OpBasedWavelet wavelet =
        new OpBasedWavelet(waveletData.getWaveId(), waveletData, CONTEXT_FACTORY,
            ParticipationHelper.DEFAULT, executor, SilentOperationSink.VOID);

    // Make a conversation with an empty root blip
    WaveletBasedConversation.makeWaveletConversational(wavelet);
    ConversationUtil conversationUtil = new ConversationUtil(FakeIdGenerator.create());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.