[Sep 14 2007] AI Matthew provide examples for 8.6.1.1 jdoconfig.xml.
Here are said examples. Please review; Craig, if ok, please
incorporate into 2.1 spec.
Sample configuration using standard Java Properties file
"hr.properties" to configure a PMF with one listener for all classes:
================ in file hr.properties
# JDO provider's implementation class
javax.jdo.PersistenceManagerFactoryClass=com.acme.jdo.AcmePmf
# Persistent class instance lifecycle listener
com.example.listener.RoleListener
# configured to listen on lifecycle events for all domain classes
javax.jdo.option.InstanceLifecycleListener.com.example.listener.DomainLi
stener
# remainder of JDO properties...
================
Sample configuration using standard Java Properties file
"hr.properties" with various listeners:
================ in file hr.properties
# JDO provider's implementation class
javax.jdo.PersistenceManagerFactoryClass=com.acme.jdo.AcmePmf
# Persistent class instance lifecycle listener
com.example.listener.RoleListener
# configured to listen on lifecycle events for domain classes User,
Employee, and Manager
javax.jdo.option.InstanceLifecycleListener.com.example.listener.RoleList
ener=com.example.domain.User,com.example.domain.Employee,com.example.dom
ain.Manager
# Persistent class instance lifecycle listener
com.example.listener.ActorListener
# configured to listen on lifecycle events for domain classes Person
& Corporation
javax.jdo.option.InstanceLifeycleListener.com.example.listener.ActorList
ener=com.example.domain.Person,com.example.domain.Corporation
# remainder of JDO properties...
================
Sample META-INF/jdoconfig.xml specifying a PMF named "hr" with one
listener for all classes:
================ in file META-INF/jdoconfig.xml
<jdoconfig
xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
<persistence-manager-factory name="hr"
class="com.acme.jdo.AcmePmf" ...>
<instance-lifecycle-listener
listener="com.example.domain.DomainListener"/>
</persistence-manager-factory>
</jdoconfig>
================
Sample META-INF/jdoconfig.xml specifying a PMF named "hr" with
various listeners:
================ in file META-INF/jdoconfig.xml
<jdoconfig
xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
<persistence-manager-factory name="hr"
class="com.acme.jdo.AcmePmf" ...>
<instance-lifecycle-listener
listener="com.example.domain.RoleListener"
classes="
com.example.domain.User,
com.example.domain.Employee,
com.example.domain.Manager"
/>
<instance-lifecycle-listener
listener="com.example.domain.ActorListener"
classes="
com.example.domain.Person,
com.example.domain.Corporation"
/>
</persistence-manager-factory>
</jdoconfig>
================
Sample META-INF/jdoconfig.xml & META-INF/services/
javax.jdo.PersistenceManagerFactory specifying a PMF named "hr" with
various listeners:
================ in file META-INF/jdoconfig.xml
<jdoconfig
xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
<persistence-manager-factory name="hr" ...>
<instance-lifecycle-listener
listener="com.example.domain.RoleListener"
classes="
com.example.domain.User,
com.example.domain.Employee,
com.example.domain.Manager"
/>
<instance-lifecycle-listener
listener="com.example.domain.ActorListener"
classes="
com.example.domain.Person,
com.example.domain.Corporation"
/>
</persistence-manager-factory>
</jdoconfig>
================ in file META-INF/services/
javax.jdo.PersistenceManagerFactory
com.acme.jdo.AcmePmf
================