This documentation is for WSO2 Enterprise Service Bus version 4.8.1 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The following code snippet shows how to programmetically take a registry resource that was written to a file and restore it to the WSO2 registry using Remote Registry.

import org.wso2.carbon.registry.app.RemoteRegistry;
import org.wso2.carbon.registry.core.exceptions.RegistryException;

import java.net.URL;
import java.net.MalformedURLException;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.IOException;

public class RemoteRegistrySampleTest {
  public static void main(String[] args) {
    System.setProperty("javax.net.ssl.trustStore", "CARBON_HOME/resources/security/client-truststore.jks");
    System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
    System.setProperty("javax.net.ssl.trustStoreType", "JKS");

    RemoteRegistry esb2xRemoteRegistry = null;
    try {
       esb2xRemoteRegistry = new RemoteRegistry(new URL("https://localhost:9443/registry"), "admin", "admin");
       esb2xRemoteRegistry.restore("/esb-resources", new FileReader("/home/heshan/Dev/wso2_heshan/temp/registry.xml"));
    } catch (RegistryException e) {
             e.printStackTrace();
    } catch (MalformedURLException e) {
             e.printStackTrace();
    } catch (IOException e) {
             e.printStackTrace();
    }
 }
}

  • No labels