RemoteRegistry is a Java API for interacting with a Registry instance. Regardless of where a given Registry instance is located, either locally or remotely, you can still talk to it using
RemoteRegistry is yet another implementation of
org.wso2.registry.Registry interface. However, the difference between the
RemoteRegistry and a standard
Registry is that, the
RemoteRegistry is not an actual registry but a client for interacting with a registry instance.
Communication between the
Registry and the
RemoteRegistry takes place using the Atom Publishing Protocol (APP). When we start the registry server, an atom feed is generated. Thereafter, if you browse https://localhost:9443/registry/atom/ (this address changes depending on your application server settings), you'd be able to see the atom feed from the registry.
How to Create an Instance of the
1. Create an instance of the
RemoteRegistry. For that purpose, figure out the URL of a registry. If the root of the registry is , the URL for the
RemoteRegistry instance would be .
2. Once the URL is figured out, create an instance of the
RemoteRegistry using the following code:
Creating an instance of the
RemoteRegistry in this manner, is similar to accessing a registry without login into it with communication taking place as an anonymous user.
If you have a user name and password for the registry, you can pass them along when creating the
remote_registry instance. At that point, all permissions granted for the particular username/password pair will apply to the owner of the
remote_registry with user name and the password can be done using:
In this example, the
remote_registry instance username with the value "admin" and the password as also "admin".
Using the Registry API
You can learn how to use Registry API from the Registry API section.
Importing the Local File System to the Registry
You can use the
RemoteRegistry to export your entire local file system into the Registry.
1. Give the location of the file system and the location where you want to put them in the Registry.
2. Once you do that, inside the registry, it will create the same structure as the file system and upload all files into the Registry. This can be considered as any check-in operation on any kind of version management system.
3. The following code demonstrates how to import a local file system into the Registry:
Exporting the Registry to a File System
1. To export, select either the entire Registry or a selected node.
2. Depending on the node selected, the
remote_registry instance will create the same structure within the file system. Even if you have the resource with binary data, it will create all of the necessary files in the file system.
For example, to export "/myFile/filesystem" into my local file system then we can use the following code: