This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Registry Artifacts

This page describes how to create artifacts for Registry. It contains the following sections:

Creating a Registry Resource project

Note that registry resources created in WSO2 EI Tooling (and deployed via Composite Applications) will only support the registry aspect and not the governance aspect when used with Registry.

You can save resources such as images, WSDLs, XSLTs in a central repository as registry resources. All these registry resources need to be saved in a separate project called a Registry Resources project. To create a Registry Resources project, follow the steps below.

  1. Open the WSO2 EI Tooling dashboard (click Developer Studio > Open Dashboard) and click Registry Resources Project.
  2. Give a name for the project and click Finish.

     

Creating registry resources

Initially, your registry resources project will contain only a pom file. You can create any number of registry resources inside that project. To create a registry resource, right click on the Registry Resources project and click New > Registry Resource.

There are several ways to create a registry resource. Follow the instructions in the sections below.

From existing template

Use the From existing template option if you want to select a template from which to create a registry resource. 

  1. Select From existing template and click Next.
  2. In the Template field, select a template from the list. In this example, a WSDL file template is used. 
  3. Specify a name for the WSDL file. 
  4. In the Registry Path field, define where you want to save the resource in the registry. 
  5. In the Save Resource in field, select an existing Registry Resource project in which you want to save the resource. Alternatively, you can create a new Registry Resource project. 

     

  6. Click Finish.
  7. Now you will see the WSDL file generated with the specified name and opened in the embedded WSDL editor as shown below.

     

Import from file system

Use the Import from file system option to import a file or a folder containing registry resources.

  1. Click the Import from file system option and click Next.
  2. Click Browse file or Browse folder and browse to the relevant file or folder.
  3. If you browsed to a folder, the Copy content only check box will be enabled. Select the check box if you want to copy only the content of the folder and not the folder itself to the location you specify below.
  4. In the Registry Path to deploy field, specify where the registry resource should be checked-in at the time of deployment. 
  5. In the Save Resource in field, select an existing Registry Resource project in which you want to save the resource. Alternatively, you can create a new Registry Resource project. 
  6. Click Finish.

     

Import Registry dump file from file system

Use this option to browse to a Registry Dump file which you can use to sync a registry. 

  1. Click the Import Registry dump file from file system option and click Next.
  2. Click Browse and browse to the relevant file.
  3. In the Registry Path to deploy field, specify where the registry resource should be checked-in at the time of deployment. 
  4. In the Save Resource in field, select an existing Registry Resource project in which you want to save the resource. Alternatively, you can create a new Registry Resource project. 
  5. Click Finish.

Check-out from registry

  1. Click Check-out from registry and click Next.
  2. Specify the path and artifact name. 
  3. In the Registry Path to deploy field, specify where the registry resource should be checked-in at the time of deployment. 
  4. In the Save Resource in field, select an existing Registry Resource project in which you want to save the resource. Alternatively, you can create a new Registry Resource project. 
  5. Click Finish.

Editing a registry resource

You may need to change the details you entered for a registry resource, for example, the registry path. You can edit such information using the Registry Resource Editor. To open the Registry Resource Editor, right-click on the Registry Resources project and click Registry Resource Editor.

This editor lists all the registry resources that you have defined in that project and it will list the Registry Path to Deploy information per resource.

Creating a registry filter project

  1. Open the WSO2 Ei Tooling dashboard (click Developer Studio > Open Dashboard) and click Registry Filter Project.
  2. Specify the project name, package name and class name. 
  3. A Maven POM file will be generated automatically for this project. If you want to include parent POM information in the file from another project in this workspace, click Next, click the Specify Parent from Workspace check box, and then select the parent project.
  4. Click Finish.

     


  5. A filter class extending the org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter class is created according to the class name you provided. The necessary libraries are added to your class path.

     


  6. If you already have a Composite Application Project created in the workspace, the newly created filter project will also be added to the pom file of the Composite Application Project. If needed, you can create a new Composite Application Project project and select the dependencies.

     

Creating a registry handler project

  1. Open the WSO2 EI Tooling dashboard (click Developer Studio > Open Dashboard) and click Registry Handler Project.

    To create a
    Registry Handler project, you need to have two types of classes. A Handler class extended by org.wso2.carbon.registry.core.jdbc.handlers.Handler and a filter class extended by org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter.
     
  2. The first page in the wizard relates to information of the handler class. Specify a name for the handler project and select the handler class creation method.

     


  3. You can create a handler class in three ways.
    1. New Registry Handler Class - Create a handler class from scratch.
    2. Import From Workspace - Select a handler class from the list of classes (all classes that are being extended by org.wso2.carbon.registry.core.jdbc.handlers.Handler will be listed).
    3. Import From File System- Import a handler class from a .jar file.
  4. If you select the first option, specify a package name and class name.

     

  5. Select the handler properties and methods and click Next.

     

  6. Specify how you want to create the filter class. 
    1. Already Existing Filter Class
      1. There are two classes that you can use as existing filter classes:
        1. org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher
        2. org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher
      2. The drop-down list will display other filter classes that are defined in the workspace. Select the filter classes and click Next.

         

      3. If you want to include parent POM information in the file from another project in this workspace, click Next, click the Specify Parent from Workspace check box, and then select the parent project.
      4. Click Finish.
    2. New Filter Class
      1. Specify the package name and filter class.
      2. Specify the filter properties and click Finish.
  7. The Handler project is created in the workspace. By default, the Registry Info Editor appears, displaying all the information you have given when creating the Handler project. You can add new handler properties, handler methods, filter criteria, etc.

     

  8. You can include the created Handler project in a Composite Application project and generate a Composite Application Archive (CAR) file to deploy your Handler in WSO2 Governance Registry.

Creating a registry aspect class

To create a Registry Aspect Class, select any java project or any artifact type project that you have created in your workspace and press Ctrl + n to open the New wizard. Alternatively, you can click File > New > Other. In the wizard that appears, browse to WSO2 > Extensions > Service Extension Features.

Select WSO2 Registry Aspect Class and click Next.

 

The Eclipse class generating wizard page appears. Specify the necessary information and click Finish.

The Aspect class is created extended from the org.wso2.carbon.registry.core.Aspect super class.

You can implement the functionality you want in this class and deploy this aspect class in to WSO2 Governance Registry by making it a library artifact.

Create a library artifact from the workspace and select the project in which the Aspect class was created. The selected project will be compiled and made in to a deployable bundle.

When creating a library artifact, select the Make this a fragment bundle check box and specify org.wso2.carbon.regisrty.core as the fragment host. To deploy a bundle which includes the aspect class, it needs to be a fragment host of org.wso2.carbon.regisrty.core. Otherwise, it will not be visible at runtime. 

Now you can deploy this library artifact in to WSO2 G-Reg as a CAR file by including it to a Composite Application project. Before creating the CAR file, make sure to change the server role of the created library bundle to GovernanceRegistry. For library artifacts, the default server role is set as ApplicationServer. To deploy it to WSO2 Governance Registry, you need to change it to the correct server role.

After deploying the library artifact, you will have to restart the server to make the Aspect class available at runtime.

You can access this class by configuring it via the registry.xml file or through the Management Console of the product.

Creating a Smooks configuration artifact

Smooks is an extensible framework for building applications that process data, such as binding data objects and transforming data. To create a Smooks configuration artifact, you must first create a registry resource as described in Creating Governance Registry Artifacts. When creating the registry resource, select the From Existing Template option and select Smooks Configuration as the template.

The smooksconfig.xml file is created. Double-click it in the Project Explorer to open it in the embedded JBoss Smooks editor.
 

 

Click Input Task, create the data mapping, and save the configuration file. 

Before you can run the Smooks configuration, you must add libraries from the Smooks framework to your registry resources project.

  1. Right-click the registry resources project in the Project Explorer and click Properties.
  2. In the list on the left, click Java Build Path, and then click the Libraries tab. 

  3. Click Add Library, click WSO2 Classpath Libraries, and then click Next.
  4. In the WSO2 Classpath Libraries dialog box, click the Smooks tab, click Select All, and click Finish.
  5. In the Properties dialog box, click OK.

All the Smooks-related libraries have been added to the project classpath. You can now run the Smooks configuration file by right-clicking the file and choosing Run As > Smooks Run Configuration. If your Smooks configuration is correct, the console displays the results according to the input model and output model you specified.

You can now add the Smooks configuration artifact to a proxy service or sequence to use it in the EI. To do so, create a proxy service. Drag and drop a Log mediator and a Smooks mediator to the InSequence. Double-click on the Smooks mediator to see the Property view. Click the button at the right hand corner of the Configuration Key field.

The Resource Key Editor dialog box appears. Specify from where you should select the resource file.

Select Workspace option since we have the created Smooks Configuration in our workspace. Browse for the Smooks Configuration file that we have created and click OK.

Now you have successfully referred to the Smooks configuration within your proxy service.