Class AttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- Direct Known Subclasses:
ListAttributeDefinition,MapAttributeDefinition,SimpleAttributeDefinition
public abstract class AttributeDefinition extends Object
Defining characteristics of an attribute in aResourceor a parameter or reply value type field in anOperationDefinition, with utility methods for validation.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAttributeDefinition.NameAndGroupSimpleComparablethat encapsulates the name of an attribute and any attribute group, ordering first one group (null group first) and then one attribute name.
-
Field Summary
Fields Modifier and Type Field Description protected AttributeMarshallerattributeMarshallerDeprecated.usegetMarshaller()as this will be made private in a future releaseprotected static Set<org.jboss.dmr.ModelType>COMPLEX_TYPESTheModelTypetypes that reflect complex DMR structures --LIST,OBJECT,PROPERTY}protected CapabilityReferenceRecorderreferenceRecorderDeprecated.usegetReferenceRecorder()()} as this will be made private in a future release
-
Constructor Summary
Constructors Modifier Constructor Description protectedAttributeDefinition(AbstractAttributeDefinitionBuilder<?,?> toCopy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddAccessConstraints(org.jboss.dmr.ModelNode result, Locale locale)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.voidaddCapabilityRequirements(OperationContext context, org.jboss.dmr.ModelNode attributeValue)Deprecated.use @{linkaddCapabilityRequirements(OperationContext, Resource, ModelNode)} variantorg.jboss.dmr.ModelNodeaddDeprecatedInfo(org.jboss.dmr.ModelNode model)Adds attribute deprecation information, if relevant, to the given attribute description nodeorg.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(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.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 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.protected static org.jboss.dmr.ModelNodeconvertStringExpression(org.jboss.dmr.ModelNode node)Checks if the given node is ofModelType.STRINGwith a string value that includes expression syntax.protected org.jboss.dmr.ModelNodecorrectValue(org.jboss.dmr.ModelNode newValue, org.jboss.dmr.ModelNode oldValue)Corrects the value if thevalue correctoris notnull.List<AccessConstraintDefinition>getAccessConstraints()List<org.jboss.dmr.ModelNode>getAllowedValues()returns array with all allowed valuesString[]getAlternatives()Gets the names of other attributes whose value must beundefinedif this attribute's value is defined, and vice versa.Map<String,org.jboss.dmr.ModelNode>getArbitraryDescriptors()StringgetAttributeDeprecatedDescription(ResourceBundle bundle, String prefix)Gets localized deprecation text from the givenResourceBundlefor the attribute.StringgetAttributeGroup()Gets the name of the attribute group with which this attribute is associated, if any.AttributeMarshallergetAttributeMarshaller()Deprecated.usegetMarshaller()StringgetAttributeTextDescription(ResourceBundle bundle, String prefix)Gets localized text from the givenResourceBundlefor the attribute.ParameterCorrectorgetCorrector()Gets the corrector used to correct values before checking that they comply with the attribute's definition.org.jboss.dmr.ModelNodegetDefaultValue()Gets the default value to use for the attribute if a value was not provided.DeprecationDatagetDeprecationData()return deprecation data if there is anySet<AttributeAccess.Flag>getFlags()Returns an immutable set of anyflagsused to indicate special characteristics of the attributeAttributeMarshallergetMarshaller()MeasurementUnitgetMeasurementUnit()The unit of measure in which an attribute with a numerical value is expressed.StringgetName()The attribute's name in the management model.org.jboss.dmr.ModelNodegetNoTextDescription(boolean forOperation)Gets descriptive metadata for this attribute, excluding free-from textdescriptionfields.AttributeParsergetParser()protected CapabilityReferenceRecordergetReferenceRecorder()String[]getRequires()Gets the names of other attributes whose value must not beundefinedif this attribute's value is defined.org.jboss.dmr.ModelTypegetType()The expectedtypeof theModelNodethat holds the attribute data.org.jboss.dmr.ModelNodegetUndefinedMetricValue()Gets the undefined metric value to use for the attribute if a value cannot be provided.ParameterValidatorgetValidator()Gets the validator used to validate that values comply with the attribute's definition.StringgetXmlName()The attribute's name in the xml configuration.booleanhasAlternative(org.jboss.dmr.ModelNode operationObject)Gets whether this attribute hasalternativesconfigured and the givenoperationObjecthas any of those alternatives defined.booleanhasCapabilityRequirements()Based on the given attribute value, tell if attribute has any capability requirements.booleanisAllowed(org.jboss.dmr.ModelNode operationObject)Inverse ofhasAlternative(org.jboss.dmr.ModelNode).booleanisAllowExpression()Whether aModelNodeholding the value of this attribute can beModelType.EXPRESSION.booleanisAllowNull()Deprecated.use eitherisRequired()orisNillable()depending on which provides the desired informationbooleanisDeprecated()booleanisMarshallable(org.jboss.dmr.ModelNode resourceModel)Gets whether the givenresourceModelhas a value for this attribute that should be marshalled to XML.booleanisMarshallable(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault)Gets whether the givenresourceModelhas a value for this attribute that should be marshalled to XML.booleanisNillable()Whether aModelNodeholding the value of this attribute can beModelType.UNDEFINEDin any situation.booleanisNullSignificant()Gets whether an access control check is required to implicitly set an attribute toundefinedin a resource "add" operation.booleanisRequired()Whether aModelNodeholding the value of this attribute can beModelType.UNDEFINEDwhen all other attributes in the same overall model that arealternativesof this attribute are undefined.booleanisRequired(org.jboss.dmr.ModelNode operationObject)Gets whether this attribute must be defined in the givenoperationObjectbooleanisResourceOnly()Show if attribute is resource only which means it wont be part of add operations but only present on resourcebooleanisValidatingNull()Deprecated.this is no longer configurable, so this getter may be removed in a future major release.voidmarshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml element, if itis marshallable.voidmarshallAsElement(org.jboss.dmr.ModelNode resourceModel, 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.voidremoveCapabilityRequirements(OperationContext context, org.jboss.dmr.ModelNode attributeValue)Deprecated.org.jboss.dmr.ModelNoderesolveModelAttribute(ExpressionResolver resolver, org.jboss.dmr.ModelNode model)Finds a value in the givenmodelwhose key matches this attribute'sname, uses the givenresolvertoExpressionResolver.resolveExpressions(org.jboss.dmr.ModelNode)resolve} it and validates it using this attribute'svalidator.org.jboss.dmr.ModelNoderesolveModelAttribute(OperationContext context, org.jboss.dmr.ModelNode model)org.jboss.dmr.ModelNoderesolveValue(ExpressionResolver resolver, org.jboss.dmr.ModelNode value)Takes the givenvalue, resolves it using the givenresolverand validates it using this attribute'svalidator.org.jboss.dmr.ModelNoderesolveValue(OperationContext context, org.jboss.dmr.ModelNode value)Takes the givenvalue, resolves it using the givencontextand validates it using this attribute'svalidator.voidvalidateAndSet(org.jboss.dmr.ModelNode operationObject, org.jboss.dmr.ModelNode model)org.jboss.dmr.ModelNodevalidateOperation(org.jboss.dmr.ModelNode operationObject)
-
-
-
Field Detail
-
COMPLEX_TYPES
protected static final Set<org.jboss.dmr.ModelType> COMPLEX_TYPES
TheModelTypetypes that reflect complex DMR structures --LIST,OBJECT,PROPERTY}
-
attributeMarshaller
@Deprecated protected final AttributeMarshaller attributeMarshaller
Deprecated.usegetMarshaller()as this will be made private in a future release
-
referenceRecorder
@Deprecated protected final CapabilityReferenceRecorder referenceRecorder
Deprecated.usegetReferenceRecorder()()} as this will be made private in a future release
-
-
Constructor Detail
-
AttributeDefinition
protected AttributeDefinition(AbstractAttributeDefinitionBuilder<?,?> toCopy)
-
-
Method Detail
-
getName
public String getName()
The attribute's name in the management model.- Returns:
- the name. Will not be
null
-
getXmlName
public String getXmlName()
The attribute's name in the xml configuration. Not relevant for operation parameters and reply value types.- Returns:
- the name. Will not be
null, although it may not be relevant
-
getType
public org.jboss.dmr.ModelType getType()
The expectedtypeof theModelNodethat holds the attribute data.- Returns:
- the type. Will not be
null
-
isRequired
public boolean isRequired()
Whether aModelNodeholding the value of this attribute can beModelType.UNDEFINEDwhen all other attributes in the same overall model that arealternativesof this attribute are undefined.In a valid model an attribute that is required must be undefined if any alternative is defined, so this method should not be used for checking if it is valid for the attribute ever to have an undefined value. Use
isNillable()for that.- Returns:
trueif anundefined ModelNodeis invalid in the absence of alternatives;falseif not
-
isAllowNull
@Deprecated public boolean isAllowNull()
Deprecated.use eitherisRequired()orisNillable()depending on which provides the desired informationInverse ofisRequired().In a valid model an attribute that is required must be undefined if any alternative is defined, so this method should not be used for checking if it is valid for the attribute ever to have an undefined value. Use
isNillable()for that.- Returns:
trueif anundefined ModelNodeis valid in the absence of alternatives;falseif not
-
isNillable
public boolean isNillable()
Whether aModelNodeholding the value of this attribute can beModelType.UNDEFINEDin any situation. An attribute that ordinarily isrequiredmay still be undefined in a given model if analternative attributeis defined.This is equivalent to
!isRequired() || (getAlternatives() != null && getAlternatives().length > 0).- Returns:
trueif anundefined ModelNodeis valid;falseif not
-
isNullSignificant
public final boolean isNullSignificant()
Gets whether an access control check is required to implicitly set an attribute toundefinedin a resource "add" operation. "Implicitly" setting an attribute refers to not providing a value for it in the add operation, leaving the attribute in an undefined state. So, if a user attempts to add a resource but does not define some attributes, a write permission check will be performed for any attributes where this method returnstrue.Generally this is
trueifundefined is allowedand adefault valueexists, although some instances may have a different setting.- Returns:
trueif anundefinedvalue is significant
-
isAllowExpression
public boolean isAllowExpression()
Whether aModelNodeholding the value of this attribute can beModelType.EXPRESSION.- Returns:
trueif anexpression ModelNodeis valid;falseif not
-
getDefaultValue
public org.jboss.dmr.ModelNode getDefaultValue()
Gets the default value to use for the attribute if a value was not provided.- Returns:
- the default value, or
nullif no defined value was provided
-
getAttributeGroup
public String getAttributeGroup()
Gets the name of the attribute group with which this attribute is associated, if any.- Returns:
- the name of the group, or
nullif the attribute is not associated with a group
-
getMeasurementUnit
public MeasurementUnit getMeasurementUnit()
The unit of measure in which an attribute with a numerical value is expressed.- Returns:
- the measurement unit, or
nullif none is relevant
-
getCorrector
public ParameterCorrector getCorrector()
Gets the corrector used to correct values before checking that they comply with the attribute's definition.- Returns:
- the corrector. May be
null
-
getValidator
public ParameterValidator getValidator()
Gets the validator used to validate that values comply with the attribute's definition.- Returns:
- the validator. Will not be
null
-
isValidatingNull
@Deprecated public boolean isValidatingNull()
Deprecated.this is no longer configurable, so this getter may be removed in a future major release.Gets whether the attribute definition is checking forundefinedvalues. This will betruefor attributes that are notisRequired()(although the validation is meaningless, since undefined is valid) and for required attributes that havealternatives.Validation by the AttributeDefinition of required attributes with alternatives is not possible, as the necessary context of the overall change being made is not available.
- Returns:
trueif validation will check undefined values.
-
getAlternatives
public String[] getAlternatives()
Gets the names of other attributes whose value must beundefinedif this attribute's value is defined, and vice versa.- Returns:
- the alternative attribute names, or
nullif there are no such attributes
-
getRequires
public String[] getRequires()
Gets the names of other attributes whose value must not beundefinedif this attribute's value is defined.- Returns:
- the required attribute names, or
nullif there are no such attributes
-
getFlags
public Set<AttributeAccess.Flag> getFlags()
Returns an immutable set of anyflagsused to indicate special characteristics of the attribute- Returns:
- the flags. Will not be
nullbut may be empty.
-
getAllowedValues
public List<org.jboss.dmr.ModelNode> getAllowedValues()
returns array with all allowed values- Returns:
- allowed values
-
isMarshallable
public boolean isMarshallable(org.jboss.dmr.ModelNode resourceModel)
Gets whether the givenresourceModelhas a value for this attribute that should be marshalled to XML.This is the same as
isMarshallable(resourceModel, true).- Parameters:
resourceModel- the model, a non-null node ofModelType.OBJECT.- Returns:
trueif the givenresourceModelhas a defined value under this attribute'sgetName()() name}.
-
isMarshallable
public boolean isMarshallable(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault)Gets whether the givenresourceModelhas a value for this attribute that should be marshalled to XML.- Parameters:
resourceModel- the model, a non-null node ofModelType.OBJECT.marshallDefault-trueif the value should be marshalled even if it matches the default value- Returns:
trueif the givenresourceModelhas a defined value under this attribute'sgetName()() name} andmarshallDefaultistrueor that value differs from this attribute'sdefault value.
-
validateOperation
public org.jboss.dmr.ModelNode validateOperation(org.jboss.dmr.ModelNode operationObject) throws OperationFailedExceptionFinds a value in the givenoperationObjectwhose key matches this attribute'snameand validates it using this attribute'svalidator.- Parameters:
operationObject- model node of typeModelType.OBJECT, typically representing an operation request- Returns:
- the value
- Throws:
OperationFailedException- if the value is not valid
-
validateAndSet
public final void validateAndSet(org.jboss.dmr.ModelNode operationObject, org.jboss.dmr.ModelNode model) throws OperationFailedExceptionFinds a value in the givenoperationObjectwhose key matches this attribute'sname, validates it using this attribute'svalidator, and, stores it under this attribute's name in the givenmodel.- Parameters:
operationObject- model node of typeModelType.OBJECT, typically representing an operation requestmodel- model node in which the value should be stored- Throws:
OperationFailedException- if the value is not valid
-
resolveModelAttribute
public org.jboss.dmr.ModelNode resolveModelAttribute(OperationContext context, org.jboss.dmr.ModelNode model) throws OperationFailedException
Finds a value in the givenmodelwhose key matches this attribute'sname, uses the givencontexttoresolveit and validates it using this attribute'svalidator. If the value is undefined and adefault valueis available, the default value is used.- Parameters:
context- the operation contextmodel- model node of typeModelType.OBJECT, typically representing a model resource- Returns:
- the resolved value, possibly the default value if the model does not have a defined value matching this attribute's name
- Throws:
OperationFailedException- if the value is not valid
-
resolveModelAttribute
public org.jboss.dmr.ModelNode resolveModelAttribute(ExpressionResolver resolver, org.jboss.dmr.ModelNode model) throws OperationFailedException
Finds a value in the givenmodelwhose key matches this attribute'sname, uses the givenresolvertoExpressionResolver.resolveExpressions(org.jboss.dmr.ModelNode)resolve} it and validates it using this attribute'svalidator. If the value is undefined and adefault valueis available, the default value is used.- Parameters:
resolver- the expression resolvermodel- model node of typeModelType.OBJECT, typically representing a model resource- Returns:
- the resolved value, possibly the default value if the model does not have a defined value matching this attribute's name
- Throws:
OperationFailedException- if the value is not valid
-
resolveValue
public org.jboss.dmr.ModelNode resolveValue(OperationContext context, org.jboss.dmr.ModelNode value) throws OperationFailedException
Takes the givenvalue, resolves it using the givencontextand validates it using this attribute'svalidator. If the value is undefined and adefault valueis available, the default value is used.- Parameters:
context- the context to use toresolvethe valuevalue- 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
-
resolveValue
public org.jboss.dmr.ModelNode resolveValue(ExpressionResolver resolver, org.jboss.dmr.ModelNode value) throws OperationFailedException
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.- 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
-
isAllowed
public boolean isAllowed(org.jboss.dmr.ModelNode operationObject)
Inverse ofhasAlternative(org.jboss.dmr.ModelNode).- Parameters:
operationObject- an objectModelNodewhose keys are attribute names.- Returns:
trueifoperationObjecthas no defined values for attributes configured as our alternatives
-
isRequired
public boolean isRequired(org.jboss.dmr.ModelNode operationObject)
Gets whether this attribute must be defined in the givenoperationObject- Parameters:
operationObject- an objectModelNodewhose keys are attribute names.- Returns:
trueif this attribute isrequiredand the givenoperationObjectdoes not have any defined attributes configured asalternativesto this attribute
-
hasAlternative
public boolean hasAlternative(org.jboss.dmr.ModelNode operationObject)
Gets whether this attribute hasalternativesconfigured and the givenoperationObjecthas any of those alternatives defined.- Parameters:
operationObject- an objectModelNodewhose keys are attribute names.- Returns:
trueifoperationObjecthas any defined values for attributes configured as our alternatives
-
marshallAsElement
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamExceptionMarshalls the value from the givenresourceModelas an xml element, if itis marshallable.- Parameters:
resourceModel- the model, a non-null node ofModelType.OBJECT.writer- stream writer to use for writing the attribute- Throws:
XMLStreamException- if thrown bywriter
-
marshallAsElement
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamExceptionMarshalls the value from the givenresourceModelas an xml element, if itis marshallable.- 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
-
addResourceAttributeDescription
public 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. The node describing the attribute is returned to make it easy to perform further modification.- 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)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.- 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)
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.- 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
-
addOperationParameterDescription
public 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. The node describing the parameter is returned to make it easy to perform further modification.- 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(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. The node describing the parameter is returned to make it easy to perform further modification.- 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)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.- 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
-
getAttributeTextDescription
public String getAttributeTextDescription(ResourceBundle bundle, String prefix)
Gets localized text from the givenResourceBundlefor the attribute.- Parameters:
bundle- the resource bundle. Cannot benullprefix- a prefix to dot-prepend to the attribute name to form a key to resolve in the bundle- Returns:
- the resolved text
-
getAttributeDeprecatedDescription
public String getAttributeDeprecatedDescription(ResourceBundle bundle, String prefix)
Gets localized deprecation text from the givenResourceBundlefor the attribute.- Parameters:
bundle- the resource bundle. Cannot benullprefix- a prefix to dot-prepend to the attribute name to form a key to resolve in the bundle- Returns:
- the resolved text
-
addDeprecatedInfo
public org.jboss.dmr.ModelNode addDeprecatedInfo(org.jboss.dmr.ModelNode model)
Adds attribute deprecation information, if relevant, to the given attribute description node- Parameters:
model- the attribute description- Returns:
- the node added to
modelornullif no deprecation data was needed
-
getNoTextDescription
public org.jboss.dmr.ModelNode getNoTextDescription(boolean forOperation)
Gets descriptive metadata for this attribute, excluding free-from textdescriptionfields.- Parameters:
forOperation-trueif the metadata is for an operation parameter or reply value type- Returns:
- object node containing the descriptive metadata
-
addCapabilityRequirements
@Deprecated public void addCapabilityRequirements(OperationContext context, org.jboss.dmr.ModelNode attributeValue)
Deprecated.use @{linkaddCapabilityRequirements(OperationContext, Resource, ModelNode)} variantBased 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.
- Parameters:
context- the operation contextattributeValue- the value of the attribute described by this object
-
addCapabilityRequirements
public void addCapabilityRequirements(OperationContext context, Resource resource, org.jboss.dmr.ModelNode attributeValue)
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.
- Parameters:
context- the operation contextresource-attributeValue- the value of the attribute described by this object
-
removeCapabilityRequirements
@Deprecated public void removeCapabilityRequirements(OperationContext context, org.jboss.dmr.ModelNode attributeValue)
Deprecated.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.
- 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)
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.
- 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
-
hasCapabilityRequirements
public boolean hasCapabilityRequirements()
Based on the given attribute value, tell if attribute has any capability requirements. If this definition is for an attribute whose value is or contains a reference to the name of some capability, this method will return true otherwise false.This is a no-op in this base class. Subclasses that support attribute types that can represent capability references should override this method.
- Returns:
-
getReferenceRecorder
protected CapabilityReferenceRecorder getReferenceRecorder()
-
addAllowedValuesToDescription
protected void addAllowedValuesToDescription(org.jboss.dmr.ModelNode result, ParameterValidator validator)Adds the allowed values. Override for attributes who should not use the allowed values.- Parameters:
result- the node to add the allowed values tovalidator- the validator to get the allowed values from
-
correctValue
protected final org.jboss.dmr.ModelNode correctValue(org.jboss.dmr.ModelNode newValue, org.jboss.dmr.ModelNode oldValue)Corrects the value if thevalue correctoris notnull. If thevalue correctorisnull, thenewValueparameter is returned.- Parameters:
newValue- the new value.oldValue- the old value.- Returns:
- the corrected value or the
newValueif thevalue correctorisnull.
-
convertParameterExpressions
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.EXPRESSIONif such is supported.This implementation checks if
expressions are allowedand if so, callsconvertStringExpression(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.- 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 - Throws:
IllegalStateException- if expressions are supported, but theattribute typeiscomplex
-
convertStringExpression
protected static org.jboss.dmr.ModelNode convertStringExpression(org.jboss.dmr.ModelNode node)
Checks if the given node is ofModelType.STRINGwith a string value that includes expression syntax. If so returns a node ofModelType.EXPRESSION, else simply returnsnodeunchanged- Parameters:
node- the node to examine. Will not benull- Returns:
- the node with expressions converted, or the original node if no conversion was performed
Cannot return
null
-
getAttributeMarshaller
@Deprecated public AttributeMarshaller getAttributeMarshaller()
Deprecated.usegetMarshaller()- Returns:
- AttributeMarshaller that provides means to marshal attribute to xml
-
getMarshaller
public AttributeMarshaller getMarshaller()
- Returns:
- attribute marshaller that can be used to persist attribute to XML
-
isResourceOnly
public boolean isResourceOnly()
Show if attribute is resource only which means it wont be part of add operations but only present on resource- Returns:
- true is attribute is resource only
-
isDeprecated
public boolean isDeprecated()
- Returns:
- true if attribute is deprecated
-
getDeprecationData
public DeprecationData getDeprecationData()
return deprecation data if there is any- Returns:
DeprecationData
-
getAccessConstraints
public List<AccessConstraintDefinition> getAccessConstraints()
-
addAccessConstraints
protected void addAccessConstraints(org.jboss.dmr.ModelNode result, Locale locale)
-
getParser
public AttributeParser getParser()
-
getUndefinedMetricValue
public org.jboss.dmr.ModelNode getUndefinedMetricValue()
Gets the undefined metric value to use for the attribute if a value cannot be provided.- Returns:
- the undefined metric value, or
nullif no undefined metric value was provided
-
-