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
AttributeDefinitionfor attributes of typeModelType.OBJECTthat 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 classObjectTypeAttributeDefinition.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
attributeMarshaller, COMPLEX_TYPES, referenceRecorder
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedObjectTypeAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends ObjectTypeAttributeDefinition> builder, String suffix, AttributeDefinition[] valueTypes)protectedObjectTypeAttributeDefinition(ObjectTypeAttributeDefinition.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddAllowedValuesToDescription(org.jboss.dmr.ModelNode result, ParameterValidator validator)Adds the allowed values.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.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.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 voidaddValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, boolean forOperation, ResourceDescriptionResolver resolver, Locale locale)protected voidaddValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, ResourceDescriptionResolver resolver, Locale locale)Deprecated.use #addValueTypeDescription(ModelNode, String, ResourceBundle, boolean, ResourceDescriptionResolver, Locale)protected org.jboss.dmr.ModelNodeconvertParameterExpressions(org.jboss.dmr.ModelNode parameter)Examine the given operation parameter value for any expression syntax, converting the relevant node toModelType.EXPRESSIONif such is supported.static ObjectTypeAttributeDefinition.Buildercreate(String name, AttributeDefinition... valueTypes)AttributeDefinition[]getValueTypes()org.jboss.dmr.ModelNodeparse(String value, XMLStreamReader reader)Creates and returns aModelNodeusing the givenvalueafter first validating the node againstthis object's validator.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 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, 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, 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:AttributeDefinitionExamine the given operation parameter value for any expression syntax, converting the relevant node toModelType.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
-
getValueTypes
public final AttributeDefinition[] getValueTypes()
-
parse
public org.jboss.dmr.ModelNode parse(String value, XMLStreamReader reader) throws XMLStreamException
Description copied from class:SimpleAttributeDefinitionCreates and returns aModelNodeusing the givenvalueafter first validating the node againstthis object's validator.If
valueisnullanundefinednode will be returned.- Overrides:
parsein classSimpleAttributeDefinition- Parameters:
value- the value. Will betrimmedbefore use if notnull.reader-XMLStreamReaderfrom which thelocationfrom which the attribute value was read can be obtained and used in anyXMLStreamException, in case the given value is invalid.- Returns:
ModelNoderepresenting the parsed value- Throws:
XMLStreamException- ifvalueis not valid- See Also:
SimpleAttributeDefinition.parseAndSetParameter(String, ModelNode, XMLStreamReader)
-
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 contextattributeValue- 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
-
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(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
-
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
-
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
-
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 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
-
addValueTypeDescription
@Deprecated protected void addValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, ResourceDescriptionResolver resolver, Locale locale)
Deprecated.use #addValueTypeDescription(ModelNode, String, ResourceBundle, boolean, ResourceDescriptionResolver, Locale)
-
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: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
-
-