Example usage for org.apache.solr.client.solrj.response ConfigSetAdminResponse.List getErrorMessages

List of usage examples for org.apache.solr.client.solrj.response ConfigSetAdminResponse.List getErrorMessages

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.response ConfigSetAdminResponse.List getErrorMessages.

Prototype

@SuppressWarnings("unchecked")
    public NamedList<String> getErrorMessages() 

Source Link

Usage

From source file:org.wso2.extension.siddhi.store.solr.impl.SolrClientServiceImpl.java

License:Open Source License

public boolean collectionConfigExists(String table) throws SolrClientServiceException {
    ConfigSetAdminResponse.List listRequestReponse;
    SiddhiSolrClient siddhiSolrClient = getSolrServiceClientByCollection(table);
    String tableNameWithDomain = SolrTableUtils
            .getCollectionNameWithDomainName(tableToConfigMapping.get(table).getDomainName(), table);
    ConfigSetAdminRequest.List listRequest = new ConfigSetAdminRequest.List();
    try {/* w w w.  j av  a 2s  .  c  o  m*/
        listRequestReponse = listRequest.process(siddhiSolrClient);
        Object errors = listRequestReponse.getErrorMessages();
        if (listRequestReponse.getStatus() == 0 && errors == null) {
            return listRequestReponse.getConfigSets().contains(tableNameWithDomain);
        } else {
            throw new SolrClientServiceException("Error in checking the existance of index configuration for "
                    + "table: '" + table + "', Response code: " + listRequestReponse.getStatus() + " , errors: "
                    + errors.toString());
        }
    } catch (IOException | SolrServerException | SolrException e) {
        throw new SolrClientServiceException("Error while checking if index configurations exists for table: "
                + table + ", error: " + e.getMessage(), e);
    }
}