You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Defining own hooks

Step 1: Copying & pasting grouper hooks to own java package

The original grouper hooks are located in  [grouper api installation directory]/src/grouper/edu/internet2/middleware/grouper/hooks. The root is the edu level, thus having edu.internet2.middleware.grouper.hooks as the package name.

We have introduced an additional class hierarchy [grouper api installation directory]/src/grouper/newLevel1/newLevel2/hooks.

Now copy & paste all original grouper hooks, rename the class names to "MyXXXHook.java" (or anything) and modify the package name of each class to newLevel1.newLevel2.hooks..

Step 2: Make sure the new hooks are found

Open the file [grouper api installation directory]/conf/grouper.base.properties and copy all of the

hooks.xxx.class=edu.yourSchool.it.YourSchoolGroupHooks,edu.yourSchool.it.YourSchoolxxxHooks2  

lines into grouper.properties configuration file.

 

Now register the new classes by modifying the new entries:

hooks.attribute.class=newLevel1.newLevel2.hooks.MyAttributeHook
hooks.attributeAssign.class=newLevel1.newLevel2.hooks.MyAttributeAssignHook

(and so on for all hooks)

Step 3: Customize your hooks

By default the hooks are empty but you can use them easily for triggered actions. All hooks are executed automatically if the corresponding activity happens. I.e. the MyGroupHook.groupPostUpdate()  method will be executed after each group update. Now fill them with life.
Here are three examples of how we use them.

Sending mails to wheel members if important member groups are deleted

 

 

  • No labels