Carbon StudioDownloadsDocumentation
SamplesGet InvolvedProject Information![]() |
Registry ToolsContentRegistry ConnectionWhen you are creating artifacts, you may need to point to resources inside a running registry instance. For that, first you need a create a registry connection to that running server.For this release, we support only WSO2 Governance Registry version 3.5 or higher. To create a registry connection, right click on the CApp project select New and then select Registry Connection from the menu, as shown in Figure 1.![]() Figure 1 Give a name, URL and path for the registry connection and click Finish (Figure 2). Default information is filled for you. You can change them with your preference. ![]() Figure 2 Now you will see a new registry connection is created with the given name, under Registry Connections folder. When you right click on the newly created registry instance, you have two options as shown in Figure 3. You can either open it on the WSO2 Registry Browser which gives you the ability to add, view and manage resources and collections or you can delete the added registry instance.
![]() Figure 3 When you select Open option, Figure 4 shows how it will be opened in the WSO2 Registry Browser.
![]() Figure 4 Now you have successfully created a registry instance. You can point resources from the created WSO2 Governance Registy instance when you create other artifact types. Registry ResourceTo create a registry resource, right click on the CApp project select New and then select Registry Resource from the menu as illustrated in Figure 5.
![]() Figure 5 There are four ways to create a registry resource.
![]() Figure 6 From existing template option, you can select a template from which you can create a registry resource. Here, we will select WSDL File template. (Figure 7) ![]() Figure 7 Give the necessary information as you preferred and Click Next. (Figure 8)
![]() Figure 8 Give a name to the artifact if it is not filled already and Click Finish. (Figure 9)
![]() Figure 9 Now you will see wsdl-config file has been created and it will be open in the embedded WSDL editor as shown in Figure 10.
![]() Figure 10 With the Import from File System option, you can import a file or a folder. (Figure 11)
![]() Figure 11 With the Check-out from registry option, you can point to a collection or resource in the registry. You can browse resources from the registry instance that you have already created or you can create a new registry instance as well. After selecting the registry instance, click on Browse to browse resources in registry. (Figure 12)
![]() Figure 12 With the Import registry dump file from file system, you can browse resources of the registry instance that you have already created or you can create a new registry instance as well. After selecting the registry instance, click on Browse to browse resources in registry. (Figure 13)
![]() Figure 13 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. (Figure 14)
![]() Figure 14 Select the CApp project you want to create the Registry Resource and click Finish. (Figure 15)
![]() Figure 15 Now you will see new registry resource has been created under the selected CApp project as shown in Figure 16.
![]() Figure 16 If you look in to the structure of Registry Resource that you have just created, you will see there is an extra file called registry-info.xml. (Figure 17)
![]() Figure 17 This file is to keep all the necessary information regarding the registry resource. (Figure 18)
![]() Figure 18 Registry FilterTo create a Registry Filter Artifact, right click on the CApp project select New and then select Registry Filter from the menu as shown in Figure 19.
![]() Figure 19 There are two ways to create an Registry Filter Artifact.
Figure 20 If you do not have any projects with Filter class, you can create a new class extending org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter base class by clicking on New button of the From Workspace option. Give the necessary information and it will create a class, extending the base class. (Figure 21)
Figure 21 With the second option, you can point a jar file which contains a filter class from the file system. (Figure 22)
Figure 22 Select the CApp project you want to create Registry Filter Artifact and give a name to the Registry Filter Artifact as shown in Figure 23. Then click Finish.
Figure 23 Now you will see a new Registry Filter Artifact has been created under Artifacts folder of the CApp project. Registry HandlerTo create a Registry Handler Artifact, right click on the CApp project select New and then select Registry Handler from the menu. (Figure 24)
Figure 24 To create a Registry Handler Artifact, 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. If you have a class extending org.wso2.carbon.registry.core.jdbc.handlers.Handler in the workspce, information regarding that class and project will be filled for you. (Figure 25)
Figure 25 You can create a new Handler class by clicking on New option as well. (Figure 26)
Figure 26 You can select Handler Properties and Handler methods and click Next. (Figure 27)
Figure 27 In the next wizard page, you have to give the information regarding Filter class. If you have Filter class already in the workspace, those information will be filled in the drop-down box. (Figure 28)
Figure 28 As you did for Handlers, you can create a new Filter class by clicking New option. Define filter criteria and click Next. Select the CApp project you want to create Registry Handler Artifact and and give a name to the Registry Handler Artifact. Then click Finish. (Figure 29)
Figure 29 Now you will see a new Registry Handler Artifact has been created under Artifacts folder of the CApp project, as shown in Figure 30.
Figure 30 Registry AspectYou can create a Registry Aspect class from WSO2 Carbon Studio. To create a Registry Aspect class, select the C-App project and press Ctrl + n to open the New wizard. You can open the same wizard by File -> New -> Other as well. Select WSO2 Registry Aspect and click Next, as shown in Figure 31.
![]() Figure 31 Then you will get normal Eclipse class generating wizard page. (Figure 32)
![]() Figure 32 Give necessary information and click Finish. (Figure 33)
![]() Figure 33 Now you will see Aspect class is created which is extended from org.wso2.carbon.registry.core.Aspect super class. (Figure 34)
![]() Figure 34 You can implement the functionality you want in this class and deploy this aspect class in to WSO2 G-Reg 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. 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, 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)
![]() Figure 35 Now you can deploy this library artifact in to WSO2 G-Reg as a CAR file.Before deploying the CAR file in to server, make sure server role of created library bundle is GovernanceRegistry. For library artifacts default server role is set as ApplicationServer. (Figure 36)
![]() Figure 36 To deploy it to WSO2 G-Reg, you need to change it to correct server role.(Figure 37)
![]() Figure 37 After deploying the library artifact, you will have to restart the server to make Aspect class available in the runtime. You can access this class by configure it via registry.xml or through the WSO2 G-Reg management console. |