Each web service and related resource has its own lifecycle in a typical software development process. Thus, as a part of its Governance suite of functionality, the WSO2 Governance Registry supports service lifecycles and management out of the box, and also provides developers the opportunity to further extend the basic functionality by providing their own extensions.
The WSO2 Governance Registry supports several points of extensibility. Handlers, Filters, Aspects and Customized User Interfaces are the four key types of extensions that can be added. A lifecycle is a specialized aspect.
The WSO2 Governance Registry is a comprehensive data management portal, that specializes in its support for storing Web Services and related resources. Each web service and related resource has its own lifecycle in a typical software development process. Thus, as a part of its Governance suite of functionality, the WSO2 Governance Registry supports service lifecycles and management out of the box, and also provides developers the opportunity to further extend the basic functionality by providing their own extensions.
The WSO2 Governance Registry supports several points of extensibility. Handlers, Filters, Aspects and Customized User Interfaces are the four key types of extensions that can be added. A lifecycle is a specialized aspect (and is refered to as lifecycle or lifecycle aspect in general), that contains,
- A name
- One or more states
- A list of check-items to be satisfied
- One or more actions that are made available based on the items that are satisfied
An aspect in general extends the basic operations that can be performed on each resource, like a handler, , but differs in its operation, where handlers are executed by the framework and the aspects' actions are required to be explicitly invoked.
Components Specific to a Lifecycle Aspect
The name of a lifecycle aspect is the name given to it, at the point of configuration. This is available on each resource where the particular lifecycle has been associated to, and can be obtained via the registry.LC.name property. Each lifecycle aspect can define one or more states in which an associated resource can be in. The current state that in which a resource is in, can be obtained via the registry.lifecycle.XYZ.state property. Any valid string, can be used in place of XYZ. This is specific to a given lifecycle.
In addition to a name and state, the lifecycle can define a list of items that needs to be satisfied before performing a given lifecycle action. These are specified as a list items that are displayed as check-boxes on the lifecycle portlet in the Resource Browser of the WSO2 Governance Registry Management Console. Each lifecycle aspect can add a check-list of items, which are stored under properties named registry.custom_lifecycle.check-list.PQR.item. Any valid string, can be used in place of PQR, and is used for identification purposes. Each check-list item has, a status, name, value, and order.
Adding, Modifying and Deleting Lifecycle Aspects
Adding a new lifecycle aspect to the registry can be done in two main methods.
Through the WSO2 Governance Registry Management Console
To add a new lifecycle aspect, click on the
Lifecycles menu item under the
Govern section, which will bring up the user interface where you can add your configuration. A sample configuration will be available, at the point of creation, for your reference.
Through the registry.xml configuration file
Similar to handler configurations that are available on the registry.xml file, lifecycle aspect configuration can be added as shown below.
<aspect name="SampleLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.ChecklistLifeCycle">
<state name="Created" location="/environment/created">
<state name="Deprecated" location="/environment/deprecated">
Unlike the configuration added through the management console, this requires the WSO2 Governance Registry to be restarted for the changes to take effect.
The configurations added via the registry.xml and the management console are mutually exclusive in a management perspective and can be modified or deleted in the very same manner that they have been added. However, they are not mutually exclusive in their operation, and can be applied to resources in a transparent manner. Thus, the WSO2 Governance Registry supports both static and dynamic lifecycle configuration management, which is an advantage in an administrator's point of view.
Adding, Modifying and Deleting Non-Lifecycle Aspects
Non-lifecycle aspects can only be added via the registry.xml and are static in nature. These can be added in the very same manner that a lifecycle aspect is being added. However, non-lifecycle aspects, would not be listed by default on the management console like a lifecycle aspect. Thus, they can only be invoked programmatically via the WSO2 Governance Registry API. In order to make these additional operations available on the management console, a custom user interface has to be developed for the particular type of resource.
Developing Lifecycle and Non-lifecycle Aspects
The WSO2 Governance Registry, Distributed Lifecycle Management sample,  can be used as an example to develop custom lifecycles, and also aspects. The difference in a lifecycle aspect and a non-lifecycle aspect is that, a lifecycle aspect adds several properties to a resource, that starts with, registry.lifecycle. or registry.custom_lifecycle.check-list.. The configuration for a lifecycle aspect should have a structure that is similar to the one mentioned in . However, a non-lifecycle aspect can have a structure as shown below.
<aspect name="ASPECT_NAME" class="ASPECT_CLASS">
This brief tutorial explains about Lifecycles and Aspects available as a part of the WSO Governance Registry extensibility API. By following this tutorial, you should have learned about the similarities and the differences between a lifecycle aspect and a non-lifecycle aspect. You also should have gathered a basic understanding on how to write your own lifecycle and non-lifecycle and aspects.
 Extending WSO2 Registry with Handlers
 The WSO2 Governance Registry Distributed Lifecycle Management Sample
Senaka Fernando, Software Engineer, WSO2 Inc., senaka at wso2 dot com