Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2017 redlink GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.redlink.solrlib.cloud;
import io.redlink.solrlib.SolrCoreContainer;
import io.redlink.solrlib.SolrCoreDescriptor;
import io.redlink.utils.PathUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.common.util.NamedList;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
/**
*/
public class SolrCloudConnector extends SolrCoreContainer {
private final SolrCloudConnectorConfiguration config;
private final String prefix;
public SolrCloudConnector(Set coreDescriptors, SolrCloudConnectorConfiguration configuration) {
this(coreDescriptors, configuration, null);
}
public SolrCloudConnector(Set coreDescriptors, SolrCloudConnectorConfiguration configuration, ExecutorService executorService) {
super(coreDescriptors, executorService);
this.config = configuration;
this.prefix = StringUtils.defaultString(configuration.getPrefix());
}
@Override
protected void init(ExecutorService executorService) throws IOException, SolrServerException {
final Path sharedLibs = Files.createTempDirectory("solrSharedLibs");
try (CloudSolrClient client = createSolrClient()) {
final NamedList