Package org.datanucleus.api

Examples of org.datanucleus.api.ApiAdapter


    }
  }

  public void testExceptionsJPA_DatastoreFailure() {
    setUpIterator(new DatastoreFailureException("boom"));
    ApiAdapter api = new JPAAdapter();
    RuntimeExceptionWrappingIterator rewi =
        new RuntimeExceptionWrappingIterator(api, iter, observer);
    try {
      rewi.hasNext();
      fail("expected exception");
View Full Code Here


    }
  }

  public void testExceptionsJPA_Timeout() {
    setUpIterator(new DatastoreTimeoutException("boom"));
    ApiAdapter api = new JPAAdapter();
    RuntimeExceptionWrappingIterator rewi =
        new RuntimeExceptionWrappingIterator(api, iter, observer);
    try {
      rewi.hasNext();
      fail("expected exception");
View Full Code Here

  }
  public void testNoExceptionsJDO() {
    Entity e1 = new Entity("foo");
    Entity e2 = new Entity("foo");
    Entity e3 = new Entity("foo");
    ApiAdapter api = new JDOAdapter();
    RuntimeExceptionWrappingIterator rewi =
        new RuntimeExceptionWrappingIterator(api, Arrays.asList(e1, e2, e3).iterator(), observer);
    int count = 0;
    while (rewi.hasNext()) {
      rewi.next();
View Full Code Here

    assertEquals(3, count);
  }

  public void testExceptionsJDO_IllegalArg() {
    setUpIterator(new IllegalArgumentException("boom"));
    ApiAdapter api = new JDOAdapter();
    RuntimeExceptionWrappingIterator rewi =
        new RuntimeExceptionWrappingIterator(api, iter, observer);
    try {
      rewi.hasNext();
      fail("expected exception");
View Full Code Here

    }
  }

  public void testExceptionsJDO_DatastoreFailure() {
    setUpIterator(new DatastoreFailureException("boom"));
    ApiAdapter api = new JDOAdapter();
    RuntimeExceptionWrappingIterator rewi =
        new RuntimeExceptionWrappingIterator(api, iter, observer);
    try {
      rewi.hasNext();
      fail("expected exception");
View Full Code Here

    }
  }

  public void testExceptionsJDO_Timeout() {
    setUpIterator(new DatastoreTimeoutException("boom"));
    ApiAdapter api = new JDOAdapter();
    RuntimeExceptionWrappingIterator rewi =
        new RuntimeExceptionWrappingIterator(api, iter, observer);
    try {
      rewi.hasNext();
      fail("expected exception");
View Full Code Here

      // NoTableManagedException because in some scenarios this isn't really
      // an error and DataNucleus catches it.  If we throw something else we'll
      // get exceptions about java.lang.String not being PersistenceCapable.
      // Really.  I saw it with my own eyes.
      Class cls = clr.classForName(className);
      ApiAdapter api = getApiAdapter();
      if (cls != null && !cls.isInterface() && !api.isPersistable(cls)) {
        throw new NoTableManagedException(
            "Class " + className + " does not seem to have been enhanced.  You may want to rerun "
            + "the enhancer and check for errors in the output.");
      }
      // Some othe problem.  Parent class's inaccurate error message is no
View Full Code Here

      // NoTableManagedException because in some scenarios this isn't really
      // an error and DataNucleus catches it.  If we throw something else we'll
      // get exceptions about java.lang.String not being PersistenceCapable.
      // Really.  I saw it with my own eyes.
      Class cls = clr.classForName(className);
      ApiAdapter api = getApiAdapter();
      if (cls != null && !cls.isInterface() && !api.isPersistable(cls)) {
        throw new NoTableManagedException(
            "Class " + className + " does not seem to have been enhanced.  You may want to rerun "
            + "the enhancer and check for errors in the output.");
      }
      // Some othe problem.  Parent class's inaccurate error message is no
View Full Code Here

      // NoTableManagedException because in some scenarios this isn't really
      // an error and DataNucleus catches it.  If we throw something else we'll
      // get exceptions about java.lang.String not being PersistenceCapable.
      // Really.  I saw it with my own eyes.
      Class cls = clr.classForName(className);
      ApiAdapter api = getApiAdapter();
      if (cls != null && !cls.isInterface() && !api.isPersistable(cls)) {
        throw new NoTableManagedException(
            "Class " + className + " does not seem to have been enhanced.  You may want to rerun "
            + "the enhancer and check for errors in the output.");
      }
      // Some othe problem.  Parent class's inaccurate error message is no
View Full Code Here

    }
    return count;
  }

  protected Key extractElementKey(ObjectManager om, Object element) {
    ApiAdapter apiAdapter = om.getApiAdapter();
    Object id = apiAdapter.getTargetKeyForSingleFieldIdentity(apiAdapter.getIdForObject(element));
    if (id == null) {
      return null;
    }
    // This is a child object so we know the pk is Key or encoded String
    return id instanceof Key ? (Key) id : KeyFactory.stringToKey((String) id);
View Full Code Here

TOP

Related Classes of org.datanucleus.api.ApiAdapter

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.