openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r452243 [1/6] - in /incubator/openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-kernel/src/ma...
Date Mon, 02 Oct 2006 22:22:21 GMT
Author: awhite
Date: Mon Oct  2 15:22:18 2006
New Revision: 452243

URL: http://svn.apache.org/viewvc?view=rev&rev=452243
Log:
Miscellaneous cleanup and fixes.  Some documentation review.


Added:
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataParsers.java
Modified:
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SimpleDriverDataSource.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/event/localizer.properties
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_conclusion.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_mapping.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_pc.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_persistence.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_query.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_sqlquery.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_trans.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_why.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_resources.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/manual.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/openjpa_intro.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_caching.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_conf.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_deploy.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_integration.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_intro.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_logging.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_mapping.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_meta.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_optimization.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_pc.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_remote.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_runtime.xml
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java Mon Oct  2 15:22:18 2006
@@ -102,10 +102,7 @@
         } catch (SQLException se) {
             throw SQLExceptions.getStore(se, row.getFailedObject(), _dict);
         } finally {
-            try {
-                stmnt.close();
-            } catch (SQLException se) {
-            }
+            try { stmnt.close(); } catch (SQLException se) {}
         }
 
         // set auto assign values

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java Mon Oct  2 15:22:18 2006
@@ -60,8 +60,7 @@
      */
     public static DataSource newDataSource(JDBCConfiguration conf,
         boolean factory2) {
-        String driver = (factory2)
-            ? conf.getConnection2DriverName()
+        String driver = (factory2) ? conf.getConnection2DriverName()
             : conf.getConnectionDriverName();
         if (driver == null || driver.length() == 0)
             throw new UserException(_loc.get("no-driver", driver)).
@@ -69,12 +68,10 @@
 
         ClassLoader loader = conf.getClassResolverInstance().
             getClassLoader(DataSourceFactory.class, null);
-        String props = (factory2)
-            ? conf.getConnection2Properties()
+        String props = (factory2) ? conf.getConnection2Properties()
             : conf.getConnectionProperties();
         try {
             Class driverClass;
-
             try {
                 driverClass = Class.forName(driver, true, loader);
             } catch (ClassNotFoundException cnfe) {
@@ -86,25 +83,23 @@
                 DriverDataSource ds = conf.newDriverDataSourceInstance();
                 ds.setClassLoader(loader);
                 ds.setConnectionDriverName(driver);
-                ds.setConnectionProperties
-                    (Configurations.parseProperties(props));
+                ds.setConnectionProperties(Configurations.
+                    parseProperties(props));
 
                 if (!factory2) {
-                    ds.setConnectionFactoryProperties
-                        (Configurations.parseProperties
-                            (conf.getConnectionFactoryProperties()));
+                    ds.setConnectionFactoryProperties(Configurations.
+                        parseProperties(conf.getConnectionFactoryProperties()));
                     ds.setConnectionURL(conf.getConnectionURL());
                     ds.setConnectionUserName(conf.getConnectionUserName());
                     ds.setConnectionPassword(conf.getConnectionPassword());
                 } else {
                     ds.setConnectionFactoryProperties
-                        (Configurations.parseProperties
-                            (conf.getConnectionFactory2Properties()));
+                        (Configurations.parseProperties(conf.
+                        getConnectionFactory2Properties()));
                     ds.setConnectionURL(conf.getConnection2URL());
                     ds.setConnectionUserName(conf.getConnection2UserName());
                     ds.setConnectionPassword(conf.getConnection2Password());
                 }
-
                 return ds;
             }
 
@@ -121,8 +116,7 @@
         }
 
         // not a driver or a data source; die
-        throw new UserException(_loc.get("bad-driver", driver)).
-            setFatal(true);
+        throw new UserException(_loc.get("bad-driver", driver)).setFatal(true);
     }
 
     /**
@@ -186,7 +180,6 @@
         DecoratingDataSource ds, final JDBCConfiguration conf,
         boolean factory2) {
         DataSource inner = ds.getInnermostDelegate();
-
         if (inner instanceof DriverDataSource)
             ((DriverDataSource) inner).initDBDictionary(dict);
 
@@ -204,8 +197,7 @@
             // transaction isolation, etc)
             ConfiguringConnectionDecorator ccd =
                 new ConfiguringConnectionDecorator();
-            ccd.setTransactionIsolation
-                (conf.getTransactionIsolationConstant());
+            ccd.setTransactionIsolation(conf.getTransactionIsolationConstant());
             if (factory2 || !conf.isConnectionFactoryModeManaged()) {
                 if (!dict.supportsMultipleNontransactionalResultSets)
                     ccd.setAutoCommit(Boolean.FALSE);

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java Mon Oct  2 15:22:18 2006
@@ -20,7 +20,6 @@
 import javax.sql.DataSource;
 
 import org.apache.openjpa.jdbc.sql.DBDictionary;
-import org.apache.openjpa.lib.conf.Configurable;
 
 /**
  * A DataSource that allows additional configuration options to be set
@@ -29,7 +28,7 @@
  * @author Marc Prud'hommeaux
  */
 public interface DriverDataSource
-    extends DataSource, Configurable {
+    extends DataSource {
 
     public void setConnectionURL(String connectionURL);
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SimpleDriverDataSource.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SimpleDriverDataSource.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SimpleDriverDataSource.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SimpleDriverDataSource.java Mon Oct  2 15:22:18 2006
@@ -25,10 +25,15 @@
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.lib.conf.Configurable;
 import org.apache.openjpa.lib.conf.Configuration;
+import org.apache.openjpa.util.StoreException;
 
+/**
+ * Non-pooling driver data source.
+ */
 public class SimpleDriverDataSource
-    implements DriverDataSource {
+    implements DriverDataSource, Configurable {
 
     private String _connectionDriverName;
     private String _connectionURL;
@@ -40,38 +45,6 @@
     private Driver _driver;
     private ClassLoader _classLoader;
 
-    private synchronized Driver getDriver()
-        throws SQLException {
-        if (_driver == null)
-            _driver = DriverManager.getDriver(_connectionURL);
-
-        if (_driver == null) {
-            try {
-                Class.forName(_connectionDriverName, true, _classLoader);
-            } catch (Exception e) {
-            }
-
-            _driver = DriverManager.getDriver(_connectionURL);
-        }
-
-        if (_driver == null) {
-            try {
-                _driver = (Driver) Class.forName(_connectionDriverName,
-                    true, _classLoader).newInstance();
-            } catch (Exception e) {
-                if (e instanceof SQLException)
-                    throw(SQLException) e;
-
-                if (e instanceof RuntimeException)
-                    throw(RuntimeException) e;
-
-                throw new SQLException(e.getClass() + ": " + e.getMessage());
-            }
-        }
-
-        return _driver;
-    }
-
     public Connection getConnection()
         throws SQLException {
         return getConnection(null);
@@ -80,16 +53,13 @@
     public Connection getConnection(String username, String password)
         throws SQLException {
         Properties props = new Properties();
-
         if (username == null)
             username = _connectionUserName;
-
         if (username != null)
             props.put("user", username);
 
         if (password == null)
             password = _connectionPassword;
-
         if (password != null)
             props.put("password", password);
 
@@ -98,7 +68,7 @@
 
     public Connection getConnection(Properties props)
         throws SQLException {
-        return getDriver().connect(_conf.getConnectionURL(), props);
+        return _driver.connect(_conf.getConnectionURL(), props);
     }
 
     public int getLoginTimeout() {
@@ -115,14 +85,31 @@
     public void setLogWriter(PrintWriter out) {
     }
 
-    public void startConfiguration() {
+    public void setConfiguration(Configuration conf) {
+        _conf = (JDBCConfiguration) conf;
     }
 
-    public void endConfiguration() {
+    public void startConfiguration() {
     }
 
-    public void setConfiguration(Configuration conf) {
-        _conf = (JDBCConfiguration) conf;
+    public void endConfiguration() {
+        try {
+            _driver = DriverManager.getDriver(_connectionURL);
+            if (_driver == null) {
+                try {
+                    Class.forName(_connectionDriverName, true, _classLoader);
+                } catch (Exception e) {
+                }
+                _driver = DriverManager.getDriver(_connectionURL);
+            }
+            if (_driver == null)
+                _driver = (Driver) Class.forName(_connectionDriverName,
+                    true, _classLoader).newInstance();
+        } catch (Exception e) {
+            if (e instanceof RuntimeException)
+                throw(RuntimeException) e;
+            throw new StoreException(e);
+        }
     }
 
     public void initDBDictionary(DBDictionary dict) {

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java Mon Oct  2 15:22:18 2006
@@ -202,8 +202,6 @@
                 break;
             case JavaTypes.COLLECTION:
                 Collection frmc = (Collection) fetchObjectField(i);
-                System.out.println("Fetch:" + fmd + ":" + frmc
-                    + ":" + nullLoaded);
                 if (frmc == null && !nullLoaded)
                     return false;
                 Collection toc = (Collection) sm.fetchObjectField(i);

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java Mon Oct  2 15:22:18 2006
@@ -1233,10 +1233,7 @@
         catch (RuntimeException re) {
             if (!rollback) {
                 forcedRollback = true;
-                try {
-                    _store.rollback();
-                } catch (RuntimeException re2) {
-                }
+                try { _store.rollback(); } catch (RuntimeException re2) {}
             }
             err = re;
         } finally {
@@ -3794,8 +3791,7 @@
                         _transAdditions = new HashSet();
                     _transAdditions.add(sm);
                 }
-            }
-            finally {
+            } finally {
                 unlock();
             }
         }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java Mon Oct  2 15:22:18 2006
@@ -250,22 +250,22 @@
             case JavaTypes.PC_UNTYPED:
                 if (!_broker.isDetachedNew() && _broker.isDetached(objval))
                     return; // allow but ignore
-                _broker.persist(objval, false, call);
+                _broker.persist(objval, true, call);
                 break;
             case JavaTypes.ARRAY:
-                _broker.persistAll(Arrays.asList((Object[]) objval), false, 
+                _broker.persistAll(Arrays.asList((Object[]) objval), true, 
                     call);
                 break;
             case JavaTypes.COLLECTION:
-                _broker.persistAll((Collection) objval, false, call);
+                _broker.persistAll((Collection) objval, true, call);
                 break;
             case JavaTypes.MAP:
                 if (fmd.getKey().getCascadePersist()
                     == ValueMetaData.CASCADE_IMMEDIATE)
-                    _broker.persistAll(((Map) objval).keySet(), false, call);
+                    _broker.persistAll(((Map) objval).keySet(), true, call);
                 if (fmd.getElement().getCascadePersist()
                     == ValueMetaData.CASCADE_IMMEDIATE)
-                    _broker.persistAll(((Map) objval).values(), false, call);
+                    _broker.persistAll(((Map) objval).values(), true, call);
                 break;
         }
     }
@@ -615,8 +615,8 @@
                     if (external)
                         val = fmd.getExternalValue(val, _broker);
                     else if (val instanceof Proxy) {
-                        // shortcut change trackers; also ensures we don't iterate
-                        // lrs fields
+                        // shortcut change trackers; also ensures we don't 
+                        // iterate lrs fields
                         ChangeTracker ct = ((Proxy) val).getChangeTracker();
                         if (ct != null && ct.isTracking()) {
                             preFlushPCs(fmd.getElement(), ct.getAdded(), 
@@ -646,8 +646,8 @@
                         val = fmd.getExternalValue(val, _broker);
                         external = false;
                     } else if (val instanceof Proxy) {
-                        // shortcut change trackers; also ensures we don't iterate
-                        // lrs fields
+                        // shortcut change trackers; also ensures we don't 
+                        // iterate lrs fields
                         MapChangeTracker ct = (MapChangeTracker) ((Proxy) val).
                             getChangeTracker();
                         if (ct != null && ct.isTracking() && ct.getTrackKeys())
@@ -670,8 +670,8 @@
                     if (external)
                         val = fmd.getExternalValue(val, _broker);
                     else if (val instanceof Proxy) {
-                        // shortcut change trackers; also ensures we don't iterate
-                        // lrs fields
+                        // shortcut change trackers; also ensures we don't 
+                        // iterate lrs fields
                         MapChangeTracker ct = (MapChangeTracker) ((Proxy) val).
                             getChangeTracker();
                         if (ct != null && ct.isTracking()) {
@@ -743,10 +743,9 @@
 
             sm = _broker.getStateManager(obj);
             if (sm == null || !sm.isPersistent())
-                throw new InvalidStateException
-                    (_loc.get("cant-cascade-persist",
-                        Exceptions.toString(obj), vmd,
-                        Exceptions.toString(_sm.getManagedInstance()))).
+                throw new InvalidStateException(_loc.get("cant-cascade-persist",
+                    Exceptions.toString(obj), vmd,
+                    Exceptions.toString(_sm.getManagedInstance()))).
                     setFailedObject(obj);
         } else {
             sm = _broker.getStateManager(obj);
@@ -763,8 +762,9 @@
                     Exceptions.toString(_sm.getManagedInstance()))).
                     setFailedObject(obj);
 
-            ((StateManagerImpl) sm).nonprovisional(logical, call);
-            ((StateManagerImpl) sm).setDereferencedDependent(false, true);
+            StateManagerImpl smimpl = (StateManagerImpl) sm;
+            smimpl.nonprovisional(logical, call);
+            smimpl.setDereferencedDependent(false, true);
         }
     }
 

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java Mon Oct  2 15:22:18 2006
@@ -486,8 +486,8 @@
      * @param recache whether to recache ourself on the new oid
      */
     private void assertObjectIdAssigned(boolean recache) {
-        if (!isNew() || isDeleted() || isProvisional() || 
-            (_flags & FLAG_OID_ASSIGNED) > 0)
+        if (!isNew() || isDeleted() || isProvisional() 
+            || (_flags & FLAG_OID_ASSIGNED) != 0)
             return;
         if (_oid == null) {
             if (_meta.getIdentityType() == ClassMetaData.ID_DATASTORE)

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java Mon Oct  2 15:22:18 2006
@@ -340,8 +340,7 @@
                         classList.add(cls);
                     break;
                 }
-            }
-            catch (Throwable t) {
+            } catch (Throwable t) {
                 // this happens when the class is not loadable by
                 // the environment class loader, so it was probably
                 // listed elsewhere; also ignore linkage failures and
@@ -364,8 +363,7 @@
 
         if (!mustExist)
             return null;
-        throw new MetaDataException(_loc.get("no-alias-meta", alias,
-            _aliases));
+        throw new MetaDataException(_loc.get("no-alias-meta", alias, _aliases));
     }
 
     /**
@@ -408,8 +406,7 @@
             // class never registers itself with the system
             if ((_validate & VALIDATE_RUNTIME) != 0) {
                 try {
-                    Class.forName(cls.getName(), true,
-                        cls.getClassLoader());
+                    Class.forName(cls.getName(), true, cls.getClassLoader());
                 } catch (Throwable t) {
                 }
             }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/event/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/event/localizer.properties?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/event/localizer.properties (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/event/localizer.properties Mon Oct  2 15:22:18 2006
@@ -74,6 +74,7 @@
 tcp-close-pool-error: Exception thrown while closing connection pool.
 tcp-wrong-version-error: Received packet from "{0}" with invalid version \
 	number. Check if a prior release of OpenJPA is being used on this host.
-bean-constructor: Could not instantiate class {0}.
+bean-constructor: Could not instantiate class {0}.  Make sure it has an \
+    accessible no-args constructor.
 method-notfound: Method "{1}" with arguments of type: {2} \
     not found in class "{0}".

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java Mon Oct  2 15:22:18 2006
@@ -84,7 +84,6 @@
 import org.apache.openjpa.lib.conf.Configurations;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.Localizer;
-import org.apache.openjpa.lib.util.Localizer.Message;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.DelegatingMetaDataFactory;
 import org.apache.openjpa.meta.FieldMetaData;
@@ -580,14 +579,14 @@
                         highs[i] = listeners[i].size();
             }
             recordCallbacks(meta, parseCallbackMethods(_cls, listeners, false,
-                false), highs, false);
+                false, getRepository()), highs, false);
 
             // scan possibly non-PC hierarchy for callbacks.
             // redundant for PC superclass but we don't know that yet
             // so let LifecycleMetaData determine that
             if (!Object.class.equals(_cls.getSuperclass())) {
-                recordCallbacks(meta, parseCallbackMethods(_cls.
-                    getSuperclass(), null, true, false), null, true);
+                recordCallbacks(meta, parseCallbackMethods(_cls.getSuperclass(),
+                    null, true, false, getRepository()), null, true);
             }
         }
 
@@ -759,7 +758,8 @@
         Class[] classes = listeners.value();
         Collection<LifecycleCallbacks>[] parsed = null;
         for (Class cls : classes)
-            parsed = parseCallbackMethods(cls, parsed, true, true);
+            parsed = parseCallbackMethods(cls, parsed, true, true, 
+                getRepository());
         return parsed;
     }
 
@@ -771,9 +771,9 @@
      * @param sups whether to scan superclasses
      * @param listener whether this is a listener or not
      */
-    public Collection<LifecycleCallbacks>[] parseCallbackMethods
+    public static Collection<LifecycleCallbacks>[] parseCallbackMethods
         (Class cls, Collection<LifecycleCallbacks>[] callbacks, boolean sups,
-            boolean listener) {
+        boolean listener, MetaDataRepository repos) {
         // first sort / filter based on inheritance
         Set<Method> methods = new TreeSet<Method>(MethodComparator.
             getInstance());
@@ -796,16 +796,15 @@
                 }
             }
             sup = sup.getSuperclass();
-        }
-        while (sups && !Object.class.equals(sup));
+        } while (sups && !Object.class.equals(sup));
 
+        MetaDataDefaults def = repos.getMetaDataFactory().getDefaults();
         for (Method m : methods) {
             for (Annotation anno : m.getDeclaredAnnotations()) {
                 MetaDataTag tag = _tags.get(anno.annotationType());
                 if (tag == null)
                     continue;
-
-                int[] events = XMLPersistenceMetaDataParser.getEventTypes(tag);
+                int[] events = MetaDataParsers.getEventTypes(tag);
                 if (events == null)
                     continue;
 
@@ -813,18 +812,13 @@
                     callbacks = (Collection<LifecycleCallbacks>[])
                         new Collection[LifecycleEvent.ALL_EVENTS.length];
 
-                for (int i = 0; events != null && i < events.length; i++) {
+                for (int i = 0; i < events.length; i++) {
                     int e = events[i];
-                    if (!verifyHasNoArgConstructor(cls))
-                        continue; 
-                    if (!verifyMultipleMethodsOnSameEvent(cls, callbacks[e], m, 
-                        tag))
-                        continue;
-
                     if (callbacks[e] == null)
-                        callbacks[e] = new ArrayList(3);                   
-                    
+                        callbacks[e] = new ArrayList(3);
                     if (listener) {
+                        MetaDataParsers.validateMethodsForSameCallback(cls, 
+                            callbacks[e], m, tag, def, repos.getLog());
                         callbacks[e].add(new BeanLifecycleCallbacks(cls, m,
                             false));
                     } else {
@@ -835,58 +829,6 @@
             }
         }
         return callbacks;
-    }
-
-    private boolean verifyMultipleMethodsOnSameEvent(Class cls, 
-            Collection<LifecycleCallbacks> callbacks, Method method, 
-            MetaDataTag tag) {
-        boolean result = true;
-        if (callbacks == null || callbacks.isEmpty())
-            return true;
-        for (LifecycleCallbacks lc: callbacks) {
-            if (!(lc instanceof MethodLifecycleCallbacks))
-                continue;
-            Method exists = ((MethodLifecycleCallbacks)lc).getCallbackMethod();
-            if (exists.getDeclaringClass().equals(method.getDeclaringClass())) {
-                result = false;
-                Object[] args = new Object[]{method.getDeclaringClass()
-                    .getName(), method.getName(), exists.getName(), 
-                    tag.toString()};
-                PersistenceMetaDataDefaults defaults = getDefaults();
-                if (defaults == null || 
-                    defaults.getAllowsMultipleMethodsOnSameCallback()) {
-                    _log.warn(_loc.get("multiple-methods-on-callback", args));
-                 } else {
-                    throw new UserException(
-                        _loc.get("multiple-methods-on-callback-error", args));
-                 }
-             }
-        }
-        return result;
-    }
-    
-    private boolean verifyHasNoArgConstructor(Class cls) {
-        try {
-            cls.getConstructor(new Class[]{});
-            return true;
-        } catch (Throwable t) {
-            PersistenceMetaDataDefaults defaults = getDefaults();
-            Message msg = _loc.get("missing-no-arg-constructor", cls.getName());
-            if (defaults == null || 
-                defaults.getAllowsMissingCallbackConstructor())
-                _log.warn(msg);
-            else
-                throw new UserException(msg, t);
-        } 
-        return false;
-    }
-    
-    private PersistenceMetaDataDefaults getDefaults() {
-        MetaDataDefaults defaults = getRepository().getMetaDataFactory().
-            getDefaults();
-        if (defaults instanceof PersistenceMetaDataDefaults)
-            return (PersistenceMetaDataDefaults)defaults;
-        return null;
     }
     
     /**

Added: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataParsers.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataParsers.java?view=auto&rev=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataParsers.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataParsers.java Mon Oct  2 15:22:18 2006
@@ -0,0 +1,88 @@
+package org.apache.openjpa.persistence;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.apache.openjpa.event.LifecycleCallbacks;
+import org.apache.openjpa.event.LifecycleEvent;
+import org.apache.openjpa.event.MethodLifecycleCallbacks;
+import org.apache.openjpa.lib.log.Log;
+import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.meta.MetaDataDefaults;
+import org.apache.openjpa.util.UserException;
+
+/**
+ * Common utilities for persistence metadata parsers.
+ *
+ * @author Abe White
+ */
+class MetaDataParsers {
+
+    private static final Localizer _loc = Localizer.forPackage
+        (MetaDataParsers.class);
+
+    /**
+     * Return the event type constants for the given tag, or null if none.
+     */
+    public static int[] getEventTypes(MetaDataTag tag) {
+        switch (tag) {
+            case PRE_PERSIST:
+                return new int[]{ LifecycleEvent.BEFORE_PERSIST };
+            case POST_PERSIST:
+                return new int[]{ LifecycleEvent.AFTER_PERSIST };
+            case PRE_REMOVE:
+                return new int[]{ LifecycleEvent.BEFORE_DELETE };
+            case POST_REMOVE:
+                return new int[]{ LifecycleEvent.AFTER_DELETE };
+            case PRE_UPDATE:
+                return new int[]{ LifecycleEvent.BEFORE_STORE };
+            case POST_UPDATE:
+                return new int[]{ LifecycleEvent.AFTER_STORE };
+            case POST_LOAD:
+                return new int[]{ LifecycleEvent.AFTER_LOAD,
+                    LifecycleEvent.AFTER_REFRESH };
+            default:
+                return null;
+        }
+    }
+
+    /**
+     * Validate that the given listener class does not have multiple methods
+     * listening for the same lifecycle event, which is forbidden by the spec.  
+     */
+    public static void validateMethodsForSameCallback(Class cls, 
+        Collection<LifecycleCallbacks> callbacks, Method method, 
+        MetaDataTag tag, MetaDataDefaults def, Log log) {
+        if (callbacks == null || callbacks.isEmpty())
+            return;
+
+        for (LifecycleCallbacks lc: callbacks) {
+            if (!(lc instanceof MethodLifecycleCallbacks))
+                continue;
+            Method exists = ((MethodLifecycleCallbacks)lc).getCallbackMethod();
+            if (!exists.getDeclaringClass().equals(method.getDeclaringClass()))
+                continue;
+
+            PersistenceMetaDataDefaults defaults = getPersistenceDefaults(def);
+            Localizer.Message msg = _loc.get("multiple-methods-on-callback", 
+                new Object[] { method.getDeclaringClass().getName(), 
+                method.getName(), exists.getName(), tag.toString() });
+            if (defaults == null 
+                || defaults.getAllowsMultipleMethodsForSameCallback())
+                log.warn(msg);
+            else
+                throw new UserException(msg);
+        }
+    }
+    
+    /**
+     * Return the {@link PersistenceMetaDataDefaults} in use, or null if not
+     * using JPA defaults.
+     */
+    private static PersistenceMetaDataDefaults getPersistenceDefaults
+        (MetaDataDefaults def) {
+        if (def instanceof PersistenceMetaDataDefaults)
+            return (PersistenceMetaDataDefaults) def;
+        return null;
+    }
+}

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java Mon Oct  2 15:22:18 2006
@@ -78,10 +78,10 @@
      * settings. OpenJPA recognizes the following configuration settings in this
      * method:
      * <ul>
-     * <li>org.apache.openjpa.ConnectionUsername</li>
-     * <li>org.apache.openjpa.ConnectionPassword</li>
-     * <li>org.apache.openjpa.ConnectionRetainMode</li>
-     * <li>org.apache.openjpa.TransactionMode</li>
+     * <li>openjpa.ConnectionUsername</li>
+     * <li>openjpa.ConnectionPassword</li>
+     * <li>openjpa.ConnectionRetainMode</li>
+     * <li>openjpa.TransactionMode</li>
      * </ul>
      */
     public OpenJPAEntityManager createEntityManager(Map props);
@@ -90,7 +90,8 @@
      * Register a listener for lifecycle-related events on the specified
      * classes. If the classes are null, all events will be propagated to
      * the listener. The listener will be passed on to all new entity
-     * managers. See the <code>org.apache.openjpa.event</code> package for listener types.
+     * managers. See the <code>org.apache.openjpa.event</code> package for 
+     * listener types.
      *
      * @since 0.3.3
      */

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java Mon Oct  2 15:22:18 2006
@@ -53,17 +53,15 @@
 import org.apache.openjpa.util.MetaDataException;
 
 /**
- * Javax persistence-based metadata defaults.
+ * JPA-based metadata defaults.
  *
  * @author Patrick Linskey
  * @author Abe White
- * @nojavadoc
  */
 public class PersistenceMetaDataDefaults
     extends AbstractMetaDataDefaults {
 
-    private boolean _allowsMultipleMethodsOnSameCallback;
-    private boolean _allowsMissingCallbackConstructor;
+    private boolean _allowsMultipleMethodsForSameCallback = true;
 
     private static Localizer _loc = Localizer.forPackage
         (PersistenceMetaDataDefaults.class);
@@ -97,8 +95,6 @@
     public PersistenceMetaDataDefaults() {
         setCallbackMode(CALLBACK_RETHROW | CALLBACK_ROLLBACK |
             CALLBACK_FAIL_FAST);
-        _allowsMultipleMethodsOnSameCallback = true;
-        _allowsMissingCallbackConstructor = true;
     }
 
     /**
@@ -182,6 +178,35 @@
             return BASIC;
         return null;
     }
+    
+    /** 
+     * Flags if multiple methods of the same class can handle the same 
+     * callback event.
+     */
+    public boolean getAllowsMultipleMethodsForSameCallback() {
+        return _allowsMultipleMethodsForSameCallback;
+    }
+    
+    /** 
+     * Flags if multiple methods of the same class can handle the same 
+     * callback event.
+     */
+    public void setAllowsMultipleMethodsForSameCallback(boolean flag) {
+        _allowsMultipleMethodsForSameCallback = flag;
+    }
+
+    /**
+     * Auto-configuration method for the default access type of base classes 
+     * with ACCESS_UNKNOWN
+     */
+    public void setDefaultAccessType(String type) {
+        if (type == null)
+            return;
+        if ("PROPERTY".equals(type.toUpperCase()))
+            setDefaultAccessType(ClassMetaData.ACCESS_PROPERTY);
+        else
+            setDefaultAccessType(ClassMetaData.ACCESS_FIELD);
+    }
 
     @Override
     public void populate(ClassMetaData meta, int access) {
@@ -271,31 +296,4 @@
             return false;
         return true;
 	}
-    
-    /** 
-     * Flags if multiple methods of the same class can handle the same 
-     * callback event.
-     */
-    public boolean getAllowsMultipleMethodsOnSameCallback() {
-        return _allowsMultipleMethodsOnSameCallback;
-    }
-    
-    public void setAllowsMultipleMethodsOnSameCallback(boolean flag) {
-        _allowsMultipleMethodsOnSameCallback = flag;
-    }
-
-    /** 
-     * Flags if it allowed for the callback listener class not to have a no-arg 
-     * constructor.
-     */
-    
-    public boolean getAllowsMissingCallbackConstructor() {
-        return _allowsMissingCallbackConstructor;
-    }
-    
-    public void setAllowsMissingCallbackConstructor(boolean flag) {
-        _allowsMissingCallbackConstructor = flag;
-    }
-    
-    
 }

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java Mon Oct  2 15:22:18 2006
@@ -35,11 +35,13 @@
 
 import org.apache.openjpa.lib.conf.Configurable;
 import org.apache.openjpa.lib.conf.Configuration;
+import org.apache.openjpa.lib.conf.GenericConfigurable;
 import org.apache.openjpa.lib.meta.ClassAnnotationMetaDataFilter;
 import org.apache.openjpa.lib.meta.ClassArgParser;
 import org.apache.openjpa.lib.meta.MetaDataFilter;
 import org.apache.openjpa.lib.meta.MetaDataParser;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.Options;
 import org.apache.openjpa.meta.AbstractCFMetaDataFactory;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.FieldMetaData;
@@ -58,18 +60,18 @@
  */
 public class PersistenceMetaDataFactory
     extends AbstractCFMetaDataFactory
-    implements Configurable {
+    implements Configurable, GenericConfigurable {
 
     private static final Localizer _loc = Localizer.forPackage
         (PersistenceMetaDataFactory.class);
 
+    private final PersistenceMetaDataDefaults _def = 
+        new PersistenceMetaDataDefaults();
     private AnnotationPersistenceMetaDataParser _annoParser = null;
     private XMLPersistenceMetaDataParser _xmlParser = null;
-    private PersistenceMetaDataDefaults _def = null;
     private Map<URL, Set> _xml = null; // xml rsrc -> class names
     private Set<URL> _unparsed = null; // xml rsrc
     private boolean _fieldOverride = true;
-    private int _access = ClassMetaData.ACCESS_FIELD;
 
     /**
      * Whether to use field-level override or class-level override.
@@ -88,18 +90,6 @@
     }
 
     /**
-     * The default access type for base classes with ACCESS_UNKNOWN
-     */
-    public void setDefaultAccessType(String type) {
-        if (type == null)
-            return;
-        if ("PROPERTY".equals(type.toUpperCase()))
-            _access = ClassMetaData.ACCESS_PROPERTY;
-        else
-            _access = ClassMetaData.ACCESS_FIELD;
-    }
-
-    /**
      * Return metadata parser, creating it if it does not already exist.
      */
     public AnnotationPersistenceMetaDataParser getAnnotationParser() {
@@ -333,10 +323,6 @@
     }
 
     public MetaDataDefaults getDefaults() {
-        if (_def == null) {
-            _def = new PersistenceMetaDataDefaults();
-            _def.setDefaultAccessType(_access);
-        }
         return _def;
     }
 
@@ -415,4 +401,8 @@
         else
 			rsrcs.add ("META-INF/orm.xml");
 	}
+
+    public void setInto(Options opts) {
+        opts.keySet().retainAll(opts.setInto(_def).keySet());
+    }
 }

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java Mon Oct  2 15:22:18 2006
@@ -113,9 +113,10 @@
         throws IOException {
         if (pinfo == null)
             return null;
-
-        if (!isOpenJPAPersistenceProvider(pinfo, null))
+        if (!isOpenJPAPersistenceProvider(pinfo, null)) {
+            warnUnknownProvider(pinfo);
             return null;
+        }
 
         ConfigurationProviderImpl cp = new ConfigurationProviderImpl();
         cp.addProperties(PersistenceUnitInfoImpl.toOpenJPAProperties(pinfo));
@@ -148,8 +149,10 @@
         // persistence.xml does not exist; just load map
         PersistenceUnitInfoImpl pinfo = new PersistenceUnitInfoImpl();
         pinfo.fromUserProperties(m);
-        if (!isOpenJPAPersistenceProvider(pinfo, null))
+        if (!isOpenJPAPersistenceProvider(pinfo, null)) {
+            warnUnknownProvider(pinfo);
             return null;
+        }
         cp.addProperties(pinfo.toOpenJPAProperties());
         return cp;
     }
@@ -248,8 +251,10 @@
                 rsrc, String.valueOf(name)).getMessage(), getClass().getName(), 
                 rsrc);
         } else if (!isOpenJPAPersistenceProvider(pinfo, loader)) {
-            if (!explicit)
+            if (!explicit) {
+                warnUnknownProvider(pinfo);
                 return Boolean.FALSE;
+            }
             throw new MissingResourceException(_loc.get("unknown-provider", 
                 rsrc, name, pinfo.getPersistenceProviderClassName()).
                 getMessage(), getClass().getName(), rsrc);
@@ -319,20 +324,30 @@
         try {
             if (PersistenceProviderImpl.class.isAssignableFrom
                 (Class.forName(provider, false, loader))) {
-                // log not configured yet
-                warn(_loc.get("extended-provider", provider).getMessage());
+                log(_loc.get("extended-provider", provider).getMessage());
                 return true;
             }
         } catch (Throwable t) {
-            warn(_loc.get("unloadable-provider", provider, t).
-                getMessage());
+            log(_loc.get("unloadable-provider", provider, t).getMessage());
             return false;
         }
-        warn(_loc.get("unrecognized-provider", provider).getMessage());
         return false;
     }
+
+    /**
+     * Warn the user that we could only find an unrecognized persistence 
+     * provider.
+     */
+    private static void warnUnknownProvider(PersistenceUnitInfo pinfo) {
+        log(_loc.get("unrecognized-provider", 
+            pinfo.getPersistenceProviderClassName()).getMessage());
+    }
     
-    private static void warn(String msg) {
+    /**
+     * Log a message.   
+     */
+    private static void log(String msg) {
+        // at this point logging isn't configured yet
         System.err.println(msg);
     }
 

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java Mon Oct  2 15:22:18 2006
@@ -48,6 +48,7 @@
 import org.apache.openjpa.meta.FieldMetaData;
 import org.apache.openjpa.meta.JavaTypes;
 import org.apache.openjpa.meta.LifecycleMetaData;
+import org.apache.openjpa.meta.MetaDataDefaults;
 import org.apache.openjpa.meta.MetaDataFactory;
 import static org.apache.openjpa.meta.MetaDataModes.*;
 import org.apache.openjpa.meta.MetaDataRepository;
@@ -196,8 +197,7 @@
      * The annotation parser. When class is discovered in an XML file,
      * we first parse any annotations present, then override with the XML.
      */
-    public void setAnnotationParser(
-        AnnotationPersistenceMetaDataParser parser) {
+    public void setAnnotationParser(AnnotationPersistenceMetaDataParser parser){
         _parser = parser;
     }
 
@@ -588,9 +588,10 @@
                     warnUnsupportedTag(name);
             }
         } else if (tag instanceof PersistenceStrategy) {
-            ret = startStrategy((PersistenceStrategy) tag, attrs);
+            PersistenceStrategy ps = (PersistenceStrategy) tag;
+            ret = startStrategy(ps, attrs);
             if (ret)
-                _strategy = (PersistenceStrategy) tag;
+                _strategy = ps;
         } else if (tag == ELEM_LISTENER)
             ret = startEntityListener(attrs);
         else if (tag == ELEM_ATTRS)
@@ -819,8 +820,7 @@
         if (log.isInfoEnabled())
             log.info(_loc.get("parse-sequence", name));
 
-        SequenceMetaData meta = getRepository().getCachedSequenceMetaData
-            (name);
+        SequenceMetaData meta = getRepository().getCachedSequenceMetaData(name);
         if (meta != null && log.isWarnEnabled())
             log.warn(_loc.get("override-sequence", name));
 
@@ -835,8 +835,7 @@
         if (seq == null || seq.indexOf('(') == -1) {
             clsName = SequenceMetaData.IMPL_NATIVE;
             props = null;
-        } else // plugin
-        {
+        } else { // plugin
             clsName = Configurations.getClassName(seq);
             props = Configurations.getProperties(seq);
             seq = null;
@@ -1075,8 +1074,7 @@
                 field = meta.addDeclaredField(name, type);
                 PersistenceMetaDataDefaults.setCascadeNone(field);
                 PersistenceMetaDataDefaults.setCascadeNone(field.getKey());
-                PersistenceMetaDataDefaults.setCascadeNone
-                    (field.getElement());
+                PersistenceMetaDataDefaults.setCascadeNone(field.getElement());
             }
             field.backingMember(member);
         } else if (field == null) {
@@ -1342,8 +1340,7 @@
         if (log.isInfoEnabled())
             log.info(_loc.get("parse-query", name));
 
-        QueryMetaData meta = getRepository().getCachedQueryMetaData
-            (null, name);
+        QueryMetaData meta = getRepository().getCachedQueryMetaData(null, name);
         if (meta != null && log.isWarnEnabled())
             log.warn(_loc.get("override-query", name, currentLocation()));
 
@@ -1398,8 +1395,7 @@
         if (log.isInfoEnabled())
             log.info(_loc.get("parse-native-query", name));
 
-        QueryMetaData meta = getRepository().getCachedQueryMetaData
-            (null, name);
+        QueryMetaData meta = getRepository().getCachedQueryMetaData(null, name);
         if (meta != null && log.isWarnEnabled())
             log.warn(_loc.get("override-query", name, currentLocation()));
 
@@ -1486,8 +1482,8 @@
         _listener = classForName(attrs.getValue("class"));
         boolean system = currentElement() == null;
         Collection<LifecycleCallbacks>[] parsed = 
-            new AnnotationPersistenceMetaDataParser(_conf).parseCallbackMethods
-            (_listener, null, true, true);
+            AnnotationPersistenceMetaDataParser.parseCallbackMethods(_listener,
+                null, true, true, _repos);
         if (parsed == null)
             return true;
 
@@ -1526,8 +1522,11 @@
         throws SAXException {
         if (!isMetaDataMode())
             return false;
-        boolean system = currentElement() == null;
+        int[] events = MetaDataParsers.getEventTypes(callback);
+        if (events == null)
+            return false;
 
+        boolean system = currentElement() == null;
         Class type = currentElement() == null ? null :
             ((ClassMetaData) currentElement()).getDescribedType();
         if (type == null)
@@ -1540,6 +1539,7 @@
                 _highs = new int[LifecycleEvent.ALL_EVENTS.length];
         }
 
+        MetaDataDefaults def = _repos.getMetaDataFactory().getDefaults();
         LifecycleCallbacks adapter;
         if (_listener != null)
             adapter = new BeanLifecycleCallbacks(_listener,
@@ -1548,12 +1548,13 @@
             adapter = new MethodLifecycleCallbacks(_cls,
                 attrs.getValue("method-name"), false);
 
-        int[] events = getEventTypes(callback);
-        if (events == null)
-            return true;
-
         for (int i = 0; i < events.length; i++) {
             int event = events[i];
+            if (_listener != null) {
+                MetaDataParsers.validateMethodsForSameCallback(_listener, 
+                    _callbacks[event], ((BeanLifecycleCallbacks) adapter).
+                    getCallbackMethod(), callback, def, getLog());
+            }
             if (_callbacks[event] == null)
                 _callbacks[event] = new ArrayList<LifecycleCallbacks>(3);
             _callbacks[event].add(adapter);
@@ -1563,28 +1564,6 @@
         return true;
     }
 
-    static int[] getEventTypes(MetaDataTag tag) {
-        switch (tag) {
-            case PRE_PERSIST:
-                return new int[]{ LifecycleEvent.BEFORE_PERSIST };
-            case POST_PERSIST:
-                return new int[]{ LifecycleEvent.AFTER_PERSIST };
-            case PRE_REMOVE:
-                return new int[]{ LifecycleEvent.BEFORE_DELETE };
-            case POST_REMOVE:
-                return new int[]{ LifecycleEvent.AFTER_DELETE };
-            case PRE_UPDATE:
-                return new int[]{ LifecycleEvent.BEFORE_STORE };
-            case POST_UPDATE:
-                return new int[]{ LifecycleEvent.AFTER_STORE };
-            case POST_LOAD:
-                return new int[]{ LifecycleEvent.AFTER_LOAD,
-                    LifecycleEvent.AFTER_REFRESH };
-            default:
-                return null;
-        }
-    }
-
     /**
      * Store lifecycle metadata.
      */
@@ -1593,8 +1572,8 @@
         Class supCls = cls.getDescribedType().getSuperclass();
         Collection<LifecycleCallbacks>[] supCalls = null;
         if (!Object.class.equals(supCls)) {
-            supCalls = new AnnotationPersistenceMetaDataParser(_conf).
-                parseCallbackMethods(supCls, null, true, false);
+            supCalls = AnnotationPersistenceMetaDataParser.parseCallbackMethods
+                (supCls, null, true, false, _repos);
         }
         if (supCalls != null) {
             for (int event : LifecycleEvent.ALL_EVENTS) {
@@ -1622,11 +1601,10 @@
     /**
      * Instantiate the given class, taking into account the default package.
 	 */
-	protected Class classForName (String name)
-		throws SAXException
-	{
-		if ("Entity".equals (name))
+	protected Class classForName(String name)
+		throws SAXException {
+		if ("Entity".equals(name))
 			return PersistenceCapable.class;
-		return super.classForName (name, isRuntime ());
+		return super.classForName(name, isRuntime());
 	}
 }

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties Mon Oct  2 15:22:18 2006
@@ -60,7 +60,7 @@
 	"{1}" can''t be found in your class path.
 cantload-xml-config: The specified XML resource "{0}" for persistence unit \
 	"{1}" can''t be parsed.
-unknown-provider: Persistence Provider "{2}" specified in persistence unit \
+unknown-provider: Persistence provider "{2}" specified in persistence unit \
 	"{1}" in "{0}" is not a recognized provider.
 illegal-index: The parameter index {0} is invalid. Parameters must be \
 	integers starting at 1.
@@ -86,19 +86,11 @@
 no-transaction: Cannot perform operation with no transaction.
 multiple-methods-on-callback: Class "{0}" declares method "{1}" as well \
 	as "{2}" for handling the same "{3}" callback. 
-multiple-methods-on-callback-error: Class "{0}" declares method "{1}" as well \
-	as "{2}" for handling the same "{3}" callback. \
-	"AllowsMultipleMethodsOnSameCallback" property of MetaDataDefaults can be \
-	set to true to supress this exception.
-missing-no-arg-constructor: Entity listener class "{0}" must declare a no-arg \
-	constructor. "AllowsNoArgConstructorCallback" property of MetaDataDefaults \
-	can be set to true to ignore this exception.	  
-extended-provider: WARNING: Configured to use extended Persistence Provider \
-	"{0}".
-unloadable-provider: WARNING: Can not load configured Persistence Provider \
-	"{0}" due to "{1}"
-unrecognized-provider: WARNING: Configured to use non-recognized Persistence \
-	Provider "{0}" 
+extended-provider: NOTE: Found extended persistence provider "{0}".
+unloadable-provider: WARNING: Unable to load persistence provider "{0}" due \
+    to "{1}"
+unrecognized-provider: WARNING: Found unrecognized persistence provider "{0}" \
+    in place of OpenJPA provider.  This provider's properties will not be used.
 EntityManagerFactory-name: EntityManagerFactory implementation
 EntityManagerFactory-desc: Allows extension of standard \
     org.apache.openjpa.persistence.EntityManagerFactoryImpl for custom behavior.

Modified: incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml (original)
+++ incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml Mon Oct  2 15:22:18 2006
@@ -105,11 +105,11 @@
 <emphasis role="bold"><link linkend="jpa_overview_trans"><classname>
 EntityTransaction</classname></link></emphasis>: Each <classname>EntityManager
 </classname> has a one-to-one relation with a single <classname>
-javax.persistence.EntityTransaction</classname>. <classname>EntityTransaction
-</classname>s allow operations on persistent data to be grouped into units of
-work that either completely succeed or completely fail, leaving the datastore in
-its original state. These all-or-nothing operations are important for
-maintaining data integrity.
+javax.persistence.EntityTransaction</classname>. <classname>
+EntityTransaction</classname>s allow operations on persistent data to be 
+grouped into units of work that either completely succeed or completely fail, 
+leaving the datastore in its original state. These all-or-nothing operations 
+are important for maintaining data integrity.
             </para>
         </listitem>
         <listitem>
@@ -178,38 +178,37 @@
 <programlisting>
 // get an EntityManagerFactory using the Persistence class; typically 
 // the factory is cached for easy repeated use
-EntityManagerFactory factory = Persistence.createEntityManagerFactory (null);
+EntityManagerFactory factory = Persistence.createEntityManagerFactory(null);
 
 // get an EntityManager from the factory
-EntityManager em = factory.createEntityManager (PersistenceContextType.EXTENDED);
+EntityManager em = factory.createEntityManager(PersistenceContextType.EXTENDED);
 
 // updates take place within transactions
-EntityTransaction tx = em.getTransaction ();
-tx.begin ();
+EntityTransaction tx = em.getTransaction();
+tx.begin();
 
 // query for all employees who work in our research division
 // and put in over 40 hours a week average
-Query query = em.createQuery ("select e from Employee e where "
+Query query = em.createQuery("select e from Employee e where "
     + "e.division.name = 'Research' AND e.avgHours &gt; 40");
 List results = query.getResultList ();
 
 // give all those hard-working employees a raise
-for (Object res : results)
-{
+for (Object res : results) {
     Employee emp = (Employee) res;
-    emp.setSalary (emp.getSalary () * 1.1);
+    emp.setSalary(emp.getSalary() * 1.1);
 }
 
 // commit the updates and free resources
-tx.commit ();
-em.close ();
-factory.close ();
+tx.commit();
+em.close();
+factory.close();
 </programlisting>
     </example>
     <para>
 Within a container, the <classname>EntityManager</classname> will be injected
-and transactional handled declaratively. Thus, the in-container version of the
-example consists entirely of business logic:
+and transactions will be handled declaratively. Thus, the in-container version 
+of the example consists entirely of business logic:
     </para>
     <example id="jpa_overview_arch_interact_inside">
         <title>
@@ -219,15 +218,14 @@
 // query for all employees who work in our research division
 // and put in over 40 hours a week average - note that the EntityManager em
 // is injected using a @Resource annotation
-Query query = em.createQuery ("select e from Employee e where "
+Query query = em.createQuery("select e from Employee e where "
     + "e.division.name = 'Research' and e.avgHours &gt; 40");
-List results = query.getResultList ();
+List results = query.getResultList();
 
 // give all those hard-working employees a raise
-for (Object res : results)
-{
+for (Object res : results) {
     emp = (Employee) res;
-    emp.setSalary (emp.getSalary () * 1.1);
+    emp.setSalary(emp.getSalary() * 1.1);
 } 
 </programlisting>
     </example>
@@ -274,8 +272,8 @@
         <para>
 The diagram above depicts the JPA exception architecture. All
 exceptions are unchecked. JPA uses standard exceptions where
-appropriate, most notably <classname> IllegalArgumentException</classname>s and
-<classname> IllegalStateException</classname> s. The specification also provides
+appropriate, most notably <classname>IllegalArgumentException</classname>s and
+<classname>IllegalStateException</classname>s. The specification also provides
 a few JPA-specific exceptions in the <literal>javax.persistence</literal>
 package. These exceptions should be self-explanatory. See the
 <ulink url="http://java.sun.com/javaee/5/docs/api">Javadoc</ulink> for

Modified: incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_conclusion.xml
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_conclusion.xml?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_conclusion.xml (original)
+++ incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_conclusion.xml Mon Oct  2 15:22:18 2006
@@ -3,10 +3,14 @@
         Conclusion
     </title>
     <para>
-This concludes our overview of the JPA specification. The
-<link linkend="jpa_tutorials_intro">OpenJPA Tutorials</link> continue your
+This concludes our overview of the JPA specification. 
+<!--
+### TUTORIAL
+The <link linkend="jpa_tutorials_intro">OpenJPA Tutorials</link> continue your
 JPA education with step-by-step instructions for building simple JPA
-applications. The <link linkend="ref_guide_intro">OpenJPA Reference Guide</link>
+applications. 
+-->
+The <link linkend="ref_guide_intro">OpenJPA Reference Guide</link>
 contains detailed documentation on all aspects of the OpenJPA implementation 
 and core development tools.
     </para>

Modified: incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml (original)
+++ incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml Mon Oct  2 15:22:18 2006
@@ -18,14 +18,15 @@
 The diagram above presents an overview of the <classname>EntityManager
 </classname> interface. For a complete treatment of the <classname>
 EntityManager</classname> API, see the
-<ulink url="jdo-javadoc/javax/jdo/EntityManager.html"> Javadoc</ulink>
-documentation. Methods whose parameter signatures consist of an ellipsis (...)
-are overloaded to take multiple parameter types.
+<ulink url="http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html">
+Javadoc</ulink> documentation. Methods whose parameter signatures consist of 
+an ellipsis (...) are overloaded to take multiple parameter types.
     </para>
     <note>
         <para>
 OpenJPA extends the standard <classname>EntityManager</classname> interface with
-the <ulink url="../../api/openjpa/persistence/OpenJPAEntityManager.html">
+the 
+<ulink url="../apidocs/org/apache/openjpa/persistence/OpenJPAEntityManager.html">
 <classname>org.apache.openjpa.persistence.OpenJPAEntityManager</classname>
 </ulink> interface to provide additional functionality.
         </para>
@@ -100,7 +101,7 @@
 </link> instance. In fact, many vendors use a single class to implement both the
 <classname>EntityManager</classname> and <classname>EntityTransaction
 </classname> interfaces. If your application requires multiple concurrent
-transactions, you will use multiple <classname>EntityManager</classname> s.
+transactions, you will use multiple <classname>EntityManager</classname>s.
         </para>
         <para>
 You can retrieve the <classname>EntityTransaction</classname> associated with an
@@ -129,7 +130,7 @@
 lifecycle state of entity instances.
         </para>
 <programlisting>
-public void persist (Object entity);
+public void persist(Object entity);
 </programlisting>
         <para>
         <indexterm>
@@ -198,7 +199,7 @@
 This action can only be used in the context of an active transaction.
         </para>
 <programlisting>
-public void remove (Object entity);
+public void remove(Object entity);
 </programlisting>
         <para>
         <indexterm>
@@ -268,7 +269,7 @@
 This action can only be used in the context of an active transaction.
         </para>
 <programlisting>
-public void refresh (Object entity);
+public void refresh(Object entity);
 </programlisting>
         <para>
         <indexterm>
@@ -345,7 +346,7 @@
             </listitem>
         </itemizedlist>
 <programlisting>
-public Object merge (Object entity);
+public Object merge(Object entity);
 </programlisting>
         <para>
         <indexterm>
@@ -562,27 +563,27 @@
             </indexterm>
 <programlisting>
 // create some objects
-Magazine mag = new Magazine ("1B78-YU9L", "JavaWorld");
+Magazine mag = new Magazine("1B78-YU9L", "JavaWorld");
 
-Company pub = new Company ("Weston House");
-pub.setRevenue (1750000D);
-mag.setPublisher (pub);
-pub.addMagazine (mag);
-
-Article art = new Article ("JPA Rules!", "Transparent Object Persistence");
-art.addAuthor (new Author ("Fred", "Hoyle"));
-mag.addArticle (art);
+Company pub = new Company("Weston House");
+pub.setRevenue(1750000D);
+mag.setPublisher(pub);
+pub.addMagazine(mag);
+
+Article art = new Article("JPA Rules!", "Transparent Object Persistence");
+art.addAuthor(new Author("Fred", "Hoyle"));
+mag.addArticle(art);
 
 // persist
-EntityManager em = emf.createEntityManager ();
-em.getTransaction ().begin ();
-em.persist (mag);
-em.persist (pub);
-em.persist (art);
-em.getTransaction ().commit ();
+EntityManager em = emf.createEntityManager();
+em.getTransaction().begin();
+em.persist(mag);
+em.persist(pub);
+em.persist(art);
+em.getTransaction().commit();
 
 // or we could continue using the EntityManager...
-em.close ();
+em.close();
 </programlisting>
         </example>
         <example id="jpa_overview_em_lifecycle_update">
@@ -601,23 +602,23 @@
                 </tertiary>
             </indexterm>
 <programlisting>
-Magazine.MagazineId mi = new Magazine.MagazineId ();
+Magazine.MagazineId mi = new Magazine.MagazineId();
 mi.isbn = "1B78-YU9L";
 mi.title = "JavaWorld";
 
 // updates should always be made within transactions; note that
 // there is no code explicitly linking the magazine or company
 // with the transaction; JPA automatically tracks all changes
-EntityManager em = emf.createEntityManager ();
-em.getTransaction ().begin ();
-Magazine mag = em.find (Magazine.class, mi);
-mag.setPrice (5.99);
-Company pub = mag.getPublisher ();
-pub.setRevenue (1750000D);
-em.getTransaction ().commit ();
+EntityManager em = emf.createEntityManager();
+em.getTransaction().begin();
+Magazine mag = em.find(Magazine.class, mi);
+mag.setPrice(5.99);
+Company pub = mag.getPublisher();
+pub.setRevenue(1750000D);
+em.getTransaction().commit();
 
 // or we could continue using the EntityManager...
-em.close ();
+em.close();
 </programlisting>
         </example>
         <example id="jpa_overview_em_lifecycle_delete">
@@ -641,16 +642,16 @@
 Object oid = ...;
 
 // deletes should always be made within transactions
-EntityManager em = emf.createEntityManager ();
-em.getTransaction ().begin ();
-Company pub = (Company) em.find (Company.class, oid);
-for (Subscription sub : pub.getSubscriptions ())
-    em.remove (sub);
-pub.getSubscriptions ().clear ();
-em.getTransaction ().commit ();
+EntityManager em = emf.createEntityManager();
+em.getTransaction().begin();
+Company pub = (Company) em.find(Company.class, oid);
+for (Subscription sub : pub.getSubscriptions())
+    em.remove(sub);
+pub.getSubscriptions().clear();
+em.getTransaction().commit();
 
 // or we could continue using the EntityManager...
-em.close ();
+em.close();
 </programlisting>
         </example>
         <example id="jpa_overview_em_detachex">
@@ -665,37 +666,37 @@
 <programlisting>
 // CLIENT:
 // requests an object with a given oid
-Record detached = (Record) getFromServer (oid);
+Record detached = (Record) getFromServer(oid);
 
 ...
 
 // SERVER:
 // send object to client; object detaches on EM close
-Object oid = processClientRequest ();
-EntityManager em = emf.createEntityManager ();
-Record record = em.find (Record.class, oid);
-em.close ();
-sendToClient (record);
+Object oid = processClientRequest();
+EntityManager em = emf.createEntityManager();
+Record record = em.find(Record.class, oid);
+em.close();
+sendToClient(record);
 
 ...
 
 // CLIENT:
 // makes some modifications and sends back to server
-detached.setSomeField ("bar");
-sendToServer (detached);
+detached.setSomeField("bar");
+sendToServer(detached);
 
 ...
 
 // SERVER:
 // merges the instance and commit the changes
-Record modified = (Record) processClientRequest ();
-EntityManager em = emf.createEntityManager ();
-em.getTransaction ().begin ();
-Record merged = (Record) em.merge (modified);
-merged.setLastModified (System.currentTimeMillis ());
-merged.setModifier (getClientIdentityCode ());
-em.getTransaction ().commit ();
-em.close ();
+Record modified = (Record) processClientRequest();
+EntityManager em = emf.createEntityManager();
+em.getTransaction().begin();
+Record merged = (Record) em.merge(modified);
+merged.setLastModified(System.currentTimeMillis());
+merged.setModifier(getClientIdentityCode());
+em.getTransaction().commit();
+em.close();
 </programlisting>
         </example>
     </section>
@@ -713,7 +714,7 @@
 persistence contexts.
         </para>
 <programlisting>
-public &lt;T&gt; T find (Class&lt;T&gt; cls, Object oid);
+public &lt;T&gt; T find(Class&lt;T&gt; cls, Object oid);
 </programlisting>
         <para>
         <indexterm>
@@ -751,7 +752,7 @@
 returns null.
         </para>
 <programlisting>
-public &lt;T&gt; T getReference (Class&lt;T&gt; cls, Object oid);
+public &lt;T&gt; T getReference(Class&lt;T&gt; cls, Object oid);
 </programlisting>
         <para>
         <indexterm>
@@ -794,11 +795,11 @@
 implementation may throw an <classname>EntityNotFoundException</classname> if it
 discovers that the entity does not exist in the datastore. The implementation
 may also throw an <classname>EntityNotFoundException</classname> from the
-<methodname>getReference</methodname> method itself. Unlike <methodname>find
-</methodname>, <methodname>getReference</methodname> does not return null.
+<methodname>getReference</methodname> method itself. Unlike <methodname>
+find</methodname>, <methodname>getReference</methodname> does not return null.
         </para>
 <programlisting>
-public boolean contains (Object entity);
+public boolean contains(Object entity);
 </programlisting>
         <para>
         <indexterm>
@@ -835,7 +836,7 @@
             </secondary>
         </indexterm>
 <programlisting>
-public void flush ();
+public void flush();
 </programlisting>
         <para>
         <indexterm>
@@ -875,8 +876,8 @@
 TransactionRequiredException</classname>.
         </para>
 <programlisting>
-public FlushModeType getFlushMode ();
-public void setFlushMode (FlushModeType flushMode);
+public FlushModeType getFlushMode();
+public void setFlushMode(FlushModeType flushMode);
 </programlisting>
         <para>
         <indexterm>
@@ -928,7 +929,7 @@
             </para>
         </note>
 <programlisting>
-public void clear ();
+public void clear();
 </programlisting>
         <para>
         <indexterm>
@@ -976,7 +977,7 @@
             </secondary>
         </indexterm>
 <programlisting>
-public Query createQuery (String query);
+public Query createQuery(String query);
 </programlisting>
         <para>
 <classname>Query</classname> objects are used to find entities matching certain
@@ -985,7 +986,7 @@
 <xref linkend="jpa_overview_query"/> for details.
         </para>
 <programlisting>
-public Query createNamedQuery (String name);
+public Query createNamedQuery(String name);
 </programlisting>
         <para>
 This method retrieves a query defined in metadata by name. The returned
@@ -994,9 +995,9 @@
 <xref linkend="jpa_overview_query_named"/>.
         </para>
 <programlisting>
-public Query createNativeQuery (String sql);
-public Query createNativeQuery (String sql, Class resultCls);
-public Query createNativeQuery (String sql, String resultMapping);
+public Query createNativeQuery(String sql);
+public Query createNativeQuery(String sql, Class resultCls);
+public Query createNativeQuery(String sql, String resultMapping);
 </programlisting>
         <para>
 <emphasis>Native</emphasis> queries are queries in the datastore's native
@@ -1018,8 +1019,8 @@
             </secondary>
         </indexterm>
 <programlisting>
-public boolean isOpen ();
-public void close ();
+public boolean isOpen();
+public void close();
 </programlisting>
         <para>
 When an <classname>EntityManager</classname> is no longer needed, you should

Modified: incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml?view=diff&rev=452243&r1=452242&r2=452243
==============================================================================
--- incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml (original)
+++ incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml Mon Oct  2 15:22:18 2006
@@ -22,7 +22,7 @@
         <para>
 OpenJPA extends the standard <classname>EntityManagerFactory</classname>
 interface with the
-<ulink url="../../api/openjpa/persistence/OpenJPAEntityManagerFactory.html">
+<ulink url="../apidocs/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.html">
 <classname>OpenJPAEntityManagerFactory</classname></ulink> to provide additional
 functionality.
         </para>
@@ -73,9 +73,9 @@
                 JNDI
             </primary>
         </indexterm>
-JPA allows you to create and configure an <classname>EntityManagerFactory
-</classname>, then store it in a Java Naming and Directory Interface (JNDI)
-tree for later retrieval and use.
+JPA allows you to create and configure an <classname>
+EntityManagerFactory</classname>, then store it in a Java Naming and Directory 
+Interface (JNDI) tree for later retrieval and use.
         </para>
     </section>
     <section id="jpa_overview_emfactory_em">
@@ -102,8 +102,8 @@
             </secondary>
         </indexterm>
 <programlisting>
-public EntityManager createEntityManager ();
-public EntityManager createEntityManager (Map map);
+public EntityManager createEntityManager();
+public EntityManager createEntityManager(Map map);
 </programlisting>
         <para>
 The two <methodname>createEntityManager</methodname> methods above create a new
@@ -144,8 +144,8 @@
 <literal>openjpa.&lt;property&gt;</literal>, where <emphasis>&lt;property&gt;
 </emphasis> is any JavaBean property of the
 <ulink url="../apidocs/org/apache/openjpa/persistence/OpenJPAEntityManager.html">
-<classname> org.apache.openjpa.persistence.OpenJPAEntityManager</classname>
-</ulink>.
+<classname>
+org.apache.openjpa.persistence.OpenJPAEntityManager</classname></ulink>.
                     </para>
                 </listitem>
             </itemizedlist>
@@ -217,7 +217,7 @@
         <para>
 Injected <classname>EntityManager</classname>s have use a <emphasis>transaction
 </emphasis>, while <classname> EntityManager</classname>s obtained through the
-<classname>EntityManagerFactory</classname> have an <emphasis> extended
+<classname>EntityManagerFactory</classname> have an <emphasis>extended
 </emphasis> persistence context. We describe these persistence context types
 below.
         </para>
@@ -276,9 +276,9 @@
 
 // each operation occurs in a separate persistence context, and returns 
 // a new detached instance
-Magazine mag1 = em.find (Magazine.class, magId);
-Magazine mag2 = em.find (Magazine.class, magId);
-assertTrue (mag2 != mag1);
+Magazine mag1 = em.find(Magazine.class, magId);
+Magazine mag2 = em.find(Magazine.class, magId);
+assertTrue(mag2 != mag1);
 ...
 
 // transaction begins:
@@ -287,17 +287,17 @@
 // detached objects.  however, two lookups within the same transaction
 // return the same instance, because the persistence context spans the
 // transaction
-Magazine mag3 = em.find (Magazine.class, magId);
-assertTrue (mag3 != mag1 &amp;&amp; mag3 != mag2);
-Magazine mag4 = em.find (Magazine.class (magId);
-assertTrue (mag4 == mag3);
+Magazine mag3 = em.find(Magazine.class, magId);
+assertTrue(mag3 != mag1 &amp;&amp; mag3 != mag2);
+Magazine mag4 = em.find(Magazine.class (magId);
+assertTrue(mag4 == mag3);
 ...
 
 // transaction commits:
 
 // once again, each operation returns a new instance
-Magazine mag5 = em.find (Magazine.class, magId);
-assertTrue (mag5 != mag3);
+Magazine mag5 = em.find(Magazine.class, magId);
+assertTrue(mag5 != mag3);
 </programlisting>
             </example>
         </section>
@@ -324,30 +324,30 @@
                 </para>
 <programlisting>
 EntityManagerFactory emf = ...
-EntityManager em = emf.createEntityManager (PersistenceContextType.EXTENDED);
+EntityManager em = emf.createEntityManager();
 
 // persistence context active for entire life of EM, so only one entity
 // for a given persistent identity
-Magazine mag1 = em.find (Magazine.class, magId);
-Magazine mag2 = em.find (Magazine.class, magId);
-assertTrue (mag2 == mag1);
+Magazine mag1 = em.find(Magazine.class, magId);
+Magazine mag2 = em.find(Magazine.class, magId);
+assertTrue(mag2 == mag1);
 
-em.getTransaction ().begin ();
+em.getTransaction().begin();
 
 // same persistence context active within the transaction
-Magazine mag3 = em.find (Magazine.class, magId);
-assertTrue (mag3 == mag1);
-Magazine mag4 = em.find (Magazine.class (magId);
-assertTrue (mag4 == mag1);
+Magazine mag3 = em.find(Magazine.class, magId);
+assertTrue(mag3 == mag1);
+Magazine mag4 = em.find(Magazine.class (magId);
+assertTrue(mag4 == mag1);
 
 em.getTransaction.commit ();
 
 // when the transaction commits, instance still managed
-Magazine mag5 = em.find (Magazine.class, magId);
-assertTrue (mag5 == mag1);
+Magazine mag5 = em.find(Magazine.class, magId);
+assertTrue(mag5 == mag1);
 
 // instance finally becomes detached when EM closes
-em.close ();
+em.close();
 </programlisting>
             </example>
         </section>
@@ -389,8 +389,8 @@
 applications that require multiple factories with different configurations have
 an obvious reason to create and close multiple <classname>EntityManagerFactory
 </classname> instances. Once a factory is closed, all methods except
-<methodname>isOpen</methodname> throw an <classname> IllegalStateException
-</classname>.
+<methodname>isOpen</methodname> throw an <classname>
+IllegalStateException</classname>.
         </para>
     </section>
 </chapter>



Mime
View raw message