Class DiscardAttributesTransformer

java.lang.Object
org.jboss.as.controller.transform.DiscardAttributesTransformer
All Implemented Interfaces:
OperationTransformer, ResourceTransformer

public abstract class DiscardAttributesTransformer extends Object implements OperationTransformer, ResourceTransformer
Discards attributes silently. This class should ONLY be used if you are 100% sure a new attribute can be discarded, even if set. Provide a DiscardAttributesTransformer.DiscardApprover to the constructor to provide specific logic for making the determination as to whether the transformation should be done. It is made abstract to make you think about using it.

Normally, you would want to use DiscardUndefinedAttributesTransformer instead.

A typical use case for this transformer would be in combination with DiscardUndefinedAttributesTransformer. First this transformer would run, with a DiscardAttributesTransformer.DiscardApprover checking the state of the model or operation to decide whether removing attributes is valid. The discard approver would only approve the removal if the value of the model or operation parameters is such that the servers launched by a slave Host Controller running the legacy version and unaware of the removed attributes would function consistently with newer version servers who saw the attributes. This transformer would remove the attributes in that case, and leave them otherwise. Then the DiscardUndefinedAttributesTransformer would run and would log a warning or fail operations if any of the attributes were left. So this transformer cleans if possible, and DiscardUndefinedAttributesTransformer deals with any problems left after cleaning.

Author:
Kabir Khan