This documentation is for WSO2 Governance Registry 5.1.0. View documentation for the latest release.
||
Skip to end of metadata
Go to start of metadata

This sample demonstrates how to export a local file system to a remote registry and how to import a remote registry into a local file system. You can build your content in the local file system with your desired folder hierarchy, and you can include any type of content. Then you can use the registry API to export your local file system to the registry. Once you upload a local file system to the registry, you have socially enabled it. You can comment on its resources, you can tag it, you can rate it, etc.

You can also build your hierarchy in the registry with the structure you want, and then download or import the remote registry to your local file system. The registry will then create the exact same folder structure and download all the files in the registry.

Running the sample

Run Ant in the GREG_HOME/bin folder of the distribution.

ant

Prerequisites

1. Download the jaxen-1.1.1.jar here: http://www.java2s.com/Code/Jar/j/Downloadjaxen111jar.htm.

2. Place all of those jars in the GREG_HOME/repository/components/lib folder.

Exporting local file system into a remote registry

Run ant upload inside the {{GREG_HOME/samples/filesampleutils/src }}folder.

You will be asked for the following:

1. Key store file path - Provide GREG_HOME/repository/resources/security/client-truststore.jks

2. Registry URL - Provide https://localhost:9443/registry

Tip

If your registry is somewhere else, then give that path.

3. User name - If you have not changed the admin user, then use admin.

4. Password - Use admin.

5. FromPath - This is the file system location to export from. Enter the full path to the resources folder (For example, C:\test\test.txt).

6. ToPath - Where to put the resource. In this sample, you would use /sample/file.

7. If you log in to the management console, you can see that all of the files have been moved and that the registry has the same structure as the file system under the Resources listing.

Here is an example for /home/isuruw/test.txt.

Importing a file into the local file system

Run ant download first:

Provide values:

1. Key store file path : Provide GREG_HOME/repository/resources/security/client-truststore.jks

2. Registry URL - Provide https://localhost:9443/registry

Tip

If your registry is somewhere else, then give that path.

3. User name - If you have not changed the admin user, then use admin.

4. Password - Use admin.

5. FromPath - Resource path, such as /sample/file.

6. ToPath - Where to put the resource in the local file system. In this sample, you would use C:\Documents and Settings\test.

7. Once you run Ant, you will see a newly created folder hierarchy in the path you specified.

Example for test.txt:

 

/home/isuruw/test.txt

  • No labels