Package org.jboss.as.controller
Class ObjectListAttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- org.jboss.as.controller.ListAttributeDefinition
-
- org.jboss.as.controller.ObjectListAttributeDefinition
-
- All Implemented Interfaces:
Feature
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObjectListAttributeDefinition.Builder-
Nested classes/interfaces inherited from class org.jboss.as.controller.AttributeDefinition
AttributeDefinition.NameAndGroup
-
-
Field Summary
-
Fields inherited from class org.jboss.as.controller.AttributeDefinition
COMPLEX_TYPES
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAllowedValuesToDescription(org.jboss.dmr.ModelNode result, ParameterValidator validator)Adds the allowed values.protected voidaddAttributeValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)voidaddCapabilityRequirements(OperationContext context, Resource resource, org.jboss.dmr.ModelNode attributeValue)Based on the given attribute value, add capability requirements.org.jboss.dmr.ModelNodeaddOperationParameterDescription(ResourceBundle bundle, String prefix, org.jboss.dmr.ModelNode operationDescription)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.protected voidaddOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)org.jboss.dmr.ModelNodeaddResourceAttributeDescription(ResourceBundle bundle, String prefix, org.jboss.dmr.ModelNode resourceDescription)Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource description model node.protected voidaddValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, boolean forOperation, ResourceDescriptionResolver resolver, Locale locale)protected voidaddValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)protected org.jboss.dmr.ModelNodeconvertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElement)Uses theObjectTypeAttributeDefinitionpassed to the constructor toconvert the element's expressions.AttributeDefinitiongetValueAttributeDefinition()Returns an AttributeDefinition describing the content of the list.ObjectTypeAttributeDefinitiongetValueType()voidmarshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshalDefault, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml element, if itis marshallable.voidremoveCapabilityRequirements(OperationContext context, Resource resource, org.jboss.dmr.ModelNode attributeValue)Based on the given attribute value, remove capability requirements.org.jboss.dmr.ModelNoderesolveValue(ExpressionResolver resolver, org.jboss.dmr.ModelNode value)Overrides the superclass implementation to allow the value type's AttributeDefinition to in turn resolve each element.-
Methods inherited from class org.jboss.as.controller.ListAttributeDefinition
addOperationParameterDescription, addOperationReplyDescription, addOperationReplyValueTypeDescription, addResourceAttributeDescription, convertParameterExpressions, getElementValidator, parseAndAddParameterElement
-
Methods inherited from class org.jboss.as.controller.AttributeDefinition
addAccessConstraints, addDeprecatedInfo, addOperationReplyDescription, convertStringExpression, correctValue, getAccessConstraints, getAllowedValues, getAlternatives, getArbitraryDescriptors, getAttributeDeprecatedDescription, getAttributeGroup, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMarshaller, getMeasurementUnit, getName, getNoTextDescription, getParser, getReferenceRecorder, getRequires, getStability, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, marshallAsElement, resolveModelAttribute, resolveModelAttribute, resolveValue, validateAndSet, validateOperation
-
-
-
-
Method Detail
-
addResourceAttributeDescription
public org.jboss.dmr.ModelNode addResourceAttributeDescription(ResourceBundle bundle, String prefix, org.jboss.dmr.ModelNode resourceDescription)
Description copied from class:AttributeDefinitionCreates 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:
addResourceAttributeDescriptionin classListAttributeDefinition- Parameters:
bundle- resource bundle to use for text descriptionsprefix- prefix to prepend to the attribute name key when looking up descriptionsresourceDescription- 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:AttributeDefinitionCreates 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:
addOperationParameterDescriptionin classListAttributeDefinition- Parameters:
bundle- resource bundle to use for text descriptionsprefix- prefix to prepend to the attribute name key when looking up descriptionsoperationDescription- 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:AttributeDefinitionBased 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:
addCapabilityRequirementsin classAttributeDefinition- Parameters:
context- the operation contextresource- the resource on which requirements are gatheredattributeValue- 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:AttributeDefinitionBased 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:
removeCapabilityRequirementsin classAttributeDefinition- Parameters:
context- the operation contextresource- resource from which capability requirement is to be removed from,nullis legal value in case thatCapabilityReferenceRecorderdoesn't require it.attributeValue- the value of the attribute described by this object
-
addValueTypeDescription
protected void addValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)- Specified by:
addValueTypeDescriptionin classListAttributeDefinition
-
addAttributeValueTypeDescription
protected void addAttributeValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)- Specified by:
addAttributeValueTypeDescriptionin classListAttributeDefinition
-
addOperationParameterValueTypeDescription
protected void addOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)- Specified by:
addOperationParameterValueTypeDescriptionin classListAttributeDefinition
-
marshallAsElement
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshalDefault, XMLStreamWriter writer) throws XMLStreamExceptionDescription copied from class:AttributeDefinitionMarshalls the value from the givenresourceModelas an xml element, if itis marshallable.- Overrides:
marshallAsElementin classListAttributeDefinition- Parameters:
resourceModel- the model, a non-null node ofModelType.OBJECT.marshalDefault-trueif the value should be marshalled even if it matches the default valuewriter- stream writer to use for writing the attribute- Throws:
XMLStreamException- if thrown bywriter
-
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 givenvalue, resolves it using the givenresolverand validates it using this attribute'svalidator. If the value is undefined and adefault valueis available, the default value is used.- Overrides:
resolveValuein classAttributeDefinition- Parameters:
resolver- the expression resolvervalue- 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
valueis not defined - Throws:
OperationFailedException- if the value is not valid
-
convertParameterElementExpressions
protected org.jboss.dmr.ModelNode convertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElement)
Uses theObjectTypeAttributeDefinitionpassed to the constructor toconvert the element's expressions. Examine the given element of a parameter list for any expression syntax, converting the relevant node toModelType.EXPRESSIONif such is supported. This implementation will only convert elements ofModelType.STRING. Subclasses that need to handle complex elements should override this method.- Overrides:
convertParameterElementExpressionsin classListAttributeDefinition- Parameters:
parameterElement- the node to examine. Will not benull- Returns:
- the parameter element with expressions converted, or the original parameter if no conversion was performed
Cannot return
null
-
addValueTypeDescription
protected void addValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, boolean forOperation, ResourceDescriptionResolver resolver, Locale locale)
-
addAllowedValuesToDescription
protected void addAllowedValuesToDescription(org.jboss.dmr.ModelNode result, ParameterValidator validator)Description copied from class:AttributeDefinitionAdds the allowed values. Override for attributes who should not use the allowed values.- Overrides:
addAllowedValuesToDescriptionin classAttributeDefinition- Parameters:
result- the node to add the allowed values tovalidator- the validator to get the allowed values from
-
getValueType
public final ObjectTypeAttributeDefinition getValueType()
-
getValueAttributeDefinition
public final AttributeDefinition getValueAttributeDefinition()
Description copied from class:ListAttributeDefinitionReturns an AttributeDefinition describing the content of the list.- Overrides:
getValueAttributeDefinitionin classListAttributeDefinition- Returns:
- an AttributeDefinition describing the content of the list - null if none is defined.
-
-