db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew T. Adams" <matthew.ad...@xcalia.com>
Subject FW: svn commit: r564384 [1/3] - in /db/jdo/trunk: api2-legacy/src/java/javax/jdo/ api2-legacy/src/schema/javax/jdo/ api2-legacy/test/java/javax/jdo/ api2-legacy/test/schema/jdoconfig/Negative0/ api2-legacy/test/schema/jdoconfig/Negative00/ api2-legacy/tes
Date Thu, 09 Aug 2007 21:37:03 GMT
FYI, this patch (JDO-496) includes changes to the public API, and also therefore TCK signature files.  I wanted to alert implementers to make sure they know about it.

-matthew

-----Original Message-----
From: madams@apache.org [mailto:madams@apache.org] 
Sent: Thursday, August 09, 2007 2:21 PM
To: jdo-commits@db.apache.org
Subject: svn commit: r564384 [1/3] - in /db/jdo/trunk: api2-legacy/src/java/javax/jdo/ api2-legacy/src/schema/javax/jdo/ api2-legacy/test/java/javax/jdo/ api2-legacy/test/schema/jdoconfig/Negative0/ api2-legacy/test/schema/jdoconfig/Negative00/ api2-legacy/test...

Author: madams
Date: Thu Aug  9 14:20:35 2007
New Revision: 564384

URL: http://svn.apache.org/viewvc?view=rev&rev=564384
Log:
JDO-496

Added:
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative07/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative07/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative07/META-INF/services/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative07/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/services/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/services/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/services/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/services/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/META-INF/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative07/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative07/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative07/META-INF/services/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative07/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/services/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/services/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/services/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/services/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/META-INF/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml
Removed:
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative0/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative1/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative2/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative3/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative4/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative5/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative6/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative7/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative8/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive0/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive1/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive3/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive4/
    db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive5/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative0/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative1/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative2/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative3/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative4/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative5/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative6/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative7/
    db/jdo/trunk/api2/test/schema/jdoconfig/Negative8/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive0/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive1/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive3/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive4/
    db/jdo/trunk/api2/test/schema/jdoconfig/Positive5/
Modified:
    db/jdo/trunk/api2-legacy/src/java/javax/jdo/Bundle.properties
    db/jdo/trunk/api2-legacy/src/java/javax/jdo/Constants.java
    db/jdo/trunk/api2-legacy/src/java/javax/jdo/JDOHelper.java
    db/jdo/trunk/api2-legacy/src/java/javax/jdo/PersistenceManagerFactory.java
    db/jdo/trunk/api2-legacy/src/schema/javax/jdo/jdoconfig_2_1.xsd
    db/jdo/trunk/api2-legacy/test/java/javax/jdo/JDOHelperConfigTest.java
    db/jdo/trunk/api2/src/java/javax/jdo/Bundle.properties
    db/jdo/trunk/api2/src/java/javax/jdo/Constants.java
    db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java
    db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java
    db/jdo/trunk/api2/src/schema/javax/jdo/jdoconfig_2_1.xsd
    db/jdo/trunk/api2/test/java/javax/jdo/JDOHelperConfigTest.java
    db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt
    db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt

Modified: db/jdo/trunk/api2-legacy/src/java/javax/jdo/Bundle.properties
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/src/java/javax/jdo/Bundle.properties?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/src/java/javax/jdo/Bundle.properties (original)
+++ db/jdo/trunk/api2-legacy/src/java/javax/jdo/Bundle.properties Thu Aug  9 14:20:35 2007
@@ -25,8 +25,9 @@
 EXC_GetPMFUnexpectedException=Unexpected exception caught.
 EXC_GetPMFClassNotFound=Class {0} was not found.
 EXC_GetPMFIllegalAccess=Illegal Access for class {0}.
-EXC_GetPMFNoClassNameProperty=A property named javax.jdo.PersistenceManagerFactoryClass must be specified, \ 
-or the jar file with the default META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath.
+EXC_GetPMFNoPMFClassNamePropertyOrPUNameProperty=A property named javax.jdo.PersistenceManagerFactoryClass must be specified, \
+or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, \
+or a property named javax.jdo.option.PersistenceUnitName must be specified.
 EXC_IOExceptionDuringServiceLookup=IO error while attempting to lookup PMF name \
 via META-INF/services/javax.jdo.PersistenceManagerFactory
 MSG_FailedObject=FailedObject:
@@ -80,10 +81,10 @@
 EXC_DateStringConstructor: Error parsing Date string "{0}" at position {1} \
 using date format "{2}".
 MSG_unknown: unknown
-EXC_DuplicateRequestedPersistenceUnitFoundInDifferentConfigs: Duplicate \
-persistence unit name "{0}" found in {1} and {2}.
-EXC_DuplicateRequestedPersistenceUnitFoundInSameConfig: Duplicate persistence \
-unit name "{0}" found in {1}.
+EXC_DuplicateRequestedNamedPMFFoundInDifferentConfigs: Duplicate \
+PMF name "{0}" found in {1} and {2}.
+EXC_DuplicateRequestedNamedPMFFoundInSameConfig: Duplicate PMF \
+name "{0}" found in {1}.
 EXC_UnableToInvokeCreateEMFMethod:  Unable to invoke \
 javax.persistence.Persistence.createEntityManagerFactory(String)
 EXC_UnableToCastEMFToPMF:  Unable to cast EntityManagerFactory class {0} \
@@ -95,10 +96,10 @@
 EXC_SAXParseException:  Exception parsing configuration {0}\
 at line {1}, column {2}
 EXC_SAXException:  Exception parsing configuration {0}
-EXC_DuplicatePropertyFound: Duplicate property name "{0}" found in persistence \
-unit name "{1}" found in {2}.
-EXC_DuplicatePersistenceUnitNamePropertyFoundWithinUnitConfig:  Duplicate \
-persistence unit name found in {2}:  attribute is "{0}", element is "{1}"
+EXC_DuplicatePropertyFound: Duplicate property name "{0}" found in PMF \
+configuration with name "{1}" found in {2}.
+EXC_DuplicatePMFNamePropertyFoundWithinConfig:  Duplicate \
+PMF name found in {2}:  attribute is "{0}", element is "{1}"
 EXC_PropertyElementHasNoNameAttribute:  Found <property> element with no \
 "name" attribute in {0}
 EXC_PropertyElementNameAttributeHasNoValue:  Found <property> element name \
@@ -111,5 +112,5 @@
 "listener" missing value in {0}
 EXC_InvalidJDOConfigNoRoot:  No root <jdoconfig> element found in {0}
 EXC_NoPMFConfigurableViaPropertiesOrXML: No PersistenceManagerFactory \
-configurable via properties resource "{0}" or no persistence unit named "{0}" \
-found using resource loader {1}
+configurable via properties resource "{0}" or no named PMF or persistence unit\
+named "{0}" found using resource loader {1}

Modified: db/jdo/trunk/api2-legacy/src/java/javax/jdo/Constants.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/src/java/javax/jdo/Constants.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/src/java/javax/jdo/Constants.java (original)
+++ db/jdo/trunk/api2-legacy/src/java/javax/jdo/Constants.java Thu Aug  9 14:20:35 2007
@@ -98,6 +98,14 @@
         = "class";
     /**
      * The name of the persistence manager factory element's
+     * "name" attribute.
+     *
+     * @since 2.1
+     */
+    static String PMF_ATTRIBUTE_NAME
+        = "name";
+    /**
+     * The name of the persistence manager factory element's
      * "persistence-unit-name" attribute.
      *
      * @since 2.1
@@ -649,6 +657,14 @@
      */
     static String PROPERTY_PERSISTENCE_UNIT_NAME
         = "javax.jdo.option.PersistenceUnitName";
+    /**
+     * "javax.jdo.option.Name"
+     *
+     * @see PersistenceManagerFactory#getName()
+     * @since 2.1
+     */
+    static String PROPERTY_NAME
+        = "javax.jdo.option.Name";
 
     /**
      * "javax.jdo.option.InstanceLifecycleListener"
@@ -703,7 +719,7 @@
      *
      * @since 2.1
      */
-    static String PROPERTY_SERVER_TIME_ZONE_ID
+        static String PROPERTY_SERVER_TIME_ZONE_ID
         = "javax.jdo.option.ServerTimeZoneID";
 
     /**

Modified: db/jdo/trunk/api2-legacy/src/java/javax/jdo/JDOHelper.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/src/java/javax/jdo/JDOHelper.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/src/java/javax/jdo/JDOHelper.java (original)
+++ db/jdo/trunk/api2-legacy/src/java/javax/jdo/JDOHelper.java Thu Aug  9 14:20:35 2007
@@ -22,10 +22,14 @@
  
 package javax.jdo;
 
-import org.w3c.dom.*;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.ErrorHandler;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.w3c.dom.NamedNodeMap;
 
 import javax.jdo.spi.I18NHelper;
 import javax.jdo.spi.JDOImplHelper;
@@ -41,13 +45,26 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
-import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.*;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.Enumeration;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 
 
 /**
@@ -64,7 +81,7 @@
  * 
  * @version 2.1
  */
-public class JDOHelper extends Object implements Constants {
+public class JDOHelper implements Constants {
 
     /**
      * A mapping from jdoconfig.xsd element attributes to PMF properties.
@@ -146,6 +163,9 @@
             PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME,
             PROPERTY_PERSISTENCE_UNIT_NAME);
         xref.put(
+            PMF_ATTRIBUTE_NAME,
+            PROPERTY_NAME);
+        xref.put(
             PMF_ATTRIBUTE_RESTORE_VALUES,
             PROPERTY_RESTORE_VALUES);
         xref.put(
@@ -628,11 +648,18 @@
      * @see #getPersistenceManagerFactory(java.util.Map,ClassLoader)
      */
     public static PersistenceManagerFactory getPersistenceManagerFactory
-            (Map props) {
+            (Map props)
+    {
         ClassLoader cl = getContextClassLoader();
         return getPersistenceManagerFactory (props, cl);
     }
 
+    public static PersistenceManagerFactory getPersistenceManagerFactory
+            (Map props, ClassLoader cl)
+    {
+        return getPersistenceManagerFactory(props, cl, cl);
+    }
+
     /**
      * Get a <code>PersistenceManagerFactory</code> based on a 
      * <code>Map</code> instance and a class loader.
@@ -654,6 +681,7 @@
      * <BR>"javax.jdo.mapping.Catalog",
      * <BR>"javax.jdo.mapping.Schema",
      * <BR>"javax.jdo.option.PersistenceUnitName".
+     * <BR>"javax.jdo.option.Name".
      * </code>
      * and properties of the form
      * <BR><code>javax.jdo.option.InstanceLifecycleListener.{listenerClass}={pcClasses}</code>
@@ -682,58 +710,74 @@
      * @return the <code>PersistenceManagerFactory</code>.
      * @param props a <code>Properties</code> instance with properties of the 
      * <code>PersistenceManagerFactory</code>.
-     * @param cl the class loader to use to load the 
+     * @param resourceLoader the class loader to use to load resources (if
+     * resource loading is necessary)
+     * @param pmfClassLoader the class loader to use to load the
      * <code>PersistenceManagerFactory</code> class
      */
     public static PersistenceManagerFactory getPersistenceManagerFactory
-            (Map props, ClassLoader cl) {
+            (Map props, ClassLoader resourceLoader, ClassLoader pmfClassLoader)
+    {
         String pmfClassName = (String) props.get (
-            PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS); //NOI18N
+                PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS);
+
         if (pmfClassName == null) {
+            // no PMF class name property -- try to find via services lookup
             try {
-                pmfClassName = getPMFClassNameViaServiceLookup(cl);
+                pmfClassName = getPMFClassNameViaServiceLookup(resourceLoader);
             }
             catch (IOException e) {
                 throw new JDOFatalInternalException(msg.msg(
                     "EXC_IOExceptionDuringServiceLookup"), e); // NOI18N
             }
-            if (pmfClassName == null) {
-                throw new JDOFatalUserException(msg.msg(
-                    "EXC_GetPMFNoClassNameProperty")); // NOI18N
+        }
+
+        if (pmfClassName != null) {
+            try {
+                Class pmfClass = pmfClassLoader.loadClass (pmfClassName);
+                Method pmfMethod = pmfClass.getMethod(
+                    "getPersistenceManagerFactory", //NOI18N
+                        new Class[] {Map.class});
+                return (PersistenceManagerFactory) pmfMethod.invoke (
+                    null, new Object[] {props});
+            } catch (ClassNotFoundException cnfe) {
+                throw new JDOFatalUserException (msg.msg(
+                    "EXC_GetPMFClassNotFound", pmfClassName), cnfe); //NOI18N
+            } catch (IllegalAccessException iae) {
+                throw new JDOFatalUserException (msg.msg(
+                    "EXC_GetPMFIllegalAccess", pmfClassName), iae); //NOI18N
+            } catch (NoSuchMethodException nsme) {
+                throw new JDOFatalInternalException (msg.msg(
+                    "EXC_GetPMFNoSuchMethod"), nsme); //NOI18N
+            } catch (InvocationTargetException ite) {
+                Throwable nested = ite.getTargetException();
+                if (nested instanceof JDOException) {
+                    throw (JDOException)nested;
+                } else throw new JDOFatalInternalException (msg.msg(
+                    "EXC_GetPMFUnexpectedException"), ite); //NOI18N
+            } catch (NullPointerException e) {
+                throw new JDOFatalInternalException (msg.msg(
+                    "EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N
+            } catch (ClassCastException e) {
+                throw new JDOFatalInternalException (msg.msg(
+                    "EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N
+            } catch (Exception e) {
+                throw new JDOFatalInternalException (msg.msg(
+                    "EXC_GetPMFUnexpectedException"), e); //NOI18N
             }
         }
-        try {
-            Class pmfClass = cl.loadClass (pmfClassName);
-            Method pmfMethod = pmfClass.getMethod(
-                "getPersistenceManagerFactory", //NOI18N
-                    new Class[] {Map.class});
-            return (PersistenceManagerFactory) pmfMethod.invoke (
-                null, new Object[] {props});
-        } catch (ClassNotFoundException cnfe) {
-            throw new JDOFatalUserException (msg.msg(
-                "EXC_GetPMFClassNotFound", pmfClassName), cnfe); //NOI18N
-        } catch (IllegalAccessException iae) {
-            throw new JDOFatalUserException (msg.msg(
-                "EXC_GetPMFIllegalAccess", pmfClassName), iae); //NOI18N
-        } catch (NoSuchMethodException nsme) {
-            throw new JDOFatalInternalException (msg.msg(
-                "EXC_GetPMFNoSuchMethod"), nsme); //NOI18N
-        } catch (InvocationTargetException ite) {
-            Throwable nested = ite.getTargetException();
-            if (nested instanceof JDOException) {
-                throw (JDOException)nested;
-            } else throw new JDOFatalInternalException (msg.msg(
-                "EXC_GetPMFUnexpectedException"), ite); //NOI18N
-        } catch (NullPointerException e) {
-            throw new JDOFatalInternalException (msg.msg(
-                "EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N
-        } catch (ClassCastException e) {
-            throw new JDOFatalInternalException (msg.msg(
-                "EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N
-        } catch (Exception e) {
-            throw new JDOFatalInternalException (msg.msg(
-                "EXC_GetPMFUnexpectedException"), e); //NOI18N
+        
+        // else no PMF class name given; check PU name
+        String puName = (String) props.get(
+                PROPERTY_PERSISTENCE_UNIT_NAME);
+
+        if (puName != null && !"".equals(puName.trim())) {
+            return getPMFFromEMF(puName, props, pmfClassLoader);
         }
+
+        // else no PMF class name or PU name
+        throw new JDOFatalUserException(msg.msg(
+                "EXC_GetPMFNoPMFClassNamePropertyOrPUNameProperty"));
     }
 
     /**
@@ -837,23 +881,30 @@
     }
         
     /**
-     * Returns a named {@link PersistenceManagerFactory} with the given
-     * persistence unit name or,
-     * if not found, a {@link PersistenceManagerFactory} configured based
+     * Returns a {@link PersistenceManagerFactory} configured based
      * on the properties stored in the resource at
-     * <code>name</code>.  Loads the Properties via
+     * <code>name</code>, or, if not found, returns a
+     * {@link PersistenceManagerFactory} with the given
+     * name or, if not found, returns a
+     * <code>javax.persistence.EntityManagerFactory</code> cast to a
+     * {@link PersistenceManagerFactory}.  Loads the properties via
      * <code>resourceLoader</code>, and creates a {@link
      * PersistenceManagerFactory} with <code>pmfLoader</code>. Any
      * exceptions thrown during resource loading will
      * be wrapped in a {@link JDOFatalUserException}.
-     * If multiple persistence units with the requested name are found, a
+     * If multiple PMFs with the requested name are found, a
      * {@link JDOFatalUserException} is thrown.
      * @since 2.0
-     * @param name the persistence unit name or resource containing the Properties
-     * @param resourceLoader the class loader to use to load the name
+     * @param name interpreted as the name of the resource containing the PMF
+     * properties, the name of the PMF, or the persistence unit name, in that
+     * order.
+     * @param resourceLoader the class loader to use to load properties or
+     * configuration file resources
      * @param pmfLoader the class loader to use to load the 
-     * <code>PersistenceManagerFactory</code> class
-     * @return the PersistenceManagerFactory
+     * <code>PersistenceManagerFactory</code> or
+     * <code>javax.persistence.EntityManagerFactory</code> classes
+     * @return the PersistenceManagerFactory with properties in the given
+     * resource, with the given name, or with the given persitence unit name 
      */
     public static PersistenceManagerFactory getPersistenceManagerFactory
         (String name, ClassLoader resourceLoader, ClassLoader pmfLoader) {
@@ -865,16 +916,16 @@
             throw new JDOFatalUserException (msg.msg (
                 "EXC_GetPMFNullPMFLoader")); //NOI18N
 
+        Properties props = null;
         InputStream in = null;
         if (name != null) { // then try to load resources from properties file
-            Properties props = new Properties ();
             try {
-                in = resourceLoader.getResourceAsStream (name);
+                in = resourceLoader.getResourceAsStream(name);
                 if (in != null) {
                     // then some kind of resource was found by the given name;
                     // assume that it's a properties file and proceed as usual
-                    props.load (in);
-                    return getPersistenceManagerFactory (props, pmfLoader);
+                    props = new Properties();
+                    props.load(in);
                 }
             }
             catch (IOException ioe) {
@@ -889,93 +940,58 @@
             }
         }
         // JDO 2.1:  else name was null or no resource found by given name;
-        // assume name represents name of PU
+        // first assume that name represents name of named PMF
 
-        PersistenceManagerFactory pmf = getPersistenceUnit(
-            name == null ? "" : name.trim(),
-            resourceLoader,
-            pmfLoader
-        );
-        if (pmf != null) {
-            return pmf;
+        Map properties = props;
+        if (properties == null) {
+            properties = getNamedPMFProperties(name, resourceLoader);
+        }
+
+        if (properties != null) {
+            String nameInProperties = (String) properties.get(PROPERTY_NAME);
+            nameInProperties = nameInProperties == null ? "" : nameInProperties;
+            if (nameInProperties == null) {
+                properties.put(PROPERTY_NAME, name);
+            }
+            return getPersistenceManagerFactory(
+                    properties, resourceLoader, pmfLoader);
         }
 
-        // else no PU found
+        // else no properties found; next, assume name is a PU name
+        if (name != null && !"".equals(name.trim())) {
+            PersistenceManagerFactory pmf =
+                    getPMFFromEMF(name, null, pmfLoader);
+            if (pmf != null) {
+                return pmf;
+            }
+        }
+        
+        // else no PMF found
         throw new JDOFatalUserException (msg.msg (
             "EXC_NoPMFConfigurableViaPropertiesOrXML",
             name,
             resourceLoader)); //NOI18N
     }
 
-    /** Find and return<BR><ul>
-     * <li>a {@link PersistenceManagerFactory} with the given name,</li>
-     * <li>a JPA <code>EntityManagerFactory</code> cast to a
-     * {@link PersistenceManagerFactory}, or <li>
-     * <li>null if not found.</li>
-     * If name is null
-     * or blank, this method attempts to return the anonymous
-     * {@link PersistenceManagerFactory}.  If multiple persistence units with
-     * the given name are found (including the anonymous persistence unit),
-     * this method will throw {@link JDOFatalUserException}.
-     *
-     * @param name The persistence unit name, or null, the empty string or a
-     * string only containing whitespace characters for the anonymous
-     * persistence unit.
-     * @param resourceLoader The ClassLoader used to load the standard JDO
-     * configuration file(s) given in the constant
-     * {@link Constants#JDOCONFIG_RESOURCE_NAME}.
-     * @param pmfLoader The loader used to load the
-     * {@link PersistenceManagerFactory} implementation class.
-     * @return A {@link PersistenceManagerFactory} corresponding to the
-     * persistence unit name if found, or null if not found.
-     * @throws JDOFatalUserException if multiple persistence units are found
-     * with the given name, or any other is encountered.
-     * @since 2.1
-     */
-    private static PersistenceManagerFactory getPersistenceUnit(
-            String name,
-            ClassLoader resourceLoader,
-            ClassLoader pmfLoader) {
-        Map properties = getPersistenceUnitProperties(
-                name, resourceLoader, JDOCONFIG_RESOURCE_NAME);
-
-        if (properties != null) { // found requested JDO persistence unit props
-            return getPersistenceManagerFactory(properties, pmfLoader);
-        }
-
-        // else try to return PMF from JPA EMF
-        if ("".equals(name)) { // no such thing as an anonymous JPA EMF
-            return null;
-        }
-
-        // else try to return PMF from named JPA EMF
-        return getPMFFromEMF(name, pmfLoader);
-    }
-
-    protected static Map getPersistenceUnitProperties(
-            String name
-    ) {
-        return getPersistenceUnitProperties(
-            name, getContextClassLoader(), JDOCONFIG_RESOURCE_NAME);
-    }
-
-    protected static Map getPersistenceUnitProperties(
+    protected static Map getNamedPMFProperties(
             String name,
             ClassLoader resourceLoader
     ) {
-        return getPersistenceUnitProperties(
+        return getNamedPMFProperties(
             name, resourceLoader, JDOCONFIG_RESOURCE_NAME);
     }
 
     /**
-     * Find and return the named {@link PersistenceManagerFactory}, or null if
+     * Find and return the named {@link PersistenceManagerFactory}'s properties,
+     * or null if
      * not found.  If name is null, return the anonymous
-     * {@link PersistenceManagerFactory}.  If multiple persistence units with
-     * the given name are found (including anonymous), throw
+     * {@link PersistenceManagerFactory}'s properties.
+     * If multiple named PMF property sets with
+     * the given name are found (including anonymous ones), throw
      * {@link JDOFatalUserException}.
      * This method is here only to facilitate testing; the parameter
      * "jdoconfigResourceName" in public usage should always have the value
-     * given in the constant <code>JDOCONFIG_RESOURCE_NAME</code>.
+     * given in the constant {@link Constants#JDOCONFIG_RESOURCE_NAME}.
      *
      * @param name The persistence unit name, or null or blank for the
      * anonymous persistence unit.
@@ -987,17 +1003,17 @@
      * @return The named PersistenceManagerFactory properties if found, null if
      * not.
      * @since 2.1
-     * @throws JDOFatalUserException if multiple persistence units are found
-     * with the given name, or any other exception is encountered.
+     * @throws JDOFatalUserException if multiple named PMF property sets are
+     * found with the given name, or any other exception is encountered.
      */
-    protected static Map getPersistenceUnitProperties(
+    protected static Map getNamedPMFProperties(
             String name,
             ClassLoader resourceLoader,
             String jdoconfigResourceName
     ) {
         /* JDO 2.1:
-        Attempt to find & return named persistence unit here.
-        If name == null or name == "", then we're looking for the default PMF.
+        Attempt to find & return named PMF properties here.
+        If name == null or name == "", then we're looking for the anonymous PMF.
 
         If we can't find it, this method returns null.
         */
@@ -1017,12 +1033,7 @@
                 ArrayList processedResources = new ArrayList();
 
                 // get ready to parse XML
-                DocumentBuilderFactory factory =
-                        implHelper.getRegisteredDocumentBuilderFactory();
-                if (factory == null) {
-                    factory = getDefaultDocumentBuilderFactory();
-                }
-
+                DocumentBuilderFactory factory = getDocumentBuilderFactory();
                 do {
                     URL currentConfigURL = (URL) resources.nextElement();
                     if (processedResources.contains(currentConfigURL)) {
@@ -1033,8 +1044,10 @@
                     }
                     
                     Map/*<String,Map>*/ propertiesByNameInCurrentConfig =
-                        readPersistenceUnitProperties(
-                            currentConfigURL, name, factory);
+                        readNamedPMFProperties(
+                            currentConfigURL,
+                            name,
+                            factory);
 
                     // try to detect duplicate requested PU
                     if (propertiesByNameInCurrentConfig.containsKey(name)) {
@@ -1045,7 +1058,7 @@
                         
                         if (propertiesByNameInAllConfigs.containsKey(name))
                             throw new JDOFatalUserException (msg.msg(
-                                "EXC_DuplicateRequestedPersistenceUnitFoundInDifferentConfigs",
+                                "EXC_DuplicateRequestedNamedPMFFoundInDifferentConfigs",
                                 "".equals(name)
                                         ? "(anonymous)"
                                         : name,
@@ -1073,6 +1086,15 @@
     }
 
 
+    protected static DocumentBuilderFactory getDocumentBuilderFactory() {
+        DocumentBuilderFactory factory =
+                implHelper.getRegisteredDocumentBuilderFactory();
+        if (factory == null) {
+            factory = getDefaultDocumentBuilderFactory();
+        }
+        return factory;
+    }
+    
     protected static DocumentBuilderFactory getDefaultDocumentBuilderFactory() {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setIgnoringComments(true);
@@ -1084,6 +1106,14 @@
         return factory;
     }
 
+    protected static ErrorHandler getErrorHandler() {
+        ErrorHandler handler = implHelper.getRegisteredErrorHandler();
+        if (handler == null) {
+            handler = getDefaultErrorHandler();
+        }
+        return handler;
+    }
+    
     protected static ErrorHandler getDefaultErrorHandler() {
         return new ErrorHandler() {
                 public void error(SAXParseException exception)
@@ -1104,26 +1134,16 @@
     }
 
     /**
-     * Convenience method for retrieving the JPA persistence unit by the given
-     * name.  This method is equivalent to
-     * calling {@link #getPMFFromEMF(String,ClassLoader)} with the context ClassLoader.
-     * @param name The persistence unit name.
-     * @see #getPMFFromEMF(String,ClassLoader)
-     * @return The named EMF cast as a PMF.
-     */
-    protected static PersistenceManagerFactory getPMFFromEMF(String name) {
-        return getPMFFromEMF(name, getContextClassLoader());
-    }
-
-    /**
      * Attempts to locate a <code>javax.persistence.EntityManagerFactory</code>
      * via the <code>javax.persistence.Persistence</code> method
      * <code>createEntityManagerFactory(String)</code>
      * and casts it to a {@link PersistenceManagerFactory}.  It is a user error
-     * if his chosen JPA vendor's <code>EntityManagerFactory</code>
+     * if his chosen JPA vendor's
+     * <code>javax.persistence.EntityManagerFactory</code>
      * implementation class does not also implement
      * {@link PersistenceManagerFactory}.
      * @param name The persistence unit name.
+     * @param properties The properties of the persistence unit.
      * @param loader The classloader used to attempt loading of the class
      * <code>javax.persistence.Persistence</code>
      * and <code>javax.persistence.PersistenceException</code>.
@@ -1151,8 +1171,8 @@
      * </ul>
      */
     protected static PersistenceManagerFactory getPMFFromEMF(
-        String name, ClassLoader loader
-    ) {
+        String name, Map properties, ClassLoader loader)
+    {
         /*
             This implementation uses reflection to try to get an EMF so that
             javax.jdo, a Java SE API, does not introduce an unnecessary
@@ -1173,7 +1193,7 @@
 
             createEntityManagerFactoryMethod = persistenceClass.getMethod(
                     "createEntityManagerFactory",
-                    new Class[] { String.class });
+                    new Class[] { String.class, Map.class });
 
             persistenceExceptionClass =
                 Class.forName(
@@ -1193,7 +1213,7 @@
         try {
             entityManagerFactory =
                 createEntityManagerFactoryMethod.invoke(
-                    persistenceClass, new Object[] { name });
+                    persistenceClass, new Object[] { name, properties });
         }
         catch (RuntimeException x) {
             if (persistenceExceptionClass.isAssignableFrom(x.getClass())) {
@@ -1228,7 +1248,7 @@
      * persistence-manager-factory, then returns the map.
      * @param url URL of a JDO configuration file compliant with
      * javax/jdo/jdoconfig.xsd.
-     * @param requestedPersistenceUnitName The name of the requested
+     * @param requestedPMFName The name of the requested
      * persistence unit (allows for fail-fast).
      * @param factory The <code>DocumentBuilderFactory</code> to use for XML
      * parsing.
@@ -1236,36 +1256,20 @@
      * the anonymous persistence unit, the
      * value of the String key is the empty string, "".
      */
-    protected static Map/*<String,Map>*/ readPersistenceUnitProperties(
+    protected static Map/*<String,Map>*/ readNamedPMFProperties(
         URL url,
-        String requestedPersistenceUnitName,
+        String requestedPMFName,
         DocumentBuilderFactory factory
     ) {
-        requestedPersistenceUnitName = requestedPersistenceUnitName == null
+        requestedPMFName = requestedPMFName == null
             ? ""
-            : requestedPersistenceUnitName.trim();
+            : requestedPMFName.trim();
 
         Map propertiesByName = new HashMap();
         InputStream in = null;
         try {
             DocumentBuilder builder = factory.newDocumentBuilder();
-            
-            builder.setErrorHandler(new ErrorHandler() {
-                public void error(SAXParseException exception)
-                        throws SAXException {
-                    throw exception;
-                }
-
-                public void fatalError(SAXParseException exception)
-                        throws SAXException {
-                    throw exception;
-                }
-
-                public void warning(SAXParseException exception)
-                        throws SAXException {
-                    // gulp
-                }
-            });
+            builder.setErrorHandler(getErrorHandler());
 
             in = url.openStream();
             Document doc = builder.parse(in);
@@ -1277,7 +1281,6 @@
                 );
             }
 
-            // TODO:  prefer using namespace-aware APIs
             NodeList pmfs = root.getElementsByTagName(
                 ELEMENT_PERSISTENCE_MANAGER_FACTORY);
 
@@ -1290,43 +1293,41 @@
                 Properties pmfPropertiesFromElements
                     = readPropertiesFromPMFSubelements(pmfElement, url);
 
-                // for informative error handling, get PU name (or names) now
-                String puNameFromAtts =
-                    pmfPropertiesFromAttributes.getProperty(
-                        PROPERTY_PERSISTENCE_UNIT_NAME);
-                String puNameFromElem =
-                    pmfPropertiesFromElements.getProperty(
-                        PROPERTY_PERSISTENCE_UNIT_NAME);
-
-                String puName = null;
-                if (nullOrBlank(puNameFromAtts)) {
-                    // no PU name attribute given
-                    if (!nullOrBlank(puNameFromElem)) {
-                        // PU name element was given
-                        puName = puNameFromElem;
+                // for informative error handling, get name (or names) now
+                String pmfNameFromAtts =
+                    pmfPropertiesFromAttributes.getProperty(PROPERTY_NAME);
+                String pmfNameFromElem =
+                    pmfPropertiesFromElements.getProperty(PROPERTY_NAME);
+
+                String pmfName = null;
+                if (nullOrBlank(pmfNameFromAtts)) {
+                    // no PMF name attribute given
+                    if (!nullOrBlank(pmfNameFromElem)) {
+                        // PMF name element was given
+                        pmfName = pmfNameFromElem;
                     }
                     else  {
-                        // PU name not given at all, means the "anonymous" PU
-                        puName = "";
+                        // PMF name not given at all, means the "anonymous" PMF
+                        pmfName = "";
                     }
                 }
                 else {
-                    // PU name given in an attribute
-                    if (!nullOrBlank(puNameFromElem)) {
-                        // exception -- PU name given as both att & elem
+                    // PMF name given in an attribute
+                    if (!nullOrBlank(pmfNameFromElem)) {
+                        // exception -- PMF name given as both att & elem
                         throw new JDOFatalUserException(
                             msg.msg(
-                                "EXC_DuplicatePersistenceUnitNamePropertyFoundWithinUnitConfig",
-                                puNameFromAtts,
-                                puNameFromElem,
+                                "EXC_DuplicatePMFNamePropertyFoundWithinConfig",
+                                pmfNameFromAtts,
+                                pmfNameFromElem,
                                 url.toExternalForm()));
                     }
-                    puName = puNameFromAtts;
+                    pmfName = pmfNameFromAtts;
                 }
-                puName = puName == null ? "" : puName.trim();
+                pmfName = pmfName == null ? "" : pmfName.trim();
 
                 // check for duplicate properties among atts & elems
-                if (requestedPersistenceUnitName.equals(puName)) {
+                if (requestedPMFName.equals(pmfName)) {
                     Iterator it =
                         pmfPropertiesFromAttributes.keySet().iterator();
                     while (it.hasNext()) {
@@ -1336,7 +1337,7 @@
                                 msg.msg(
                                     "EXC_DuplicatePropertyFound",
                                     property,
-                                    puName,
+                                    pmfName,
                                     url.toExternalForm()));
                         }
                     }
@@ -1348,16 +1349,16 @@
                 pmfProps.putAll(pmfPropertiesFromAttributes);
                 pmfProps.putAll(pmfPropertiesFromElements);
 
-                // check for duplicate requested PU name
-                if (puName.equals(requestedPersistenceUnitName)
-                    && propertiesByName.containsKey(puName)) {
+                // check for duplicate requested PMF name
+                if (pmfName.equals(requestedPMFName)
+                    && propertiesByName.containsKey(pmfName)) {
 
                     throw new JDOFatalUserException(msg.msg(
-                        "EXC_DuplicateRequestedPersistenceUnitFoundInSameConfig",
-                        puName,
+                            "EXC_DuplicateRequestedNamedPMFFoundInSameConfig",
+                        pmfName,
                         url.toExternalForm()));
                 }
-                propertiesByName.put(puName, pmfProps);
+                propertiesByName.put(pmfName, pmfProps);
             }
             return propertiesByName;
         }
@@ -1576,7 +1577,7 @@
         Properties props = new Properties ();
         InputStream in = null;
         try {
-            in = new FileInputStream (propsFile);
+            in = new FileInputStream(propsFile);
             props.load (in);
         } catch (FileNotFoundException fnfe) {
             throw new JDOFatalUserException (msg.msg (

Modified: db/jdo/trunk/api2-legacy/src/java/javax/jdo/PersistenceManagerFactory.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/src/java/javax/jdo/PersistenceManagerFactory.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/src/java/javax/jdo/PersistenceManagerFactory.java (original)
+++ db/jdo/trunk/api2-legacy/src/java/javax/jdo/PersistenceManagerFactory.java Thu Aug  9 14:20:35 2007
@@ -22,14 +22,11 @@
  
 package javax.jdo;
 
-import java.util.Properties;
-import java.util.Collection;
-
-import java.io.Serializable;
-
 import javax.jdo.datastore.DataStoreCache;
-
 import javax.jdo.listener.InstanceLifecycleListener;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Properties;
 
 /** The <code>PersistenceManagerFactory</code> is the interface to use to obtain
  * <code>PersistenceManager</code> instances.  
@@ -359,6 +356,19 @@
      */
     void setDetachAllOnCommit(boolean flag);
 
+    /**
+     * Sets the name of this PersistenceManagerFactory.
+     * @since 2.1
+     * @param name the name of this PMF
+     */
+    void setName(String name);
+
+    /**
+     * Gets the name of this PersistenceManagerFactory.
+     * @since 2.1
+     * @return the name of this PMF
+     */
+    String getName();
 
     /**
      * Sets the PersistenceUnitName for this PersistenceManagerFactory.

Modified: db/jdo/trunk/api2-legacy/src/schema/javax/jdo/jdoconfig_2_1.xsd
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/src/schema/javax/jdo/jdoconfig_2_1.xsd?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/src/schema/javax/jdo/jdoconfig_2_1.xsd (original)
+++ db/jdo/trunk/api2-legacy/src/schema/javax/jdo/jdoconfig_2_1.xsd Thu Aug  9 14:20:35 2007
@@ -119,7 +119,9 @@
 
         <!-- Corresponds to standard JDO property javax.jdo.PersistenceManagerFactoryClass. -->
         <xs:attribute name="class" use="optional"/>
-        <!-- Corresponds to standard JDO property javax.jdo.option.PersistenceUnitName.  The absence of this attributes implies the anonymous persistence unit. -->
+        <!-- Corresponds to standard JDO property javax.jdo.option.Name.  The absence of this attribute implies the anonymous PMF. -->
+        <xs:attribute name="name" use="optional"/>
+        <!-- Corresponds to standard JDO property javax.jdo.option.PersistenceUnitName. -->
         <xs:attribute name="persistence-unit-name" use="optional"/>
         <!-- Corresponds to standard JDO property javax.jdo.option.Optimistic. -->
         <xs:attribute name="optimistic" use="optional"/>

Modified: db/jdo/trunk/api2-legacy/test/java/javax/jdo/JDOHelperConfigTest.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/java/javax/jdo/JDOHelperConfigTest.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/java/javax/jdo/JDOHelperConfigTest.java (original)
+++ db/jdo/trunk/api2-legacy/test/java/javax/jdo/JDOHelperConfigTest.java Thu Aug  9 14:20:35 2007
@@ -23,11 +23,11 @@
 import javax.jdo.util.BatchTestRunner;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URLClassLoader;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Random;
-import java.net.URLClassLoader;
 
 /**
  * Tests class javax.jdo.JDOHelper for META-INF/jdoconfig.xml compliance.
@@ -42,197 +42,108 @@
         return new TestSuite(JDOHelperConfigTest.class);
     }
 
-    protected static String JDOCONFIG_CLASSPATH_PREFIX = 
-        System.getProperty("basedir") + "/test/schema/jdoconfig";
-
-    protected static Random RANDOM = new Random(System.currentTimeMillis());
-
-    /**
-     * Tests JDOHelper.getPersistenceUnitProperties using file
-     * Positive0-jdoconfig.xml and PU name
-     * "persistence-unit-name.positive0.pmf0"
-     */
-    public void testPositive00_PMF0_GetNamedPMFProperties() throws IOException {
+    protected static String JDOCONFIG_CLASSPATH_PREFIX
+            = initJDOConfigClasspathPrefix();
 
-        try {
-            URLClassLoader loader = new JDOConfigTestClassLoader(
-                    JDOCONFIG_CLASSPATH_PREFIX,
-                    getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
-            Map expected = prepareInitialExpectedMap("positive0.pmf0", 2);
-            String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
-            Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
-            assertNotNull("No properties found", actual);
-            assertEqualProperties(expected, actual);
-        } catch (Exception e) {
-            e.printStackTrace();
+    protected static String initJDOConfigClasspathPrefix() {
+        String basedir = System.getProperty("basedir");
+        if (basedir != null) {
+            if (!basedir.endsWith("/")) {
+                basedir += "/";
+            }
+        } else {
+            basedir = "";
         }
+        return basedir + "test/schema/jdoconfig";
     }
 
-    /**
-     * Tests JDOHelper.getPersistenceUnitProperties using file
-     * Positive0-jdoconfig.xml and PU name
-     * "persistence-unit-name.positive0.pmf1"
-     */
-    public void testPositive00_PMF1_GetNamedPMFProperties() throws IOException  {
-        URLClassLoader loader = new JDOConfigTestClassLoader(
-                JDOCONFIG_CLASSPATH_PREFIX,
-                getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
-        Map expected = prepareInitialExpectedMap("positive0.pmf1", 2);
-        String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
-        Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
-        assertNotNull("No properties found", actual);
-        assertEqualProperties(expected, actual);
-    }
-
-    /**
-     * Tests JDOHelper.getPersistenceUnitProperties using file
-     * Positive0-jdoconfig.xml and PU name
-     * "persistence-unit-name.positive0.pmf2"
-     */
-    public void testPositive00_PMF2_GetNamedPMFProperties() throws IOException  {
-        URLClassLoader loader = new JDOConfigTestClassLoader(
-                JDOCONFIG_CLASSPATH_PREFIX,
-                getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
-        Map expected = prepareInitialExpectedMap("positive0.pmf2", 2);
-        String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
-        Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
-        assertNotNull("No properties found", actual);
-        assertEqualProperties(expected, actual);
-    }
-
-    /**
-     * Tests JDOHelper.getPersistenceUnitProperties using file
-     * Positive0-jdoconfig.xml and PU name
-     * "persistence-unit-name.positive0.pmf3"
-     */
-    public void testPositive00_PMF3_GetNamedPMFProperties() throws IOException  {
-        URLClassLoader loader = new JDOConfigTestClassLoader(
-                JDOCONFIG_CLASSPATH_PREFIX,
-                getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
-        Map expected = prepareInitialExpectedMap("positive0.pmf3", 2, 2);
-        String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
-        Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
-        assertNotNull("No properties found", actual);
-        assertEqualProperties(expected, actual);
-    }
-
-    /**
-     * Tests JDOHelper.getPersistenceUnitProperties using file
-     * Positive0-jdoconfig.xml and PU name
-     * "persistence-unit-name.positive0.pmf4"
-     */
-    public void testPositive00_PMF4_GetNamedPMFProperties() throws IOException  {
-        URLClassLoader loader = new JDOConfigTestClassLoader(
-                JDOCONFIG_CLASSPATH_PREFIX,
-                getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
-        Map expected = prepareInitialExpectedMap("positive0.pmf4", 0, 2);
-        String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
-        Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
-        assertNotNull("No properties found", actual);
-        assertEqualProperties(expected, actual);
-    }
+    protected static Random RANDOM = new Random(System.currentTimeMillis());
 
-    public Map prepareInitialExpectedMap(String testVariant) {
-        return prepareInitialExpectedMap(testVariant, 0, 0);
-    }
-    public Map prepareInitialExpectedMap(String testVariant, int numListeners) {
-        return prepareInitialExpectedMap(testVariant, numListeners, 0);
-    }
-    public Map prepareInitialExpectedMap(
-        String testVariant,
-        int numListeners,
-        int numProperties
+    protected Map prepareInitialExpectedMap(
+            String testVariant,
+            int listenerCount,
+            int vendorSpecificPropertyCount,
+            boolean excludeName,
+            boolean excludePUName
     ) {
         Map expected = new HashMap();
 
+        if (!excludeName) {
+            expected.put(
+                    PROPERTY_NAME,
+                    PMF_ATTRIBUTE_NAME + "." + testVariant);
+        }
+        if (!excludePUName) {
+            expected.put(
+                    PROPERTY_PERSISTENCE_UNIT_NAME,
+                    PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME + "." + testVariant);
+        }
+
         expected.put(PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS,
-            PMF_ATTRIBUTE_CLASS + "." + testVariant);
+                PMF_ATTRIBUTE_CLASS + "." + testVariant);
         expected.put(
-            PROPERTY_CONNECTION_DRIVER_NAME,
-            PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME + "." + testVariant);
+                PROPERTY_CONNECTION_DRIVER_NAME,
+                PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME + "." + testVariant);
         expected.put(
-            PROPERTY_CONNECTION_FACTORY_NAME,
-            PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME + "." + testVariant);
+                PROPERTY_CONNECTION_FACTORY_NAME,
+                PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME + "." + testVariant);
         expected.put(
-            PROPERTY_CONNECTION_FACTORY2_NAME,
-            PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME + "." + testVariant);
+                PROPERTY_CONNECTION_FACTORY2_NAME,
+                PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME + "." + testVariant);
         expected.put(
-            PROPERTY_CONNECTION_PASSWORD,
-            PMF_ATTRIBUTE_CONNECTION_PASSWORD + "." + testVariant);
+                PROPERTY_CONNECTION_PASSWORD,
+                PMF_ATTRIBUTE_CONNECTION_PASSWORD + "." + testVariant);
         expected.put(
-            PROPERTY_CONNECTION_URL,
-            PMF_ATTRIBUTE_CONNECTION_URL + "." + testVariant);
+                PROPERTY_CONNECTION_URL,
+                PMF_ATTRIBUTE_CONNECTION_URL + "." + testVariant);
         expected.put(
-            PROPERTY_CONNECTION_USER_NAME,
-            PMF_ATTRIBUTE_CONNECTION_USER_NAME + "." + testVariant);
+                PROPERTY_CONNECTION_USER_NAME,
+                PMF_ATTRIBUTE_CONNECTION_USER_NAME + "." + testVariant);
         expected.put(
-            PROPERTY_IGNORE_CACHE,
-            PMF_ATTRIBUTE_IGNORE_CACHE + "." + testVariant);
+                PROPERTY_IGNORE_CACHE,
+                PMF_ATTRIBUTE_IGNORE_CACHE + "." + testVariant);
         expected.put(
-            PROPERTY_MAPPING,
-            PMF_ATTRIBUTE_MAPPING + "." + testVariant);
+                PROPERTY_MAPPING,
+                PMF_ATTRIBUTE_MAPPING + "." + testVariant);
         expected.put(
-            PROPERTY_MULTITHREADED,
-            PMF_ATTRIBUTE_MULTITHREADED + "." + testVariant);
+                PROPERTY_MULTITHREADED,
+                PMF_ATTRIBUTE_MULTITHREADED + "." + testVariant);
         expected.put(
-            PROPERTY_NONTRANSACTIONAL_READ,
-            PMF_ATTRIBUTE_NONTRANSACTIONAL_READ + "." + testVariant);
+                PROPERTY_NONTRANSACTIONAL_READ,
+                PMF_ATTRIBUTE_NONTRANSACTIONAL_READ + "." + testVariant);
         expected.put(
-            PROPERTY_NONTRANSACTIONAL_WRITE,
-            PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE + "." + testVariant);
+                PROPERTY_NONTRANSACTIONAL_WRITE,
+                PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE + "." + testVariant);
         expected.put(
-            PROPERTY_OPTIMISTIC,
-            PMF_ATTRIBUTE_OPTIMISTIC + "." + testVariant);
+                PROPERTY_OPTIMISTIC,
+                PMF_ATTRIBUTE_OPTIMISTIC + "." + testVariant);
         expected.put(
-            PROPERTY_PERSISTENCE_UNIT_NAME,
-            PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME + "." + testVariant);
+                PROPERTY_RESTORE_VALUES,
+                PMF_ATTRIBUTE_RESTORE_VALUES + "." + testVariant);
         expected.put(
-            PROPERTY_RESTORE_VALUES,
-            PMF_ATTRIBUTE_RESTORE_VALUES + "." + testVariant);
+                PROPERTY_RETAIN_VALUES,
+                PMF_ATTRIBUTE_RETAIN_VALUES + "." + testVariant);
         expected.put(
-            PROPERTY_RETAIN_VALUES,
-            PMF_ATTRIBUTE_RETAIN_VALUES + "." + testVariant);
+                PROPERTY_DETACH_ALL_ON_COMMIT,
+                PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT + "." + testVariant);
         expected.put(
-            PROPERTY_DETACH_ALL_ON_COMMIT,
-            PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT + "." + testVariant);
-        expected.put(
-            PROPERTY_SERVER_TIME_ZONE_ID,
-            PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID + "." + testVariant);
+                PROPERTY_SERVER_TIME_ZONE_ID,
+                PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID + "." + testVariant);
 
         // listeners
-        for (int i = 0; i < numListeners; i++) {
+        for (int i = 0; i < listenerCount; i++) {
             expected.put(
-                PROPERTY_PREFIX_INSTANCE_LIFECYCLE_LISTENER +
-                    "listener." + testVariant + ".listener" + i,
-                "classes." + testVariant + ".classes" + i
+                    PROPERTY_PREFIX_INSTANCE_LIFECYCLE_LISTENER +
+                            "listener." + testVariant + ".listener" + i,
+                    "classes." + testVariant + ".classes" + i
             );
         }
 
-        // properties
-        for (int i = 0; i < numProperties; i++) {
+        // vendor-specific properties
+        for (int i = 0; i < vendorSpecificPropertyCount; i++) {
             expected.put(
-                "property." +  testVariant + ".name" + i,
-                "property." +  testVariant + ".value" + i
+                    "property." + testVariant + ".name" + i,
+                    "property." + testVariant + ".value" + i
             );
         }
 
@@ -248,240 +159,364 @@
             String actualValue = (String) actual.get(key);
 
             assertEquals(
-                "Actual property at key [" + key + "] with value [" +
-                    actualValue + "] not equal to expected value [" +
-                    expectedValue + "]",
-                expectedValue,
-                actualValue);
+                    "Actual property at key [" + key + "] with value [" +
+                            actualValue + "] not equal to expected value [" +
+                            expectedValue + "]",
+                    expectedValue,
+                    actualValue);
         }
     }
 
-    /**
-     * Tests JDOHelper.getPersistenceUnitProperties using file
-     * Positive0-jdoconfig.xml and PU name
-     * "persistence-unit-name.positive0.pmf0"
-     */
-    public void testPositive01_DuplicatePUsInDifferentConfigFilesButNotRequested() throws IOException {
-
+    protected void doPositiveTest(
+            String[] classpaths,
+            String testVariantName,
+            int listenerCount,
+            int vendorSpecificPropertyCount,
+            boolean checkEqualProperties)
+            throws IOException {
+        
         URLClassLoader loader = new JDOConfigTestClassLoader(
                 JDOCONFIG_CLASSPATH_PREFIX,
                 getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive1/1a", loader);
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive1/1b", loader);
 
-        Map props = JDOHelper.getPersistenceUnitProperties(null, loader);
-        assertNotNull(props);
+        for (int i = 0; i < classpaths.length; i++) {
+            ClasspathHelper.addFile(classpaths[i], loader);
+        }
+
+        Map expected = prepareInitialExpectedMap(
+                testVariantName,
+                listenerCount,
+                vendorSpecificPropertyCount,
+                false,
+                false);
+        
+        String name = testVariantName == null
+                ? null
+                : (String) expected.get(PROPERTY_NAME);
+
+        Map actual = JDOHelper.getNamedPMFProperties(name, loader);
+
+        assertNotNull("No properties found", actual);
+        if (checkEqualProperties) {
+            assertEqualProperties(expected, actual);
+        }
+    }
+
+    public void testPositive00_PMF0_BasicPMFConfigUsingOnlyStandardAttributesAndListeners()
+            throws IOException {
+        doPositiveTest(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+                "positive00.pmf0",
+                2,
+                0,
+                true);
+    }
+
+    public void testPositive00_PMF1_BasicPMFConfigUsingOnlyPropertyElementsWithStandardJavaxDotJDOProperties()
+            throws IOException {
+        doPositiveTest(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+                "positive00.pmf1",
+                2,
+                0,
+                true);
+    }
+
+    public void testPositive00_PMF2_NestedPropertyElementsWithOnlyStandardAttributeNames()
+            throws IOException {
+        doPositiveTest(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+                "positive00.pmf2",
+                2,
+                0,
+                true);
+    }
+
+    public void testPositive00_PMF3_StandardAttributesPlusNonstandardPropertiesInPropertyElements()
+            throws IOException {
+        doPositiveTest(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+                "positive00.pmf3",
+                2,
+                2,
+                true);
+    }
+
+    public void testPositive00_PMF4_StandardAttributesPlusNonstandardAttributes()
+            throws IOException {
+        doPositiveTest(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+                "positive00.pmf4",
+                0,
+                2,
+                true);
+    }
+
+    public void testPositive01_DuplicatePUsInDifferentConfigFilesButNotRequested()
+            throws IOException {
+
+        doPositiveTest(
+                new String[]{
+                        JDOCONFIG_CLASSPATH_PREFIX + "/Positive01/1a",
+                        JDOCONFIG_CLASSPATH_PREFIX + "/Positive01/1b"
+                },
+                null,
+                0,
+                2,
+                false);
     }
 
-    /**
-     * Tests JDOHelper.getPMFClassNameViaServiceLookup
-     */
-    public void testPositive03_PMF0_PMFClassNameViaServicesLookup() throws IOException {
+    public void testPositive03_PMF0_PMFClassNameViaServicesLookup()
+            throws IOException {
 
         URLClassLoader loader = new JDOConfigTestClassLoader(
                 JDOCONFIG_CLASSPATH_PREFIX,
                 getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive3", loader);
+        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive03", loader);
 
-        String expected = "class.positive3.pmf0";
+        String expected = "class.positive03.pmf0";
         String actual = JDOHelper.getPMFClassNameViaServiceLookup(loader);
 
         assertNotNull("No PMF name found via services lookup", actual);
         assertEquals(expected, actual);
     }
 
-    /**
-     * Tests JDOHelper.getPMFClassNameViaServiceLookup
-     */
-    public void testPositive04_PMF0_PMFClassNameViaServicesLookup() throws IOException {
+    public void testPositive04_PMF0_PMFClassNameViaServicesLookup()
+            throws IOException {
 
         URLClassLoader loader = new JDOConfigTestClassLoader(
                 JDOCONFIG_CLASSPATH_PREFIX,
                 getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive4", loader);
+        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive04", loader);
 
-        String expected = "class.positive4.pmf0";
+        String expected = "class.positive04.pmf0";
         String actual = JDOHelper.getPMFClassNameViaServiceLookup(loader);
 
         assertNotNull("No PMF name found via services lookup", actual);
         assertEquals(expected, actual);
     }
 
-    /**
-     * Tests JDOHelper.getPMFClassNameViaServiceLookup
-     */
-    public void testPositive05_PMF0_PMFClassNameViaServicesLookup() throws IOException {
+    public void testPositive05_PMF0_PMFClassNameViaServicesLookup()
+            throws IOException {
 
         URLClassLoader loader = new JDOConfigTestClassLoader(
                 JDOCONFIG_CLASSPATH_PREFIX,
                 getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive5", loader);
+        ClasspathHelper.addFile(
+                JDOCONFIG_CLASSPATH_PREFIX + "/Positive05", loader);
 
-        String expected = "class.positive5.pmf0";
+        String expected = "class.positive05.pmf0";
         String actual = JDOHelper.getPMFClassNameViaServiceLookup(loader);
 
         assertNotNull("No PMF name found via services lookup", actual);
         assertEquals(expected, actual);
     }
 
-    public void testNegative08_NoResourcesFound() {
-        String resource = "" + RANDOM.nextLong();
+    public void testPositive06_PMF0_GetAnonymousPMFProperties()
+            throws IOException {
 
-        InputStream in =
-            getClass().getClassLoader().getResourceAsStream(resource);
-        assertNull(in);
+        URLClassLoader loader = new JDOConfigTestClassLoader(
+                JDOCONFIG_CLASSPATH_PREFIX,
+                getClass().getClassLoader());
 
-        // resource pretty much guaranteed not to exist
-        try {
-            JDOHelper.getPersistenceManagerFactory(resource);
-            fail("JDOHelper failed to throw JDOFatalUserException");
-        }
-        catch (JDOFatalUserException x) {
-            // happy path
-        }
+        ClasspathHelper.addFile(
+                JDOCONFIG_CLASSPATH_PREFIX + "/Positive06", loader);
+
+        Map expected = prepareInitialExpectedMap(
+                "positive06.pmf0", 2, 0, true, true);
+
+        Map actual = JDOHelper.getNamedPMFProperties(null, loader);
+
+        assertNotNull("No properties found", actual);
+        assertEqualProperties(expected, actual);
     }
 
-    public void testNegative00_EmptyJDOConfigXML() throws IOException  {
+    public void testPositive07_PMF0_GetAnonymousPMFPropertiesWithPUName()
+            throws IOException {
+
+        URLClassLoader loader = new JDOConfigTestClassLoader(
+                JDOCONFIG_CLASSPATH_PREFIX,
+                getClass().getClassLoader());
+
+        ClasspathHelper.addFile(
+                JDOCONFIG_CLASSPATH_PREFIX + "/Positive07", loader);
+
+        Map expected = prepareInitialExpectedMap(
+                "positive07.pmf0", 2, 0, true, false);
+
+        Map actual = JDOHelper.getNamedPMFProperties(null, loader);
+
+        assertNotNull("No properties found", actual);
+        assertEqualProperties(expected, actual);
+    }
+
+    public void testNegative00_EmptyJDOConfigXML() throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative0", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative0", loader);
 
             JDOHelper.getPersistenceManagerFactory(loader);
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // sunny day
         }
     }
-    
-    public void testNegative01_NoPersistenceUnitsDefined() throws IOException  {
+
+    public void testNegative01_NoPersistenceUnitsDefined() throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative1", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative01", loader);
 
             JDOHelper.getPersistenceManagerFactory(loader);
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // joy, sweet joy
         }
     }
 
     public void testNegative02_DuplicateAnonymousPersistenceUnitsInSameConfig()
-        throws IOException
-    {
+            throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative2", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative02", loader);
 
             JDOHelper.getPersistenceManagerFactory(loader);
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // the cockles of my heart warmeth
         }
     }
 
     public void testNegative03_DuplicateNamedPersistenceUnitsInSameConfig()
-        throws IOException
-    {
+            throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative3", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative03", loader);
 
             JDOHelper.getPersistenceManagerFactory(
-                "persistence-unit-name.negative3",
-                loader);
+                    "name.negative03",
+                    loader);
 
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // warm fuzzies
         }
     }
 
     public void testNegative04_DuplicatePUNamePropertyInAttributeAndElement()
-        throws IOException
-    {
+            throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative4", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative04", loader);
 
             JDOHelper.getPersistenceManagerFactory(
-                "persistence-unit-name.negative4.value0",
-                loader);
+                    "name.negative04.value0",
+                    loader);
 
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // no cold pricklies
         }
     }
 
     public void testNegative05_DuplicatePropertyInAttributeAndElement()
-        throws IOException
-    {
+            throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative5", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative05", loader);
 
             JDOHelper.getPersistenceManagerFactory(loader);
 
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // party!
         }
     }
 
     public void testNegative06_DuplicatePUInDifferentConfigFiles()
-        throws IOException
-    {
+            throws IOException {
         try {
             URLClassLoader loader = new JDOConfigTestClassLoader(
                     JDOCONFIG_CLASSPATH_PREFIX,
                     getClass().getClassLoader());
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative6/6a", loader);
-            ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative6/6b", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative06/6a", loader);
+            ClasspathHelper.addFile(
+                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative06/6b", loader);
 
             JDOHelper.getPersistenceManagerFactory(
-                    "persistence-unit-name.negative6",
+                    "name.negative06",
                     loader);
 
             fail("JDOHelper failed to throw JDOFatalUserException");
         }
         catch (JDOFatalUserException x) {
-            // happy path
+            // clear blue sky
         }
     }
 
     public void testNegative07_EmptyServicesFile()
-        throws IOException
-    {
-        JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(new String[] {JDOCONFIG_CLASSPATH_PREFIX}, getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative7", testLoader);
-        String shouldBeNull = JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
+            throws IOException {
+        JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX},
+                getClass().getClassLoader());
+        ClasspathHelper.addFile(
+                JDOCONFIG_CLASSPATH_PREFIX + "/Negative07", testLoader);
+        String shouldBeNull =
+                JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
         assertNull(shouldBeNull);
     }
 
+    public void testNegative08_NoResourcesFound() {
+        String resource = "" + RANDOM.nextLong();
+
+        InputStream in =
+                getClass().getClassLoader().getResourceAsStream(resource);
+        assertNull(in);
+
+        // resource pretty much guaranteed not to exist
+        try {
+            JDOHelper.getPersistenceManagerFactory(resource);
+            fail("JDOHelper failed to throw JDOFatalUserException");
+        }
+        catch (JDOFatalUserException x) {
+            // happy path
+        }
+    }
+
     public void testNegative08_ServicesFileWithOnlyComments()
-        throws IOException
-    {
-        JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(new String[] {JDOCONFIG_CLASSPATH_PREFIX}, getClass().getClassLoader());
-        ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative8", testLoader);
-        String shouldBeNull = JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
+            throws IOException {
+        JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(
+                new String[]{JDOCONFIG_CLASSPATH_PREFIX},
+                getClass().getClassLoader());
+        ClasspathHelper.addFile(
+                JDOCONFIG_CLASSPATH_PREFIX + "/Negative08", testLoader);
+        String shouldBeNull =
+                JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
         assertNull(shouldBeNull);
     }
 }

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1 @@
+

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jdoconfig
+        xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+    <!-- No PMFs defined -->
+</jdoconfig>
+

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jdoconfig
+        xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+    <!-- Duplicate anonymous PMFs present -->
+    <persistence-manager-factory/>
+    <persistence-manager-factory/>
+</jdoconfig>
+
+    
\ No newline at end of file

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Do not change any values in this file without also making changes to
+    JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+    xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+    <!-- Duplicate named PMF -->
+    <persistence-manager-factory
+        name="name.negative3"/>
+
+    <persistence-manager-factory
+        name="name.negative3"/>
+
+</jdoconfig>
+
+    
\ No newline at end of file

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Do not change any values in this file without also making changes to
+    JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+    xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+    <!-- Duplicate PMF name property in attribute & element -->
+    <persistence-manager-factory
+        name="persistence-unit-name.negative4.value0">
+        <property
+            name="name"
+            value="name.negative4.value1"/>
+
+    </persistence-manager-factory>
+</jdoconfig>
+
+    
\ No newline at end of file

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Do not change any values in this file without also making changes to
+    JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+    xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+    <!-- Duplicate property in attribute & element -->
+    <persistence-manager-factory
+        class="class.negative5.value0">
+        <property
+            name="class"
+            value="class.negative5.value1"/>
+
+    </persistence-manager-factory>
+</jdoconfig>
+
+    
\ No newline at end of file

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Do not change any values in this file without also making changes to
+    JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+    xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+    <!-- Duplicate PMF in this file and another -->
+    <persistence-manager-factory
+        name="name.negative6"/>
+</jdoconfig>
+
+    
\ No newline at end of file

Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml Thu Aug  9 14:20:35 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Do not change any values in this file without also making changes to
+    JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+    xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+    <!-- Duplicate PMF in this file and another -->
+    <persistence-manager-factory
+        name="name.negative6"/>
+</jdoconfig>
+
+    
\ No newline at end of file



Mime
View raw message