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

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

Introduction

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

Prototype

public void uploadConfig(Path configPath, String configName) throws IOException 

Source Link

Document

Upload a set of config files to Zookeeper and give it a name NOTE: You should only allow trusted users to upload configs.

Usage

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

License:Open Source License

/**
 * Uploads the Solr config set files into Zookeeper.
 *
 * @see <a href="https://lucene.apache.org/solr/7_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 upload the configuration files from.
 *
 * @throws DSException Solr Data Source exception.
 * @throws IOException Zookeeper I/O exception.
 *//*  w w w . j ava 2 s. co m*/
public void uploadFolderFiles(String aConfigSetName, String aPathName) throws DSException, IOException {
    Logger appLogger = mAppMgr.getLogger(this, "uploadFolderFiles");

    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.uploadConfig(folderPath, aConfigSetName);
    } else
        throw new DSException(String.format("%s: Does not exist!", aPathName));

    appLogger.trace(mAppMgr.LOGMSG_TRACE_DEPART);
}