Class MapAttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- org.jboss.as.controller.MapAttributeDefinition
-
- Direct Known Subclasses:
ObjectMapAttributeDefinition,PropertiesAttributeDefinition,SimpleMapAttributeDefinition
public abstract class MapAttributeDefinition extends AttributeDefinition
Defining characteristics of anModelType.OBJECTattribute in aResource, where all children of the object have values of the same type; i.e. the attribute represents a logical map of arbitrary key value pairs.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapAttributeDefinition.Builder<BUILDER extends MapAttributeDefinition.Builder,ATTRIBUTE extends MapAttributeDefinition>-
Nested classes/interfaces inherited from class org.jboss.as.controller.AttributeDefinition
AttributeDefinition.NameAndGroup
-
-
Field Summary
Fields Modifier and Type Field Description static ParameterCorrectorLIST_TO_MAP_CORRECTOR-
Fields inherited from class org.jboss.as.controller.AttributeDefinition
attributeMarshaller, COMPLEX_TYPES, referenceRecorder
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapAttributeDefinition(MapAttributeDefinition.Builder<? extends MapAttributeDefinition.Builder,? extends MapAttributeDefinition> builder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddAttributeValueTypeDescription(org.jboss.dmr.ModelNode result, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)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.org.jboss.dmr.ModelNodeaddOperationParameterDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)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 abstract voidaddOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode result, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)org.jboss.dmr.ModelNodeaddOperationReplyDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)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.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.org.jboss.dmr.ModelNodeaddResourceAttributeDescription(org.jboss.dmr.ModelNode resourceDescription, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource description model node.protected abstract voidaddValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)protected org.jboss.dmr.ModelNodeconvertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElementValue)Examine the given value item of a parameter map for any expression syntax, converting the relevant node toModelType.EXPRESSIONif such is supported.protected org.jboss.dmr.ModelNodeconvertParameterExpressions(org.jboss.dmr.ModelNode parameter)Iterates through the items in theparametermap, callingconvertParameterElementExpressions(ModelNode)for each value.ParameterValidatorgetElementValidator()The validator used to validate values in the map.voidmarshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml element, if itis marshallable.org.jboss.dmr.ModelNodeparse(String value, Location location)Creates and returns aModelNodeusing the givenvalueafter first validating the node againstthis object's validator.voidparseAndAddParameterElement(String key, String value, org.jboss.dmr.ModelNode operation, org.jboss.staxmapper.XMLExtendedStreamReader reader)-
Methods inherited from class org.jboss.as.controller.AttributeDefinition
addAccessConstraints, addAllowedValuesToDescription, addCapabilityRequirements, addCapabilityRequirements, addDeprecatedInfo, addOperationReplyDescription, convertStringExpression, correctValue, getAccessConstraints, getAllowedValues, getAlternatives, getArbitraryDescriptors, getAttributeDeprecatedDescription, getAttributeGroup, getAttributeMarshaller, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMarshaller, getMeasurementUnit, getName, getNoTextDescription, getParser, getReferenceRecorder, getRequires, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isAllowNull, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, isValidatingNull, marshallAsElement, removeCapabilityRequirements, removeCapabilityRequirements, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, validateAndSet, validateOperation
-
-
-
-
Field Detail
-
LIST_TO_MAP_CORRECTOR
public static final ParameterCorrector LIST_TO_MAP_CORRECTOR
-
-
Constructor Detail
-
MapAttributeDefinition
protected MapAttributeDefinition(MapAttributeDefinition.Builder<? extends MapAttributeDefinition.Builder,? extends MapAttributeDefinition> builder)
-
-
Method Detail
-
parse
public org.jboss.dmr.ModelNode parse(String value, Location location) throws XMLStreamException
Creates and returns aModelNodeusing the givenvalueafter first validating the node againstthis object's validator.If
valueisnulland adefault valueis available, the value of that default value will be used.- Parameters:
value- the value. Will betrimmedbefore use if notnull.location- current location of the parser'sXMLStreamReader. Used for any exception message- Returns:
ModelNoderepresenting the parsed value- Throws:
XMLStreamException- ifvalueis not valid
-
parseAndAddParameterElement
public void parseAndAddParameterElement(String key, String value, org.jboss.dmr.ModelNode operation, org.jboss.staxmapper.XMLExtendedStreamReader reader) throws XMLStreamException
- Throws:
XMLStreamException
-
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 classAttributeDefinition- 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 classAttributeDefinition- 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
-
getElementValidator
public ParameterValidator getElementValidator()
The validator used to validate values in the map.- Returns:
- the element validator
-
addValueTypeDescription
protected abstract void addValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)
-
addResourceAttributeDescription
public org.jboss.dmr.ModelNode addResourceAttributeDescription(org.jboss.dmr.ModelNode resourceDescription, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)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 classAttributeDefinition- Parameters:
resourceDescription- the overall resource descriptionresolver- provider of localized text descriptionslocale- locale to pass to the resolverbundle- bundle to pass to the resolver- Returns:
- the attribute description node
-
addAttributeValueTypeDescription
protected abstract void addAttributeValueTypeDescription(org.jboss.dmr.ModelNode result, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
-
addOperationParameterDescription
public org.jboss.dmr.ModelNode addOperationParameterDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)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 classAttributeDefinition- Parameters:
resourceDescription- the overall resource descriptionoperationName- the operation nameresolver- provider of localized text descriptionslocale- locale to pass to the resolverbundle- bundle to pass to the resolver- Returns:
- the attribute description node
-
addOperationReplyDescription
public org.jboss.dmr.ModelNode addOperationReplyDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)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:
addOperationReplyDescriptionin classAttributeDefinition- Parameters:
resourceDescription- the overall resource descriptionoperationName- the operation nameresolver- provider of localized text descriptionslocale- locale to pass to the resolverbundle- bundle to pass to the resolver- Returns:
- the attribute description node
-
addOperationParameterValueTypeDescription
protected abstract void addOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode result, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
-
marshallAsElement
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamExceptionDescription copied from class:AttributeDefinitionMarshalls the value from the givenresourceModelas an xml element, if itis marshallable.- Overrides:
marshallAsElementin classAttributeDefinition- Parameters:
resourceModel- the model, a non-null node ofModelType.OBJECT.marshallDefault-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
-
convertParameterExpressions
protected org.jboss.dmr.ModelNode convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
Iterates through the items in theparametermap, callingconvertParameterElementExpressions(ModelNode)for each value.Note that the default implementation of
Examine the given operation parameter value for any expression syntax, converting the relevant node toconvertParameterElementExpressions(ModelNode)will only convert simpleModelType.STRINGvalues. If users need to handle complex values with embedded expressions, they should use a subclass that overrides that method.ModelType.EXPRESSIONif such is supported.This implementation checks if
expressions are allowedand if so, callsAttributeDefinition.convertStringExpression(ModelNode)to convert aModelType.STRINGto aModelType.EXPRESSION. No other conversions are performed. For use cases requiring more complex behavior, a subclass that overrides this method should be used.If expressions are supported this implementation also checks if the
attribute typeis one of thecomplex DMR types. If it is, anIllegalStateExceptionis thrown, as this implementation cannot properly handle such a combination, and a subclass that overrides this method should be used.- Overrides:
convertParameterExpressionsin classAttributeDefinition- Parameters:
parameter- the node to examine. Cannot not benull- Returns:
- a node matching
parameterbut with expressions converted, or the original parameter if no conversion was performed. Will not returnnull
-
convertParameterElementExpressions
protected org.jboss.dmr.ModelNode convertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElementValue)
Examine the given value item of a parameter map for any expression syntax, converting the relevant node toModelType.EXPRESSIONif such is supported.- Parameters:
parameterElementValue- the node to examine. Will not benull- Returns:
- the parameter element value with expressions converted, or the original parameter if no conversion
was performed. Cannot return
null
-
-