You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by ma...@apache.org on 2007/08/09 23:20:55 UTC
svn commit: r564384 [2/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...
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative07/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative07/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
(empty)
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1,3 @@
+# there are
+# only comments
+# in this file
\ No newline at end of file
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,260 @@
+<?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">
+
+ <!--
+ Basic PMF config using attributes & listeners with no nonstandard
+ properties.
+ -->
+ <persistence-manager-factory
+ class="class.positive00.pmf0"
+ connection-driver-name="connection-driver-name.positive00.pmf0"
+ connection-factory-name="connection-factory-name.positive00.pmf0"
+ connection-factory2-name="connection-factory2-name.positive00.pmf0"
+ connection-password="connection-password.positive00.pmf0"
+ connection-url="connection-url.positive00.pmf0"
+ connection-user-name="connection-user-name.positive00.pmf0"
+ ignore-cache="ignore-cache.positive00.pmf0"
+ mapping="mapping.positive00.pmf0"
+ multithreaded="multithreaded.positive00.pmf0"
+ nontransactional-read="nontransactional-read.positive00.pmf0"
+ nontransactional-write="nontransactional-write.positive00.pmf0"
+ optimistic="optimistic.positive00.pmf0"
+ name="name.positive00.pmf0"
+ persistence-unit-name="persistence-unit-name.positive00.pmf0"
+ restore-values="restore-values.positive00.pmf0"
+ retain-values="retain-values.positive00.pmf0"
+ detach-all-on-commit="detach-all-on-commit.positive00.pmf0"
+ server-time-zone-id="server-time-zone-id.positive00.pmf0">
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf0.listener0"
+ classes="classes.positive00.pmf0.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf0.listener1"
+ classes="classes.positive00.pmf0.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ Basic PMF config using only <property> elements with javax.jdo
+ properties and no nonstandard properties.
+ -->
+ <persistence-manager-factory>
+ <property
+ name="javax.jdo.PersistenceManagerFactoryClass"
+ value="class.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionDriverName"
+ value="connection-driver-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionFactoryName"
+ value="connection-factory-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionFactory2Name"
+ value="connection-factory2-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionPassword"
+ value="connection-password.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionURL"
+ value="connection-url.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionUserName"
+ value="connection-user-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.IgnoreCache"
+ value="ignore-cache.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Mapping"
+ value="mapping.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Multithreaded"
+ value="multithreaded.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.NontransactionalRead"
+ value="nontransactional-read.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.NontransactionalWrite"
+ value="nontransactional-write.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Optimistic"
+ value="optimistic.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Name"
+ value="name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.PersistenceUnitName"
+ value="persistence-unit-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.DetachAllOnCommit"
+ value="detach-all-on-commit.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.RestoreValues"
+ value="restore-values.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.RetainValues"
+ value="retain-values.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ServerTimeZoneID"
+ value="server-time-zone-id.positive00.pmf1"/>
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf1.listener0"
+ classes="classes.positive00.pmf1.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf1.listener1"
+ classes="classes.positive00.pmf1.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ PMF config that uses nested <property> elements with standard
+ attribute names instead of javax.jdo property names and no nonstandard
+ properties.
+ -->
+ <persistence-manager-factory>
+ <property
+ name="class"
+ value="class.positive00.pmf2"/>
+ <property
+ name="connection-driver-name"
+ value="connection-driver-name.positive00.pmf2"/>
+ <property
+ name="connection-factory-name"
+ value="connection-factory-name.positive00.pmf2"/>
+ <property
+ name="connection-factory2-name"
+ value="connection-factory2-name.positive00.pmf2"/>
+ <property
+ name="connection-password"
+ value="connection-password.positive00.pmf2"/>
+ <property
+ name="connection-url"
+ value="connection-url.positive00.pmf2"/>
+ <property
+ name="connection-user-name"
+ value="connection-user-name.positive00.pmf2"/>
+ <property
+ name="ignore-cache"
+ value="ignore-cache.positive00.pmf2"/>
+ <property
+ name="mapping"
+ value="mapping.positive00.pmf2"/>
+ <property
+ name="multithreaded"
+ value="multithreaded.positive00.pmf2"/>
+ <property
+ name="nontransactional-read"
+ value="nontransactional-read.positive00.pmf2"/>
+ <property
+ name="nontransactional-write"
+ value="nontransactional-write.positive00.pmf2"/>
+ <property
+ name="optimistic"
+ value="optimistic.positive00.pmf2"/>
+ <property
+ name="name"
+ value="name.positive00.pmf2"/>
+ <property
+ name="persistence-unit-name"
+ value="persistence-unit-name.positive00.pmf2"/>
+ <property
+ name="detach-all-on-commit"
+ value="detach-all-on-commit.positive00.pmf2"/>
+ <property
+ name="restore-values"
+ value="restore-values.positive00.pmf2"/>
+ <property
+ name="retain-values"
+ value="retain-values.positive00.pmf2"/>
+ <property
+ name="javax.jdo.option.ServerTimeZoneID"
+ value="server-time-zone-id.positive00.pmf2"/>
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf2.listener0"
+ classes="classes.positive00.pmf2.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf2.listener1"
+ classes="classes.positive00.pmf2.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ PMF config using standard attributes plus nonstandard properties in
+ <property> elements.
+ -->
+ <persistence-manager-factory
+ class="class.positive00.pmf3"
+ connection-driver-name="connection-driver-name.positive00.pmf3"
+ connection-factory-name="connection-factory-name.positive00.pmf3"
+ connection-factory2-name="connection-factory2-name.positive00.pmf3"
+ connection-password="connection-password.positive00.pmf3"
+ connection-url="connection-url.positive00.pmf3"
+ connection-user-name="connection-user-name.positive00.pmf3"
+ ignore-cache="ignore-cache.positive00.pmf3"
+ mapping="mapping.positive00.pmf3"
+ multithreaded="multithreaded.positive00.pmf3"
+ nontransactional-read="nontransactional-read.positive00.pmf3"
+ nontransactional-write="nontransactional-write.positive00.pmf3"
+ optimistic="optimistic.positive00.pmf3"
+ name="name.positive00.pmf3"
+ persistence-unit-name="persistence-unit-name.positive00.pmf3"
+ restore-values="restore-values.positive00.pmf3"
+ retain-values="retain-values.positive00.pmf3"
+ detach-all-on-commit="detach-all-on-commit.positive00.pmf3"
+ server-time-zone-id="server-time-zone-id.positive00.pmf3">
+
+ <property name="property.positive00.pmf3.name0"
+ value="property.positive00.pmf3.value0"/>
+ <property name="property.positive00.pmf3.name1"
+ value="property.positive00.pmf3.value1"/>
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf3.listener0"
+ classes="classes.positive00.pmf3.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf3.listener1"
+ classes="classes.positive00.pmf3.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ PMF config using standard attributes plus nonstandard attributes.
+ -->
+ <persistence-manager-factory
+ class="class.positive00.pmf4"
+ connection-driver-name="connection-driver-name.positive00.pmf4"
+ connection-factory-name="connection-factory-name.positive00.pmf4"
+ connection-factory2-name="connection-factory2-name.positive00.pmf4"
+ connection-password="connection-password.positive00.pmf4"
+ connection-url="connection-url.positive00.pmf4"
+ connection-user-name="connection-user-name.positive00.pmf4"
+ ignore-cache="ignore-cache.positive00.pmf4"
+ mapping="mapping.positive00.pmf4"
+ multithreaded="multithreaded.positive00.pmf4"
+ nontransactional-read="nontransactional-read.positive00.pmf4"
+ nontransactional-write="nontransactional-write.positive00.pmf4"
+ optimistic="optimistic.positive00.pmf4"
+ name="name.positive00.pmf4"
+ persistence-unit-name="persistence-unit-name.positive00.pmf4"
+ restore-values="restore-values.positive00.pmf4"
+ retain-values="retain-values.positive00.pmf4"
+ detach-all-on-commit="detach-all-on-commit.positive00.pmf4"
+ server-time-zone-id="server-time-zone-id.positive00.pmf4"
+
+ property.positive00.pmf4.name0="property.positive00.pmf4.value0"
+ property.positive00.pmf4.name1="property.positive00.pmf4.value1"/>
+</jdoconfig>
+
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,17 @@
+<?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 PUs in this file and another, but not requested -->
+ <persistence-manager-factory/>
+
+ <persistence-manager-factory
+ name="name.positive01"/>
+</jdoconfig>
+
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,15 @@
+<?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 PUs in this file and another, but not requested -->
+ <persistence-manager-factory
+ name="name.positive01"/>
+</jdoconfig>
+
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,13 @@
+<?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">
+
+ <!-- Anonymous PMF & with META-INF/services lookup for PMF class name -->
+ <persistence-manager-factory/>
+</jdoconfig>
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1 @@
+class.positive03.pmf0
\ No newline at end of file
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,13 @@
+<?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">
+
+ <!-- Anonymous PMF & with META-INF/services lookup for PMF class name -->
+ <persistence-manager-factory/>
+</jdoconfig>
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1,3 @@
+
+#this is a comment
+class.positive04.pmf0 # this is another comment
\ No newline at end of file
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,13 @@
+<?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">
+
+ <!-- Anonymous PMF & with META-INF/services lookup for PMF class name -->
+ <persistence-manager-factory/>
+</jdoconfig>
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1 @@
+class.positive05.pmf0# this is a comment without whitespace separating it from the uncommented text
\ No newline at end of file
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,43 @@
+<?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">
+
+ <!--
+ Basic anonymous PMF config using attributes & listeners with no nonstandard
+ properties.
+ -->
+ <persistence-manager-factory
+ class="class.positive06.pmf0"
+ connection-driver-name="connection-driver-name.positive06.pmf0"
+ connection-factory-name="connection-factory-name.positive06.pmf0"
+ connection-factory2-name="connection-factory2-name.positive06.pmf0"
+ connection-password="connection-password.positive06.pmf0"
+ connection-url="connection-url.positive06.pmf0"
+ connection-user-name="connection-user-name.positive06.pmf0"
+ ignore-cache="ignore-cache.positive06.pmf0"
+ mapping="mapping.positive06.pmf0"
+ multithreaded="multithreaded.positive06.pmf0"
+ nontransactional-read="nontransactional-read.positive06.pmf0"
+ nontransactional-write="nontransactional-write.positive06.pmf0"
+ optimistic="optimistic.positive06.pmf0"
+ restore-values="restore-values.positive06.pmf0"
+ retain-values="retain-values.positive06.pmf0"
+ detach-all-on-commit="detach-all-on-commit.positive06.pmf0"
+ server-time-zone-id="server-time-zone-id.positive06.pmf0">
+
+ <instance-lifecycle-listener
+ listener="listener.positive06.pmf0.listener0"
+ classes="classes.positive06.pmf0.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive06.pmf0.listener1"
+ classes="classes.positive06.pmf0.classes1"
+ />
+ </persistence-manager-factory>
+</jdoconfig>
Added: db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2-legacy/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,45 @@
+<?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">
+
+ <!--
+ Basic anonymous PMF config using attributes & listeners with no nonstandard
+ properties but with a PU name.
+ -->
+ <persistence-manager-factory
+ class="class.positive07.pmf0"
+ connection-driver-name="connection-driver-name.positive07.pmf0"
+ connection-factory-name="connection-factory-name.positive07.pmf0"
+ connection-factory2-name="connection-factory2-name.positive07.pmf0"
+ connection-password="connection-password.positive07.pmf0"
+ connection-url="connection-url.positive07.pmf0"
+ connection-user-name="connection-user-name.positive07.pmf0"
+ ignore-cache="ignore-cache.positive07.pmf0"
+ mapping="mapping.positive07.pmf0"
+ multithreaded="multithreaded.positive07.pmf0"
+ nontransactional-read="nontransactional-read.positive07.pmf0"
+ nontransactional-write="nontransactional-write.positive07.pmf0"
+ optimistic="optimistic.positive07.pmf0"
+ persistence-unit-name="persistence-unit-name.positive07.pmf0"
+ restore-values="restore-values.positive07.pmf0"
+ retain-values="retain-values.positive07.pmf0"
+ detach-all-on-commit="detach-all-on-commit.positive07.pmf0"
+ server-time-zone-id="server-time-zone-id.positive07.pmf0">
+
+ <instance-lifecycle-listener
+ listener="listener.positive07.pmf0.listener0"
+ classes="classes.positive07.pmf0.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive07.pmf0.listener1"
+ classes="classes.positive07.pmf0.classes1"
+ />
+ </persistence-manager-factory>
+</jdoconfig>
+
Modified: db/jdo/trunk/api2/src/java/javax/jdo/Bundle.properties
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/Bundle.properties?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/Bundle.properties (original)
+++ db/jdo/trunk/api2/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/src/java/javax/jdo/Constants.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/Constants.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/Constants.java (original)
+++ db/jdo/trunk/api2/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"
Modified: db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java (original)
+++ db/jdo/trunk/api2/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/src/java/javax/jdo/PersistenceManagerFactory.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java (original)
+++ db/jdo/trunk/api2/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/src/schema/javax/jdo/jdoconfig_2_1.xsd
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/schema/javax/jdo/jdoconfig_2_1.xsd?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2/src/schema/javax/jdo/jdoconfig_2_1.xsd (original)
+++ db/jdo/trunk/api2/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"/>