Class ListAttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- org.jboss.as.controller.ListAttributeDefinition
-
- Direct Known Subclasses:
ObjectListAttributeDefinition
,PrimitiveListAttributeDefinition
,SimpleListAttributeDefinition
public abstract class ListAttributeDefinition extends AttributeDefinition
Defining characteristics of anModelType.LIST
attribute in aResource
, with utility methods for conversion to and from xml and for validation.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ListAttributeDefinition.Builder<BUILDER extends ListAttributeDefinition.Builder,ATTRIBUTE extends ListAttributeDefinition>
-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ListAttributeDefinition(ListAttributeDefinition.Builder<?,?> builder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract void
addAttributeValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
org.jboss.dmr.ModelNode
addOperationParameterDescription(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.ModelNode
addOperationParameterDescription(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 void
addOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
org.jboss.dmr.ModelNode
addOperationReplyDescription(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 void
addOperationReplyValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
org.jboss.dmr.ModelNode
addResourceAttributeDescription(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.ModelNode
addResourceAttributeDescription(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 void
addValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)
protected org.jboss.dmr.ModelNode
convertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElement)
Examine the given element of a parameter list for any expression syntax, converting the relevant node toModelType.EXPRESSION
if such is supported.protected org.jboss.dmr.ModelNode
convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
Iterates through the elements in theparameter
list, callingconvertParameterElementExpressions(ModelNode)
for each.ParameterValidator
getElementValidator()
The validator used to validate elements in the list.AttributeDefinition
getValueAttributeDefinition()
Returns an AttributeDefinition describing the content of the list.void
marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)
Marshalls the value from the givenresourceModel
as an xml element, if itis marshallable
.void
parseAndAddParameterElement(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader)
Deprecated.-
Methods inherited from class org.jboss.as.controller.AttributeDefinition
addAccessConstraints, addAllowedValuesToDescription, addCapabilityRequirements, addDeprecatedInfo, addOperationReplyDescription, convertStringExpression, correctValue, getAccessConstraints, getAllowedValues, getAlternatives, getArbitraryDescriptors, getAttributeDeprecatedDescription, getAttributeGroup, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMarshaller, getMeasurementUnit, getName, getNoTextDescription, getParser, getReferenceRecorder, getRequires, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, marshallAsElement, removeCapabilityRequirements, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, validateAndSet, validateOperation
-
-
-
-
Constructor Detail
-
ListAttributeDefinition
protected ListAttributeDefinition(ListAttributeDefinition.Builder<?,?> builder)
-
-
Method Detail
-
getElementValidator
public ParameterValidator getElementValidator()
The validator used to validate elements in the list.- Returns:
- the element validator
-
getValueAttributeDefinition
public AttributeDefinition getValueAttributeDefinition()
Returns an AttributeDefinition describing the content of the list.- Returns:
- an AttributeDefinition describing the content of the list - null if none is defined.
-
parseAndAddParameterElement
@Deprecated public void parseAndAddParameterElement(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader) throws XMLStreamException
Deprecated.Creates aModelNode
using the givenvalue
after first validating the node againstthis object's element validator
, and then stores it in the givenoperation
model node as an element in aModelType.LIST
value in a key/value pair whose key is this attribute'sname
.If
value
isnull
anundefined
node will be stored if such a value is acceptable to the validator.The expected usage of this method is in parsers seeking to build up an operation to store their parsed data into the configuration.
- Parameters:
value
- the value. Will betrimmed
before use if notnull
.operation
- model node of typeModelType.OBJECT
into which the parsed value should be storedreader
-XMLStreamReader
from which thelocation
from which the attribute value was read can be obtained and used in anyXMLStreamException
, in case the given value is invalid.- Throws:
XMLStreamException
- ifvalue
is not valid
-
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 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
-
addResourceAttributeDescription
public org.jboss.dmr.ModelNode addResourceAttributeDescription(org.jboss.dmr.ModelNode resourceDescription, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
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 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
-
addOperationParameterDescription
public org.jboss.dmr.ModelNode addOperationParameterDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
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 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
-
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 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
-
addOperationReplyDescription
public org.jboss.dmr.ModelNode addOperationReplyDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
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:
addOperationReplyDescription
in 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
-
addValueTypeDescription
protected abstract void addValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)
-
addAttributeValueTypeDescription
protected abstract void addAttributeValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
-
addOperationParameterValueTypeDescription
protected abstract void addOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
-
addOperationReplyValueTypeDescription
protected void addOperationReplyValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
-
marshallAsElement
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
Description copied from class:AttributeDefinition
Marshalls the value from the givenresourceModel
as an xml element, if itis marshallable
.- Overrides:
marshallAsElement
in classAttributeDefinition
- Parameters:
resourceModel
- the model, a non-null node ofModelType.OBJECT
.marshallDefault
-true
if 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 elements in theparameter
list, callingconvertParameterElementExpressions(ModelNode)
for each.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.STRING
elements. If users need to handle complex elements with embedded expressions, they should use a subclass that overrides that method.ModelType.EXPRESSION
if such is supported.This implementation checks if
expressions are allowed
and if so, callsAttributeDefinition.convertStringExpression(ModelNode)
to convert aModelType.STRING
to 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 type
is one of thecomplex DMR types
. If it is, anIllegalStateException
is thrown, as this implementation cannot properly handle such a combination, and a subclass that overrides this method should be used.- Overrides:
convertParameterExpressions
in classAttributeDefinition
- Parameters:
parameter
- the node to examine. Cannot not benull
- Returns:
- a node matching
parameter
but 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 parameterElement)
Examine the given element of a parameter list for any expression syntax, converting the relevant node toModelType.EXPRESSION
if such is supported. This implementation will only convert elements ofModelType.STRING
. Subclasses that need to handle complex elements should override this method.- 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
-
-