Skip to end of metadata
Go to start of metadata

What are expressions

Expressions are mechanism that enables you to support variables in your attributes, for instance when you want that value of attribute is resolved using system / environment properties.

an example for expression is this:

which means that value should be taken from system propertey named jboss.bind.address.management and if it is not defined use 127.0.0.1

What properties type are supported

  • system properties (summary of predefined system properties can be found here)
  • environment properties, prefixed with env.

How to support expressions in subsystems

The easiest way is by using AttributeDefinition that provides support for expression just just by using it right.

when we create AttributeDefinition all we need to do is mark that is allows expression. Here is an example how to define an attribute that allows expressions to be used.

Then later when you are parsing the xml configuration you should use attribute definition to set value to model.

Note that this just helps you properly set the value to the model node you are working on, so no need to additionally set anything to the model for this attribute. Method parseAndSetParameter parses the value that was read from xml for possible expressions in it and if it finds it it creates special model node that defines that node is of type expression.

Later in your operation handlers where you implement populateModel and have to set model you also use this attribute definition.

This will make sure that attribute that is passed to operation is valid and nothing is lost and also that default values are used.

As last step we need to use the value of the attribute? This is usually needed inside of the performRuntime method

As you can see resolving of attribute's value is not done until it is needed, that way we do not loose any information in the model and can assure that also marshalling is done properly, where we must marshall back the unresolved value.

Attribute definitinon also helps you with that:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.