Created
February 16, 2016 15:54
-
-
Save wgthom/54e08c7d44b802f720ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example change log consumer based on ChangeLogConsumerBaseImpl. ChangeLogConsumerBaseImpl handles | |
* the mapping of change log event to methods, the processing loop, and exception handling. | |
*/ | |
public class PrintChangeLogConsumer extends ChangeLogConsumerBaseImpl { | |
private static final Logger LOG = LoggerFactory.getLogger(PrintChangeLogConsumer.class); | |
@Override | |
protected void addGroup(ChangeLogEntry changeLogEntry, String consumerName) { | |
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_ADD.name); | |
LOG.debug("{} add group {}.", consumerName, groupName); | |
// final edu.internet2.middleware.grouper.Group group = connector.fetchGrouperGroup(groupName); | |
} | |
@Override | |
protected void updateGroup(ChangeLogEntry changeLogEntry, String consumerName){ | |
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.name); | |
LOG.debug("{} update group {}.", consumerName, groupName); | |
} | |
@Override | |
protected void deleteGroup(ChangeLogEntry changeLogEntry, String consumerName){ | |
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_DELETE.name); | |
LOG.debug("{} delete group {}.", consumerName, groupName); | |
} | |
@Override | |
protected void addMembership(ChangeLogEntry changeLogEntry, String consumerName){ | |
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_ADD.groupName); | |
final String subjectId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_ADD.subjectId); | |
LOG.debug("{} add {} to group {}.", new Object[] {consumerName, subjectId, groupName}); | |
} | |
@Override | |
protected void deleteMembership(ChangeLogEntry changeLogEntry, String consumerName){ | |
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_DELETE.groupName); | |
final String subjectId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_DELETE.subjectId); | |
LOG.debug("{} remove {} from group {}.", new Object[] {consumerName, subjectId, groupName}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment