Examples of AnnotationObjectDatastore


Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

       
        // store task information
        DateTime timestamp = DateTime.now().plus(delay);
        GaeTask storedTask = new GaeTask(task.getName(),
            agentId, timestamp.toString());
        ObjectDatastore datastore = new AnnotationObjectDatastore();
        datastore.store(storedTask);
       
        return task.getName();     
      } catch (MalformedURLException e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

      // stop the task
      Queue queue = QueueFactory.getDefaultQueue();
      queue.deleteTask(id);
     
      // remove stored task
      ObjectDatastore datastore = new AnnotationObjectDatastore();
      GaeTask storedTask = datastore.load(GaeTask.class, id);
      if (storedTask != null) {
        datastore.delete(storedTask);
      }     
    }
View Full Code Here

Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

     * Get the ids of all currently scheduled tasks
     * @return tasksIds
     */
    @Override
    public Set<String> getTasks() {
      ObjectDatastore datastore = new AnnotationObjectDatastore();
      QueryResultIterator<GaeTask> query = datastore.find()
          .type(GaeTask.class)
          .addFilter("agentId", FilterOperator.EQUAL, agentId).now();
     
      Set<String> taskIds = new HashSet<String>();
      while (query.hasNext()) {
        GaeTask task = query.next();
        if (new DateTime(task.getTimestamp()).isAfterNow()) {
          taskIds.add(task.getTaskId());
        }
        else {
          // clean up expired entry
          datastore.delete(task);
        }
      }
     
      return taskIds;
    }
View Full Code Here

Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

       
        // store task information
        DateTime timestamp = DateTime.now().plus(delay);
        GaeTask storedTask = new GaeTask(task.getName(),
            agentId, timestamp.toString());
        ObjectDatastore datastore = new AnnotationObjectDatastore();
        datastore.store(storedTask);
       
        return task.getName();     
      } catch (MalformedURLException e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

      // stop the task
      Queue queue = QueueFactory.getDefaultQueue();
      queue.deleteTask(id);
     
      // remove stored task
      ObjectDatastore datastore = new AnnotationObjectDatastore();
      GaeTask storedTask = datastore.load(GaeTask.class, id);
      if (storedTask != null) {
        datastore.delete(storedTask);
      }     
    }
View Full Code Here

Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

     * @return tasksIds
     */
    @Override
    @Access(AccessType.PUBLIC)
    public Set<String> getTasks() {
      ObjectDatastore datastore = new AnnotationObjectDatastore();
      QueryResultIterator<GaeTask> query = datastore.find()
          .type(GaeTask.class)
          .addFilter("agentId", FilterOperator.EQUAL, agentId).now();
     
      Set<String> taskIds = new HashSet<String>();
      while (query.hasNext()) {
        GaeTask task = query.next();
        if (new DateTime(task.getTimestamp()).isAfterNow()) {
          taskIds.add(task.getTaskId());
        }
        else {
          // clean up expired entry
          datastore.delete(task);
        }
      }
     
      return taskIds;
    }
View Full Code Here

Examples of com.google.code.twig.annotation.AnnotationObjectDatastore

   * @return
   */
  @SuppressWarnings("unchecked")
  private boolean loadFromDatastore () {
    try {
      ObjectDatastore datastore = new AnnotationObjectDatastore();
      KeyValue entity = datastore.load(KeyValue.class, getAgentId());
     
      @SuppressWarnings("rawtypes")
      Class<? extends HashMap> MAP_OBJECT_CLASS =
        (new HashMap<String, Serializable>()).getClass();
     
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  @Override
  public void setUp()
  {
    super.setUp();
    datastore = new AnnotationObjectDatastore();
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  {
    MusicFestival musicFestival = createFestival();

    Key key = datastore.store(musicFestival);

    AnnotationObjectDatastore typesafe2 = new AnnotationObjectDatastore();
    typesafe2.setActivationDepth(5);
    Object reloaded = typesafe2.load(key);

    // they should be different instances from distinct sessions
    assertNotSame(musicFestival, reloaded);

    // they should have the same data
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  @Test
  public void embeddedQueryTest()
  {
    {
      ObjectDatastore datastore = new AnnotationObjectDatastore(false);

      Foo foo = new Foo();
      foo.myKey = "foo1";
      foo.innerFoo = new InnerFoo("foo1Name");
      foo.moreInnerFoos = new HashMap<String, InnerFoo>();
      foo.moreInnerFoos.put("hello", new InnerFoo("helloFoo"));
      foo.moreInnerFoos.put("goodbye", new InnerFoo("goodbyeFoo"));

      datastore.store(foo);
    }

    {
      ObjectDatastore datastore = new AnnotationObjectDatastore(false);
      Foo foundFoo = datastore.load(Foo.class, "foo1");

      assertEquals("foo1", foundFoo.myKey);
      assertEquals("foo1Name", foundFoo.innerFoo.myName);
      assertEquals(2, foundFoo.moreInnerFoos.size());
      assertEquals("helloFoo", foundFoo.moreInnerFoos.get("hello").myName);
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.