Class ObjectTypeAttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- org.jboss.as.controller.SimpleAttributeDefinition
-
- org.jboss.as.controller.ObjectTypeAttributeDefinition
-
public class ObjectTypeAttributeDefinition extends SimpleAttributeDefinition
AttributeDefinition
for attributes of typeModelType.OBJECT
that aren't simple maps, but rather a set fixed keys where each key may be associated with a value of a different type.- Author:
- James R. Perkins, Richard Achmatowicz (c) 2012 RedHat Inc.
- See Also:
MapAttributeDefinition
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObjectTypeAttributeDefinition.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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ObjectTypeAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends ObjectTypeAttributeDefinition> builder, String suffix, AttributeDefinition[] valueTypes)
protected
ObjectTypeAttributeDefinition(ObjectTypeAttributeDefinition.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAllowedValuesToDescription(org.jboss.dmr.ModelNode result, ParameterValidator validator)
Adds the allowed values.void
addCapabilityRequirements(OperationContext context, Resource resource, org.jboss.dmr.ModelNode attributeValue)
Based on the given attribute value, add capability requirements.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.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.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 void
addValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, boolean forOperation, ResourceDescriptionResolver resolver, Locale locale)
protected org.jboss.dmr.ModelNode
convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
Examine the given operation parameter value for any expression syntax, converting the relevant node toModelType.EXPRESSION
if such is supported.static ObjectTypeAttributeDefinition.Builder
create(String name, AttributeDefinition... valueTypes)
AttributeDefinition[]
getValueTypes()
void
removeCapabilityRequirements(OperationContext context, Resource resource, org.jboss.dmr.ModelNode attributeValue)
Based on the given attribute value, remove capability requirements.org.jboss.dmr.ModelNode
resolveValue(ExpressionResolver resolver, org.jboss.dmr.ModelNode value)
Overrides the superclass implementation to allow the AttributeDefinition for each field in the object to in turn resolve that field.-
Methods inherited from class org.jboss.as.controller.SimpleAttributeDefinition
marshallAsAttribute, marshallAsAttribute, marshallAsElement, parseAndSetParameter
-
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, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, marshallAsElement, resolveModelAttribute, resolveModelAttribute, resolveValue, validateAndSet, validateOperation
-
-
-
-
Constructor Detail
-
ObjectTypeAttributeDefinition
protected ObjectTypeAttributeDefinition(ObjectTypeAttributeDefinition.Builder builder)
-
ObjectTypeAttributeDefinition
protected ObjectTypeAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends ObjectTypeAttributeDefinition> builder, String suffix, AttributeDefinition[] valueTypes)
-
-
Method Detail
-
convertParameterExpressions
protected org.jboss.dmr.ModelNode convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
Description copied from class:AttributeDefinition
Examine the given operation parameter value for any expression syntax, converting the relevant node toModelType.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
-
getValueTypes
public final AttributeDefinition[] getValueTypes()
-
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 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: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 classAttributeDefinition
- Parameters:
context
- the operation contextresource
- resource from which capability requirement is to be removed from,null
is legal value in case thatCapabilityReferenceRecorder
doesn't require it.attributeValue
- the value of the attribute described by this object
-
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
-
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
-
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
-
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(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
-
resolveValue
public org.jboss.dmr.ModelNode resolveValue(ExpressionResolver resolver, org.jboss.dmr.ModelNode value) throws OperationFailedException
Overrides the superclass implementation to allow the AttributeDefinition for each field in the object to in turn resolve that field. Takes the givenvalue
, resolves it using the givenresolver
and validates it using this attribute'svalidator
. If the value is undefined and adefault value
is available, the default value is used.- Overrides:
resolveValue
in 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
value
is not defined - Throws:
OperationFailedException
- if the value is not valid
-
addValueTypeDescription
protected void addValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, boolean forOperation, ResourceDescriptionResolver resolver, Locale locale)
-
create
public static ObjectTypeAttributeDefinition.Builder create(String name, AttributeDefinition... valueTypes)
-
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 classAttributeDefinition
- Parameters:
result
- the node to add the allowed values tovalidator
- the validator to get the allowed values from
-
-