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 15:31:20 -0500

On 06/25/2009 03:00 PM, Chris Hyzer wrote:
Im not sure I understand why you would use this hook and not
membershipPostCommitInsert and membershipPostCommitDelete?

Those would save me trouble, thanks. I thought I would do something else with the set of memberships, but that turned out to not be true.


Also, if notifications / change log existed in 2.4, you would use that right?

It is very likely.


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