Class PersistentObjectSchemaUpdater<T>

Type Parameters:
T - type of the root persistent object
All Implemented Interfaces:
PersistentObjectDelegate<T>
Direct Known Subclasses:
SpringPersistentObjectSchemaUpdater

public class PersistentObjectSchemaUpdater<T> extends AbstractSchemaUpdater<PersistentFileTransaction,PersistentFileTransaction> implements PersistentObjectDelegate<T>
A PersistentObjectDelegate that is also a AbstractSchemaUpdater that automatically applies needed updates to the persistent XML file.

To use this class, wrap your normal delegate in an instance of this class. This will augment the serialization and deserialization process to keep track of which updates have been applied to the XML structure, and automatically and transparently apply any needed updates during deserialization.

Updates are tracked by inserting an <pobj:updates> element into the serialized XML document; this update list is transparently removed when the document is read back, and any missing updates are applied automatically. In this way the document and its set of applied updates always travel together. For example:


  <MyConfig>
      <pobj:updates xmlns:pobj="http://dellroad-stuff.googlecode.com/ns/persistentObject">
          <pobj:update>some-update-name-1</pobj:update>
          <pobj:update>some-update-name-2</pobj:update>
      </pobj:updates>
      <username>admin</username>
      <password>secret</password>
  </MyConfig>
 

For Spring applications, SpringPersistentObjectSchemaUpdater provides a convenient declarative way to define your schema updates via XSLT files.