Package org.waveprotocol.wave.client.common.util

Examples of org.waveprotocol.wave.client.common.util.JsoView


    rpc.makeRequest(Rpc.Method.POST, serviceName, CollectionUtils.newStringMap(
          "ids", b.toString()),
        new Rpc.RpcCallback() {
          @Override
          public void onSuccess(String data) throws MessageException {
            JsoView json = RpcUtil.evalPrefixed(data);
            callback.onSuccess(json);
          }

          @Override
          public void onConnectionError(Throwable e) {
View Full Code Here


            Params.SESSION, signedSessionString,
            Params.REVISION, revision + ""),
        new Rpc.RpcCallback() {
          @Override
          public void onSuccess(String data) throws MessageException {
            JsoView json = RpcUtil.evalPrefixed(data);
            if (json.containsKey("error")) {
              onConnectionError(new Exception(json.getString("error")));
            } else {
              callback.onConnect(json.getString("token"));
              JsoView history = json.getJsoView("history");
              if (history.getNumber("length") > 0) {
                sendHistoryItems(history, callback, revision);
              }
              // The head revision might be greater than expected if some
              // history items were missed, so let's give the listener
              // as much information as possible.
View Full Code Here

            Params.SESSION, signedSessionString,
            Params.START_REVISION, startRevision + ""),
        new Rpc.RpcCallback() {
          @Override
          public void onSuccess(String data) throws MessageException {
            JsoView json = RpcUtil.evalPrefixed(data).getJsoView("history");

            int len = sendHistoryItems(json, callback, startRevision);
            boolean hasMore = json.getBoolean("more");

            // In case the result is batched, we'll keep fetching.
            if (hasMore) {
              // TODO(danilatos): Move this logic into GaeReceiveOpChannel,
              // keep this class dumb.
View Full Code Here

      callback.onFatalError(new Exception("history fetch returned empty results"));
      return 0;
    }

    for (int i = 0; i < len; i++) {
      JsoView item = json.getJsoView(i);
      callback.onHistoryItem(startRevision + i + 1// + 1 for resulting revision
          ChangeDataParser.fromJson(item));
    }

    return len;
View Full Code Here

            "v", revision + "",
            "operations", serializer.serializeOperationBatch(operations)),
        new Rpc.RpcCallback() {
          @Override
          public void onSuccess(String data) throws MessageException {
            JsoView json = RpcUtil.evalPrefixed(data);
            callback.onSuccess((int) json.getNumber("version"));
          }

          @Override
          public void onConnectionError(Throwable e) {
            callback.onConnectionError(e);
View Full Code Here

    if (data == null) {
      log.log(Level.WARNING, "Null data on channel");
      return;
    }
    try {
      JsoView jso = JsUtil.eval(data);
      if (!jso.containsKey("id") || !jso.containsKey("m")) {
        throw new MessageException("Missing fields");
      }
      String id = jso.getString("id");
      JsoView m = jso.getJsoView("m");
      GaeChannel channel = channels.get(id);
      if (channel == null) {
        log.log(Level.WARNING, "No channel registered for object with id ", id);
        return;
      }
View Full Code Here

  @Override
  public void onMessage(JsoView changes) {
    int len = (int) changes.getNumber("length");
    for (int i = 0; i < len; i++) {
      JsoView jso = changes.getJsoView(i);
      int resultingRevision = (int) jso.getNumber("revision");
      ChangeData<JavaScriptObject> message = ChangeDataParser.fromJson(jso);

      log.log(Level.INFO, "Store message: ", message);
      receiveUnorderedData(resultingRevision, message);
    }
View Full Code Here

    final List<String> updatedIds = new ArrayList<String>();
    pendingInfoIds.clear();
    // TODO(danilatos) Iterate over the result instead, once random access
    // to pendingInfoIds is added.
    for (String id : pendingIdsCopy) {
      JsoView data = (JsoView) result.getJso(id);
      if (data != null) {
        WalkaroundAttachment attachment = attachments.get(id);
        assert attachment != null;
        attachment.setData(data);
        updatedIds.add(id);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.common.util.JsoView

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.