Package org.dellroad.stuff.pobj
package org.dellroad.stuff.pobj
Simple XML Persistence Objects (POBJ).
This package implements a library for simple persistence of Java objects via XML. It's targeted at Java data structures that are small enough to fit in memory and which are read much more often than they are written, and can be persisted as an XML file. A good example would be configuration information for an application.
Attributes and features:
- Able to persist an arbitrary java object graph - you supply the XML (de)serialization strategy
- Automatic support for deep copying the object graph
- Read access uses natural Java
- Changes are atomic, serialized, wholesale updates
- All changes must fully validate
- Versioning support for optimistic locking
- Support for "out-of-band" persistent file updates
- Support for automatic re-indexing on change
- Support for listener notifications on update
- Support for schema updates via XSLT transforms using the
org.dellroad.stuff.schema
classes - Support for JTA/XA transactions
The primary class is PersistentObject
. Typically this class would be accessed through a
PersistentObjectSchemaUpdater
which allows for evolution of the XML schema over time;
see SpringPersistentObjectSchemaUpdater
for an example of Spring configuration.
A PersistentObjectTransactionManager
for use with Spring's transaction support is also provided.
- See Also:
-
ClassDescriptionAbstractConfiguredBean<ROOT,
T> Support superclass for Spring beans that are configured by aPersistentObject
root object, or some portion thereof.Support superclass forPersistentObjectDelegate
classes, with implementations of all methods other thanserialize()
anddeserialize()
.Adapter class forPersistentObjectDelegate
implementations that wrap a nested delegate.Thrown byAbstractConfiguredBean.getRequiredConfig()
when the bean is not configured.Represents an open "transaction" on aPersistentObject
's persistent file.Main class for Simple XML Persistence Objects (POBJ).Delegate interface required forPersistentObject
s.Notification event emitted by aPersistentObject
to listeners whenever there is an update to the root object.Runtime exception thrown duringPersistentObject
operations.PersistentObject
implementation of Spring'sPersistenceExceptionTranslator
interface.Listener interface for changes to aPersistentObject
.APersistentObjectDelegate
that is also aAbstractSchemaUpdater
that automatically applies needed updates to the persistent XML file.PersistentObject
implementation of Spring'sPlatformTransactionManager
interface, allowing methods annotated with Spring's@Transactional
annotation to perform transactions onPersistentObject
s.Runtime exception thrown duringPersistentObject
operations.Optimistic locking exception thrown byPersistentObject.setRoot()
when the expected version number does not agree.PersistentObjectDelegate
that uses Spring'sMarshaller
andUnmarshaller
interfaces for XML conversion.Support superclass for Spring-enabledSchemaUpdate
s for use with aPersistentObjectSchemaUpdater
.PersistentObjectSchemaUpdater
optimized for use with Spring:SpringPersistentObjectSchemaUpdater.getOrderingTieBreaker()
is overridden to break ties by ordering updates in the same order as they are defined in the bean factory. This class implementsInitializingBean
and verifies all required properties are set. If no updates are explicitly configured, then allSpringPersistentObjectSchemaUpdate
s found in the containing bean factory are automatically configured; this requires that all of the schema updates are defined in the sameListableBeanFactory
. The default value may be configured as an XML resourceSpringPersistentObjectSchemaUpdate
that applies a configured XSL transform to the XML form of the persistent object.SpringBeanPostProcessor
that looks forSpringXSLPersistentObjectSchemaUpdate
beans that don't have an explicit transform resource configured, and configures them using a resource location based on the bean name, by simply adding a configured prefix and suffix.AnnotatedXMLStreamReader
that reads the nested schema update list.AnnotatedXMLStreamWriter
that inserts the schema update list into the document using anPersistentObjectSchemaUpdater.UPDATES_ELEMENT_NAME
annotation element.