log.info("initialise {}",getClass().getSimpleName());
//The constructors and the setConfiguration(..) only validate the parsed
//parameters and initialise the member variables. This method performs
//the the actual initialisation of the SolrYard!
//copy a custom configuration (if present)
EmbeddedSolrServer server;
IndexReference solrServerRef = IndexReference.parse(solrYardConfig.getSolrServerLocation());
if(solrIndexConfig != null){ //can only be != null if also solrIndexLocation
//copy the configuration
try {
log.info(" ... copy Solr Configuration form {} to {}",solrIndexConfig,solrIndexLocation);
FileUtils.copyDirectory(solrIndexConfig, solrIndexLocation);
} catch (IOException e) {
throw new IllegalStateException(String.format(
"Unable to copy the Solr index configuration from %s to %s!",
solrIndexConfig,solrIndexLocation),e);
}
solrYardConfig.setAllowInitialisation(Boolean.FALSE);
server = StandaloneEmbeddedSolrServerProvider.getInstance().getSolrServer(
solrServerRef,solrServerRef.getIndex());
} else {
//allow the default initialisation
log.info(" ... use default Solr Configuration");
solrYardConfig.setAllowInitialisation(Boolean.TRUE);
server = StandaloneEmbeddedSolrServerProvider.getInstance().getSolrServer(
solrServerRef,solrYardConfig.getIndexConfigurationName());
}
log.info(" ... create SolrYard");
this.solrYard = new SolrYard(server,solrYardConfig,indexingConfig.getNamespacePrefixService());
this.core = server.getCoreContainer().getCore(solrServerRef.getIndex());
}