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

Managing Aspects



Retrieve Available Aspects

The available aspects in the Registry can be retrieved through the following code. It returns a string array containing the names of the aspects:

String[] aspects = registry.getAvailableAspects();

Adding a new Aspect

An aspect is a way of associating custom behaviors with resources. The Registry is shipped with an implemented Aspect known as SimpleLifeCycle by default. The following code shows how this aspect can be added to the registry:

Aspect simpleLifeCycle = new SimpleLifeCycle();

registry.addAspect("SimpleLifeCycle", simpleLifeCycle);

Associating an Aspect with a Resource

An aspect can be associated with a Resource. The following code associated the SimpleLifeCycle to be associated with a resource:

registry.associateAspect("c1/c2/r3", "SimpleLifeCycle");

Invoking an Aspect

An aspect needs to be invoked with the appropriate actions to make use of its custom behavior. The following code invokes the SimpleLifeCycle to be associated with a resource:

registry.invokeAspect("c1/c2/r3", "SimpleLifeCycle", SimpleLifecycle.ACTION);

Retrieving Actions of an Aspect

An actions associated with an aspect with respect to a particular resource can be retrieved using the following line of code:

registry.getAspectActions("c1/c2/r3", "SimpleLifeCycle");

Removing an Aspect from Registry

An aspect can be removed from the registry with the following line of code:

registry.removeAspect("SimpleLifeCycle");

 

For the detailed information about aspects, see Configuring Aspects.