Java Code Examples for org.apache.solr.core.SolrXmlConfig#fromInputStream()
The following examples show how to use
org.apache.solr.core.SolrXmlConfig#fromInputStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SolrDispatchFilter.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Get the NodeConfig whether stored on disk, in ZooKeeper, etc. * This may also be used by custom filters to load relevant configuration. * @return the NodeConfig */ public static NodeConfig loadNodeConfig(Path solrHome, Properties nodeProperties) { if (!StringUtils.isEmpty(System.getProperty("solr.solrxml.location"))) { log.warn("Solr property solr.solrxml.location is no longer supported. Will automatically load solr.xml from ZooKeeper if it exists"); } String zkHost = System.getProperty("zkHost"); if (!StringUtils.isEmpty(zkHost)) { int startUpZkTimeOut = Integer.getInteger("waitForZk", 30); startUpZkTimeOut *= 1000; try (SolrZkClient zkClient = new SolrZkClient(zkHost, startUpZkTimeOut)) { if (zkClient.exists("/solr.xml", true)) { log.info("solr.xml found in ZooKeeper. Loading..."); byte[] data = zkClient.getData("/solr.xml", null, null, true); return SolrXmlConfig.fromInputStream(solrHome, new ByteArrayInputStream(data), nodeProperties, true); } } catch (Exception e) { throw new SolrException(ErrorCode.SERVER_ERROR, "Error occurred while loading solr.xml from zookeeper", e); } log.info("Loading solr.xml from SolrHome (not found in ZooKeeper)"); } return SolrXmlConfig.fromSolrHome(solrHome, nodeProperties); }
Example 2
Source File: MetricsConfigTest.java From lucene-solr with Apache License 2.0 | 4 votes |
private NodeConfig loadNodeConfig() throws Exception { InputStream is = MetricsConfigTest.class.getResourceAsStream("/solr/solr-metricsconfig.xml"); return SolrXmlConfig.fromInputStream(TEST_PATH(), is, new Properties()); //TODO pass in props }