Versions Compared

Key

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

...

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 seperate project called Registry Resources Project. To create a Registry Resources Project, go to File -> New -> Projects -> WSO2 -> Repository and select Registry Resources Project.
New Server RuntimeImage Removed
New Server RuntimeImage Added

Give a name to the project and click Finish.
New Server RuntimeImage Removed
New Server RuntimeImage Added

Initially your project will only contains 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 select Registry Resource from New menu.



New Server RuntimeImage Removed New Server RuntimeImage Added

There are several ways to create a Registry Resource.



New Server RuntimeImage Removed New Server RuntimeImage Added

From Existing Template

From Existing Template option, you can select a template from which you can create a registry resource. Here, we will select WSDL File template. Give a name to the WSDL file. There's a field called Registry Path to Deploy which is to define where you want to save the resource in the registry. Save Resource In field is to select the Registry Resources Projectsin the workspace in where you can save your resource file.

New Server RuntimeImage Removed New Server RuntimeImage Added 

New Server RuntimeImage Removed New Server RuntimeImage Added

Now you will see WSDL file has been generated with the name that we specified and it will open in the embedded WSDL editor as shown.

New Server RuntimeImage Removed New Server RuntimeImage Added

In the similar way, you can create files from other templates as well.

...

With the Import from File System option, you can import a file or a folder.

New Server RuntimeImage Removed New Server RuntimeImage Added

With this also, you have the same fields such as Registry Path to Deploy and Save Resource In fields. If you select a Folder as a Registry Resource, you will see a Copy Content Only check box being enabled. By default, this field is un-tick in the sense that you will have a copy of the folder inside the location you specified in the field Registry Path to Deploy. If you tick 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.

...

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

New Server RuntimeImage Removed New Server RuntimeImage Added

Registry Path To Deploy is common for all the three options. With this, you are specifying, to where that registry resource should be checked-in at the time of deployment.

You may need to change the details you enter for Registry Path to Deploy at the later stage. You can edit such information with Registry Resource Editor. To open the Registry Resource Editor, right click on the Registry Resources Project and there is a menu item called Registry Resource Editor.

New Server RuntimeImage Removed New Server RuntimeImage Added

This editor list all the registry resources that you have defined in that project and it will list Registry Path to Deploy per resource and you can edit that according to your need.

New Server RuntimeImage Removed New Server RuntimeImage Added

Registry Filter

To create a Registry Filter open WSO2 Developer Studio Dashboard and select Registry Filter Project from Governance Registry category.

New Server RuntimeImage Removed New Server RuntimeImage Added

Give details for Project Name, Package Name and Class Name and clicl Finish.

New Server RuntimeImage Removed New Server RuntimeImage Added

Now you will see a Filter class being created according to the class name you have provided and it is extending org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter class. Necessary libraries are added to your classpath in order to make your life easy.

New Server RuntimeImage Removed New Server RuntimeImage Added

If you already have a Carbon Application Project that is being created in the workspace, newly created Filter Project will also be added to the Carbon Application Project pom. If needed, you can create a new Carbon Application Project project and include the

New Server RuntimeImage Removed New Server RuntimeImage Added

Registry Handler

To create a Registry Handler open WSO2 Developer Studio Dashboard and select Registry Handler Project from Governance Registry category.

New Server RuntimeImage Removed New Server RuntimeImage Added

To create a Registry Handler Project, you need to have two types of classes. Handler class which is exteneded 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.

First wizard page is regarding information of Handler class. Give a name to the Handler Project and select the Hadler Class creation method.

New Server RuntimeImage Removed New Server RuntimeImage Added

You can create a Handler class in two ways.

...

With the first option, you can create a Handler class from the scratch and if you select the second option, it will list all the classes that are bieng exteneded by org.wso2.carbon.registry.core.jdbc.handlers.Handler. Suppose I select the first option and click Next. Fill the necessary information for Package Name and Class Name.
New Server RuntimeImage Removed
New Server RuntimeImage Added

In the next page, you can select Handler Properties Info and Handler Methods and click Next.

New Server RuntimeImage Removed New Server RuntimeImage Added

Then it will ask 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

New Server RuntimeImage Removed New Server RuntimeImage Added

If you select the first option, there are two classes that you can use as Existing Filter classes. These classes are available in WSO2 Governance Registryproduct.

...

This drop-down box will display any other Filter classes that you have defined in the workspace.
New Server RuntimeImage Removed
New Server RuntimeImage Added

Define filter criteria and click Finish.

New Server RuntimeImage Removed New Server RuntimeImage Added

Now you will see the Handler Project has been created in the workspace. By default, it will open Regisrty Info Editor which shows you all the information that you have given when creating the Handler Project. You can add new Handler Properties, add new Handler Methods, Filter Criteria etc.

New Server RuntimeImage Removed New Server RuntimeImage Added

As the same manner you did for Filter Projects, you can include the created Handler Project in to a Carbon Application Project and generate Carbon Application Archive [CAR] file to deploy your Handler in to WSO2 Governance Registry.

...

Select WSO2 Registry Aspect Class and click Next.

New Server RuntimeImage Removed New Server RuntimeImage Added

Then you will get normal Eclipse class generating wizard page. Give necessary information and click Finish.

New Server RuntimeImage Removed New Server RuntimeImage Added

Now you will see Aspect class is created which is extended from org.wso2.carbon.registry.core.Aspect super class.

New Server RuntimeImage Removed New Server RuntimeImage Added

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

Please refer Third Party Java Library Artifact section for more details on how to create library artifact using WSO2 Carbon Studio.

...

When creating a library artifact, there is a checkbox called Make this a fragment bundle. 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 we will check that check box and make org.wso2.carbon.regisrty.core as the fragment host. (Figure 35)

New Server RuntimeImage Removed New Server RuntimeImage Added 

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

To deploy it to WSO2 Governance Registry, you need to change it to correct server role.

...