I like your thoughts...A LOT! ;-) Excellent work. ;-)
> 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.
This part, I have all coded up an working already.
> 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.
Ok, I like this. I like this a lot.
> 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.
You are right. The part that I was missing above was what you have
suggested...new Peer(). ;-)
> This would seem to eliminate most of the need for creating a Peer class
> by hand.
Bingo. Excellent Idea.
> 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);
> }
Ok, so this would be:
public class Catalog{}
right?
> 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.
Actually, you would not want to subclass Peer...you would add this
functionality to the BO's...
> Just thinking out loud,
Perfect. I love it. ;-)
So, I suggest the following...
public interface Peer
// defines a Peer
public abstract class BasePeer implements Peer
// doSelect(), etc...
public class TableMapPeer extends BasePeer
// setTableMap()
public class PeerFactory
// generates Peer's from TableMapPeer
public class PeerService
// uses PeerFactory to generate Peer's
-jon
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]