Ok, so I'm still thinking about how to use an XML file
to generate Table mappings and Peers in memory.
Here's what I've come up with so far:
Let's say on startup of Turbine it has a PeerService.
The PeerService is responsible for grabbing the XML file
of DB schema and generates from the file the TableMap and
ColumnMap objects. From there the PeerService generates a Peer
class (very much like BasePeer but not abstract) for each TableMap -
new Peer(TableMap) -
and stores it in a lookup table keyed by tablename in the PeerService.
Each Peer class has a reference to 1 tablemap and knows how to
operate on the TableMap to get the information it needs to
do it's job (e.g. selects, inserts, etc...). It seems to me
that BasePeer pretty much does this already.
This would seem to eliminate most of the need for creating a Peer class by hand.
In your business object you could do something like this:
//In the Catalog Business Object
public Vector getProducts()
{
Peer p = PeerService.getPeerOf("PRODUCTS");
Criteria c = new Criteria();
c.add(p.getColumn("brand"), "ACME");
return = p.doSelect(criteria);
}
Further more, if you made PeerService a loader like Action or Screen
you could subclass Peer to add any specific functionality you may
want the Peer to have and configure it via the props file.
Just thinking out loud,
dave
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]