The WS Registry API exposes a complete set of registry operations that can be accessed through Web Service calls.
This readme explains how to run the sample that uses the WS Registry client sample.
Pre - Requirements
Before getting the sample to work you have to run ant from GREG_HOME/bin. This copies all the necessary libraries to their respective locations.
Start the WSO2 Governance Registry by running the respective script (wso2server.sh or wso2server.bat) from GREG_HOME/bin.
Steps to get this sample to work
Execute the ant command ant run from the ws-client sample directory.
Each operation that occurred will be printed on the console.
A resource will be created in root by the name of abc (i.e. path = \abc).
This can be checked through the Resource Browser which can be accessed through the Management Console.
Exporting/importing a file to Remote registry
Introduction
This sample demonstrates how to export a local file system into a remote registry, and how to import
a remote registry into a local file system. We can build our content in the local file system with
the folder hierarchy we want, including any type of content. Then we can use the registry API to
export our local file system into the registry.
Once we upload a local file system into the registry we have socially enabled it.
We can comment on resources, we can tag, we can rate, etc...
We can also build our hierarchy in the Registry with the structure we want, and then we can download
or import the remote registry into our local file system. Then the registry will create the exact
same folder structure and download all the files in the registry.
Running the sample
Running the sample is just a matter of executing an ant file. If you don't
have ant, you can download it at http://ant.apache.org/.
Run ant at the GREG_HOME/bin folder of the distribution.
Exporting local file system into a remote registry
Run ant upload inside the GREG_HOME/samples/filesampleutils/src folder.
You will be asked for:
Key store file path: Provide GREG_HOME/repository/resources/security/client-truststore.jks
Registry URL : Provide https://localhost:9443/registry
(If your registry is in somewhere else then give that path)
User name : If you have not changed the admin user then pass admin
Password : Use admin
FromPath : Location in the file system to export from. Enter the
full path to the resources folder (eg:- C:\test\test.txt)
ToPath : Where to put the resource. In this sample let's use
/sample/file
If you login to the management console you can see that all the files have been
moved and the registry has the same structure as the filesystem under
Resources listing.
Importing a file into the local file system
Now we go the other way. Again, run ant download first, and provide values:
Key store file path : Provide GREG_HOME/repository/resources/security/client-truststore.jks
Registry URL : Provide https://localhost:9443/registry
(If your registry is in somewhere else then give that path)
User name : If you have not changed the admin user then pass admin
Password : Use admin
FromPath : Resource path, such as /sample/file
ToPath : Where to put the resource in the local filesystem. For this
sample let's use C:\Documents and Settings\test
Once you run ant you will see a newly created folder hierarchy in the path you specified.
Project Proposal Handler Sample
Introduction
The idea of this sample is to demonstrate how to use media type handlers. The sample
application is to process project proposals, so we'll be using a component that intercepts
Registry put() requests with a particular proposal media-type. The Handler will read
the proposal and mark it as valid or not. In order to be a valid proposal there should be
a number of fields - if all of them are there then the handler will mark the proposal as
valid. If one or more fields are missing then the proposal would be invalid.
Copy the org.wso2.carbon.registry.samples.handler-3.2.0.jar into
GREG_HOME/repository/components/dropins.
You also can upload handlers through the administration console by visiting the Extensions --> Add menu.
Edit the registry.xml file which is in GREG_HOME/repository/conf folder with the following xml snippet.<handler class="org.wso2.carbon.registry.samples.handler.ProjectProposalMediaTypeHandler" methods="PUT">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">pp</property>
</filter>
</handler>
You also can add the handler configuration through the administration console by opening the
Handlers configuration (Extensions --> Configure --> Handlers) menu and clicking on Add New Handler.
Start the server.
Go to admin console.
Browse the resources tree and add a new resource by visiting Resources --> Browse menue.
Select the Upload content from file from the drop down list.
Select your project proposal and type the media type as pp (you can use whatever the media type you prefer).
Note:- Sample project proposals are available in GREG_HOME/samples/handler/src/resources folder.
And Add it.
Browse to the added project proposal. You could see the Properties and the Tag have been added to the resource..
Custom UI Sample
This sample demonstrates how a simple custom UI can be created to add, view, and edit,
endpoints stored on the WSO2 Governance Registry. Please note that the Resource Name,
Endpoint Name and the Endpoint URI are mandatory fields, and The URI must be valid.
Adding an endpoint reference as a resource
Drop the sample's jars into GREG_HOME/repository/components/dropins.
Copy org.wso2.carbon.registry.samples.custom.topics-3.2.0.jar into the dropins folder.
Copy org.wso2.carbon.registry.samples.custom.topics.ui-3.2.0.jar into the dropins folder.
Restart the server and Log in to the admin console and go to the Resources menu.
Click Add Resource link to add a new resource and choose Create custom content from Method combo box.
A text box named Media type will be displayed, from which select other option from drop down button for media type.
Enter epr as the media type.
Click Create Content. A form to fill endpoint details will be displayed.
Fill the form and click Save. The resource will be added.
Browsing the resource
Browse the added resource from the Entries table and click on it.
The content of the resource will be shown in a custom view.
The content can be edited by clicking Edit endpoint.
Shutterbug Sample
The idea of this sample is to demonstrate how to use the WSO2 Governance Registry to build
real world applications. This sample is designed to be used to host a competition on the
WSO2 Governance Registry that will select 12 images out of several hundreds of images to
be published on a calendar. Each user will be allowed to upload up to 2 images, and can
vote for 12 images. Finally the administrators can browse the images with the highest
number of votes and decide on the winners.
Copy org.wso2.governance.samples.shutterbug.ui/src/main/resources/web/shutterbug/resources/crossdomain.xml
in to the tomcat's ROOT context.
Copy the jars found in GREG_HOME/samples/shutterbug/bin to GREG_HOME/repository/components/dropins.
Set the Index Page URL in GREG_HOME/repository/conf/carbon.xml as follows.<IndexPageURL>/carbon/shutterbug/shutterbug-ajaxprocessor.jsp</IndexPageURL>
Start the server.
Go to the admin console.
Cooliris 3D Embed Wall
This sample uses the Cooliris 3D Embed Wall (online), to display uploaded images. More
information on how to use the Cooliris 3D Embed Wall, and Terms and Conditions of usage
can be found at http://www.cooliris.com.
JCR Sample
This sample demonstrates how a simple JCR Client is using the JCR implementation of WSO2 G-Reg and doing sample operations through JCR API to the running G-Reg instance.
Pre - Requirements
Before getting the sample to work you have to run ant from GREG_HOME/bin. This copies all the necessary libraries to their respective locations.
Start the WSO2 Governance Registry by running the respective script (wso2server.sh or wso2server.bat) from GREG_HOME/bin.
Steps for running this sample
Run the ant command ant run, which will add a set of Collections and Resources to the Registry.
Login to the Registry and see the added Collections and Resources.