Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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-5.23.0";

public static void main(String[] args) {
    String url = "https://localhost:9443/services/";
    String username = "admin";
    String password = "admin";
    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);
	GovernanceUtils.loadGovernanceArtifacts((UserRegistry) govReg);
	return govReg;
}

...