For review:

<proposed>
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 PersistenceManagerFactory - The application provides an InputStream in Properties.store(Writer) format whose contents define the Properties for the PersistenceManagerFactory - The application provides a File whose contents are in Properties.store(Writer) format which define the Properties for the PersistenceManagerFactory - 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 getPersistenceManagerFactory()

public static PersistenceManagerFactory getPersistenceManagerFactory(ClassLoader cl)

public static PersistenceManagerFactory getPersistenceManagerFactory(
            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 elements.

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.

</proposed>

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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to