List of usage examples for org.apache.solr.core SolrResourceLoader getCoreProperties
public Properties getCoreProperties()
From source file:de.hybris.platform.solr.rest.IndexAwareStorageIO.java
License:Open Source License
@Override public void configure(final SolrResourceLoader resourceLoader, final NamedList<String> initArgs) throws SolrException { if (resourceLoader instanceof ZkSolrResourceLoader) { final String collection = resourceLoader.getCoreProperties().getProperty(COLLECTION_PROPERTY); if (collection == null || collection.isEmpty()) { throw new SolrException(ErrorCode.SERVER_ERROR, "Failed to detect collection"); }//from w w w. j av a 2 s .c om final SolrZkClient zkClient = ((ZkSolrResourceLoader) resourceLoader).getZkController().getZkClient(); final String znodeBase = "/collections/" + collection + "/" + MANAGED_RESOURCES_DIR; delegate = new ZooKeeperStorageIO(zkClient, znodeBase); } else { initArgs.remove(STORAGE_DIR_INIT_ARG); final String instanceDir = resourceLoader.getCoreProperties().getProperty(INSTANCE_DIR_PROPERTY); if (instanceDir == null || instanceDir.isEmpty()) { throw new SolrException(ErrorCode.SERVER_ERROR, "Failed to detect instance dir"); } final File storageDir = new File(instanceDir, MANAGED_RESOURCES_DIR); initArgs.add(STORAGE_DIR_INIT_ARG, storageDir.getAbsolutePath()); delegate = new FileStorageIO(); } getDelegate().configure(resourceLoader, initArgs); }