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)

The elements of a RXT define all the properties with respect to an asset type that is stored in WSO2 G-Reg. A drop-down field corresponding to an RXT element is generally populated using static values that are defined in the RXT of that particular asset type. However, you can dynamically populate values to a drop-down field of an RXT element.

...

  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;
     }
    }
  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