Info | ||
---|---|---|
| ||
Please follow the documentation on how to create a client-side connection to use the Governance API before following these examples. |
Follow the instructions below to learn how to access Registry extensions using Governance API.
...
Code Block |
---|
import org.wso2.carbon.governance.api.generic.GenericArtifactManager; import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact; GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry); GenericArtifactManager artifactManager = new GenericArtifactManager(registry, projectKey); GenericArtifact artifact = artifactManager.newGovernanceArtifact(new QName("http://www.example.com","event")); artifactManager.addGenericArtifact(artifact); |
Info | ||
---|---|---|
| ||
Please note that you need to invoke the following method before using the Governance API for generic artifacts. GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry); |
Update an Artifact
To make further changes to a Artifact which already in the Registry you can use the updateGenericArtifact()
method.
...
Code Block |
---|
GenericArtifact[] artifacts = artifactManager.findGenericArtifacts( new GenericArtifactFilter() { public boolean matches(GenericArtifact genericArtifactartifact) throws GovernanceException { String attributeVal = artifact.getAttribute("EventName"); return (attributeVal != null && attributeVal.equals("Running")); } }); |
...
Code Block |
---|
GovernanceArtifact[] dependents = artifact.getDependents(); GovernanceArtifact[] dependencies = artifact.getDependencies(); |
See also Configurable Governance Artifacts (RXT) and Governance Artifacts.
Excerpt | ||
---|---|---|
| ||
Instructions on how to access Registry extensions using Governance API. |