db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew T. Adams" <matt...@matthewadams.org>
Subject RE: Please review PMF bootstrap process for JDO specification
Date Wed, 12 Sep 2007 05:01:57 GMT
You forgot the "name" attribute of the persistence-manager-factory element,
and the fact that a missing or empty "name" attribute means the anonymous
PMF, and a non-empty "name" attribute contains the name of a named PMF, as
distinct from attribute/property persistence-unit-name.

I also find reading "...in Properties.store(Writer) format..." a bit clumsy.
Could we just use a phrase like "the standard Java Properties file format"
or something similar?  You'd have to have been living under a rock for the
last ten years not to know what that is.

We also should mention in this passage something about the use of
persistence.xml as a means to bootstrap a PMF.  Additionally, we still need
to define (possibly here) the JDO equivalents of the properties that can be
set on a persistence unit.


-----Original Message-----
From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] 
Sent: Tuesday, September 11, 2007 6:10 PM
To: Apache JDO project; JDO Expert Group
Subject: Please review PMF bootstrap process for JDO specification

For review:

8.6 PersistenceManagerFactory methods
JDOHelper provides several methods to bootstrap an application by  
looking up a PersistenceManagerFactory for the application to use.  
Users have a choice of configuration techniques.
- The application provides a Map of properties that are used to  
construct a PersistenceManagerFactory
- The application provides the name of a resource in Properties.store 
(Writer) format whose contents define the Properties for the  
- The application provides an InputStream in Properties.store(Writer)  
format whose contents define the Properties for the  
- The application provides a File whose contents are in  
Properties.store(Writer) format which define the Properties for the  
- The application provides a JNDI name and context in which the name  
is defined
- The application provides a resource named META-INF/jdoconfig.xml  
and optionally META-INF/services/javax.jdo.PersistenceManagerFactory  
which contain configuration information

     public static PersistenceManagerFactory  

     public static PersistenceManagerFactory  
getPersistenceManagerFactory(ClassLoader cl)

     public static PersistenceManagerFactory  
             ClassLoader resourceLoader,
             ClassLoader pmfLoader)

These methods return the PersistenceManagerFactory as configured in  
the configuration files (META-INF/jdoconfig.xml and META-INF/services/ 
javax.jdo.PersistenceManagerFactory). If no class loader is  
specified, the current context class loader is used to both access  
the configuration files and load the PersistenceManagerFactory class.  
If only one class loader is specified, the parameter is used to both  
access the configuration files and load the PersistenceManagerFactory  
class. If both class loaders are specified, the resource loader is  
used to access the configuration files, and the pmf loader is used to  
load the PersistenceManagerFactory class.

The jdoconfig.xml file is used to construct a Properties instance  
which is then passed to one of the get PersistenceManagerFactory  
methods that take a Map instance.

If there is no property named  
javax.jdo.PersistenceManagerFactoryClass in the Map, then the class  
is looked up via the services protocol. That is, a resource named  
META-INF/services/javax.jdo.PersistenceManagerFactory is looked up  
via the resource loader. If this resource cannot be accessed, a  
JDOFatalUserException is thrown. If the resource is loadable then it  
defines the name of a class that is loaded using the pmf loader. If  
multiple resources named META-INF/services/ 
javax.jdo.PersistenceManagerFactory are accessible via the resource  
loader, only the first resource is used.

8.6.1 The jdoconfig.xml descriptor
Document root element jdoconfig
The root element contains one or more persistence-manager-factory  

Element persistence-manager-factory contains zero or more property  
elements and zero or more instance-lifecycle-listener elements.

Attributes of persistence-manager-factory include the boolean  
attributes optimistic, retain-values, restore-values, ignore-cache,  
nontransactional-read, nontransactional-write, detach-all-on-commit,  
and multithreaded; and string attributes class, persistence-unit- 
name, connection-driver-name, connection-user-name, connection- 
password, connection-url, connection-factory-name, connection- 
factory2-name, mapping, and server-time-zone-id.

Element property contains attributes name and value.

Element instance-lifecycle-listener contains attributes listener  
which names the class of the listener; and classes which names the  
classes listened to. The semantics of instance-lifecycle-listener are  
that the listeners are registered with the persistence-manager- 
factory exactly as if  for each listener,  
addInstanceLifecycleListener (InstanceLifecycleListener listener,  
Class[] classes) were called on the pmf instance prior to returning  
it to the user.


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

View raw message