-
-
Notifications
You must be signed in to change notification settings - Fork 478
WFCORE-6995 Allow stability-specific resource transformations for mixed domains #6214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| import java.util.Set; | ||
|
|
||
| import org.jboss.as.controller.AttributeDefinition; | ||
| import org.jboss.as.version.Stability; | ||
|
|
||
| /** | ||
| * @author <a href="kabir.khan@jboss.com">Kabir Khan</a> | ||
|
|
@@ -29,74 +30,72 @@ abstract class AttributeTransformationDescriptionBuilderImpl<T extends BaseAttri | |
| } | ||
|
|
||
| @Override | ||
| public ResourceTransformationDescriptionBuilder end() { | ||
| return builder; | ||
| public Stability getStability() { | ||
| return this.builder.getStability(); | ||
| } | ||
|
|
||
| @Override | ||
| public T setDiscard(DiscardAttributeChecker discardChecker, AttributeDefinition...discardedAttributes) { | ||
| AttributeDefinition[] useDefs = discardedAttributes; | ||
| for (AttributeDefinition attribute : useDefs) { | ||
| String attrName = getAttributeName(attribute); | ||
| registry.setDiscardedAttribute(discardChecker, attrName); | ||
| } | ||
| return thisBuilder(); | ||
| public ResourceTransformationDescriptionBuilder end() { | ||
| return builder; | ||
| } | ||
|
|
||
| @Override | ||
| public T setDiscard(DiscardAttributeChecker discardChecker, Collection<AttributeDefinition> discardedAttributes) { | ||
| for (AttributeDefinition attribute : discardedAttributes) { | ||
| String attrName = getAttributeName(attribute); | ||
| registry.setDiscardedAttribute(discardChecker, attrName); | ||
| for (AttributeDefinition discardedAttribute : discardedAttributes) { | ||
| if (this.enables(discardedAttribute)) { | ||
| this.registry.setDiscardedAttribute(discardChecker, discardedAttribute.getName()); | ||
| } | ||
| } | ||
| return thisBuilder(); | ||
| return this.thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T setDiscard(DiscardAttributeChecker discardChecker, String... discardedAttributes) { | ||
| String[] useDefs = discardedAttributes; | ||
| for (String attrName : useDefs) { | ||
| registry.setDiscardedAttribute(discardChecker, attrName); | ||
| for (String discardedAttribute : discardedAttributes) { | ||
| this.registry.setDiscardedAttribute(discardChecker, discardedAttribute); | ||
| } | ||
| return thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T addRejectCheck(final RejectAttributeChecker checker, final AttributeDefinition...rejectedAttributes){ | ||
| for (AttributeDefinition attribute : rejectedAttributes) { | ||
| String attrName = getAttributeName(attribute); | ||
| registry.addAttributeCheck(attrName, checker); | ||
| public T addRejectCheck(final RejectAttributeChecker checker, final AttributeDefinition... rejectedAttributes){ | ||
| for (AttributeDefinition rejectedAttribute : rejectedAttributes) { | ||
| if (this.enables(rejectedAttribute)) { | ||
| this.registry.addAttributeCheck(rejectedAttribute.getName(), checker); | ||
| } | ||
| } | ||
| return thisBuilder(); | ||
| return this.thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T addRejectCheck(RejectAttributeChecker rejectChecker, String... rejectedAttributes) { | ||
| for (String attribute : rejectedAttributes) { | ||
| registry.addAttributeCheck(attribute, rejectChecker); | ||
| for (String rejectedAttribute : rejectedAttributes) { | ||
| this.registry.addAttributeCheck(rejectedAttribute, rejectChecker); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this method be deprecated? Just reading the diff it seems like it's unable to apply the desired 'enables' check so it's just assuming. Which is ok temporarily but perhaps should be deprecated. It seems like the javadoc in the interface should explain the behavior re the 'enables' call for all the methods.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #6589 adds the deprecation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for that - I'll rebase this branch on that change next week. |
||
| return thisBuilder(); | ||
| return this.thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T addRejectChecks(List<RejectAttributeChecker> rejectCheckers, AttributeDefinition...rejectedAttributes) { | ||
| for (RejectAttributeChecker rejectChecker : rejectCheckers) { | ||
| addRejectCheck(rejectChecker, rejectedAttributes); | ||
| this.addRejectCheck(rejectChecker, rejectedAttributes); | ||
| } | ||
| return thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T addRejectChecks(List<RejectAttributeChecker> rejectCheckers, String... rejectedAttributes) { | ||
| for (RejectAttributeChecker rejectChecker : rejectCheckers) { | ||
| addRejectCheck(rejectChecker, rejectedAttributes); | ||
| this.addRejectCheck(rejectChecker, rejectedAttributes); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment re deprecation.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #6589 adds the deprecation. |
||
| } | ||
| return thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T addRename(AttributeDefinition attributeName, String newName) { | ||
| registry.addRenamedAttribute(getAttributeName(attributeName), newName); | ||
| public T addRename(AttributeDefinition attribute, String newName) { | ||
| if (this.enables(attribute)) { | ||
| this.addRename(attribute.getName(), newName); | ||
| } | ||
| return thisBuilder(); | ||
| } | ||
|
|
||
|
|
@@ -106,19 +105,21 @@ public T addRename(String attributeName, String newName) { | |
| return thisBuilder(); | ||
| } | ||
|
|
||
| @Override | ||
| public T addRenames(Map<String, String> renames) { | ||
| for (Map.Entry<String, String> rename : renames.entrySet()) { | ||
| registry.addRenamedAttribute(rename.getKey(), rename.getValue()); | ||
| this.addRename(rename.getKey(), rename.getValue()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment re deprecation.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #6589 adds the deprecation. |
||
| } | ||
| return thisBuilder(); | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public T setValueConverter(AttributeConverter attributeConverter, AttributeDefinition...convertedAttributes) { | ||
| for (AttributeDefinition attribute : convertedAttributes) { | ||
| String attrName = getAttributeName(attribute); | ||
| registry.addAttributeConverter(attrName, attributeConverter); | ||
| for (AttributeDefinition convertedAttribute : convertedAttributes) { | ||
| if (this.enables(convertedAttribute)) { | ||
| this.registry.addAttributeConverter(convertedAttribute.getName(), attributeConverter); | ||
| } | ||
| } | ||
| return thisBuilder(); | ||
| } | ||
|
|
@@ -131,10 +132,6 @@ public T setValueConverter(AttributeConverter attributeConverter, String... conv | |
| return thisBuilder(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment re deprecation.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #6589 adds the deprecation. |
||
| } | ||
|
|
||
| protected String getAttributeName(AttributeDefinition attr) { | ||
| return attr.getName(); | ||
| } | ||
|
|
||
| protected AttributeTransformationDescriptionBuilderRegistry getLocalRegistry() { | ||
| return registry; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens with the current usage of this method in our code? Shouldn't we at least force the creation of a transformer registry using a specific Stability level? Otherwise, we will continue using the wrong registry and we won't be able yet to add specific transformations to the subsystems.