[Zope3-dev] ObjectHub notes: removing objects

Gary Poster gary@zope.com
16 Oct 2002 15:09:44 -0400


[This is the second email regarding the ObjectHub and various other
concerns that I plan to send out :-)]

Now to removing objects.  

In the current interfaces, it appears the desired behavior is for the
ObjectHub, when it receives an IObjectRemoved event, to remove the
object from its registry and send out an IObjectRemovedHubEvent, which
is a subclass of IObjectUnregisteredHubEvent.  

In the check-out's implementation, the behavior is for an IObjectRemoved
event to fire an IObjectRemovedHubEvent if the object is in the
registry, and stop--that is, the object's path is not unregistered
automatically.  The expected next step is that you have a subscriber
listening to IObjectRemovedHubEvents and, in most-to-all cases, sending
out, in reply, a request to the ObjectHub to unregister the given object
path.  This of course sends out an IObjectUnregisteredHubEvent.  The
events fired are then these:

(from source external to ObjectHub:) IObjectRemoved
(from ObjectHub:) IObjectRemovedHubEvent
(from hypothetical ObjectHub subscriber: message objectHub.unregister)
(from IObjectHub:) IObjectUnregisteredHubEvent

PROPOSAL: keep the current implementation, and change the interface to
describe it.  

PRO: I can think of a use case for it.  On object removal, we might want
to do more complex behavior than merely either removing the link or
raising an exception.  We might want to allow the removal but make a
"ghost" placeholder to which the object-hub-related information can
still point, for instance.  

CON: (1) delegating the *essential* behavior of what to do when an
object is removed to a plugin seems a bit risky.  (2) it's not a direct
parallel to what I proposed to do for object added events.

--------

Don't worry, there's more coming!