Copyright (C) 2003 Philip Dorrell
Timeless Meaning is a simple Java library that facilitates robust schema evolution.
Currently there is not much documentation, and the best way to see how it is used is to look at the source code for Womcat Bookmarks which uses the library.
The main idea behind Timeless Meaning is to encode information represented in your application's database in English-like sentences, with parameters corresponding to variables in particular positions in the sentences. You can then write the sentences as Java interface methods. To save a data dump, call the interface methods on a proxy that serializes the method calls to a file (currently a simple XML implementation). To restore the data dump, say to a newer version of the application, the application exposes an implementation of the same interface, and the serialized method calls are then replayed against the interface.
There is of course no magical guarantee that a new version of the application will correctly interpret the serialized method calls. It is up to the developer to use unambiguous names for their method calls, in such a way that there is no doubt as to how they should be interpreted in both current and future versions of the application.
As the application grows through new versions, new methods will be added to the interface (or interfaces) used by Timeless Meaning to save and restore application data. Methods should generally never be dropped, unless the information they represent is no longer relevant to the application.
An application records capital cities of countries.
public interface class GeographyInformation {
public void the_capital_of_COUNTRY_is_CITY (String country, String city);
}
The code to dump the information is:
public void dumpApplicationData (GeographyInformation geographyInformation) {
for (int i=0; i<countriesList.size(); i++) { // countries and cities in parallel List's
geographyInformation.the_capital_of_COUNTRY_is_CITY ((String)countriesList.get (i),
(String)capitalCitiesList.get (i));
}
}
This is invoked by the Timeless Meaning classes as follows:
import timelessmeaning.*;
...
XMLMethodSerializer methodSerializer = new XMLMethodSerializer (document);
InformationWriter informationWriter = new InformationWriter (methodSerializer);
GeographyInformation geographyInformation =
(GeographyInformation)informationWriter.getInformationProxy (GeographyInformation.class);
dumpApplicationData (geographyInformation);
The code to restore the information is:
public class RestoreGeographyMeaning implements GeographyMeaning {
List countriesList;
List capitalCitiesList;
public RestoreGeographyMeaning (List countriesList, List capitalCitiesList) {
this.countriesList = countriesList;
this.capitalCitiesList = capitalCitiesList;
}
public void the_capital_of_COUNTRY_is_CITY (String country, String city) {
countriesList.add (country);
capitalCitiesList.add (city);
}
}
This is invoked by Timeless Meaning classes as follows -
import timelessmeaning.*;
import org.jdom.*;
...
InformationReader informationReader = new InformationReader (IgnoredDataLogger.STANDARD_OUTPUT);
informationReader.addInterfaceObject (RestoreGeographyMeaning.class,
new RestoreGeographyMeaning (countriesList, capitalCitiesList));
Document document = // get document from jdom
XMLMethodDeserializer methodDeserializer = new XMLMethodDeserializer (document, informationReader);
methodDeserializer.deserialize();
You will notice two layers in the above code: XMLMethodSerializer connected to InformationWriter for saving the data dump and XMLMethodDeserializer connected to InformationReader for reading the data dump. This enables the future development of alternative serialization formats, for example a more economical binary format.
Latest version: timelessmeaning.v1.0.jar
Timeless Meaning is licenced under the LGPL