openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r567838 [2/4] - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ openjpa-kernel/src/main/java/org/apache/openjpa/event/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-persistence-jdbc/src/main/j...
Date Mon, 20 Aug 2007 21:33:13 GMT
Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java Mon Aug 20 14:32:54 2007
@@ -29,7 +29,7 @@
 
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.kernel.OpenJPAStateManager;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.util.ImplHelper;
@@ -68,7 +68,7 @@
     }
 
     public void testMetaData() {
-        ClassMetaData meta = OpenJPAPersistence.getMetaData(emf,
+        ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
             getUnenhancedClass());
         assertEquals(ClassRedefiner.canRedefineClasses(),
             meta.isIntercepting());
@@ -567,18 +567,18 @@
     }
 
     public void testGetMetaDataOfSubtype() {
-        ClassMetaData meta = OpenJPAPersistence.getMetaData(emf,
+        ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
             getUnenhancedClass());
         List<Class> subs =  ManagedClassSubclasser.prepareUnenhancedClasses(
             emf.getConfiguration(),
             Collections.singleton(getUnenhancedClass()), null);
-        assertSame(meta, OpenJPAPersistence.getMetaData(emf, subs.get(0)));
+        assertSame(meta, JPAFacadeHelper.getMetaData(emf, subs.get(0)));
 
-        meta = OpenJPAPersistence.getMetaData(emf, getUnenhancedSubclass());
+        meta = JPAFacadeHelper.getMetaData(emf, getUnenhancedSubclass());
         subs =  ManagedClassSubclasser.prepareUnenhancedClasses(
             emf.getConfiguration(),
             Collections.singleton(getUnenhancedSubclass()), null);
-        assertSame(meta, OpenJPAPersistence.getMetaData(emf, subs.get(0)));
+        assertSame(meta, JPAFacadeHelper.getMetaData(emf, subs.get(0)));
     }
 
     private class ListenerImpl

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/event/TestSJVMRemoteCommitProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/event/TestSJVMRemoteCommitProvider.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/event/TestSJVMRemoteCommitProvider.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/event/TestSJVMRemoteCommitProvider.java Mon Aug 20 14:32:54 2007
@@ -24,14 +24,15 @@
 import javax.persistence.Persistence;
 
 import org.apache.openjpa.persistence.test.PersistenceTestCase;
-import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 
 public class TestSJVMRemoteCommitProvider
     extends PersistenceTestCase {
 
-    private OpenJPAEntityManagerFactory emf1;
-    private OpenJPAEntityManagerFactory emf2;
+    private OpenJPAEntityManagerFactorySPI emf1;
+    private OpenJPAEntityManagerFactorySPI emf2;
     private ListenerImpl listen1;
     private ListenerImpl listen2;
 
@@ -40,7 +41,7 @@
         sjvm1.put("openjpa.RemoteCommitProvider", "sjvm");
         // set this to differentiate emf1 from the other emf below
         sjvm1.put("openjpa.DetachState", "true");
-        emf1 = OpenJPAPersistence.cast(
+        emf1 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.cast(
             Persistence.createEntityManagerFactory("test", sjvm1));
         emf1.getConfiguration().getRemoteCommitEventManager().addListener(
             listen1 = new ListenerImpl());
@@ -48,15 +49,15 @@
         Map sjvm2 = new HashMap();
         sjvm2.put("openjpa.RemoteCommitProvider", "sjvm");
         sjvm2.put("openjpa.DetachState", "false"); // differentiate from above
-        emf2 = OpenJPAPersistence.cast(
+        emf2 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.cast(
             Persistence.createEntityManagerFactory("test", sjvm2));
         emf2.getConfiguration().getRemoteCommitEventManager().addListener(
             listen2 = new ListenerImpl());
     }
 
     public void testSJVMRemoteCommitProvider() {
-        assertNotSame(OpenJPAPersistence.toBrokerFactory(emf1),
-            OpenJPAPersistence.toBrokerFactory(emf2));
+        assertNotSame(JPAFacadeHelper.toBrokerFactory(emf1),
+            JPAFacadeHelper.toBrokerFactory(emf2));
         
         emf1.getConfiguration().getRemoteCommitEventManager()
             .getRemoteCommitProvider().broadcast(
@@ -82,4 +83,4 @@
         public void close() {
         }
     }
-}
\ No newline at end of file
+}

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java Mon Aug 20 14:32:54 2007
@@ -28,8 +28,8 @@
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.schema.SchemaTool;
-import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.simple.AllFieldTypes;
 
 import junit.framework.TestCase;
@@ -39,13 +39,13 @@
     extends TestCase {
 
     private JDBCConfiguration _conf;
-    private OpenJPAEntityManagerFactory emf;
+    private OpenJPAEntityManagerFactorySPI emf;
 
     public void setUp() {
         Map props = new HashMap(System.getProperties());
         props.put("openjpa.MetaDataFactory",
             "jpa(Types=" + AllFieldTypes.class.getName() + ")");
-        emf = OpenJPAPersistence.cast( 
+        emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.cast( 
             Persistence.createEntityManagerFactory("test", props));
         _conf = (JDBCConfiguration) emf.getConfiguration();
         

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolTemporal.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolTemporal.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolTemporal.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolTemporal.java Mon Aug 20 14:32:54 2007
@@ -22,6 +22,7 @@
 import java.sql.SQLException;
 
 import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.simple.TemporalFieldTypes;
 import org.apache.openjpa.persistence.test.SingleEMTestCase;
 
@@ -32,7 +33,8 @@
     }
 
     public void testMappingToolTemporal() throws IOException, SQLException {
-        ClassMapping mapping = (ClassMapping) OpenJPAPersistence.cast(emf)
+        ClassMapping mapping = (ClassMapping)
+            ((OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.cast(emf))
                 .getConfiguration().getMetaDataRepositoryInstance()
                 .getMetaData("TemporalFieldTypes", getClass().getClassLoader(),
                         true);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryEventManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryEventManager.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryEventManager.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryEventManager.java Mon Aug 20 14:32:54 2007
@@ -24,14 +24,15 @@
 import org.apache.openjpa.event.BrokerFactoryListener;
 import org.apache.openjpa.event.BrokerFactoryEvent;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 
 public class TestBrokerFactoryEventManager
     extends TestCase {
 
     public void testCreateEvent() {
-        OpenJPAEntityManagerFactory emf = OpenJPAPersistence.cast(
-            Persistence.createEntityManagerFactory("test"));
+        OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI)
+            OpenJPAPersistence.cast(
+                Persistence.createEntityManagerFactory("test"));
         ListenerImpl listener = new ListenerImpl();
         emf.getConfiguration().getBrokerFactoryEventManager()
             .addListener(listener);
@@ -44,8 +45,10 @@
 
         boolean createEventReceived = false;
 
-        public void afterBrokerFactoryCreate(BrokerFactoryEvent event) {
-            createEventReceived = true;
+        public void eventFired(BrokerFactoryEvent event) {
+            if (event.getEventType()
+                == BrokerFactoryEvent.BROKER_FACTORY_CREATED)
+                createEventReceived = true;
         }
     }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryListenerRegistry.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryListenerRegistry.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryListenerRegistry.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestBrokerFactoryListenerRegistry.java Mon Aug 20 14:32:54 2007
@@ -22,6 +22,7 @@
 
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.simple.AllFieldTypes;
 import org.apache.openjpa.event.AbstractLifecycleListener;
 import org.apache.openjpa.event.AbstractTransactionListener;
@@ -35,13 +36,13 @@
     private int beginCount = 0;
 
     @Override
-    protected void setUp() {
+    public void setUp() {
         super.setUp(AllFieldTypes.class);
     }
 
     @Override
-    protected OpenJPAEntityManagerFactory createEMF(Object... props) {
-        OpenJPAEntityManagerFactory emf = super.createEMF(props);
+    protected OpenJPAEntityManagerFactorySPI createEMF(Object... props) {
+        OpenJPAEntityManagerFactorySPI emf = super.createEMF(props);
         emf.addLifecycleListener(new AbstractLifecycleListener() {
             @Override
             public void beforePersist(LifecycleEvent event) {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestQueryCompilationCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestQueryCompilationCache.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestQueryCompilationCache.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestQueryCompilationCache.java Mon Aug 20 14:32:54 2007
@@ -26,9 +26,9 @@
 import org.apache.openjpa.kernel.QueryImpl.Compilation;
 import org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.ParsedJPQL;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
-import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
 import org.apache.openjpa.persistence.OpenJPAQuery;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.simple.NamedEntity;
 
 import junit.framework.TestCase;
@@ -41,8 +41,9 @@
         Map props = new HashMap(System.getProperties());
         props.put("openjpa.MetaDataFactory", "jpa(Types=" 
             + NamedEntity.class.getName() + ")");
-        OpenJPAEntityManagerFactory emf = OpenJPAPersistence.cast(
-            Persistence.createEntityManagerFactory("test", props));
+        OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI)
+            OpenJPAPersistence.cast(
+                Persistence.createEntityManagerFactory("test", props));
 
         Map cache = emf.getConfiguration().getQueryCompilationCacheInstance();
         cache.clear();

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestArrayFieldsInDataCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestArrayFieldsInDataCache.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestArrayFieldsInDataCache.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestArrayFieldsInDataCache.java Mon Aug 20 14:32:54 2007
@@ -18,7 +18,6 @@
  */
 package org.apache.openjpa.persistence.datacache;
 
-import java.util.Map;
 import java.util.Arrays;
 import javax.persistence.EntityManager;
 
@@ -26,6 +25,8 @@
 import org.apache.openjpa.kernel.PCData;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.StoreCacheImpl;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.persistence.simple.AllFieldTypes;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
@@ -54,17 +55,18 @@
         // get the external and internal forms of the ID for cache
         // interrogation and data validation
         jpaOid = OpenJPAPersistence.cast(em).getObjectId(aft);
-        internalOid = OpenJPAPersistence.toBroker(em).getObjectId(aft);
+        internalOid = JPAFacadeHelper.toBroker(em).getObjectId(aft);
 
         em.close();
     }
 
     public void testArrayOfStrings() {
         // check that the data cache contains an efficient representation
-        DataCache cache = OpenJPAPersistence.cast(emf).getStoreCache()
-            .getDelegate();
+        StoreCacheImpl storeCache = (StoreCacheImpl)
+            OpenJPAPersistence.cast(emf).getStoreCache();
+        DataCache cache = storeCache.getDelegate();
         PCData data = cache.get(internalOid);
-        ClassMetaData meta = OpenJPAPersistence.getMetaData(emf,
+        ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
             AllFieldTypes.class);
         Object cachedFieldData =
             data.getData(meta.getField("arrayOfStrings").getIndex());
@@ -82,10 +84,11 @@
 
     public void testArrayOfInts() {
         // check that the data cache contains an efficient representation
-        DataCache cache = OpenJPAPersistence.cast(emf).getStoreCache()
-            .getDelegate();
+        StoreCacheImpl storeCache = (StoreCacheImpl)
+            OpenJPAPersistence.cast(emf).getStoreCache();
+        DataCache cache = storeCache.getDelegate();
         PCData data = cache.get(internalOid);
-        ClassMetaData meta = OpenJPAPersistence.getMetaData(emf,
+        ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
             AllFieldTypes.class);
         Object cachedFieldData =
             data.getData(meta.getField("arrayOfInts").getIndex());

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkUpdatesAndVersionColumn.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkUpdatesAndVersionColumn.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkUpdatesAndVersionColumn.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkUpdatesAndVersionColumn.java Mon Aug 20 14:32:54 2007
@@ -24,7 +24,7 @@
 import javax.persistence.RollbackException;
 
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.meta.FieldMapping;
@@ -54,7 +54,7 @@
     }
 
     public void testOplockFieldMapping() {
-        ClassMapping cm = (ClassMapping) OpenJPAPersistence.getMetaData(
+        ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(
             emf, OptimisticLockInstance.class);
         FieldMapping fm = cm.getFieldMapping("oplock");
         assertEquals(1, fm.getColumns().length);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java Mon Aug 20 14:32:54 2007
@@ -27,6 +27,8 @@
 import javax.sql.DataSource;
 
 import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 import org.apache.openjpa.event.RemoteCommitListener;
 import org.apache.openjpa.event.RemoteCommitEvent;
@@ -78,8 +80,8 @@
         em = emf.createEntityManager();
         em.getTransaction().begin();
         OptimisticLockInstance oli = em.find(OptimisticLockInstance.class, pk);
-        Object oid = OpenJPAPersistence.toOpenJPAObjectId(
-            OpenJPAPersistence.getMetaData(oli),
+        Object oid = JPAFacadeHelper.toOpenJPAObjectId(
+            JPAFacadeHelper.getMetaData(oli),
             OpenJPAPersistence.cast(em).getObjectId(oli));
         int firstOpLockValue = oli.getOpLock();
         em.lock(oli, LockModeType.READ);
@@ -88,8 +90,9 @@
         // via direct SQL in a separate transaction
         int secondOpLockValue = firstOpLockValue + 1;
 
-        DataSource ds = (DataSource) OpenJPAPersistence.cast(em)
-            .getEntityManagerFactory().getConfiguration()
+        OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI)
+            OpenJPAPersistence.cast(em).getEntityManagerFactory();
+        DataSource ds = (DataSource) emf.getConfiguration()
             .getConnectionFactory();
         Connection c = ds.getConnection();
         c.setAutoCommit(false);
@@ -120,7 +123,7 @@
         // assert that the oplock column is set to the one that
         // happened in the out-of-band transaction
         em.close();
-        em = emf.createEntityManager();
+        em = this.emf.createEntityManager();
         oli = em.find(OptimisticLockInstance.class, pk);
 
         // If this fails, then the data cache has the wrong value.

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachmentOneMany.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachmentOneMany.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachmentOneMany.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachmentOneMany.java Mon Aug 20 14:32:54 2007
@@ -21,8 +21,8 @@
 import javax.persistence.EntityManager;
 
 import junit.textui.TestRunner;
-import org.apache.openjpa.kernel.AutoDetach;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.AutoDetachType;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
 /**
@@ -41,7 +41,8 @@
         long id = createParentAndChildren();
     
         EntityManager em = emf.createEntityManager();
-        OpenJPAPersistence.cast(em).setAutoDetach(AutoDetach.DETACH_NONTXREAD);
+        OpenJPAPersistence.cast(em).setAutoDetach(
+            AutoDetachType.NON_TRANSACTIONAL_READ);
         DetachmentOneManyParent parent = em.find(DetachmentOneManyParent.class,
             id);
         assertNotNull(parent);
@@ -53,7 +54,8 @@
         long id = createParentAndChildren();
      
         EntityManager em = emf.createEntityManager();
-        OpenJPAPersistence.cast(em).setAutoDetach(AutoDetach.DETACH_NONTXREAD);
+        OpenJPAPersistence.cast(em).setAutoDetach(
+            AutoDetachType.NON_TRANSACTIONAL_READ);
         DetachmentOneManyParent parent = em.find(DetachmentOneManyParent.class,
             id);
         assertNotNull(parent);
@@ -74,7 +76,8 @@
         long id = createParentAndChildren();
         
         EntityManager em = emf.createEntityManager();
-        OpenJPAPersistence.cast(em).setAutoDetach(AutoDetach.DETACH_NONTXREAD);
+        OpenJPAPersistence.cast(em).setAutoDetach(
+            AutoDetachType.NON_TRANSACTIONAL_READ);
         DetachmentOneManyParent parent = em.find(DetachmentOneManyParent.class,
             id);
         assertNotNull(parent);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java Mon Aug 20 14:32:54 2007
@@ -23,7 +23,6 @@
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.meta.Discriminator;
 import org.apache.openjpa.meta.JavaTypes;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
 public class TestDiscriminatorTypes extends SingleEMFTestCase {
@@ -93,7 +92,7 @@
     }
 
     private ClassMapping getMapping(String name) {
-        return (ClassMapping) OpenJPAPersistence.cast(emf).getConfiguration()
+        return (ClassMapping) emf.getConfiguration()
                 .getMetaDataRepositoryInstance().getMetaData(name,
                         getClass().getClassLoader(), true);
     }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestPersistentMapTableConfiguration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestPersistentMapTableConfiguration.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestPersistentMapTableConfiguration.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestPersistentMapTableConfiguration.java Mon Aug 20 14:32:54 2007
@@ -18,11 +18,9 @@
  */
 package org.apache.openjpa.persistence.fields;
 
-import javax.persistence.EntityManager;
-
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 
 public class TestPersistentMapTableConfiguration
@@ -33,7 +31,7 @@
     }
 
     public void testPersistentMapMetaData() {
-        ClassMapping cm = (ClassMapping) OpenJPAPersistence.getMetaData(emf,
+        ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(emf,
             NonstandardMappingEntity.class);
         assertEquals("NONSTD_MAPPING_MAP",
             cm.getFieldMapping("map").getTable().getName());

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestIsolationLevelOverride.java Mon Aug 20 14:32:54 2007
@@ -22,10 +22,9 @@
 
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 import org.apache.openjpa.persistence.simple.AllFieldTypes;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAQuery;
 import org.apache.openjpa.persistence.InvalidStateException;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.HSQLDictionary;
@@ -54,8 +53,7 @@
 
     public void testIsolationLevelOverride(boolean useHintsAndQueries,
         boolean useStringHints) {
-        OpenJPAEntityManager em =
-            OpenJPAPersistence.cast(emf.createEntityManager());
+        OpenJPAEntityManagerSPI em = emf.createEntityManager();
         DBDictionary dict = ((JDBCConfiguration) em.getConfiguration())
             .getDBDictionaryInstance();
 

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestJDBCEnumToKernelConstantMappings.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestJDBCEnumToKernelConstantMappings.java?rev=567838&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestJDBCEnumToKernelConstantMappings.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestJDBCEnumToKernelConstantMappings.java Mon Aug 20 14:32:54 2007
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence.jdbc;
+
+import junit.framework.TestCase;
+import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
+import org.apache.openjpa.jdbc.kernel.LRSSizes;
+import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
+
+public class TestJDBCEnumToKernelConstantMappings
+    extends TestCase {
+
+    public void testEagerFetchModes() {
+        assertEquals(EagerFetchModes.EAGER_NONE,
+            EagerFetchType.NONE.toKernelConstant());
+        assertEquals(EagerFetchType.NONE,
+            EagerFetchType.fromKernelConstant(
+                EagerFetchModes.EAGER_NONE));
+        assertEquals(EagerFetchType.NONE.toKernelConstant(),
+            EagerFetchType.NONE.ordinal());
+
+        assertEquals(EagerFetchModes.EAGER_JOIN,
+            EagerFetchType.JOIN.toKernelConstant());
+        assertEquals(EagerFetchType.JOIN,
+            EagerFetchType.fromKernelConstant(
+                EagerFetchModes.EAGER_JOIN));
+        assertEquals(EagerFetchType.JOIN.toKernelConstant(),
+            EagerFetchType.JOIN.ordinal());
+
+        assertEquals(EagerFetchModes.EAGER_PARALLEL,
+            EagerFetchType.PARALLEL.toKernelConstant());
+        assertEquals(EagerFetchType.PARALLEL,
+            EagerFetchType.fromKernelConstant(
+                EagerFetchModes.EAGER_PARALLEL));
+        assertEquals(EagerFetchType.PARALLEL.toKernelConstant(),
+            EagerFetchType.PARALLEL.ordinal());
+
+        assertEquals(getConstantCount(EagerFetchModes.class),
+            EagerFetchType.values().length);
+    }
+
+    public void testLRSSizeType() {
+        assertEquals(LRSSizes.SIZE_UNKNOWN,
+            LRSSizeType.UNKNOWN.toKernelConstant());
+        assertEquals(LRSSizeType.UNKNOWN,
+            LRSSizeType.fromKernelConstant(
+                LRSSizes.SIZE_UNKNOWN));
+        assertEquals(LRSSizeType.UNKNOWN.toKernelConstant(),
+            LRSSizeType.UNKNOWN.ordinal());
+
+        assertEquals(LRSSizes.SIZE_LAST,
+            LRSSizeType.LAST.toKernelConstant());
+        assertEquals(LRSSizeType.LAST,
+            LRSSizeType.fromKernelConstant(
+                LRSSizes.SIZE_LAST));
+        assertEquals(LRSSizeType.LAST.toKernelConstant(),
+            LRSSizeType.LAST.ordinal());
+
+        assertEquals(LRSSizes.SIZE_QUERY,
+            LRSSizeType.QUERY.toKernelConstant());
+        assertEquals(LRSSizeType.QUERY,
+            LRSSizeType.fromKernelConstant(
+                LRSSizes.SIZE_QUERY));
+        assertEquals(LRSSizeType.QUERY.toKernelConstant(),
+            LRSSizeType.QUERY.ordinal());
+
+        assertEquals(getConstantCount(LRSSizes.class),
+            LRSSizeType.values().length);
+    }
+
+    public void testJoinSyntaxType() {
+        assertEquals(JoinSyntaxes.SYNTAX_SQL92,
+            JoinSyntaxType.SQL92.toKernelConstant());
+        assertEquals(JoinSyntaxType.SQL92,
+            JoinSyntaxType.fromKernelConstant(
+                JoinSyntaxes.SYNTAX_SQL92));
+        assertEquals(JoinSyntaxType.SQL92.toKernelConstant(),
+            JoinSyntaxType.SQL92.ordinal());
+
+        assertEquals(JoinSyntaxes.SYNTAX_TRADITIONAL,
+            JoinSyntaxType.TRADITIONAL.toKernelConstant());
+        assertEquals(JoinSyntaxType.TRADITIONAL,
+            JoinSyntaxType.fromKernelConstant(
+                JoinSyntaxes.SYNTAX_TRADITIONAL));
+        assertEquals(JoinSyntaxType.TRADITIONAL.toKernelConstant(),
+            JoinSyntaxType.TRADITIONAL.ordinal());
+
+        assertEquals(JoinSyntaxes.SYNTAX_DATABASE,
+            JoinSyntaxType.DATABASE.toKernelConstant());
+        assertEquals(JoinSyntaxType.DATABASE,
+            JoinSyntaxType.fromKernelConstant(
+                JoinSyntaxes.SYNTAX_DATABASE));
+        assertEquals(JoinSyntaxType.DATABASE.toKernelConstant(),
+            JoinSyntaxType.DATABASE.ordinal());
+
+        assertEquals(getConstantCount(JoinSyntaxes.class),
+            JoinSyntaxType.values().length);
+    }
+
+    private int getConstantCount(Class cls) {
+        return cls.getDeclaredFields().length;
+    }
+}
\ No newline at end of file

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java Mon Aug 20 14:32:54 2007
@@ -26,6 +26,7 @@
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAQuery;
 import org.apache.openjpa.persistence.InvalidStateException;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.HSQLDictionary;
@@ -50,8 +51,7 @@
     }
     public void testOptimizeForClause(boolean hint,
         boolean find, boolean queryHint) {
-        OpenJPAEntityManager em =
-            OpenJPAPersistence.cast(emf.createEntityManager());
+        OpenJPAEntityManagerSPI em = emf.createEntityManager();
         DBDictionary dict = ((JDBCConfiguration) em.getConfiguration())
             .getDBDictionaryInstance();
 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestSelectForUpdateOverride.java Mon Aug 20 14:32:54 2007
@@ -18,14 +18,12 @@
  */
 package org.apache.openjpa.persistence.jdbc;
 
-import javax.persistence.EntityManager;
 import javax.persistence.LockModeType;
 
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 import org.apache.openjpa.persistence.simple.AllFieldTypes;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.FetchPlan;
-import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.HSQLDictionary;
@@ -42,7 +40,7 @@
     }
 
     public void testSelectForUpdateOverride() {
-        OpenJPAEntityManager em =
+        OpenJPAEntityManagerSPI em = (OpenJPAEntityManagerSPI)
             OpenJPAPersistence.cast(emf.createEntityManager());
         DBDictionary dict = ((JDBCConfiguration) em.getConfiguration())
             .getDBDictionaryInstance();

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestTableNamesDefaultToEntityNames.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestTableNamesDefaultToEntityNames.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestTableNamesDefaultToEntityNames.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestTableNamesDefaultToEntityNames.java Mon Aug 20 14:32:54 2007
@@ -19,7 +19,7 @@
 package org.apache.openjpa.persistence.simple;
 
 import org.apache.openjpa.jdbc.meta.ClassMapping;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
 public class TestTableNamesDefaultToEntityNames
@@ -30,7 +30,7 @@
     }
 
     public void testEntityNames() {
-        ClassMapping cm = (ClassMapping) OpenJPAPersistence.getMetaData(
+        ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(
             emf, NamedEntity.class);
         assertEquals("named", cm.getTable().getName());
     }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java Mon Aug 20 14:32:54 2007
@@ -32,8 +32,8 @@
 import org.apache.openjpa.kernel.AbstractBrokerFactory;
 import org.apache.openjpa.kernel.Broker;
 import org.apache.openjpa.meta.ClassMetaData;
-import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
 
 /**
  * Base test class providing persistence utilities.
@@ -55,7 +55,7 @@
      * @param props list of persistent types used in testing and/or 
      * configuration values in the form key,value,key,value...
      */
-    protected OpenJPAEntityManagerFactory createEMF(Object... props) {
+    protected OpenJPAEntityManagerFactorySPI createEMF(Object... props) {
         Map map = new HashMap(System.getProperties());
         List<Class> types = new ArrayList<Class>();
         boolean prop = false;
@@ -84,7 +84,7 @@
                 "jpa(Types=" + buf.toString() + ")");
         }
 
-        return (OpenJPAEntityManagerFactory) Persistence.
+        return (OpenJPAEntityManagerFactorySPI) Persistence.
             createEntityManagerFactory("test", map);
     }
 
@@ -97,12 +97,12 @@
         if (!emf.isOpen())
             return false;
 
-        for (Iterator iter = ((AbstractBrokerFactory) OpenJPAPersistence
+        for (Iterator iter = ((AbstractBrokerFactory) JPAFacadeHelper
             .toBrokerFactory(emf)).getOpenBrokers().iterator();
             iter.hasNext(); ) {
             Broker b = (Broker) iter.next();
             if (b != null && !b.isClosed()) {
-                EntityManager em = OpenJPAPersistence.toEntityManager(b);
+                EntityManager em = JPAFacadeHelper.toEntityManager(b);
                 if (em.getTransaction().isActive())
                     em.getTransaction().rollback();
                 em.close();
@@ -122,7 +122,7 @@
 
         List<ClassMetaData> metas = new ArrayList<ClassMetaData>(types.length);
         for (Class c : types) {
-            ClassMetaData meta = OpenJPAPersistence.getMetaData(emf, c);
+            ClassMetaData meta = JPAFacadeHelper.getMetaData(emf, c);
             if (meta != null)
                 metas.add(meta);
         }
@@ -136,7 +136,7 @@
     protected void clear(EntityManagerFactory emf) {
         if (emf == null)
             return;
-        clear(emf, ((OpenJPAEntityManagerFactory) emf).getConfiguration().
+        clear(emf, ((OpenJPAEntityManagerFactorySPI) emf).getConfiguration().
             getMetaDataRepositoryInstance().getMetaDatas());
     }
 
@@ -164,7 +164,7 @@
      * Return the entity name for the given type.   
      */
     protected String entityName(EntityManagerFactory emf, Class c) {
-        ClassMetaData meta = OpenJPAPersistence.getMetaData(emf, c);
+        ClassMetaData meta = JPAFacadeHelper.getMetaData(emf, c);
         return (meta == null) ? null : meta.getTypeAlias();
     }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java Mon Aug 20 14:32:54 2007
@@ -18,17 +18,21 @@
  */
 package org.apache.openjpa.persistence.test;
 
-import java.util.Map;
-import java.util.HashMap;
-import javax.persistence.Persistence;
-
-import junit.framework.TestCase;
-import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 
 public abstract class SingleEMFTestCase
     extends PersistenceTestCase {
 
-    protected OpenJPAEntityManagerFactory emf;
+    protected OpenJPAEntityManagerFactorySPI emf;
+
+    /**
+     * Call {@link #setUp(Object...)} with no arguments so that the emf
+     * set-up happens even if <code>setUp()</code> is not called from the
+     * subclass.
+     */
+    protected void setUp() {
+        setUp(new Object[0]);
+    }
 
     /**
      * Initialize entity manager factory. Put {@link #CLEAR_TABLES} in

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/query/TestXMLCustomerOrder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/query/TestXMLCustomerOrder.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/query/TestXMLCustomerOrder.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/query/TestXMLCustomerOrder.java Mon Aug 20 14:32:54 2007
@@ -35,6 +35,8 @@
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 import org.apache.openjpa.persistence.xmlmapping.xmlbindings.myaddress.*;
 import org.apache.openjpa.persistence.xmlmapping.entities.*;
@@ -52,7 +54,7 @@
     private boolean enabled = false;
 
     public void setUp() {
-        OpenJPAEntityManagerFactory emf = createEMF();
+        OpenJPAEntityManagerFactorySPI emf = createEMF();
         DBDictionary dict = ((JDBCConfiguration) emf.getConfiguration())
             .getDBDictionaryInstance();
 
@@ -79,8 +81,7 @@
         if (!enabled)
             return;
 
-        OpenJPAEntityManager em =
-            OpenJPAPersistence.cast(emf.createEntityManager());
+        OpenJPAEntityManagerSPI em = emf.createEntityManager();
         DBDictionary dict = ((JDBCConfiguration) em.getConfiguration())
             .getDBDictionaryInstance();
 

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationBuilder.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationBuilder.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationBuilder.java Mon Aug 20 14:32:54 2007
@@ -33,6 +33,7 @@
  *
  * @author Gokhan Ergul
  * @since 1.0.0
+ * @nojavadoc
  */
 public class AnnotationBuilder {
 
@@ -155,46 +156,45 @@
         return sb.toString();
     }
 
-}
+    class AnnotationEntry {
 
-class AnnotationEntry {
+        String key;
+        Object value;
 
-    String key;
-    Object value;
-
-    AnnotationEntry(String key, Object value) {
-        this.key = key;
-        this.value = value;
-    }
+        AnnotationEntry(String key, Object value) {
+            this.key = key;
+            this.value = value;
+        }
 
-    @SuppressWarnings("unchecked")
-    void toString(StringBuilder sb) {
-        if (null != key)
-            sb.append(key).append("=");
-
-        List.class.getTypeParameters();
-        if (value instanceof List) {
-            sb.append("{");
-            List<AnnotationBuilder> l = (List<AnnotationBuilder>) value;
-            for (Iterator<AnnotationBuilder> i = l.iterator(); i.hasNext();) {
-                AnnotationBuilder ab =  i.next();
-                sb.append(ab.toString());
-                if (i.hasNext())
-                    sb.append(", ");
+        @SuppressWarnings("unchecked")
+        void toString(StringBuilder sb) {
+            if (null != key)
+                sb.append(key).append("=");
+
+            List.class.getTypeParameters();
+            if (value instanceof List) {
+                sb.append("{");
+                List<AnnotationBuilder> l = (List<AnnotationBuilder>) value;
+                for (Iterator<AnnotationBuilder> i = l.iterator(); i.hasNext();) {
+                    AnnotationBuilder ab =  i.next();
+                    sb.append(ab.toString());
+                    if (i.hasNext())
+                        sb.append(", ");
+                }
+                sb.append("}");
+            } else if (value instanceof Class) {
+                String cls = ((Class) value).getName().replace('$', '.');
+                sb.append(cls).append(".class");
+            } else if (value instanceof String) {
+                sb.append('"').append(value).append('"');
+            } else if (value instanceof Enum) {
+                sb.append(AnnotationBuilder.enumToString((Enum) value));
+            } else if (value instanceof EnumSet) {
+                sb.append(AnnotationBuilder.enumSetToString((EnumSet) value));
+            } else {
+                sb.append(value);
             }
-            sb.append("}");
-        } else if (value instanceof Class) {
-            String cls = ((Class) value).getName().replace('$', '.');
-            sb.append(cls).append(".class");
-        } else if (value instanceof String) {
-            sb.append('"').append(value).append('"');
-        } else if (value instanceof Enum) {
-            sb.append(AnnotationBuilder.enumToString((Enum) value));
-        } else if (value instanceof EnumSet) {
-            sb.append(AnnotationBuilder.enumSetToString((EnumSet) value));
-        } else {
-            sb.append(value);
         }
-    }
 
-}
+    }
+}
\ No newline at end of file

Added: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoClearType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoClearType.java?rev=567838&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoClearType.java (added)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoClearType.java Mon Aug 20 14:32:54 2007
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence;
+
+import org.apache.openjpa.kernel.AutoClear;
+
+/**
+ * The possible settings for the auto-clear behavior of an
+ * {@link OpenJPAEntityManager}.
+ *
+ * @since 1.0.0
+ * @published
+ */
+public enum AutoClearType {
+    DATASTORE(AutoClear.CLEAR_DATASTORE),
+    ALL(AutoClear.CLEAR_ALL);
+
+    private final int autoClearConstant;
+
+    private AutoClearType(int value) {
+        autoClearConstant = value;
+    }
+
+    int toKernelConstant() {
+        return autoClearConstant;
+    }
+
+    static AutoClearType fromKernelConstant(int kernelConstant) {
+        switch (kernelConstant) {
+            case AutoClear.CLEAR_DATASTORE:
+                return DATASTORE;
+
+            case AutoClear.CLEAR_ALL:
+                return ALL;
+
+            default:
+                throw new IllegalArgumentException(kernelConstant + "");
+        }
+    }
+}

Added: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoDetachType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoDetachType.java?rev=567838&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoDetachType.java (added)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AutoDetachType.java Mon Aug 20 14:32:54 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence;
+
+import java.util.EnumSet;
+
+import org.apache.openjpa.kernel.AutoDetach;
+
+/**
+ * The possible settings for the auto-detach behavior of an
+ * {@link OpenJPAEntityManager}.
+ *
+ * @since 1.0.0
+ * @published
+ */
+public enum AutoDetachType {
+    CLOSE(AutoDetach.DETACH_CLOSE),
+    COMMIT(AutoDetach.DETACH_COMMIT),
+    NON_TRANSACTIONAL_READ(AutoDetach.DETACH_NONTXREAD),
+    ROLLBACK(AutoDetach.DETACH_ROLLBACK);
+
+    private final int autoDetachConstant;
+
+    private AutoDetachType(int value) {
+        autoDetachConstant = value;
+    }
+
+    public static EnumSet<AutoDetachType> toEnumSet(int autoDetach) {
+        EnumSet<AutoDetachType> types = EnumSet.noneOf(AutoDetachType.class);
+        if ((autoDetach & AutoDetach.DETACH_CLOSE) != 0)
+            types.add(CLOSE);
+        if ((autoDetach & AutoDetach.DETACH_COMMIT) != 0)
+            types.add(COMMIT);
+        if ((autoDetach & AutoDetach.DETACH_NONTXREAD) != 0)
+            types.add(NON_TRANSACTIONAL_READ);
+        if ((autoDetach & AutoDetach.DETACH_ROLLBACK) != 0)
+            types.add(ROLLBACK);
+        return types;
+    }
+
+    public static int fromEnumSet(EnumSet<AutoDetachType> types) {
+        int autoDetach = 0;
+        for (AutoDetachType type : types)
+            autoDetach |= type.autoDetachConstant;
+        return autoDetach;
+    }
+}

Added: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/CallbackType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/CallbackType.java?rev=567838&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/CallbackType.java (added)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/CallbackType.java Mon Aug 20 14:32:54 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence;
+
+import java.util.EnumSet;
+
+import org.apache.openjpa.event.CallbackModes;
+
+/**
+ * The possible settings for the callback behavior of an
+ * {@link OpenJPAEntityManager}.
+ *
+ * @since 1.0.0
+ * @published
+ */
+public enum CallbackType {
+    FAIL_FAST(CallbackModes.CALLBACK_FAIL_FAST),
+    IGNORE(CallbackModes.CALLBACK_IGNORE),
+    LOG(CallbackModes.CALLBACK_LOG),
+    RETHROW(CallbackModes.CALLBACK_RETHROW),
+    ROLLBACK(CallbackModes.CALLBACK_ROLLBACK);
+
+    private final int callbackMode;
+
+    private CallbackType(int value) {
+        callbackMode = value;
+    }
+
+    public static EnumSet<CallbackType> toEnumSet(int callback) {
+        EnumSet<CallbackType> types = EnumSet.noneOf(CallbackType.class);
+        if ((callback & CallbackModes.CALLBACK_FAIL_FAST) != 0)
+            types.add(FAIL_FAST);
+        if ((callback & CallbackModes.CALLBACK_IGNORE) != 0)
+            types.add(IGNORE);
+        if ((callback & CallbackModes.CALLBACK_LOG) != 0)
+            types.add(LOG);
+        if ((callback & CallbackModes.CALLBACK_RETHROW) != 0)
+            types.add(RETHROW);
+        if ((callback & CallbackModes.CALLBACK_ROLLBACK) != 0)
+            types.add(ROLLBACK);
+        return types;
+    }
+
+    public static int fromEnumSet(EnumSet<CallbackType> types) {
+        int callback = 0;
+        for (CallbackType type : types)
+            callback |= type.callbackMode;
+        return callback;
+    }
+}

Added: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ConnectionRetainType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ConnectionRetainType.java?rev=567838&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ConnectionRetainType.java (added)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ConnectionRetainType.java Mon Aug 20 14:32:54 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence;
+
+import org.apache.openjpa.kernel.ConnectionRetainModes;
+
+/**
+ * The possible values for use when configuring the connection retain
+ * behavior for an {@link OpenJPAEntityManager}.
+ *
+ * @since 1.0.0
+ * @published
+ */
+public enum ConnectionRetainType {
+    ON_DEMAND(ConnectionRetainModes.CONN_RETAIN_DEMAND),
+    TRANSACTION(ConnectionRetainModes.CONN_RETAIN_TRANS),
+    ALWAYS(ConnectionRetainModes.CONN_RETAIN_ALWAYS);
+
+    private final int connectionRetainConstant;
+
+    private ConnectionRetainType(int value) {
+        connectionRetainConstant = value;
+    }
+
+    int toKernelConstant() {
+        return connectionRetainConstant;
+    }
+
+    static ConnectionRetainType fromKernelConstant(int kernelConstant) {
+        switch (kernelConstant) {
+            case ConnectionRetainModes.CONN_RETAIN_DEMAND:
+                return ON_DEMAND;
+
+            case ConnectionRetainModes.CONN_RETAIN_ALWAYS:
+                return ALWAYS;
+
+            case ConnectionRetainModes.CONN_RETAIN_TRANS:
+                return TRANSACTION;
+
+            default:
+                throw new IllegalArgumentException(kernelConstant + "");
+        }
+    }
+}

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataCache.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataCache.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataCache.java Mon Aug 20 14:32:54 2007
@@ -28,6 +28,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ TYPE })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataStoreId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataStoreId.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataStoreId.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DataStoreId.java Mon Aug 20 14:32:54 2007
@@ -29,6 +29,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ TYPE })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Dependent.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Dependent.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Dependent.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Dependent.java Mon Aug 20 14:32:54 2007
@@ -29,6 +29,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ METHOD, FIELD })
 @Retention(RUNTIME)

Added: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachStateType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachStateType.java?rev=567838&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachStateType.java (added)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachStateType.java Mon Aug 20 14:32:54 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence;
+
+import org.apache.openjpa.kernel.DetachState;
+
+/**
+ * The possible settings for the detachment behavior of an
+ * {@link OpenJPAEntityManager}.
+ *
+ * @since 1.0.0
+ * @published
+ */
+public enum DetachStateType {
+    FETCH_GROUPS(DetachState.DETACH_FETCH_GROUPS),
+    LOADED(DetachState.DETACH_LOADED),
+    ALL(DetachState.DETACH_ALL);
+
+    private final int detachStateConstant;
+
+    private DetachStateType(int value) {
+        detachStateConstant = value;
+    }
+
+    int toKernelConstant() {
+        return detachStateConstant;
+    }
+
+    static DetachStateType fromKernelConstant(int kernelConstant) {
+        switch (kernelConstant) {
+            case DetachState.DETACH_FETCH_GROUPS:
+                return FETCH_GROUPS;
+
+            case DetachState.DETACH_LOADED:
+                return LOADED;
+
+            case DetachState.DETACH_ALL:
+                return ALL;
+
+            default:
+                throw new IllegalArgumentException(kernelConstant + "");
+        }
+    }
+}

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachedState.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachedState.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachedState.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/DetachedState.java Mon Aug 20 14:32:54 2007
@@ -29,6 +29,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ TYPE, FIELD })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementDependent.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementDependent.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementDependent.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementDependent.java Mon Aug 20 14:32:54 2007
@@ -29,6 +29,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ METHOD, FIELD })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementType.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementType.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ElementType.java Mon Aug 20 14:32:54 2007
@@ -30,6 +30,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ METHOD, FIELD })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java Mon Aug 20 14:32:54 2007
@@ -42,6 +42,7 @@
 import org.apache.openjpa.lib.conf.ProductDerivations;
 import org.apache.openjpa.lib.conf.Value;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.Closeable;
 import org.apache.openjpa.util.OpenJPAException;
 import serp.util.Strings;
 
@@ -53,7 +54,8 @@
  * @nojavadoc
  */
 public class EntityManagerFactoryImpl
-    implements OpenJPAEntityManagerFactory {
+    implements OpenJPAEntityManagerFactory, OpenJPAEntityManagerFactorySPI,
+    Closeable {
 
     private static final Localizer _loc = Localizer.forPackage
         (EntityManagerFactoryImpl.class);
@@ -139,11 +141,11 @@
         }
     }
 
-    public OpenJPAEntityManager createEntityManager() {
+    public OpenJPAEntityManagerSPI createEntityManager() {
         return createEntityManager(null);
     }
 
-    public OpenJPAEntityManager createEntityManager(Map props) {
+    public OpenJPAEntityManagerSPI createEntityManager(Map props) {
         if (props == null)
             props = Collections.EMPTY_MAP;
         else if (!props.isEmpty())
@@ -195,12 +197,12 @@
         broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
         
         broker.setDetachedNew(false);
-        OpenJPAEntityManager em = newEntityManagerImpl(broker);
+        OpenJPAEntityManagerSPI em = newEntityManagerImpl(broker);
 
         // allow setting of other bean properties of EM
         String[] prefixes = ProductDerivations.getConfigurationPrefixes();
         List<RuntimeException> errs = null;
-        Method setter = null;
+        Method setter;
         String prop, prefix;
         Object val;
         for (Map.Entry entry : (Set<Map.Entry>) props.entrySet()) {
@@ -251,7 +253,7 @@
             if (errs.size() == 1)
                 throw errs.get(0);
             throw new ArgumentException(_loc.get("bad-em-props"),
-                (Throwable[]) errs.toArray(new Throwable[errs.size()]),
+                errs.toArray(new Throwable[errs.size()]),
                 null, true);
         }
         return em;
@@ -308,9 +310,8 @@
         if (fetch == null)
             return null;
 
-        FetchConfiguration inner = fetch;
-        if (inner instanceof DelegatingFetchConfiguration)
-            inner = ((DelegatingFetchConfiguration) inner).
+        if (fetch instanceof DelegatingFetchConfiguration)
+            fetch = ((DelegatingFetchConfiguration) fetch).
                 getInnermostDelegate();
 
         try {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java Mon Aug 20 14:32:54 2007
@@ -21,16 +21,11 @@
 import java.lang.reflect.Array;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.EnumSet;
 import javax.persistence.EntityManager;
-import javax.persistence.EntityTransaction;
 import javax.persistence.FlushModeType;
 import javax.persistence.LockModeType;
 import javax.persistence.Query;
-import javax.resource.ResourceException;
-import javax.resource.cci.ConnectionMetaData;
-import javax.resource.cci.Interaction;
-import javax.resource.cci.LocalTransaction;
-import javax.resource.cci.ResultSetInfo;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
@@ -46,6 +41,7 @@
 import org.apache.openjpa.kernel.Seq;
 import org.apache.openjpa.kernel.jpql.JPQLParser;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.Closeable;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.FieldMetaData;
 import org.apache.openjpa.meta.QueryMetaData;
@@ -63,7 +59,8 @@
  * @nojavadoc
  */
 public class EntityManagerImpl
-    implements OpenJPAEntityManager, FindCallbacks, OpCallbacks {
+    implements OpenJPAEntityManagerSPI,
+    FindCallbacks, OpCallbacks, Closeable, OpenJPAEntityTransaction {
 
     private static final Localizer _loc = Localizer.forPackage
         (EntityManagerImpl.class);
@@ -71,6 +68,7 @@
     private final DelegatingBroker _broker;
     private final EntityManagerFactoryImpl _emf;
     private FetchPlan _fetch = null;
+    private static final Object[] EMPTY_OBJECTS = new Object[0];
 
     /**
      * Constructor; supply factory and delegate.
@@ -91,27 +89,6 @@
         return _broker.getDelegate();
     }
 
-    public ConnectionMetaData getMetaData()
-        throws ResourceException {
-        return _broker.getMetaData();
-    }
-
-    public Interaction createInteraction()
-        throws ResourceException {
-        assertNotCloseInvoked();
-        return _broker.createInteraction();
-    }
-
-    public LocalTransaction getLocalTransaction()
-        throws ResourceException {
-        return this;
-    }
-
-    public ResultSetInfo getResultSetInfo()
-        throws ResourceException {
-        return _broker.getResultSetInfo();
-    }
-
     public OpenJPAEntityManagerFactory getEntityManagerFactory() {
         return _emf;
     }
@@ -133,8 +110,9 @@
         }
     }
 
-    public int getConnectionRetainMode() {
-        return _broker.getConnectionRetainMode();
+    public ConnectionRetainType getConnectionRetainMode() {
+        return ConnectionRetainType.fromKernelConstant(
+            _broker.getConnectionRetainMode());
     }
 
     public boolean isManaged() {
@@ -211,13 +189,13 @@
         _broker.setOptimistic(val);
     }
 
-    public int getRestoreState() {
-        return _broker.getRestoreState();
+    public RestoreStateType getRestoreState() {
+        return RestoreStateType.fromKernelConstant(_broker.getRestoreState());
     }
 
-    public void setRestoreState(int val) {
+    public void setRestoreState(RestoreStateType val) {
         assertNotCloseInvoked();
-        _broker.setRestoreState(val);
+        _broker.setRestoreState(val.toKernelConstant());
     }
 
     public boolean getRetainState() {
@@ -229,31 +207,36 @@
         _broker.setRetainState(val);
     }
 
-    public int getAutoClear() {
-        return _broker.getAutoClear();
+    public AutoClearType getAutoClear() {
+        return AutoClearType.fromKernelConstant(_broker.getAutoClear());
     }
 
-    public void setAutoClear(int val) {
+    public void setAutoClear(AutoClearType val) {
         assertNotCloseInvoked();
-        _broker.setAutoClear(val);
+        _broker.setAutoClear(val.toKernelConstant());
     }
 
-    public int getDetachState() {
-        return _broker.getDetachState();
+    public DetachStateType getDetachState() {
+        return DetachStateType.fromKernelConstant(_broker.getDetachState());
     }
 
-    public void setDetachState(int mode) {
+    public void setDetachState(DetachStateType type) {
         assertNotCloseInvoked();
-        _broker.setDetachState(mode);
+        _broker.setDetachState(type.toKernelConstant());
     }
 
-    public int getAutoDetach() {
-        return _broker.getAutoDetach();
+    public EnumSet<AutoDetachType> getAutoDetach() {
+        return AutoDetachType.toEnumSet(_broker.getAutoDetach());
     }
 
-    public void setAutoDetach(int flags) {
+    public void setAutoDetach(AutoDetachType flag) {
         assertNotCloseInvoked();
-        _broker.setAutoDetach(flags);
+        _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(flag)));
+    }
+
+    public void setAutoDetach(EnumSet<AutoDetachType> flags) {
+        assertNotCloseInvoked();
+        _broker.setAutoDetach(AutoDetachType.fromEnumSet(flags));
     }
 
     public void setAutoDetach(int flag, boolean on) {
@@ -279,13 +262,13 @@
         _broker.setPopulateDataCache(cache);
     }
 
-    public boolean isLargeTransaction() {
-        return _broker.isLargeTransaction();
+    public boolean isTrackChangesByType() {
+        return _broker.isTrackChangesByType();
     }
 
-    public void setLargeTransaction(boolean largeTransaction) {
+    public void setTrackChangesByType(boolean trackByType) {
         assertNotCloseInvoked();
-        _broker.setLargeTransaction(largeTransaction);
+        _broker.setTrackChangesByType(trackByType);
     }
 
     public Object getUserObject(Object key) {
@@ -307,13 +290,21 @@
         _broker.removeTransactionListener(listener);
     }
 
-    public int getTransactionListenerCallbackMode() {
-        return _broker.getTransactionListenerCallbackMode();
+    public EnumSet<CallbackType> getTransactionListenerCallbackMode() {
+        return CallbackType.toEnumSet(
+            _broker.getTransactionListenerCallbackMode());
     }
 
-    public void setTransactionListenerCallbackMode(int mode) {
+    public void setTransactionListenerCallbackMode(CallbackType type) {
         assertNotCloseInvoked();
-        _broker.setTransactionListenerCallbackMode(mode);
+        _broker.setTransactionListenerCallbackMode(
+            CallbackType.fromEnumSet(EnumSet.of(type)));
+    }
+
+    public void setTransactionListenerCallbackMode(EnumSet<CallbackType> types){
+        assertNotCloseInvoked();
+        _broker.setTransactionListenerCallbackMode(
+            CallbackType.fromEnumSet(types));
     }
 
     public void addLifecycleListener(Object listener, Class... classes) {
@@ -326,13 +317,21 @@
         _broker.removeLifecycleListener(listener);
     }
 
-    public int getLifecycleListenerCallbackMode() {
-        return _broker.getLifecycleListenerCallbackMode();
+    public EnumSet<CallbackType> getLifecycleListenerCallbackMode() {
+        return CallbackType.toEnumSet(
+            _broker.getLifecycleListenerCallbackMode());
+    }
+
+    public void setLifecycleListenerCallbackMode(CallbackType type) {
+        assertNotCloseInvoked();
+        _broker.setLifecycleListenerCallbackMode(
+            CallbackType.fromEnumSet(EnumSet.of(type)));
     }
 
-    public void setLifecycleListenerCallbackMode(int mode) {
+    public void setLifecycleListenerCallbackMode(EnumSet<CallbackType> types) {
         assertNotCloseInvoked();
-        _broker.setLifecycleListenerCallbackMode(mode);
+        _broker.setLifecycleListenerCallbackMode(
+            CallbackType.fromEnumSet(types));
     }
 
     @SuppressWarnings("unchecked")
@@ -382,11 +381,11 @@
         assertNotCloseInvoked();
         if (cls == null)
             return null;
-        return OpenJPAPersistence.fromOpenJPAObjectIdClass
+        return JPAFacadeHelper.fromOpenJPAObjectIdClass
                 (_broker.getObjectIdType(cls));
     }
 
-    public EntityTransaction getTransaction() {
+    public OpenJPAEntityTransaction getTransaction() {
         if (_broker.isManaged())
             throw new InvalidStateException(_loc.get("get-managed-trans"),
                 null, null, false);
@@ -640,7 +639,7 @@
 
     public void evictAll(Extent extent) {
         assertNotCloseInvoked();
-        _broker.evictAll(extent.getDelegate(), this);
+        _broker.evictAll(((ExtentImpl) extent).getDelegate(), this);
     }
 
     @SuppressWarnings("unchecked")
@@ -667,7 +666,7 @@
 
     public Object[] mergeAll(Object... entities) {
         if (entities.length == 0)
-            return new Object[0];
+            return EMPTY_OBJECTS;
         return mergeAll(Arrays.asList(entities)).toArray();
     }
 
@@ -1019,7 +1018,7 @@
 
     public Object getObjectId(Object o) {
         assertNotCloseInvoked();
-        return OpenJPAPersistence.fromOpenJPAObjectId(_broker.getObjectId(o));
+        return JPAFacadeHelper.fromOpenJPAObjectId(_broker.getObjectId(o));
     }
 
     public boolean isDirty(Object o) {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java Mon Aug 20 14:32:54 2007
@@ -31,11 +31,6 @@
     extends Iterable<T> {
 
     /**
-     * Delegate.
-     */
-    public org.apache.openjpa.kernel.Extent getDelegate();
-
-    /**
      * The extent's element type.
      */
     public Class<T> getElementClass();

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java Mon Aug 20 14:32:54 2007
@@ -47,6 +47,9 @@
             PersistenceExceptions.getRollbackTranslator(em));
     }
 
+    /**
+     * Delegate.
+     */
     public org.apache.openjpa.kernel.Extent getDelegate() {
         return _extent.getDelegate();
     }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExternalValues.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExternalValues.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExternalValues.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExternalValues.java Mon Aug 20 14:32:54 2007
@@ -31,6 +31,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ METHOD, FIELD })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Externalizer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Externalizer.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Externalizer.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Externalizer.java Mon Aug 20 14:32:54 2007
@@ -30,6 +30,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ METHOD, FIELD })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Factory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Factory.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Factory.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Factory.java Mon Aug 20 14:32:54 2007
@@ -30,6 +30,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ METHOD, FIELD })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchAttribute.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchAttribute.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchAttribute.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchAttribute.java Mon Aug 20 14:32:54 2007
@@ -27,6 +27,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({})
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroup.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroup.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroup.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroup.java Mon Aug 20 14:32:54 2007
@@ -28,6 +28,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ TYPE })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroups.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroups.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroups.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchGroups.java Mon Aug 20 14:32:54 2007
@@ -28,6 +28,7 @@
  *
  * @author Abe White
  * @since 0.4.0
+ * @published
  */
 @Target({ TYPE })
 @Retention(RUNTIME)

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java Mon Aug 20 14:32:54 2007
@@ -56,11 +56,6 @@
     public static final int DEFAULT = FetchConfiguration.DEFAULT;
 
     /**
-     * Delegate.
-     */
-    public FetchConfiguration getDelegate();
-
-    /**
      * The maximum fetch depth when loading an object.
      */
     public int getMaxFetchDepth();
@@ -90,15 +85,19 @@
      * will not be enabled. If this
      * returns <code>false</code>, query caching will not be used
      * even if the datacache plugin is installed.
+     *
+     * @since 1.0.0
      */
-    public boolean getQueryResultCache();
+    public boolean isEnlistInQueryResultCache();
 
     /**
      * Control whether or not query caching is enabled. This has no effect
      * if the datacache plugin is not installed, or if the query cache size
      * is set to zero.
+     *
+     * @since 1.0.0
      */
-    public FetchPlan setQueryResultCache(boolean cache);
+    public FetchPlan setEnlistInQueryResultCache(boolean cache);
 
     /**
      * Returns the names of the fetch groups that this component will use

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java Mon Aug 20 14:32:54 2007
@@ -82,12 +82,12 @@
         return this;
     }
 
-    public boolean getQueryResultCache() {
-        return _fetch.getQueryCache();
+    public boolean isEnlistInQueryResultCache() {
+        return _fetch.getEnlistInQueryCache();
     }
 
-    public FetchPlan setQueryResultCache(boolean cache) {
-        _fetch.setQueryCache(cache);
+    public FetchPlan setEnlistInQueryResultCache(boolean cache) {
+        _fetch.setEnlistInQueryCache(cache);
         return this;
     }
 

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java?rev=567838&r1=567837&r2=567838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java Mon Aug 20 14:32:54 2007
@@ -33,11 +33,6 @@
     public static final String UUID_STRING = "uuid-string";
 
     /**
-     * Delegate.
-     */
-    public Seq getDelegate();
-
-    /**
      * The sequence name.
      */
     public String getName();



Mime
View raw message