Skip to Content.
Sympa Menu

grouper-dev - Re: [grouper-dev] MembershipHooks high vs not high level hooks

Subject: Grouper Developers Forum

List archive

Re: [grouper-dev] MembershipHooks high vs not high level hooks


Chronological Thread 
  • From: Colin Hudler <>
  • To: Chris Hyzer <>
  • Cc: "" <>
  • Subject: Re: [grouper-dev] MembershipHooks high vs not high level hooks
  • Date: Thu, 25 Jun 2009 12:18:42 -0500

On 06/24/2009 10:38 PM, Chris Hyzer wrote:
Alright, let me re-explain:

It is called whenever that method is called whenever a certain method is
called in the API.

However, there might be other ways that a membership could be inserted. If
you want to catch *every* insert, then do a preInsert. If you want to catch
group.addMember(), then maybe membershipPreAddMember. However, I don't know
which internal methods call the one which fires a membershipPreAddMember, and
which don't... maybe it should say:

FROM: high level, not the side effects
TO: high level, maybe not the side effects

What are you trying to do?

This hook notifies a udp listener of membership changes. The listener then takes action, in this case, updating an LDAP database.

I registered two hooks.

membershipPostCommitRemoveMember
membershipPostCommitAddMember

I could not easily predict when the hooks would fire, so it is their job to filter the event before notifying. Please forgive this crude code fragment, but I think it illustrates what I am doing:

Set memberships = postCommitBeanThread.getMembershipEffectiveSaves();
memberships.addAll(postCommitBeanThread.getMembershipImmediateSaves());
Iterator memberator = memberships.iterator();
while (memberator.hasNext()) {
Membership membership = (Membership) memberator.next();
String listName = membership.getListName();
if (!listName.equals("members")) { memberator.next(); continue; }
// Proceed to process this event...


This works well so far.



Archive powered by MHonArc 2.6.16.

Top of Page