This documentation is for WSO2 ESB version 4.0.2. View documentation for the latest release.

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 Next »

Following code shows, how to programmetically backup WSO2 Registry Resource to a file using RemoteRegistry.

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.dump("/esb-resources", new FileWriter("/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