|
<< back to johnspurlock.com
projects/java ProjectGhostData dist src ProjectRevere dist src ProjectUtil dist src lib cloudscape commons-httpclient commons-lang commons-logging hsqldb informa jaf jaimlib javamail jdom jgmail junit mssql postgresql smtpmailer soap swt timer xerces xstream john spurlock 2008
|
ProjectGhostData
A basic framework for object persistence.
Binary packages
Source code packages
Browse source...
Library References
Description:
This is meant to be a simple mechanism for storing regular java objects to (and retrieving them from) a "datastore". Some features:
To make an existing object persistable, you write two proxy classes: the proxy to put a simple java object into a datastore is the IFieldProvider, and the proxy to pull an object out of a datastore is the IObjectBuilder. (Domain Object) -> (IFieldProvider) -> (IDatastore) (Domain Object) <- (IObjectBuilder) <- (IDatastore) There are five tested sql datastore implementations included, for Postgres, Hsql, Cloudscape, Microsoft Sql Server & Access. Example:
Album album = whatever.getAlbum();
// define the datastore, in this case it is a sql server database
IDatastore datastore = GhostDataMinistry.getDatastore("mssql|servername|instancename|databasename|username|password");
// store the album
datastore.add(album.new DefaultFieldProvider());
// retrieve a list of albums using a query
List results = datastore.getObjects(new Album.DefaultObjectBuilder(),"where artist = 'Wilco'");
// retrieve a single album
Album album123 = (Album)datastore.getObjects(new Album.DefaultObjectBuilder(),"where artist = 'Wilco' and album='A ghost is born'");
|