This documentation is for WSO2 Application Server 5.2.0. View documentation for the latest release.
Managing Aspects - Application Server 5.2.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata


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");
  • No labels