...
Code Block |
---|
import org.wso2.carbon.registry.app.RemoteRegistry; import org.wso2.carbon.governance.api.util.GovernanceUtils; public static void main(String[] args) { System.setProperty("carbon.repo.write.mode", "true"); Registry rootRegistry = new RemoteRegistry(new URL(remoteRegistryUrl), username, password); Registry governanceRegistry = GovernanceUtils.getGovernanceUserRegistry(rootRegistry, username); } |
As another specific example, Governance Registry can be obtained via WS-Registry as shown below. See also Setting up the WS API Registry Client and WS-Security.
Code Block |
---|
import org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient; import org.wso2.carbon.governance.api.util.GovernanceUtils; import org.apache.axis2.context.ConfigurationContextFactory; import org.wso2.carbon.base.ServerConfiguration; private static final String GREG_HOME = "/home/test/wso2greg-4.5.0"; public static void main(String[] args) { System.setProperty("carbon.repo.write.mode", "true"); ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( GREG_HOME + File.separator + "repository" + File.separator + "deployment" + File.separator + "client", ServerConfiguration.getInstance().getFirstProperty("Axis2Config.clientAxis2XmlLocation"))); WSRegistryServiceClient rootRegistry = new WSRegistryServiceClient(url, username, password,configurationContext); Registry governanceRegistry = GovernanceUtils.getGovernanceUserRegistry(rootRegistry, username); } |
See more information about the Governance API on the following pages:
...