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/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Aspects are used to associate custom behaviors with resources. Aspects are different form handlers in a way, that handlers are automatically applied to a resource, whereas, aspects are needed to be invoked manually through user action (for example, by clicking a button in the user interface).

You can integrate a piece of logic that involve with resource manipulation, inside an aspect, so they can be reused using registry aspect interface.

You can create an aspect by implementing the Aspect class.



A Lifecycle Aspect

A lifecycle is a specialized aspect (and is refered to as lifecyle 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:

  • status
  • name
  • value
  • 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

See Adding Lifecycles.

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.

<dbConfig name="wso2registry">
        <url>jdbc:h2:database/WSO2CARBON_DB</url>
        <userName>wso2carbon</userName>
        <password>wso2carbon</password>
        <driverName>org.h2.Driver</driverName>
        <maxActive>80</maxActive>
        <maxWait>60000</maxWait>
        <minIdle>5</minIdle>
    </dbConfig>

    <aspect name="SampleLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.ChecklistLifeCycle">
        <configuration type="literal">
            <lifecycle>
                <state name="Created" location="/environment/created">
                    <checkitem>Condition 1</checkitem>
                    <checkitem>Condition 2</checkitem>
                </state>
                <state name="Deprecated" location="/environment/deprecated">
                </state>
            </lifecycle>
        </configuration>
    </aspect>

    <handler class="org.wso2.carbon.registry.extensions.handlers.SynapseRepositoryHandler">
        <filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
            <property name="mediaType">application/vnd.apache.synapse</property>
        </filter>
    </handler>

Note

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 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..

A non-lifecycle aspect can have a structure as shown below.

<aspect name="ASPECT_NAME" class="ASPECT_CLASS">
        <MY_OWN_XML>MY_OWN_CONTENT</MY_OWN_XML>
    </aspect>

  • No labels