-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up synchronization-related code
This is a preparation for giant leaps in the area of resource configuration changes planned in weeks to come. 1. Separated shadow tag generation from the shadow classification (just to be precise in the use of terms). 2. Made further fields SynchronizationContext final. This makes the data flow during context loading much cleaner. 3. Migrate from the use of kind/intent to use of object type definition. This may be too brave, but hopefully reasonable. We don't want to deal with messy combinations of account/unknown and similar classifications. 4. ResourceObjectClassifierImpl is now stand-alone component, not using SynchronizationContext anymore. 5. Introduced lightweight ResourceObjectProcessingContext to be used throughout synchronization-related code. 6. Added model expression environment for tag generation. Work in progress. Some tests may fail.
- Loading branch information
Showing
34 changed files
with
1,167 additions
and
725 deletions.
There are no files selected for viewing
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
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
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
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
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
75 changes: 75 additions & 0 deletions
75
...-impl/src/main/java/com/evolveum/midpoint/model/impl/ResourceObjectProcessingContext.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (C) 2010-2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.model.impl; | ||
|
||
import com.evolveum.midpoint.model.api.correlator.CorrelationContext; | ||
import com.evolveum.midpoint.model.impl.sync.SynchronizationContext; | ||
import com.evolveum.midpoint.model.impl.util.ModelImplUtils; | ||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.prism.delta.ObjectDelta; | ||
import com.evolveum.midpoint.provisioning.api.ResourceObjectClassifier; | ||
import com.evolveum.midpoint.provisioning.api.ResourceObjectShadowChangeDescription; | ||
import com.evolveum.midpoint.schema.expression.VariablesMap; | ||
import com.evolveum.midpoint.task.api.Task; | ||
import com.evolveum.midpoint.util.annotation.Experimental; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* A context generally useful for the manipulation of a shadow - classification, correlation, synchronization. | ||
* | ||
* We use it to avoid repeating the contained data throughout various "context" classes | ||
* ({@link SynchronizationContext}, {@link CorrelationContext}, ...). | ||
*/ | ||
@Experimental | ||
public interface ResourceObjectProcessingContext { | ||
|
||
/** | ||
* Returns shadowed resource object, or - at least - so-called "combined object" in the sense | ||
* used in {@link ResourceObjectClassifier}. | ||
*/ | ||
@NotNull ShadowType getShadowedResourceObject(); | ||
|
||
@Nullable ObjectDelta<ShadowType> getResourceObjectDelta(); | ||
|
||
@NotNull ResourceType getResource(); | ||
|
||
default @NotNull PrismObject<ResourceType> getResourcePrismObject() { | ||
return getResource().asPrismObject(); | ||
} | ||
|
||
@Nullable SystemConfigurationType getSystemConfiguration(); | ||
|
||
/** | ||
* Returns the channel relevant to the current operation. | ||
* | ||
* It may be a channel from {@link ResourceObjectShadowChangeDescription} or from a task. | ||
*/ | ||
@Nullable String getChannel(); | ||
|
||
@NotNull Task getTask(); | ||
|
||
/** | ||
* Returns {@link VariablesMap} relevant for the current context. | ||
*/ | ||
default @NotNull VariablesMap createVariablesMap() { | ||
return createDefaultVariablesMap(); | ||
} | ||
|
||
/** To be used in implementations of {@link #createVariablesMap()}. */ | ||
default @NotNull VariablesMap createDefaultVariablesMap() { | ||
return ModelImplUtils.getDefaultVariablesMap(null, getShadowedResourceObject(), getResource(), getSystemConfiguration()); | ||
} | ||
|
||
/** Useful Spring beans. */ | ||
@NotNull ModelBeans getBeans(); | ||
} |
Oops, something went wrong.