Niclas Hedhman wrote: > I think that either; > > a) Don't require the registration, and instead let UoW explicitly > know of a MixinType that signals the callback. > > or > > b) Allow anyone to register synch callbacks, in which case the > Entity instance must also be passed in the sync calls.
For b), the registered synch could already have a reference to the Entity(ies) it wants to validate, so it doesn't have to be passed. The ValidatableMixin already does this, in a sense (check the code I committed yesterday). What I like about b) is the combination of being able to easily register custom validations, and also that only entities which actually have the ValidatableMixin will register. With a) the UoW will, first of all, have to be explicitly aware of the Validatable interface which is currently in the framework extension, and secondly it would have to do "instanceof" checks on every entity which seems slow. With the Entity registering itself, as it is now, there is no penalty for the feature if no validation is used, which I think is better. > Also, UnitOfWorkSynchronization? Is that descriptive? I can't come up > with a better name, but asking the many lurkers to chip in. The name was copied from JTA, and in a sense it is so bad that it *has* to be changed. Having slept on it, here are some options: *Listener: problem is that beforeCompletion throws exception, so not a strict listener *Notification: same problem as with Listener *Callback: works, since it's a generic name, but might be too generic *Validation: this captures what one would typically do, and works very well with the most common case, i.e. ValidatableMixin registering itself. Only problem I see with this is that one might want to register things that does not just do validation. My personal favourite is the last one (i.e. registerUnitOfWorkValidation). Any other ideas? /Rickard _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

