Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.AsyncDatastoreService


    return result;
  }

  public AsyncDatastoreService asAsync()
  {
    return new AsyncDatastoreService()
    {
      public Collection<Transaction> getActiveTransactions()
      {
        return DummyDatastoreService.this.getActiveTransactions();
      }
View Full Code Here


    String originalNamespace = NamespaceManager.get();
   
    try {
      NamespaceManager.set(NAMESPACE);
     
      AsyncDatastoreService asyncDatastoreService = DatastoreServiceFactory.getAsyncDatastoreService();
     
      Query query = new Query("CounterNamesShard");
     
      if (null != this.lastUpdate) {
        Long now = new Date().getTime();
        query.addFilter("timestamp", FilterOperator.GREATER_THAN_OR_EQUAL, (now - (MAX_CLOCK_SKEW)));
      }
     
      PreparedQuery pq = asyncDatastoreService.prepare(query);
      Iterator<Entity> it = pq.asIterator();
     
      while (it.hasNext()) {
        Entity entity = it.next();
       
View Full Code Here

    String originalNamespace = NamespaceManager.get();
   
    try {
      NamespaceManager.set(NAMESPACE);
     
      AsyncDatastoreService asyncDatastoreService = DatastoreServiceFactory.getAsyncDatastoreService();
     
      Query query = new Query("CounterNamesShard");
     
      if (null != this.lastUpdate) {
        Long now = new Date().getTime();
        query.addFilter("timestamp", FilterOperator.GREATER_THAN_OR_EQUAL, (now - (MAX_CLOCK_SKEW)));
      }
     
      PreparedQuery pq = asyncDatastoreService.prepare(query);
      Iterator<Entity> it = pq.asIterator();
     
      return it;
    } finally {
      NamespaceManager.set(originalNamespace);
View Full Code Here

          dirtyShards.add(counterNameShard);
        }
      }
     
      if (!dirtyShards.isEmpty()) {
        AsyncDatastoreService ds = DatastoreServiceFactory.getAsyncDatastoreService();
        ds.put(dirtyShards);
      }
    } catch (Exception e) {
      _logger.severe("Unexpected exception while deleting counter: " + e);
    } finally {
      NamespaceManager.set(originalNamespace);
View Full Code Here

    return this.begin(this.createDefaultOpts());
  }

  @Override
  public ObjectifyPersister begin(ObjectifyOpts opts) {
    AsyncDatastoreService async = this.getAsyncDatastoreService(opts);
    return this.createObjectify(async, opts);
  }
View Full Code Here

  }

  @Test
  public void testGetAsyncDatastore() {

    AsyncDatastoreService datastore = asyncPersiter.getAsyncDatastore();
    ;
    assertNotNull(datastore);

  }
View Full Code Here

     *             if {@link IOException} occurred
     */
    protected void process(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String command = req.getParameter(COMMAND_NAME);
        AsyncDatastoreService ds =
            DatastoreServiceFactory.getAsyncDatastoreService();
        if (ROLLFORWARD_COMMAND.equalsIgnoreCase(command)) {
            String keyStr = req.getParameter(KEY_NAME);
            if (StringUtil.isEmpty(keyStr)) {
                logger.warning("The key parameter must not be null.");
View Full Code Here

    this.memcache = memcache;
  }

  @Override
  public List<MetaNamespace> loadMetaData() {
    AsyncDatastoreService datastore = DatastoreServiceFactory.getAsyncDatastoreService();
   
    // step 1 : load all namespaces
    Query nsQ = new Query(Query.NAMESPACE_METADATA_KIND).setKeysOnly();
    Iterable<Entity> namespaces = datastore.prepare(nsQ).asIterable();
   
    // step 2 : load all kinds and properties per each namespaces
    String defaultNs = NamespaceManager.get();
   
    Map<String, Iterable<Entity>> kindsMap = new HashMap<String, Iterable<Entity>>();
    Map<String, Iterable<Entity>> propertiesMap = new HashMap<String, Iterable<Entity>>();
    for (Entity e : namespaces) {
      String namespace = e.getKey().getName();
     
      if (isNullOrEmpty(namespace)) {
        NamespaceManager.set(defaultNs);
      } else {
        NamespaceManager.set(namespace);
      }
     
      Query kindQ = new Query(Query.KIND_METADATA_KIND).setKeysOnly();
      kindsMap.put(namespace, datastore.prepare(kindQ).asIterable());
     
      // ancestor query is not used here, properties will be grouped in memory
      // not keyOnly query because we will need to load property_representation
      Query propertyQ = new Query(Query.PROPERTY_METADATA_KIND);
      propertiesMap.put(namespace, datastore.prepare(propertyQ).asIterable());
    }
   
    // set namespace back
    NamespaceManager.set(defaultNs);
   
View Full Code Here

        throw new YaacException(ErrorCode.E201, null);
      }
    }
   
    // step3 : execute query
    AsyncDatastoreService datastore = DatastoreServiceFactory.getAsyncDatastoreService();
    Iterable<Entity> entities = datastore.prepare(gql.query()).asIterable(gql.fetchOptions());
   
    List<BlobInfoDTO> result = newLinkedList();
    for (Entity e : entities) {
      result.add(new BlobInfoDTO(e.getKey().getName(),
                (Date) e.getProperty(Blobstore.BLOB_INFO_CREATION),
View Full Code Here

   *
   * @return an AsyncDatastoreService configured per the specified options.
   */
  public AsyncDatastoreService createAsyncDatastoreService(DatastoreServiceConfig cfg, boolean globalCache)
  {
    AsyncDatastoreService ads = this.createRawAsyncDatastoreService(cfg);

    if (globalCache && this.registrar.isCacheEnabled())
      return new CachingAsyncDatastoreService(ads, this.entityMemcache);
    else
      return ads;
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.AsyncDatastoreService

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.