public abstract class Provisioner<ConfigurationClass extends ProvisionerConfiguration,TSUserClass extends TargetSystemUser,TSGroupClass extends TargetSystemGroup> extends Object
| Modifier and Type | Field and Description |
|---|---|
static ThreadLocal<Provisioner> |
activeProvisioner |
protected ConfigurationClass |
config |
protected boolean |
fullSyncMode
Should this provisioner operate in Full-Sync mode? This might mean fetching all members of a group
which can be expensive in an incremental-sync, but is worth the trouble in a full-sync.
|
protected org.slf4j.Logger |
LOG |
String |
provisionerConfigName |
String |
provisionerDisplayName |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
addMembership(GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup,
Subject subject,
TSUserClass tsUser)
Action method that handles membership additions where a person-subject is added to a
group.
|
Set<GrouperGroupInfo> |
allGroupsForProvisionerFromCache(String provisionerName) |
static void |
allGroupsForProvisionerFromCacheClear(String provisionerName) |
protected void |
cacheGroup(GrouperGroupInfo grouperGroupInfo,
TSGroupClass newTSGroup)
Store Group-->TSGroupClass mapping in long-term and short-term caches
|
static void |
checkAttributeDefinitions()
This creates any attributes missing within the etc:pspng: folder.
|
protected abstract TSGroupClass |
createGroup(GrouperGroupInfo grouperGroup,
Collection<Subject> initialMembers)
Provisioning a new Group in the target system.
|
protected TSUserClass |
createUser(Subject personSubject)
Provisioning a new User account in the target system.
|
protected abstract void |
deleteGroup(GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup)
Action method that handles group removal.
|
protected abstract void |
deleteMembership(GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup,
Subject subject,
TSUserClass tsUser)
Abstract action method that handles membership removals.
|
protected abstract void |
doFullSync_cleanupExtraGroups(JobStatistics stats)
This method's responsibility is find extra groups within Grouper's responsibility that
exist in the target system.
|
protected abstract boolean |
doFullSync(GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup,
Set<Subject> correctSubjects,
Map<Subject,TSUserClass> tsUserMap,
Set<TSUserClass> correctTSUsers,
JobStatistics stats)
This method's responsibility is to make sure that group's only provisioned memberships are those
of correctSubjects.
|
protected String |
evaluateJexlExpression(String expressionName,
String expression,
Subject subject,
TSUserClass tsUser,
GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup,
Object... keysAndValues)
Make a JexlMap that contains subject and group information and evaluate the given
expression.
|
protected TSGroupClass |
fetchTargetSystemGroup(GrouperGroupInfo grouperGroup)
Lookup a single TSGroupClass for a single (grouper) Group.
|
protected abstract Map<GrouperGroupInfo,TSGroupClass> |
fetchTargetSystemGroups(Collection<GrouperGroupInfo> grouperGroups)
This fetches group information from the target system.
|
Map<GrouperGroupInfo,TSGroupClass> |
fetchTargetSystemGroupsInBatches(Collection<GrouperGroupInfo> groupsToFetch)
This method fetches an arbitrary number of groups from the target system.
|
protected TSUserClass |
fetchTargetSystemUser(Subject personSubject)
Lookup a single TSUserClass for a single Subject.
|
protected abstract Map<Subject,TSUserClass> |
fetchTargetSystemUsers(Collection<Subject> personSubjects)
This fetches user information from the target system.
|
List<ProvisioningWorkItem> |
filterWorkItems(List<ProvisioningWorkItem> workItems)
This method returns the work items that are supposed to be provisioned
by calling shouldGroupBeProvisioned on each group mentioned
by a workItem.
|
List<ProvisioningWorkItem> |
filterWorkItems2(List<ProvisioningWorkItem> workItems)
This method returns the work items that are supposed to be provisioned
by calling shouldGroupBeProvisioned on each group mentioned
by a workItem.
|
void |
finishCoordination(List<ProvisioningWorkItem> workItems,
boolean wasSuccessful)
Provisioning is over.
|
void |
finishProvisioningBatch(List<ProvisioningWorkItem> workItems) |
protected void |
flushCachesIfNecessary(List<ProvisioningWorkItem> allWorkItems)
Look at the batch of workItems and flush caches necessary to process the entries
properly.
|
Set<GrouperGroupInfo> |
getAllGroupsForProvisioner()
This method looks for groups that are marked for provisioning as determined by
the GroupSelectionExpression.
|
Set<GrouperGroupInfo> |
getAllGroupsForProvisioner2()
This method looks for groups that are marked for provisioning as determined by
the GroupSelectionExpression.
|
ConfigurationClass |
getConfig() |
String |
getConfigName() |
ProvisioningWorkItem |
getCurrentWorkItem()
Get the ProvisioningWorkItem that this provisioner is currently processing
|
String |
getDisplayName() |
protected GrouperGroupInfo |
getGroupInfo(ProvisioningWorkItem workItem) |
protected GrouperGroupInfo |
getGroupInfoOfExistingGroup(Group group) |
protected GrouperGroupInfo |
getGroupInfoOfExistingGroup(String groupName) |
protected Map<String,Object> |
getGroupJexlMap(String expression,
GrouperGroupInfo grouperGroupInfo) |
JobStatistics |
getJobStatistics()
job stats for real time
|
static Class<? extends ProvisionerConfiguration> |
getPropertyClass()
This returns the configuration class needed by provisioners of this class.
|
protected Subject |
getSubject(String subjectId,
String sourceId) |
protected static String |
getSubjectCacheKey(String subjectId,
String sourceId) |
protected static String |
getSubjectCacheKey(Subject subject) |
TSUserClass |
getTargetSystemUser(Subject subject) |
static edu.internet2.middleware.grouperClient.util.ExpirableCache<String,edu.internet2.middleware.grouperClient.collections.MultiKey> |
groupNameToMillisAndProvisionable(String provisionerConfigId) |
boolean |
isFullSyncMode() |
protected void |
populateJexlMap(String expression,
Map<String,Object> variableMap,
Subject subject,
TSUserClass tsUser,
GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup)
Overridable method to put group and subject information into the Jexl map
for use during evaluation.
|
void |
provisionBatchOfItems(List<ProvisioningWorkItem> allWorkItems) |
protected void |
provisionItem(ProvisioningWorkItem workItem)
Dispatches an event to the right method, with generally
useful parameters.
|
void |
setCurrentWorkItem(ProvisioningWorkItem item) |
void |
setJobStatistics(JobStatistics jobStatistics)
job stats for real time
|
protected boolean |
shouldGroupBeProvisioned(GrouperGroupInfo grouperGroupInfo)
Evaluate the GroupSelectionExpression to see if group should be processed by this
provisioner.
|
protected boolean |
shouldGroupBeProvisionedConsiderCache(GrouperGroupInfo grouperGroupInfo)
Evaluate the GroupSelectionExpression to see if group should be processed by this
provisioner.
|
protected boolean |
shouldLogAboutMissingSubjects(Collection<Subject> subjectsToFetch,
Collection<?> subjectsInfoFound)
Were enough subjects missing from target system that we should log more information than normal
to help track down why they were missing?
Subclasses should use this in fetchTargetSystemUsers()
|
protected boolean |
shouldWorkItemBeProcessed(ProvisioningWorkItem workItem)
Used to filter workItems.
|
void |
startCoordination(List<ProvisioningWorkItem> workItems)
Lock the groups that we are about to process.
|
void |
startProvisioningBatch(List<ProvisioningWorkItem> workItems)
Get ready for a provisioning batch.
|
String |
toString() |
protected void |
uncacheAllGroups()
This removes all Group information from our caches
|
protected void |
uncacheGroup(GrouperGroupInfo grouperGroupInfo,
TSGroupClass tsGroup)
The specified Grouper or TargetSystem group has changed, remove
them from various caches, including hibernate L2 cache.
|
protected void |
warnAboutCacheSizeConcerns() |
boolean |
workItemMightChangeGroupSelection(ProvisioningWorkItem workItem)
Some changes (eg, labeling a folder for syncing) can have a large effect and are best handled with
a complete sync of all groups.
|
protected final org.slf4j.Logger LOG
public final String provisionerDisplayName
public final String provisionerConfigName
protected final boolean fullSyncMode
protected final ConfigurationClass extends ProvisionerConfiguration config
public static final ThreadLocal<Provisioner> activeProvisioner
public JobStatistics getJobStatistics()
public void setJobStatistics(JobStatistics jobStatistics)
jobStatistics - public static void checkAttributeDefinitions()
protected abstract void addMembership(GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup, Subject subject, TSUserClass tsUser) throws PspException
grouperGroupInfo - The group to which the subject needs to be added as a membertsGroup - A TSGroupClass created for group by fetchTargetSystemGroup. This will
be null for systems that do not need target system groups.subject - The (person) subject that needs to be provisioned as a member of 'group'tsUser - A TSUserClass created for the subject by fetchTargetSystemUser. This will
be null for systems that do not need target system users.PspExceptionprotected abstract void deleteMembership(GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup, Subject subject, TSUserClass tsUser) throws PspException
grouperGroupInfo - The group to which the subject needs to be removed as a membertsGroup - TSGroupClass for the 'group.' This is null for systems that do not need
target-system group infosubject - The subject that needs to be deprovisioned as a member of 'group'tsUser - TSUserClass for the 'subject.' This is null for systems that do not need
target-system user infoPspExceptionprotected abstract TSGroupClass createGroup(GrouperGroupInfo grouperGroup, Collection<Subject> initialMembers) throws PspException
grouperGroup - initialMembers - What members should in the provisioned group once the method completes.
This is generally empty during incremental/changelog-based provisioning, but may list users
at other times.PspExceptionprotected abstract void deleteGroup(GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup) throws PspException
grouperGroupInfo - tsGroup - PspExceptionprotected abstract boolean doFullSync(GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup, Set<Subject> correctSubjects, Map<Subject,TSUserClass> tsUserMap, Set<TSUserClass> correctTSUsers, JobStatistics stats) throws PspException
grouperGroupInfo - Grouper group to fully synchronize with target systemtsGroup - TSGroupClass that maps to group.correctSubjects - What subjects are members in the Grouper RegistrytsUserMap - Map of TargetSystemUsers which map to the correctSubjects. This will be empty
for provisioners that do not use TargetSystemUsers.correctTSUsers - A list of the TSUsers that correspond to correctSubjects. This might be a subset
of the TSUsers in the tsUserMap.stats - A holder of the number of changes the fullSync performsPspExceptionprotected abstract void doFullSync_cleanupExtraGroups(JobStatistics stats) throws PspException
PspExceptionprotected abstract Map<GrouperGroupInfo,TSGroupClass> fetchTargetSystemGroups(Collection<GrouperGroupInfo> grouperGroups) throws PspException
grouperGroups - PspExceptionprotected abstract Map<Subject,TSUserClass> fetchTargetSystemUsers(Collection<Subject> personSubjects) throws PspException
personSubjects - PspExceptionpublic static edu.internet2.middleware.grouperClient.util.ExpirableCache<String,edu.internet2.middleware.grouperClient.collections.MultiKey> groupNameToMillisAndProvisionable(String provisionerConfigId)
public List<ProvisioningWorkItem> filterWorkItems2(List<ProvisioningWorkItem> workItems) throws PspException
workItems - WorkItems read from the triggering source (Changelog or messaging).
This will include both events that affect groups and those that do not. Generally, we
pass on non-group changes in case a provisioner wants to process them.PspExceptionpublic List<ProvisioningWorkItem> filterWorkItems(List<ProvisioningWorkItem> workItems) throws PspException
workItems - WorkItems read from the triggering source (Changelog or messaging).
This will include both events that affect groups and those that do not. Generally, we
pass on non-group changes in case a provisioner wants to process them.PspExceptionprotected boolean shouldWorkItemBeProcessed(ProvisioningWorkItem workItem)
workItem - public void startCoordination(List<ProvisioningWorkItem> workItems)
workItems - public void finishCoordination(List<ProvisioningWorkItem> workItems, boolean wasSuccessful)
workItems - wasSuccessful - public void startProvisioningBatch(List<ProvisioningWorkItem> workItems) throws PspException
workItems - PspExceptionprotected void warnAboutCacheSizeConcerns()
public void finishProvisioningBatch(List<ProvisioningWorkItem> workItems) throws PspException
PspExceptionprotected final String evaluateJexlExpression(String expressionName, String expression, Subject subject, TSUserClass tsUser, GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup, Object... keysAndValues) throws PspException
expressionName - expression - subject - tsUser - grouperGroupInfo - tsGroup - keysAndValues - Key/Value pairs that will also be available within the Jexl's variable mapPspExceptionprotected void populateJexlMap(String expression, Map<String,Object> variableMap, Subject subject, TSUserClass tsUser, GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup)
variableMap - Map that will eventually be provided in Jexl evalutionssubject - tsUser - grouperGroupInfo - tsGroup - public Map<GrouperGroupInfo,TSGroupClass> fetchTargetSystemGroupsInBatches(Collection<GrouperGroupInfo> groupsToFetch) throws PspException
groupsToFetch - PspExceptionpublic TSUserClass getTargetSystemUser(Subject subject) throws PspException
PspExceptionprotected void cacheGroup(GrouperGroupInfo grouperGroupInfo, TSGroupClass newTSGroup)
grouperGroupInfo - newTSGroup - protected void uncacheGroup(GrouperGroupInfo grouperGroupInfo, TSGroupClass tsGroup)
grouperGroupInfo - tsGroup - protected void uncacheAllGroups()
protected final TSUserClass fetchTargetSystemUser(Subject personSubject) throws PspException
personSubject - PspExceptionprotected final TSGroupClass fetchTargetSystemGroup(GrouperGroupInfo grouperGroup) throws PspException
grouperGroup - PspExceptionprotected TSUserClass createUser(Subject personSubject) throws PspException
personSubject - PspExceptionprotected void provisionItem(ProvisioningWorkItem workItem) throws PspException
workItem - PspExceptionpublic ProvisioningWorkItem getCurrentWorkItem()
public void setCurrentWorkItem(ProvisioningWorkItem item)
protected GrouperGroupInfo getGroupInfoOfExistingGroup(Group group)
protected GrouperGroupInfo getGroupInfoOfExistingGroup(String groupName)
protected GrouperGroupInfo getGroupInfo(ProvisioningWorkItem workItem)
public Set<GrouperGroupInfo> getAllGroupsForProvisioner2()
public static void allGroupsForProvisionerFromCacheClear(String provisionerName)
public Set<GrouperGroupInfo> allGroupsForProvisionerFromCache(String provisionerName)
public Set<GrouperGroupInfo> getAllGroupsForProvisioner()
public ConfigurationClass getConfig()
public static Class<? extends ProvisionerConfiguration> getPropertyClass()
protected Map<String,Object> getGroupJexlMap(String expression, GrouperGroupInfo grouperGroupInfo)
protected boolean shouldGroupBeProvisionedConsiderCache(GrouperGroupInfo grouperGroupInfo)
grouperGroupInfo - protected boolean shouldGroupBeProvisioned(GrouperGroupInfo grouperGroupInfo)
grouperGroupInfo - public String getDisplayName()
public String getConfigName()
public void provisionBatchOfItems(List<ProvisioningWorkItem> allWorkItems)
protected void flushCachesIfNecessary(List<ProvisioningWorkItem> allWorkItems) throws PspException
allWorkItems - PspExceptionpublic boolean isFullSyncMode()
public boolean workItemMightChangeGroupSelection(ProvisioningWorkItem workItem)
protected boolean shouldLogAboutMissingSubjects(Collection<Subject> subjectsToFetch, Collection<?> subjectsInfoFound)
subjectsToFetch - subjectsInfoFound - Copyright © 2022 Internet2. All rights reserved.