This page describes how to create artifacts for Governance Registry. It contains the following sections:
You can save resources such as images, WSDLs, XSLTs in a central repository. We define them as Registry Resources. We save all these Registry Resources in a separate project called a Registry Resources Project. To create a Registry Resources Project, go to the Developer Studio dashboard and click Registry Resources Project.
Give a name to the project and click Finish.
Initially your project will contain only a pom file. You can create any number of Resgistry 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.
From Existing Template
Using the From Existing Template option, you can select a template from which you can create a registry resource. Here, we will select the WSDL File template. Give a name to the WSDL file. There's a field called Registry Path to Deploy where you can define where you want to save the resource in the registry. The Save Resource In field is to select the Registry Resources Projects in the workspace where you can save your resource file.
Now you will see the WSDL file has been generated with the name that we specified, and it will open in the embedded WSDL editor as shown.
In a similar way, you can create files from other templates as well.
Import from File System
With the Import from File System option, you can import a file or a folder. The same fields as before appear here, such as Registry Path to Deploy and Save Resource In fields. If you select a Folder as a Registry Resource, you will see the Copy Content Only check box being enabled. By default, this field is cleared so you will have a copy of the folder inside the location you specified in the Registry Path to Deploy field. If you select that option, it will only copy the content of the folder you have given in to the registry location you specified at Registry Path to Deploy.
Import Registry Dump File from File System
With this option, you can browse a Registry Dump file which you can use to sync a registry. Registry Path To Deploy is common for all the three options. You specify to where that registry resource should be checked-in at the time of deployment.
You may need to change the details you entered for the Registry Path to Deploy at a later stage. 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 per resource which can be edited accordingly.
To create a Registry Filter open the WSO2 Developer Studio Dashboard and click Registry Filter Project from the Governance Registry category.
Give details for the Project Name, Package Name and Class Name. A Maven POM file will be generated automatically for this project. If you want to add a parent project's POM information to this project's POM, click Next and specify the parent project. Otherwise, just click Finish.
Now you will see a Filter class being created according to the class name you have provided and it is extending the org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter class. The necessary libraries are added to your class path.
If you already have a Composite Application Project created in the workspace, the newly created Filter Project will also be added to the Composite Application Project pom file. If needed, you can create a new Composite Application Project project and select the dependencies.
To create a Registry Handler open the WSO2 Developer Studio Dashboard and click Registry Handler Project from the Governance Registry category.
To create a Registry Handler Project, you need to have two types of classes. Handler class which is extended by org.wso2.carbon.registry.core.jdbc.handlers.Handler and a Filter class which is extended by org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter.
The first page in the wizard relates to information of the Handler class. Give a name to the Handler Project and select the Handler Class creation method.
You can create a Handler class in two ways.
- New Registry Handler Class
- Import Handler Class from the workspace
With the first option, you can create a Handler class from scratch and if you select the second option, it will list all the classes that are being extended by org.wso2.carbon.registry.core.jdbc.handlers.Handler.
Fill the necessary information for Package Name and Class Name.
In the next page, you can select the Handler Properties Info and Handler Methods and click Next.
Then specify how you want to create the Filter class. As for the Handler, you can create the Filter class in two different ways.
- Already Existing Filter Class
- New Filter Class
If you select the first option, there are two classes that you can use as Existing Filter classes. These classes are available in the WSO2 Governance Registry product.
This drop-down box will display any other Filter classes that you have defined in the workspace.
Define the filter criteria and click Next if you want to add a parent project's POM information to this project's POM, or just click Finish.
Now you will see that the Handler Project has been created in the workspace. By default, the Registry Info Editor appears which shows you all the information you have given when creating the Handler Project. You can add new Handler Properties, add new Handler Methods, Filter Criteria etc.
In the same manner as for Filter Projects, you can include the created Handler Project in to a Composite Application Project and generate a Composite Application Archive [CAR] file to deploy your Handler in to WSO2 Governance Registry.
You can create a Registry Aspect class from WSO2 Developer Studio. 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. You can open the same wizard by clicking File -> New -> Other as well. In the wizard, go to WSO2 -> Extensions -> Service Extension Features.
Select WSO2 Registry Aspect Class and click Next.
Then you will get normal Eclipse class generating wizard page. Give necessary information and click Finish.
Now you will see the Aspect class is created which is 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.
Please refer the Third Party Java Library Artifact section for more details on how to create library artifact using WSO2 Developer Studio.
There, you have an option to select a project in your workspace when creating the library artifact. With that option, it will compile the selected project and make it a deployable bundle. To deploy the Registry Aspect that we have just created for WSO2 G-Reg server, first we will make it a library artifact. Select the project which has the created aspect class when creating the library artifact.
When creating a library artifact, select the Make this a fragment bundle check box. To deploy a bundle which includes the aspect class, we need to make it a fragment host of org.wso2.carbon.regisrty.core. Otherwise it will not be visible at the runtime. So select the check box and make org.wso2.carbon.regisrty.core as the fragment host. (Figure 35)
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 artefacts, 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 in the runtime.
You can access this class by configuring it via the registry.xml or through the WSO2 Governance Registry management console.