This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Supported Standard Validators
WSO2 Governance Registry ships with several standard validators and a series of aggregators making it possible to combine two or more validators to make a single decision.
Â
Attribute Existence Validator
This validator can be used along with a governance artifact such as Service, URI, API or Configurable Artifacts to check whether a particular optional attribute has been set.
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.AttributeExistenceValidator"> <parameter name="attributes" value="overview_version,overview_description"/> </validation>
Attribute Value Count Validator
This validator can be used along with a governance artifact such as Service, URI, API or Configurable Artifacts to check whether a multi-valued attribute has the given number of entries.
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.AttributeValueCountValidator"> <parameter name="attribute" value="endpoints_entry"/> <parameter name="count" value="3"/> <parameter name="expression" value=">="/> </validation>
The expression parameter accepts multiple values, >
, <
, >=
, <=
, ==
an !=
. The count parameter accepts a numerical value.
Attribute Value Validator
This validator can be used along with a governance artifact such as Service, URI, API or Configurable Artifacts to check whether an attribute matches the given pattern. The atLeastOne match parameter is useful for a multi-valued attribute to indicate whether you need all values to match or whether you are accepting at least one match.
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.AttributeValueCountValidator"> <parameter name="attribute" value="endpoints_entry"/> <parameter name="pattern" value="REGULAR_EXPRESSION"/> <parameter name="atLeastOne" value="true"/> </validation>
The atLeastOne parameter accepts either true or false.
Check-Item Ticked Validator
This validator can be used along with a governance artifact such as Service, URI, API or Configurable Artifacts to check whether an optional check-list item should be selected or not.
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.CheckItemTickedValidator"> <parameter name="itemIndex" value="1"/> <parameter name="checked" value="true"/> </validation>
The checked parameter accepts either true or false. The itemIndex parameter is used to specify the index of the checklist item that you are validating.
Property Value Validator
This validator can be used along with a resource to validate whether it has a property by the given name and value.
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.PropertyValueValidator"> <parameter name="propertyName" value="foo"/> <parameter name="isMultiValued" value="false"/> <parameter name="propertyValue" value="bar"/> </validation>
The isMultiValued parameter can be used to specify whether the given property is a multi-valued property. For a multi-valued property, the existence of one or more matching value is taken as valid.
Typed Association Validator
This validator can be used along with a resource to validate whether it has as an association with a given type of resource
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.TypedAssociationValidator"> <parameter name="associationType" value="depends"/> <parameter name="associationDirection" value="outward"/> <parameter name="associatedMediaType" value="application/wsdl+xml"/> <parameter name="propertyName" value="Valid"/> <parameter name="isMultiValued" value="false"/> <parameter name="propertyValue" value="true"/> </validation>
The associationType parameter accepts the type of association. For a dependency, it should be depends. The associatedMediaType parameter is used to define the media type of the association and the associationDirection parameter accepts either inward or outward. The Typed Association Validator is an extension of a Property Value Validator. However, the property value validation happens for the associated resource and not the source resource.
Standard Aggregators
These are defined in the same way as in the case of validators. There are Four standard aggregators.
- org.wso2.carbon.governance.registry.extensions.validators.aggregators.AndAggregator
- org.wso2.carbon.governance.registry.extensions.validators.aggregators.OrAggregator
- org.wso2.carbon.governance.registry.extensions.validators.aggregators.IfThenAggregator
- org.wso2.carbon.governance.registry.extensions.validators.aggregators.NotAggregator
All aggregators except for the NotAggregator, accepts two parameters, inputA and inputB. The NotAggregator accepts a single paramter, input. Below is an example aggregator configuration.
<validation forEvent="" class="org.wso2.carbon.governance.registry.extensions.validators.aggregators.IfThenAggregator"> <parameter name="inputA" value="class:org.wso2.carbon.governance.registry.extensions.validators.AttributeExistenceValidator, parameters:{attributes:overview_version},"/> <parameter name="inputB" value="class:org.wso2.carbon.governance.registry.extensions.validators.AttributeValueCountValidator, parameters:{attribute:overview_version},{pattern:^\\d+[.]\\d+[.]\\d+(-[a-zA-Z0-9]+)?$}"/> <parameter name="associationDirection" value="outward"/> <parameter name="associatedMediaType" value="application/wsdl+xml"/> <parameter name="propertyName" value="Valid"/> <parameter name="isMultiValued" value="false"/> <parameter name="propertyValue" value="true"/> </validation>
The parameter input accepts a value in a special format with the class name first and comma separated parameter list that follows. Each parameter on that comma separated list is defined as a name/value pair within curly braces.