Class DefaultCheckersAndConverter

All Implemented Interfaces:
AttributeConverter, DiscardAttributeChecker, RejectAttributeChecker

public abstract class DefaultCheckersAndConverter extends DiscardAttributeChecker.DefaultDiscardAttributeChecker implements RejectAttributeChecker, AttributeConverter
Author:
Kabir Khan
  • Constructor Details

    • DefaultCheckersAndConverter

      protected DefaultCheckersAndConverter(boolean discardExpressions, boolean discardUndefined)
      Constructor
      Parameters:
      discardExpressions - true if the attribute should be discarded if expressions are used
      discardUndefined - true if the attribute should be discarded if expressions are used
    • DefaultCheckersAndConverter

      public DefaultCheckersAndConverter()
      Constructor. Sets it up with discardExpressions==false and discardUndefined==true
  • Method Details

    • convertOperationParameter

      public void convertOperationParameter(PathAddress address, String attributeName, org.jboss.dmr.ModelNode attributeValue, org.jboss.dmr.ModelNode operation, TransformationContext context)
      Converts an operation parameter
      Specified by:
      convertOperationParameter in interface AttributeConverter
      Parameters:
      address - the address of the operation
      attributeName - the name of the operation parameter
      attributeValue - the value of the operation parameter to be converted
      operation - the operation executed. This is unmodifiable.
      context - the context of the transformation
    • convertResourceAttribute

      public void convertResourceAttribute(PathAddress address, String attributeName, org.jboss.dmr.ModelNode attributeValue, TransformationContext context)
      Converts a resource attribute
      Specified by:
      convertResourceAttribute in interface AttributeConverter
      Parameters:
      address - the address of the operation
      attributeName - the name of the attribute
      attributeValue - the value of the attribute to be converted
      context - the context of the transformation
    • rejectOperationParameter

      public boolean rejectOperationParameter(PathAddress address, String attributeName, org.jboss.dmr.ModelNode attributeValue, org.jboss.dmr.ModelNode operation, TransformationContext context)
      Determines whether the given operation parameter value is not understandable by the target process and needs to be rejected.
      Specified by:
      rejectOperationParameter in interface RejectAttributeChecker
      Parameters:
      address - the address of the operation
      attributeName - the name of the attribute
      attributeValue - the value of the attribute
      operation - the operation executed. This is unmodifiable.
      context - the context of the transformation
      Returns:
      true if the parameter value is not understandable by the target process and so needs to be rejected, false otherwise.
    • rejectResourceAttribute

      public boolean rejectResourceAttribute(PathAddress address, String attributeName, org.jboss.dmr.ModelNode attributeValue, TransformationContext context)
      Gets whether the given resource attribute value is not understandable by the target process and needs to be rejected.
      Specified by:
      rejectResourceAttribute in interface RejectAttributeChecker
      Parameters:
      address - the address of the resource
      attributeName - the name of the attribute
      attributeValue - the value of the attribute
      context - the context of the transformation
      Returns:
      true if the attribute value is not understandable by the target process and so needs to be rejected, false otherwise.
    • getRejectionLogMessageId

      public String getRejectionLogMessageId()
      Returns the log message id used by this checker. This is used to group it so that all attributes failing a type of rejction end up in the same error message. This default implementation uses the formatted log message with an empty attribute map as the id.
      Specified by:
      getRejectionLogMessageId in interface RejectAttributeChecker
      Returns:
      the log message id
    • checkForExpression

      protected boolean checkForExpression(org.jboss.dmr.ModelNode node)
    • rejectAttribute

      protected abstract boolean rejectAttribute(PathAddress address, String attributeName, org.jboss.dmr.ModelNode attributeValue, TransformationContext context)
      Gets called by the default implementations of #rejectOperationParameter(String, ModelNode, ModelNode, TransformationContext) and #rejectResourceAttribute(String, ModelNode, TransformationContext).
      Parameters:
      address - the address of the operation
      attributeName - the name of the attribute
      attributeValue - the value of the attribute
      context - the context of the transformation
      Returns:
      true if the attribute or parameter value is not understandable by the target process and so needs to be rejected, false otherwise.
    • convertAttribute

      protected abstract void convertAttribute(PathAddress address, String attributeName, org.jboss.dmr.ModelNode attributeValue, TransformationContext context)
      Parameters:
      address - the address of the operation or resource
      attributeName - the name of the attribute
      attributeValue - the value of the attribute
      context - the context of the transformation