Versions Compared

Key

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

Configurable Governance Artifacts (RXT) extend the functionality of WSO2 Governance Registry. The RXT feature provides you to define your own data model. For more information on configurable Governance artifacts (RXT), see Configurable Governance Artifacts (RXT)

...

  1. Create a Java project by adding the following content (e.g. populator.jar). 

    Info

    You need to implement the DropDownDataPopulator interface in the drop-down populator class. 

    Code Block
    languagejava
    package org.sample.rxt.populator;
    
    import javax.servlet.ServletConfig;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.wso2.carbon.governance.generic.stub.beans.xsd.ContentArtifactsBean;
    import org.wso2.carbon.governance.generic.ui.clients.ManageGenericArtifactServiceClient;
    import org.wso2.carbon.governance.generic.ui.utils.DropDownDataPopulator;
    import org.wso2.carbon.registry.core.Registry;
    import org.wso2.carbon.registry.core.session.UserRegistry;
    import org.wso2.carbon.registry.api.RegistryException;
    import org.wso2.carbon.governance.api.generic.GenericArtifactManager;
    import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
    import org.wso2.carbon.governance.api.util.GovernanceArtifactConfiguration;
    import org.wso2.carbon.governance.api.util.GovernanceUtils;
    
    public class WSDLPopulator implements DropDownDataPopulator {
     private static final Log log = LogFactory.getLog(WSDLPopulator.class);
     String[] out = new String[1];
     @Override
     public String[] getList(HttpServletRequest httpServletRequest, ServletConfig servletConfig) {
      try {
       ManageGenericArtifactServiceClient client =
        new ManageGenericArtifactServiceClient(servletConfig, httpServletRequest.getSession());
       ContentArtifactsBean artifactsBean = client.listContentArtifacts("application/wsdl+xml");
       if (artifactsBean.getName() != null && artifactsBean.getName().length > 0) {
        return artifactsBean.getName();
       } else {
        out[0] = "None";
       }
      } catch (RegistryException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      }
      return out;
     }
    
     @Override
     public String[] getList(String uuid, String path, Registry registry) {
      try {
       GenericArtifact[] artifacts;
       Registry gov = GovernanceUtils.getGovernanceUserRegistry(registry, "admin");
       GovernanceUtils.loadGovernanceArtifacts((UserRegistry) gov);
       GenericArtifactManager manager = new GenericArtifactManager(gov, "wsdl");
       artifacts = manager.getAllGenericArtifacts();
       if (artifacts != null && artifacts.length > 0) {
        String[] artifactNames = new String[artifacts.length];
        for (int i = 0; i < artifacts.length; i++) {
         artifactNames[i] = artifacts[i].getQName().getLocalPart();
        }
        return artifactNames;
       } else {
        out[0] = "None";
        return out;
       }
    
      } catch (RegistryException e) {
       log.error("An error occurred while obtaining the list of lifecycles.", e);
      }
      return new String[0];
     }
    }
  2. Place it in the <G-REG_HOME>/repository/lib/ directory.
  3. Log in to the Management Console of WSO2 G-Reg using the following URL and admin/admin credentials: https://<G-REG_HOST>:<G-REG_PORT>/carbon/
  4. Click Extensions, and then click Artifact Types in the Configure menu.
  5. Click the View/Edit link of the soapservice artifact type as shown below.
    select SOAP Service artifact type
  6. Add a new field after the Description field, and then click Save.

    Code Block
    languagexml
    <field type="options">
        <name label="WSDL">WSDL</name>
        <values class="org.sampl.rxt.populator.WSDLPopulator"/>
    </field>
  7. Click Main, and then click SOAP Services in the Add menu. You view the new field added with the populated drop-down list in the Add SOAP Service screen as shown below.
    view new field with drop down list
  8. Log in to the G-Reg Publisher using the following URL and admin/admin credentials: http://<G-REG_HOST>:<G-REG_PORT>/publisher
  9. Click the Add button in the SOAP Services box.
  10. Select Add a SOAP Service manually, and then click Continue. You view the new field added with the populated drop-down list in the Add SOAP Service screen as shown below.
    drop down populator in the G-Reg Publisher