Example usage for org.apache.solr.client.solrj.impl ZkClientClusterStateProvider downloadConfig

List of usage examples for org.apache.solr.client.solrj.impl ZkClientClusterStateProvider downloadConfig

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.impl ZkClientClusterStateProvider downloadConfig.

Prototype

public void downloadConfig(String configName, Path downloadPath) throws IOException 

Source Link

Document

Download a named config from Zookeeper to a location on the filesystem

Usage

From source file:com.nridge.ds.solr.SolrConfigSet.java

License:Open Source License

/**
 * Downloads the Solr config set files from Zookeeper.
 *
 * @see <a href="https://lucene.apache.org/solr/6_6_0/solr-solrj/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.html">Solr ZkClientClusterStateProvider</a>
 *
 * @param aConfigSetName Config set name.
 * @param aPathName Name of a path to store the configuration files.
 *
 * @throws DSException Solr Data Source exception.
 * @throws IOException Zookeeper I/O exception.
 */// w  w  w  .  j  a  va  2 s.  co  m
public void download(String aConfigSetName, String aPathName) throws DSException, IOException {
    Logger appLogger = mAppMgr.getLogger(this, "download");

    appLogger.trace(mAppMgr.LOGMSG_TRACE_ENTER);

    File pathFile = new File(aPathName);
    if (pathFile.exists()) {
        initialize();

        Path folderPath = Paths.get(aPathName);
        ZkClientClusterStateProvider zkClientClusterStateProvider = mSolrDS.getZkClusterStateProvider();
        if (zkClientClusterStateProvider == null)
            throw new DSException("Unable to obtain the Zookeeper client cluster state instance.");
        zkClientClusterStateProvider.downloadConfig(aConfigSetName, folderPath);
    } else
        throw new DSException(String.format("%s: Does not exist!", aPathName));

    appLogger.trace(mAppMgr.LOGMSG_TRACE_DEPART);
}