Skip to Content.
Sympa Menu

grouper-dev - Re: [grouper-dev] Action Items: Grouper-Dev Call 9-Jul-2008

Subject: Grouper Developers Forum

List archive

Re: [grouper-dev] Action Items: Grouper-Dev Call 9-Jul-2008


Chronological Thread 
  • From: Tom Barton <>
  • To: Chris Hyzer <>
  • Cc: "" <>
  • Subject: Re: [grouper-dev] Action Items: Grouper-Dev Call 9-Jul-2008
  • Date: Thu, 10 Jul 2008 07:40:48 -0500

Now I get it. This is an elegant solution to the problem of multiple hook developers with differing purposes.

How is the sequence of hook firing determined? What if a hook must be last, or first, or must override others?

Chris Hyzer wrote:
[AI] {Chris} will write an explanation of how hooks will be declared.

I added 3 Grouper lifecycle hooks, for grouper init, hooks init, and
hibernate init.

So now there are 3 ways to configure hooks, by declaring piecemeal in
grouper.properties, by declaring one lifecycle hook which registers a
suite of hooks in java in the hooks init method, or I picture built
in grouper hooks / suites being declared in java and configured
(turned on and off perhaps) in the grouper.properties (when someone
wants to do this the first time I can do an example, just let me know
the lifecycle hooks class and grouper.properties setting). This
built in way would not require classes of hooks or lifecycles
configured in the grouper.properties (we will leave that for user
hooks or 3rd party hooks).

I documented these on the hooks page:

https://wiki.internet2.edu/confluence/display/GrouperWG/Hooks

Regards,
Chris

#### from documentation ####

To configure a hook, subclass one of the hooks base classes, e.g. GroupHooks,
MembershipHooks, etc. Then either register this in the grouper.properties
(see grouper.example.properties for documentation)

#implement a group hook by extending
edu.internet2.middleware.grouper.hooks.GroupHooks
hooks.group.class=edu.yourSchool.it.YourSchoolGroupHooks,edu.yourSchool.it.YourSchoolGroupHooks2

Note you can register multiple hooks by comma separating them. Or you can
register runtime with:

GrouperHookType.addHookManual("hooks.group.class",
YourSchoolGroupHooks2.class);

If you want to register a suite of hooks, just register a lifecycle hook:


hooks.lifecycle.class=edu.internet2.middleware.grouper.hooks.LifecycleHooksImpl

Then in the hook init method, register some hooks for the suite:

package edu.internet2.middleware.grouper.hooks;

import edu.internet2.middleware.grouper.hooks.beans.HooksContext;
import
edu.internet2.middleware.grouper.hooks.beans.HooksLifecycleHooksInitBean;
import edu.internet2.middleware.grouper.hooks.logic.GrouperHooksUtils;


/**
*
*/
public class LifecycleHooksImpl extends LifecycleHooks {

/**
* @see
edu.internet2.middleware.grouper.hooks.LifecycleHooks#hooksInit(edu.internet2.middleware.grouper.hooks.beans.HooksContext,
*
edu.internet2.middleware.grouper.hooks.beans.HooksLifecycleHooksInitBean)
*/
@Override
public void hooksInit(HooksContext hooksContext,
HooksLifecycleHooksInitBean hooLifecycleHooksInitBean) {
GrouperHooksUtils.addHookManual("hooks.group.class", MyGroupHooks.class);
GrouperHooksUtils.addHookManual("hooks.stem.class", MyStemHooks.class);
GrouperHooksUtils.addHookManual("hooks.member.class",
MyMemberHooks.class);
}

}

Finally, I picutre built-in grouper suites to just insert the
registration based on grouper config property in GrouperHooksUtils in
the initHooks block. To enable the suite the grouper properties file
would just have a boolean switch. When someone wants to get this
working, let me know the grouper properties config property and the
LifecycleHooks subclass and I can do an example.




Archive powered by MHonArc 2.6.16.

Top of Page