[Persistence-sig] A simple Observation API
Jeremy Hylton
jeremy@alum.mit.edu
Wed, 31 Jul 2002 16:23:42 -0400
>>>>> "PJE" == Phillip J Eby <pje@telecommunity.com> writes:
PJE> That's what TransactionAgents does, but that's not what I'm
PJE> looking for per se. I'm looking at simple data managers. For
PJE> example, if I make a data manager that persists a set of
PJE> objects to an XML DOM, I might want to use it with a DOM
PJE> persistence manager that stores XML documents in an SQL
PJE> database. All three "data managers" (persist->XML,
PJE> XML->Database, SQL database) are transaction participants, with
PJE> implied or actual ordering.
If I understand this example correctly, then there are three different
objects that implement the resource manager interface:
1. persist->XML
2. XML->Database
3. Database
It sounds like the application code only interacts with 1, and that 2
and 2 should be considered implementation details of 1. Thus, only 1
should register with the transaction, since it's the only independent
entity.
When the transaction commits, it first calls prepare() on 1. This
delegates the responsibility for the commit to 2, which in turn
delegates to 3. So for 1 to return True from its prepare, 2 and 3
must also return True.
Why doesn't this work? :-)
Jeremy