org.sandev.basics.DataManager
Interface Converter


public interface Converter

The Converter interface defines a class which is capable of converting a Persister storage structure. If during initialization the Persister finds that a storage structure no longer matches the struct definition, then it will call the Converter to fix it. If it can't be fixed, then initialization fails.

A Converter provides a way to automate forward migration of data storage over time.


Method Summary
 void fixStructure(java.lang.String structure, java.lang.Object detail)
          The storage structure for the specified Struct doesn't match.
 void init(DataManagerNode node)
          Perform whatever steps are necessary at startup.
 

Method Detail

init

void init(DataManagerNode node)
          throws PersisterException
Perform whatever steps are necessary at startup. The back reference to the DataManager is provided for access to the node data and facilities.

Throws:
PersisterException

fixStructure

void fixStructure(java.lang.String structure,
                  java.lang.Object detail)
The storage structure for the specified Struct doesn't match. Make whatever changes are necessary. The storage structure will be rechecked by the Persister after this call, and if it still fails, then the Persister fails. This method should always complete.

Each Persister will typically have some form of additional information that the Converter can utilize in processing. The actual form of this data depends on the Persister, so it is information is passed as a generic Object.

The specified structure can also vary with the Persister implementation. Typically this would be the table name for relational database persister, or the persistent message name for an OODB persister.