Examples of GetRequest


Examples of com.apitrary.api.request.GetRequest

      return null;
    }

    log.debug("Searching " + entity + " " + id);

    GetRequest request = new GetRequest();
    request.setEntity(resolveApitraryEntity(entity));
    request.setId(id);
    GetResponse response = resolveApitraryClient().send(request);

    T result = (T) new GetResponseUnmarshaller(this).unMarshall(response, entity);

    if (result != null) {
View Full Code Here

Examples of com.couchbase.client.core.message.kv.GetRequest

                    }
                    if (flushResponse.isDone()) {
                        return Observable.just(true);
                    }
                    while (true) {
                        GetResponse res = core.<GetResponse>send(new GetRequest(markerKey, bucket)).toBlocking().single();
                        if (res.status() == ResponseStatus.NOT_EXISTS) {
                            return Observable.just(true);
                        }
                    }
                }
View Full Code Here

Examples of com.google.appengine.api.search.GetRequest

      listResult = new ArrayList<News>();
    }
  }

  public void countTotal() {
    GetRequest request = GetRequest.newBuilder()
        .setReturningIdsOnly(true).build();
    totalResult = (int) INDEX.getRange(request).getResults().size();
  }
View Full Code Here

Examples of com.google.apphosting.api.DatastorePb.GetRequest

   *
   * @return A {@link Future} that provides the results of the operation.
   */
  private Future<Map<Key, Entity>> doBatchGetBySize( Transaction txn,
      final Iterable<Key> keys, final Map<Key, Entity> resultMap) {
    GetRequest baseReq = new GetRequest();
    if (txn != null) {
      TransactionImpl.ensureTxnActive(txn);
      baseReq.setTransaction(localTxnToRemoteTxn(txn));
    }
    if (getDatastoreServiceConfig().getReadPolicy().getConsistency() == EVENTUAL) {
      baseReq.setFailoverMs(ARBITRARY_FAILOVER_READ_MS);
      baseReq.setStrong(false);
    }
    final int baseEncodedReqSize = baseReq.encodingSize();

    final List<Future<GetResponse>> futures = new ArrayList<Future<GetResponse>>();
    GetRequest req = baseReq.clone();
    int encodedReqSize = baseEncodedReqSize;
    for (Key key : keys) {
      if (!key.isComplete()) {
        throw new IllegalArgumentException(key + " is incomplete.");
      }
      Reference ref = KeyTranslator.convertToPb(key);

      int encodedKeySize = Protocol.stringSize(ref.encodingSize()) + 1;
      if (getDatastoreServiceConfig().exceedsReadLimits(
          req.keySize() + 1, encodedReqSize + encodedKeySize)) {
        futures.add(makeAsyncCall(apiConfig, "Get", req, new GetResponse()));
        encodedReqSize = baseEncodedReqSize;
        req = baseReq.clone();
      }

      encodedReqSize += encodedKeySize;
      req.addKey(ref);
    }

    if (req.keySize() > 0) {
      futures.add(makeAsyncCall(apiConfig, "Get", req, new GetResponse()));
    }

    return registerInTransaction(txn,
        new IteratingAggregateFuture<GetResponse, Key, Map<Key, Entity>>(futures) {
View Full Code Here

Examples of com.google.apphosting.datastore.DatastoreV3Pb.GetRequest

    return new InternalTransactionV3(apiConfig, request.getApp(), future);
  }

  @Override
  protected final Future<Map<Key, Entity>> doBatchGet( Transaction txn, final Set<Key> keysToGet, final Map<Key, Entity> resultMap) {
    final GetRequest baseReq = new GetRequest();
    baseReq.setAllowDeferred(true);
    if (txn != null) {
      TransactionImpl.ensureTxnActive(txn);
      baseReq.setTransaction(InternalTransactionV3.localTxnToRemoteTxn(txn));
    }
    if (datastoreServiceConfig.getReadPolicy().getConsistency() == EVENTUAL) {
      baseReq.setFailoverMs(ARBITRARY_FAILOVER_READ_MS);
      baseReq.setStrong(false);
    }

    final boolean shouldUseMultipleBatches = getDatastoreType() != MASTER_SLAVE && txn == null
        && datastoreServiceConfig.getReadPolicy().getConsistency() != EVENTUAL;

    Iterator<GetRequest> batches = getByKeyBatcher.getBatches(keysToGet, baseReq,
        baseReq.getSerializedSize(), shouldUseMultipleBatches);
    List<Future<GetResponse>> futures = getByKeyBatcher.makeCalls(batches);

    return registerInTransaction(txn, new MultiFuture<GetResponse,  Map<Key, Entity>>(futures) {
      /**
       * A Map from a Reference without an App Id specified to the corresponding Key that the user
       * requested.  This is a workaround for the Remote API to support matching requested Keys to
       * Entities that may be from a different App Id .
       */
      private Map<Reference, Key> keyMapIgnoringAppId;

      @Override
      public Map<Key, Entity> get() throws InterruptedException, ExecutionException {
        try {
          aggregate(futures, null, null);
        } catch (TimeoutException e) {
          throw new RuntimeException(e);
        }
        return resultMap;
      }

      @Override
      public Map<Key, Entity> get(long timeout, TimeUnit unit)
          throws InterruptedException, ExecutionException, TimeoutException {
        aggregate(futures, timeout, unit);
        return resultMap;
      }

      /**
       * Aggregates the results of the given Futures and issues (synchronous) followup requests if
       * any results were deferred.
       *
       * @param currentFutures the Futures corresponding to the batches of the initial GetRequests.
       * @param timeout the timeout to use while waiting on the Future, or null for none.
       * @param timeoutUnit the unit of the timeout, or null for none.
       */
      private void aggregate(
          Iterable<Future<GetResponse>> currentFutures, Long timeout, TimeUnit timeoutUnit)
          throws ExecutionException, InterruptedException, TimeoutException {
        while (true) {
          List<Reference> deferredRefs = Lists.newLinkedList();

          for (Future<GetResponse> currentFuture : currentFutures) {
            GetResponse resp = getFutureWithOptionalTimeout(currentFuture, timeout, timeoutUnit);
            addEntitiesToResultMap(resp);
            deferredRefs.addAll(resp.deferreds());
          }

          if (deferredRefs.isEmpty()) {
            break;
          }

          Iterator<GetRequest> followupBatches = getByReferenceBatcher.getBatches(deferredRefs,
              baseReq, baseReq.getSerializedSize(), shouldUseMultipleBatches);
          currentFutures = getByReferenceBatcher.makeCalls(followupBatches);
        }
      }

      /**
 
View Full Code Here

Examples of com.google.nigori.common.NigoriMessages.GetRequest

    @Override
    public void handle(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
        IOException, JsonConversionException, NotFoundException, UnauthorisedException {

      String json = getJsonAsString(req, maxJsonQueryLength);
      GetRequest request = MessageLibrary.getRequestFromJson(json);
      GetResponse response = protocol.get(request);

      String jsonresponse = MessageLibrary.toJson(response);
      resp.setContentType(MessageLibrary.MIMETYPE_JSON);
      resp.setCharacterEncoding(MessageLibrary.CHARSET);
View Full Code Here

Examples of com.hazelcast.concurrent.atomicreference.client.GetRequest

        return (Boolean) invoke(new ContainsRequest(name, toData(expected)));
    }

    @Override
    public E get() {
        return invoke(new GetRequest(name));
    }
View Full Code Here

Examples of com.mashape.unirest.request.GetRequest

      asyncMonitorThread.interrupt();
    }
  }
 
  public static GetRequest get(String url) {
    return new GetRequest(HttpMethod.GET, url);
  }
View Full Code Here

Examples of com.opengamma.engine.cache.msg.GetRequest

    getRemoteCacheClient().sendPutMessage(request, CacheMessage.class);
  }

  @Override
  public FudgeMsg get(long identifier) {
    final GetRequest request = new GetRequest(getCacheKey().getViewCycleId(), getCacheKey()
        .getCalculationConfigurationName(), Collections.singleton(identifier));
    final GetResponse response = getRemoteCacheClient().sendGetMessage(request, GetResponse.class);
    final FudgeMsg data = response.getData().get(0);
    return data.isEmpty() ? null : data;
  }
View Full Code Here

Examples of com.rallydev.rest.request.GetRequest

        response.add("Defect", defect);
        defect.add("Errors", new JsonArray());
        defect.add("Warnings", new JsonArray());
        defect.addProperty("_ref", "/defect/1234");

        GetRequest request = new GetRequest("/defect/1234");
        doReturn(new Gson().toJson(response)).when(api.client).doGet(request.toUrl());
        GetResponse getResponse = api.get(request);

        verify(api.client).doGet(request.toUrl());
        Assert.assertTrue(getResponse.wasSuccessful());
        JsonObject obj = getResponse.getObject();
        assertEquals(obj.get("_ref").getAsString(), "/defect/1234");
    }
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.