In the Governance Registry, you can store and govern the behaviors of SOA artifacts like services, WSDLs, schemas, policies and Endpoints. Governance API provides a way to do it programatically.
The relationship of the classes used in the Governance API is shown in the following class diagram.
The Governance API needs to be accessed through a Governance Registry (as opposed to a root registry) instance.
Inside an admin service, a Governance Registry instance can be obtained by inheriting from the org.wso2.carbon.core.AbstractAdmin
class and calling its getGovernanceRegistry()
method.
When Remote Registry or WS-Registry is used, this instance can be created as shown below.
import org.wso2.carbon.governance.api.util.GovernanceUtils; Registry governanceRegistry = GovernanceUtils.getGovernanceUserRegistry(rootRegistry, username); //rootRegistry refers to an instance of RemoteRegistry or WSRegistryServiceClient
As a specific example, Governance Registry can be obtained via Remote Registry as shown below. See also Accessing Registry Remotely through API.
import org.wso2.carbon.registry.app.RemoteRegistry; import org.wso2.carbon.governance.api.util.GovernanceUtils; Registry rootRegistry = new RemoteRegistry(new URL(remoteRegistryUrl), username, password); Registry governanceRegistry = GovernanceUtils.getGovernanceUserRegistry(rootRegistry, username);
See more information about the Governance API on the following pages: