Creating Governance Registry Artifacts
This page describes how to create artifacts for Governance Registry. It contains the following sections:
Creating a Registry Resource project
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.
- Open the Developer Studio dashboard (click Developer Studio > Open Dashboard) and click Registry Resources Project.
- 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.
- Select From existing template and click Next.
- In the Template field, select a template from the list. In this example, a WSDL file template is used.
- Specify a name for the
WSDL
file. - In the Registry Path field, define where you want to save the resource in the registry.
- 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.
- Click Finish.
- 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.
- Click the Import from file system option and click Next.
- Click Browse file or Browse folder and browse to the relevant file or folder.
- 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.
- In the Registry Path to deploy field, specify where the registry resource should be checked-in at the time of deployment.
- 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.
- 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.
- Click the Import Registry dump file from file system option and click Next.
- Click Browse and browse to the relevant file.
- In the Registry Path to deploy field, specify where the registry resource should be checked-in at the time of deployment.
- 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.
- Click Finish.
Check-out from registry
- Click Check-out from registry and click Next.
- Specify the path and artifact name.
- In the Registry Path to deploy field, specify where the registry resource should be checked-in at the time of deployment.
- 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.
- 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
- Open the Developer Studio dashboard (click Developer Studio > Open Dashboard) and click Registry Filter Project.
- Specify the project name, package name and class name.
- 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.
- Click Finish.
- 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.
- 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
- Open the Developer Studio 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 byorg.wso2.carbon.registry.core.jdbc.handlers.Handler
and a filter class extended byorg.wso2.carbon.registry.core.jdbc.handlers.filters.Filter
.
- 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.
- You can create a handler class in three ways.
- New Registry Handler Class - Create a handler class from scratch.
- 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). - Import From File System- Import a handler class from a
.jar
file.
- If you select the first option, specify a package name and class name.
- Select the handler properties and methods and click Next.
- Specify how you want to create the filter class.
- Already Existing Filter Class
- There are two classes that you can use as existing filter classes:
org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher
org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher
- The drop-down list will display other filter classes that are defined in the workspace. Select the filter classes and click Next.
- 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.
- Click Finish.
- There are two classes that you can use as existing filter classes:
- New Filter Class
- Specify the package name and filter class.
- Specify the filter properties and click Finish.
- Already Existing Filter Class
- 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.
- 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.
For more details on how to create a library artifact using WSO2 Developer Studio, see Java Library Project.
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 WSO2 Governance Registry management console.