Hi,
I would like to propose a change to the way
database maps are dished out by the PoolBroker, and
the way the default database map is setup to use
the ID Broker.
Right now, the default database map is "told"
about the ID Broker system in TurbineMapBuilder:
dbMap.setIdTable("ID_TABLE");
TableMap tMap = dbMap.getIdTable();
tMap.addPrimaryKey("ID_TABLE_ID", integer);
tMap.addColumn("TABLE_NAME", string);
tMap.addColumn("NEXT_ID", integer);
tMap.addColumn("QUANTITY", integer);
Now, the TurbineMapBuilder is used by all
the peers for the Turbine security system, so
the default db map gets built when you use
the peers within Turbine. The problem is
when you are not using the Turbine security
system, and therefore not using any of Turbine
peers, the chunk of code which tells the db map
where to look for the Id Table is not run.
I came across this when I was making a simple
peer based app that doesn't use the Turbine
security system. The Id Table mapping wasn't
being done so my app wouldn't work.
Now I could make it work by adding the above
code to one, or all of Torque generated MapBuilders
but that doesn't really make sense. The weirdness
is caused by the fact that TurbineMapBuilder is
used by ALL the security tables so the map building
is only done once. Torque generates a MapBuilder for
each table -> object mapping so you don't need to
do the Id Table mapping in each of them because it's
redundant, and trying to slip the Id Table mapping
into one of MapBuilders is silly.
The solution I propose is to setup the Id Table mapping
at the source of db maps, the PoolBroker. Typically
you would do the following to get the default db map
from the PoolBroker:
PoolBrokerService.getInstance().getDatabaseMap(
PoolBrokerService.DEFAULT);
In PoolBrokerServices.getDatabaseMap(mapname) method
is where I would like to set up the Id Table mapping
so that all db maps returned by the PoolBroker would
automatically be able to use the Id Broker system, so
this mapping could be removed from all MapBuilders.
This would only make the Id Broker work, and be available,
it would force it's use. Doing this would allow all
Turbine apps to use the Id Broker transparently and
not rely on the TurbineMapBuilder setting up the mapping.
The change would basically involved adding the block
of code above to the PoolBrokerService.getDatabaseMap()
method. I have tried this with my sample TDK app and
everything works. The TurbineMapBuilder can remain the
same as it doesn't hurt anything to do the Id Broker
mapping again, but it can be removed.
I just want to make the Id Broker work transparently
for all app regardless of whether the Turbine security
system is used. If no one has any objections I will
make the changes.
--
jvz.
Jason van Zyl
[EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]