Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] easier way to implement change log consumers

Subject: Grouper Developers Forum

List archive

[grouper-dev] easier way to implement change log consumers


Chronological Thread 
  • From: "Hyzer, Chris" <>
  • To: "" <>
  • Subject: [grouper-dev] easier way to implement change log consumers
  • Date: Tue, 5 Apr 2016 19:40:24 +0000
  • Accept-language: en-US
  • Authentication-results: internet2.edu; dkim=none (message not signed) header.d=none;internet2.edu; dmarc=none action=none header.from=isc.upenn.edu;
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:23

In 2.3 Bill Thompson submitted a new and easier way to implement change log consumers.  Thanks Bill!  Note, this is brand new so it needs its tires kicked J  We also need to figure out how was want this working with messaging

 

https://spaces.internet2.edu/pages/viewpage.action?pageId=14517905#Notifications(changelog)-ExtendChangeLogConsumerImpl

 

 

This is a new class in Grouper 2.3+ that allows you to create an attribute, assign it to folder(s) or group(s), and assigned groups/memberships will be provisioned.

Create and assign an attribute in GSH (note you can do this with the UI as well).

 

 

GrouperSession grouperSession = GrouperSession.startRootSession();

AttributeDef provisioningMarkerAttributeDef = new AttributeDefSave(grouperSession).assignCreateParentStemsIfNotExist(true).assignName("attr:someAttrDef").assignToStem(true).assignToGroup(true).save();

AttributeDefName provisioningMarkerAttributeName = new AttributeDefNameSave(grouperSession, provisioningMarkerAttributeDef).assignName("attr:provisioningMarker").save()

Stem parentFolder = StemFinder.findByName(grouperSession, "some:folder", true);

parentFolder.getAttributeDelegate().assignAttribute(provisioningMarkerAttributeName);

 

Group someGroup = GroupFinder.findByName(grouperSession, "another:folder:someGroup", true);

someGroup .getAttributeDelegate().assignAttribute(provisioningMarkerAttributeName);

 

 

Configure the class in grouper-loader.properties

 

 

changeLog.consumer.abc.class = edu.internet2.middleware.grouper.changeLog.consumer.PrintChangeLogConsumer

# note: this name matches the attribute name created in the example above

changeLog.consumer.abc.syncAttributeName = attr:provisioningMarker

changeLog.consumer.abc.quartzCron =

# defaults to true if not configured

changeLog.consumer.abc.retryOnError = true

 

 

There are certain methods to override to sync groups and memberships

 

 

public class SomeChangeLogConsumer extends ChangeLogConsumerBaseImpl {

 

  protected void renameGroup(String oldGroupName, String newGroupName, ChangeLogEntry changeLogEntry) {

  }

  protected void removeMovedGroup(String oldGroupName, ChangeLogEntry changeLogEntry) {

  }

 

  protected void addGroup(Group group, ChangeLogEntry changeLogEntry) {

  }

  protected void addGroupAndMemberships(Group group, ChangeLogEntry changeLogEntry) {

  }

  protected void updateGroup(Group group, ChangeLogEntry changeLogEntry) {

  }

 

  protected void removeGroup(Group group, ChangeLogEntry changeLogEntry) {

  }

  protected void removeDeletedGroup(PITGroup pitGroup, ChangeLogEntry changeLogEntry) {

  }

  protected void addMembership(Subject subject, Group group, ChangeLogEntry changeLogEntry) {

  }

  protected void removeMembership(Subject subject, Group group, ChangeLogEntry changeLogEntry) {

  }

  protected boolean isFullSyncRunning(String consumerName) {

  }

}

 

 

 

Thanks

Chris



  • [grouper-dev] easier way to implement change log consumers, Hyzer, Chris, 04/05/2016

Archive powered by MHonArc 2.6.16.

Top of Page