The product not only allows you to store service descriptions, policies and other service-specific meta information, but also images, text files and office documents. The WSO2 Governance Registry also provides a simple RESTful remote interface which uses the Atom Publishing Protocol (powered by Apache Abdera). More information on the WSO2 Governance Registry can be found in here.
WSO2 Governance Registry includes the following key configuration files:
- Configuration for the WSO2 Carbon Server (carbon.xml)
- Configuration for Embedded Apache Axis2 Client and Server (axis2.xml and axis2_client.xml)
- Configuration for Media Types of Resources stored on the Repository (mime.types)
- Configuration for the WSO2 Governance Registry (registry.xml)
- Configuration for Embedded Tomcat Servlet Transports (transports.xml)
- Configuration for Managing Users on the WSO2 Carbon Server (user-mgt.xml)
- Configuration for running the Daemon script (wrapper.conf)
This tutorial explains the configuration of the WSO2 Governance Registry, through the registry.xml file. You will be learning about the various parameters appearing in the registry.xml and their usages. By following this brief tutorial you will be learning how to take control of your WSO2 Governance Registry configuration and also how you can customize your own parameters and other configuration details. The registry.xml file contains several types of configuration details.
- Registry configuration details
- Database configuration details
- Handler configuration details
- Remote Instance configuration details
- Registry Configuration Details
- Database Configuration Details
- Handler Configuration Details
- Remote Instance Configuration Details
- Changing Configuration Details
Registry Configuration Details
The WSO2 Governance Registry, is designed, having in mind the ability to tailor it according to various business requirements. As an implementation framework for Governance within an organization, its people, processes and services, the WSO2 Governance Registry gives an administrator the ability to choose from a wide variety of design-time (static) configuration options.
<!-- Location you want to add service and default
location will be /governance/services/ -->
The ability to track changes done to organizational resource, and optionally review and revert back to an older version, puts one of the most important pieces to the puzzle that most organizations are facing. The WSO2 Governance Registry takes you a step further by giving you the option to decide on what operations on a resource are versioned and what are not. This allows you to optimize data storage and also gain better performance while securing your business goals. Versioning is enabled for all operations on a resource by default, and, you can disable versioning of properties, comments, tags and ratings by changing the value of the corresponding parameter to
In addition to versioning the WSO2 Governance Registry also allows you to configure how you store various resources (mainly for services). You can change the default service path /governance/services to any valid path on the registry. If this location already exists, it will be re-used, or if not, it will be created for you.
Versioning resource per each change made can be an extremely expensive operation at runtime (especially if there are many resources that change). By setting the versionResourcesOnChange parameter to
false, you can disable versioning resources on change.
The WSO2 Governance Registry can be used in two modes of operation, READ-ONLY and READ-WRITE. The WSO2 Carbon Server has been designed with the provision of multiple instances of similar servers to make use of a single configuration base. An ideal example is a cluster of WSO2 Enterprise Service Buses (ESBs). Here, we can define one node as the master of the cluster which has the ability to read and write configuration data, while the others can only read. The single-reader multiple-writer deployment scenario solves concurrency problems. The registry.xml file can be used to define whether the embedded (or remote) instance of the Registry in-use is writeable or not. This is controlled by the readOnly parameter.
The WSO2 Governance Registry also supports the notion of using a single repository shared among multiple servers based on the WSO2 Carbon Server platform. This is analogous to different users sharing the same file system. Each server (like each user) will be given a chroot'ed environment to work upon, with its apparent root being a child of the root of the shared repository.
The registryRoot parameter can be used to define whether the apparent root of the running instance of the server. In the event of multiple servers running against a single repository, the WSO2 Carbon Server can be configured in three different ways. Without loss of generality, lets take two servers A and B, sharing the same repository. Then the three configuration options are as follows:
- A is B's sibling - A and B have the same registry root ('/', or '/myroot').
- A is B's parent - A has registry root '/' or '/myroot' while B has registry root '/child' or '/myroot/child'.
- A and B are isolated - A has registry root '/a' and B has registry root '/b'.
The three different configuration options facilitate a number of grid and clustered deployments.
Database Configuration Details
The WSO2 Governance Registry has been tested to work with various relational database management systems including,
- H2 (Embedded and Server)
- Apache Derby (Embedded and Server)
- MS SQL Server
The server administrator can define the type of database to be used, along with the JDBC connection URL to connect to the database and a compatible driver via the database configuration parameters.
Each database configuration will have a name, a JDBC connection URL, and a compatible driver to be used. Depending on the type of database used, you can define several other parameters such as,
- The username used to connect to the database server
- The password of the database user
- The maximum number of active connections that can be allocated from the connection pool at the same time, or a negative value to allow unlimited connections
- The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or non-positive value to wait indefinitely
- The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none
There can be more than one database configuration specified within the registry.xml file. For instance, you can have something similar to the configuration below.
However, the server can only handle one active configuration at a time. The currentDBConfig parameter is used to specify the database configuration that is active at present.
The value of the currentDBConfig parameter should be a valid name of a database configuration defined on the registry.xml file. An administrator can gain a number of benefits by being able to switch between database configurations.
- The ability to create back-up databases that can be activated by a simple configuration change resulting in minimal downtime.
- Ease of development with the ability of testing on multiple database systems.
Handler Configuration Details
The WSO2 Governance Registry can be extended in several ways. Handlers are pluggable components, that contain custom processing logic for handling resources. All handlers extend an abstract class named Handler, which provides default implementations for resource handling methods as well as a few utilities useful for concrete handler implementations. Each handler is associated with a filter. Filters provide criteria for engaging handlers. Registry always evaluates the associated filter before invoking a handler. If the filter evaluates to true, it will invoke its associated handler.
Handlers can be engaged to the WSO2 Governance Registry either programmatically, or by defining them in the registry.xml. Most built-in handlers are engaged by default, whereas optional and user-defined handlers should be configured by defining them in the registry.xml file. The registry.xml file includes several optional handlers that can be enabled or disabled according to your requirement.
There are four repository handlers in use, which can create the directory structure required by Apache Axis2, Apache Synapse, WSO2 Enterprise Service Bus and WSO2 Web Service Application Server on the WSO2 Governance Registry. Each repository handler will create a collection with a defined media type, so that future repository-wide operations and additional validations can easily be done. This media type is also useful in locating one of many repositories, using search queries.
Although not fully implemented for the current released version, the WSO2 Governance Registry includes a framework of handlers that can be used to index resources of various types. There are handlers which can be extended to index XML files, PDF files, Microsoft Word documents, spreadsheets and presentations.
Service Metadata Handlers
The WSO2 Governance Registry is optimized to support Design-time and Run-time governance for Web Services. There exists handlers that can process WSDL files, schemas and policies. These handlers are even capable of managing related resources such as imported WSDLs and schemas. The service metadata handlers accept several configuration options which allows you to define the associated media type and storage location.
<property name="schemaLocationConfiguration" type="xml">
<property name="wsdlLocationConfiguration" type="xml">
<locationType>absolute</locationType> <!-- absolute or relative -->
External Link Handler
The WSO2 Governance Registry allows you to store external links as a part of the repository tree structure. Clicking on such a resource would take you to the external link. This makes it easy for an organization to manage physically separated resources as a part of a single hierarchical tree structure.
You can similarly include your own handlers on the registry.xml. The handler sample included with the WSO2 Governance Registry distribution explains to how you could create your own handler and include it in the registry.xml file.
Remote Instance Configuration Details
The WSO2 Governance Registry supports the concept of federating the directory structure of the repository across multiple servers. Thus, the structure of collections need not necessarily be existent on a single instance of the server. Each remote instance can be mounted and un-mounted by the simple addition of a configuration describing how to connect to it. The WSO2 Governance Registry's Remote Registry API is used to communicate between such remote instances.
More than one remote instance can be attached to a given WSO2 Governance Registry by adding the relevant configuration details as seen above. Each remote instance must be given an identifier along with valid credentials that have sufficient privileges to perform the desired registry operations (requires at least read-privileges to the registry along with permission to log-in to the server). The URL of the remote instance can be deduced as follows:
Let the URL of the destination server be
https://localhost:9443/services. Then the URL of the remote instance will be
https://localhost:9443/registry. Let the URL of the destination server be
https://10.20.30.40:9445/webcontext/services. Then the URL of the remote instance will be
https://10.20.30.40:9445/webcontext/registry. Please also note that you can't mount the same server as a remote instance to itself.
Changing Configuration Details
The WSO2 Governance Registry configuration will be loaded when the org.wso2.carbon.registry.core bundle (the registry kernel) is activated. Thus, if any change done to the registry configuration, the server needs to be restarted if it is already running. While most configuration options can be changed after the first run of the WSO2 Governance Registry, changing the Static Configuration (configuration details under the staticConfiguration parameter), will not be fully effective. If you need to change any Static Configuration and expect it to take effect, you will have to erase the contents of the database, and restart the server passing the -Dsetup system property which will re-generate the database.
Now we know that there are several types of configuration details defined in the registry.xml file. We also learned how to change configuration details and how they would become effective. While some configuration details are strictly for the use of the WSO2 Governance Registry, there are others that can be used to control the operation and initialization of handlers that you write to extend the registry. The registry.xml file is therefore the central location that configures how the registry is used, the extensions are added on top of it, and the siblings that it should interact with.
Senaka Fernando, Software Engineer, WSO2 Inc., senaka at wso2 dot com