grouper-dev - Re: [grouper-dev] MembershipHooks high vs not high level hooks
Subject: Grouper Developers Forum
List archive
- 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.
- MembershipHooks high vs not high level hooks, Colin Hudler, 06/24/2009
- RE: [grouper-dev] MembershipHooks high vs not high level hooks, Chris Hyzer, 06/24/2009
- Re: [grouper-dev] MembershipHooks high vs not high level hooks, Colin Hudler, 06/24/2009
- RE: [grouper-dev] MembershipHooks high vs not high level hooks, Chris Hyzer, 06/24/2009
- Re: [grouper-dev] MembershipHooks high vs not high level hooks, Colin Hudler, 06/25/2009
- RE: [grouper-dev] MembershipHooks high vs not high level hooks, Chris Hyzer, 06/25/2009
- Re: [grouper-dev] MembershipHooks high vs not high level hooks, Colin Hudler, 06/25/2009
- RE: [grouper-dev] MembershipHooks high vs not high level hooks, Chris Hyzer, 06/25/2009
- Re: [grouper-dev] MembershipHooks high vs not high level hooks, Colin Hudler, 06/25/2009
- RE: [grouper-dev] MembershipHooks high vs not high level hooks, Chris Hyzer, 06/24/2009
- Re: [grouper-dev] MembershipHooks high vs not high level hooks, Colin Hudler, 06/24/2009
- RE: [grouper-dev] MembershipHooks high vs not high level hooks, Chris Hyzer, 06/24/2009
Archive powered by MHonArc 2.6.16.