WSO2 Governance Registry can be extended in several ways. A Registry Handler which is a pluggable component, can be used to customize processing logic for resources stored on the repository. Resource operations can be intercepted by engaging a handler along with a filter, which will be evaluated to determine whether the handler will be invoked or not. In this brief article, Senaka explains how to configure the two built-in filters of the WSO2 Governance Registry that can be used to control the engaging of handlers at runtime. These are:
1. The Media Type Matcher
2. The URL Matcher
The Media Type Matcher
This filter will determine whether a given handler is invoked based on the media type of the resource (or collection) on which the registry operation is performed. Configuration of a Media Type Matcher includes a single media type for which a handler baring this filter will be executed.
The definition above ensures that the handler in concern is executed against all XML files.
The URL Matcher
This filter can be used to invoke handlers based on the path of the resource (or collection) on which the registry operation is performed. Unlike the Media Type Matcher, the URL Matcher allows you to configure the target resource path per registry operation. The accepted value is a regular expression and therefore, can easily be written to match more than one resource (or collection) stored on the repository. The configuration for a URL Matcher can have one or more properties, as follows:
The definition above ensures that the handler in concern is executed against all the resource within the collection /a/b/. This includes children as well as grand children. You can have more than one such pattern property.
The URL Matcher defines a list of possible properties that can used which includes,
Support for Inverse Operations
WSO2 Governance Registry also supports inversion of filter operations. This can be done by setting the invert property to true.
Setting this property for a Media Type Matcher will cause the handler to execute for all other media types than the specified. Setting this property for a URL Matcher will cause the handler to execute for each operation configured using the pattern property but for all paths that don't match the given regular expression.
Applies To:- WSO2 Governance Registry-3.0.0 or later.
Senaka Fernando, Software Engineer, WSO2, [email protected]