Class ObjectListAttributeDefinition


  • public class ObjectListAttributeDefinition
    extends ListAttributeDefinition
    AttributeDefinition suitable for managing LISTs of OBJECTs, which takes into account recursive processing of allowed values and their value types.

    Date: 13.10.2011

    Author:
    James R. Perkins, Richard Achmatowicz (c) 2012 RedHat Inc., Tomaz Cerar
    • Method Detail

      • addResourceAttributeDescription

        public org.jboss.dmr.ModelNode addResourceAttributeDescription​(ResourceBundle bundle,
                                                                       String prefix,
                                                                       org.jboss.dmr.ModelNode resourceDescription)
        Description copied from class: AttributeDefinition
        Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource description model node. The node describing the attribute is returned to make it easy to perform further modification.
        Overrides:
        addResourceAttributeDescription in class ListAttributeDefinition
        Parameters:
        bundle - resource bundle to use for text descriptions
        prefix - prefix to prepend to the attribute name key when looking up descriptions
        resourceDescription - the overall resource description
        Returns:
        the attribute description node
      • addOperationParameterDescription

        public org.jboss.dmr.ModelNode addOperationParameterDescription​(ResourceBundle bundle,
                                                                        String prefix,
                                                                        org.jboss.dmr.ModelNode operationDescription)
        Description copied from class: AttributeDefinition
        Creates a returns a basic model node describing a parameter that sets this attribute, after attaching it to the given overall operation description model node. The node describing the parameter is returned to make it easy to perform further modification.
        Overrides:
        addOperationParameterDescription in class ListAttributeDefinition
        Parameters:
        bundle - resource bundle to use for text descriptions
        prefix - prefix to prepend to the attribute name key when looking up descriptions
        operationDescription - the overall resource description
        Returns:
        the attribute description node
      • addCapabilityRequirements

        public void addCapabilityRequirements​(OperationContext context,
                                              Resource resource,
                                              org.jboss.dmr.ModelNode attributeValue)
        Description copied from class: AttributeDefinition
        Based on the given attribute value, add capability requirements. If this definition is for an attribute whose value is or contains a reference to the name of some capability, this method should record the addition of a requirement for the capability.

        This is a no-op in this base class. Subclasses that support attribute types that can represent capability references should override this method.

        Overrides:
        addCapabilityRequirements in class AttributeDefinition
        Parameters:
        context - the operation context
        resource - the resource on which requirements are gathered
        attributeValue - the value of the attribute described by this object
      • removeCapabilityRequirements

        public void removeCapabilityRequirements​(OperationContext context,
                                                 Resource resource,
                                                 org.jboss.dmr.ModelNode attributeValue)
        Description copied from class: AttributeDefinition
        Based on the given attribute value, remove capability requirements. If this definition is for an attribute whose value is or contains a reference to the name of some capability, this method should record the removal of a requirement for the capability.

        This is a no-op in this base class. Subclasses that support attribute types that can represent capability references should override this method.

        Overrides:
        removeCapabilityRequirements in class AttributeDefinition
        Parameters:
        context - the operation context
        resource - resource from which capability requirement is to be removed from, null is legal value in case that CapabilityReferenceRecorder doesn't require it.
        attributeValue - the value of the attribute described by this object
      • marshallAsElement

        public void marshallAsElement​(org.jboss.dmr.ModelNode resourceModel,
                                      boolean marshalDefault,
                                      XMLStreamWriter writer)
                               throws XMLStreamException
        Description copied from class: AttributeDefinition
        Marshalls the value from the given resourceModel as an xml element, if it is marshallable.
        Overrides:
        marshallAsElement in class ListAttributeDefinition
        Parameters:
        resourceModel - the model, a non-null node of ModelType.OBJECT.
        marshalDefault - true if the value should be marshalled even if it matches the default value
        writer - stream writer to use for writing the attribute
        Throws:
        XMLStreamException - if thrown by writer
      • resolveValue

        public org.jboss.dmr.ModelNode resolveValue​(ExpressionResolver resolver,
                                                    org.jboss.dmr.ModelNode value)
                                             throws OperationFailedException
        Overrides the superclass implementation to allow the value type's AttributeDefinition to in turn resolve each element. Takes the given value, resolves it using the given resolver and validates it using this attribute's validator. If the value is undefined and a default value is available, the default value is used.
        Overrides:
        resolveValue in class AttributeDefinition
        Parameters:
        resolver - the expression resolver
        value - a node that is expected to be a valid value for an attribute defined by this definition
        Returns:
        the resolved value, possibly the default value if value is not defined
        Throws:
        OperationFailedException - if the value is not valid
      • convertParameterElementExpressions

        protected org.jboss.dmr.ModelNode convertParameterElementExpressions​(org.jboss.dmr.ModelNode parameterElement)
        Uses the ObjectTypeAttributeDefinition passed to the constructor to convert the element's expressions. Examine the given element of a parameter list for any expression syntax, converting the relevant node to ModelType.EXPRESSION if such is supported. This implementation will only convert elements of ModelType.STRING. Subclasses that need to handle complex elements should override this method.
        Overrides:
        convertParameterElementExpressions in class ListAttributeDefinition
        Parameters:
        parameterElement - the node to examine. Will not be null
        Returns:
        the parameter element with expressions converted, or the original parameter if no conversion was performed Cannot return null
      • addAllowedValuesToDescription

        protected void addAllowedValuesToDescription​(org.jboss.dmr.ModelNode result,
                                                     ParameterValidator validator)
        Description copied from class: AttributeDefinition
        Adds the allowed values. Override for attributes who should not use the allowed values.
        Overrides:
        addAllowedValuesToDescription in class AttributeDefinition
        Parameters:
        result - the node to add the allowed values to
        validator - the validator to get the allowed values from