Class DiscardAttributesTransformer.AttributeValueDiscardApprover
- java.lang.Object
-
- org.jboss.as.controller.transform.DiscardAttributesTransformer.AttributeValueDiscardApprover
-
- All Implemented Interfaces:
DiscardAttributesTransformer.DiscardApprover
- Enclosing class:
- DiscardAttributesTransformer
public static class DiscardAttributesTransformer.AttributeValueDiscardApprover extends Object implements DiscardAttributesTransformer.DiscardApprover
ADiscardApprover
that checks the value of a provided attribute in order to decide whether transformation is allowed. If the attribute has the desired value (or is undefined if allowing that is configured) then the transformation is allowed.This approver can only be used for
add
,write-attribute
andundefine-attribute
operation transformation as well as resource transformation.
-
-
Constructor Summary
Constructors Constructor Description AttributeValueDiscardApprover(String attributeName, org.jboss.dmr.ModelNode approvedValue, boolean allowUndefined)
Creates a new transformer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isOperationDiscardAllowed(TransformationContext context, PathAddress address, org.jboss.dmr.ModelNode operation)
Checks if the value of the resource after the operation is applied would meet the criteria.boolean
isResourceDiscardAllowed(TransformationContext context, PathAddress address, Resource resource)
Replies with whether resource transformation should be done.
-
-
-
Constructor Detail
-
AttributeValueDiscardApprover
public AttributeValueDiscardApprover(String attributeName, org.jboss.dmr.ModelNode approvedValue, boolean allowUndefined)
Creates a new transformer.- Parameters:
attributeName
- the name of the attribute to checkapprovedValue
- the value the attribute must have in order to allow transformationallowUndefined
-true
if the attribute can also be undefined
-
-
Method Detail
-
isResourceDiscardAllowed
public boolean isResourceDiscardAllowed(TransformationContext context, PathAddress address, Resource resource)
Description copied from interface:DiscardAttributesTransformer.DiscardApprover
Replies with whether resource transformation should be done.- Specified by:
isResourceDiscardAllowed
in interfaceDiscardAttributesTransformer.DiscardApprover
- Parameters:
context
- the contextaddress
- the address of the resource to transformresource
- the resource- Returns:
true
if transformation should be done;false
if the resource should be left as is
-
isOperationDiscardAllowed
public boolean isOperationDiscardAllowed(TransformationContext context, PathAddress address, org.jboss.dmr.ModelNode operation)
Checks if the value of the resource after the operation is applied would meet the criteria. Can only be used foradd
,write-attribute
andundefine-attribute
operation transformation. Replies with whether operation transformation should be done.- Specified by:
isOperationDiscardAllowed
in interfaceDiscardAttributesTransformer.DiscardApprover
- Parameters:
context
- the contextaddress
- the address of the resource to transformoperation
- the operation- Returns:
true
if transformation should be done;false
if the operation should be left as is- Throws:
IllegalStateException
- if the operation name isn'tadd
,write-attribute
orundefine-attribute
-
-