当前位置: 首页>>代码示例>>Java>>正文


Java SolrResourceLoader.locateSolrHome方法代码示例

本文整理汇总了Java中org.apache.solr.core.SolrResourceLoader.locateSolrHome方法的典型用法代码示例。如果您正苦于以下问题:Java SolrResourceLoader.locateSolrHome方法的具体用法?Java SolrResourceLoader.locateSolrHome怎么用?Java SolrResourceLoader.locateSolrHome使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.core.SolrResourceLoader的用法示例。


在下文中一共展示了SolrResourceLoader.locateSolrHome方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TestHarness

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
/**
 * @param coreName to initialize
 * @param dataDir path for index data, will not be cleaned up
 * @param solrConfig solrconfig resource name
 * @param indexSchema schema resource name
 */
public TestHarness(String coreName, String dataDir, String solrConfig, String indexSchema) {
  try {
    if (coreName == null)
      coreName = ConfigSolrXmlOld.DEFAULT_DEFAULT_CORE_NAME;
    this.coreName = coreName;

    SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
    ConfigSolr config = getTestHarnessConfig(loader, coreName, dataDir, solrConfig, indexSchema);
    container = new CoreContainer(loader, config);
    container.load();

    updater = new UpdateRequestHandler();
    updater.init( null );
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:TestHarness.java

示例2: startSolr

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
/**
     * Start up an embedded Solr server.
     *
     * @param home The path to the Solr home directory
     * @return EmbeddedSolrServer: The instantiated server
     * @throws Exception if any errors occur
     */
    private EmbeddedSolrServer startSolr(String home) throws Exception {
        try {
            SolrConfig solrConfig = new SolrConfig(home, SOLR_CONFIG, null);
            IndexSchema schema = new IndexSchema(solrConfig, SOLR_SCHEMA, null);

            solrContainer = new CoreContainer(new SolrResourceLoader(
                    SolrResourceLoader.locateSolrHome()));
            CoreDescriptor descriptor = new CoreDescriptor(solrContainer, "",
                    solrConfig.getResourceLoader().getInstanceDir());
            descriptor.setConfigName(solrConfig.getResourceName());
            descriptor.setSchemaName(schema.getResourceName());

            solrCore = new SolrCore(null, solrConfig.getDataDir(),
                    solrConfig, schema, descriptor);
            solrContainer.register("cheese", solrCore, false);
//            CoreAdminRequest.create
            return new EmbeddedSolrServer(solrContainer, "cheese");
        } catch(Exception ex) {
            log.error("\nFailed to start Solr server\n");
            throw ex;
        }
    }
 
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:GeonamesIndexGenerator.java

示例3: createCoreContainer

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
/**
 * Override this to change CoreContainer initialization
 * @return a CoreContainer to hold this server's cores
 */
protected CoreContainer createCoreContainer() {
  SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
  ConfigSolr config = loadConfigSolr(loader);
  CoreContainer cores = new CoreContainer(loader, config);
  cores.load();
  return cores;
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:SolrDispatchFilter.java

示例4: buildSolrIndex

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
private EmbeddedSolrServer buildSolrIndex(String home) throws ParserConfigurationException, IOException, SAXException {
	SolrConfig solrConfig = new SolrConfig(home, SOLR_CONFIG, null);
	IndexSchema schema = new IndexSchema(solrConfig, SOLR_SCHEMA, null);

	solrContainer = new CoreContainer(new SolrResourceLoader(
			SolrResourceLoader.locateSolrHome()));
	CoreDescriptor descriptor = new CoreDescriptor(solrContainer, "",
			solrConfig.getResourceLoader().getInstanceDir());
	descriptor.setConfigName(solrConfig.getResourceName());
	descriptor.setSchemaName(schema.getResourceName());
	SolrCore solrCore = new SolrCore(null, solrConfig.getDataDir(),solrConfig, schema, descriptor);
	
	solrContainer.register("cheese", solrCore, false);
	return new EmbeddedSolrServer(solrContainer, "cheese");
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:16,代码来源:GeonamesIndex.java

示例5: initialize

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
@Override
public CoreContainer initialize() {
  CoreContainer container = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateSolrHome())) {
    {
      hostPort = System.getProperty("hostPort");
      hostContext = "solr";
      defaultCoreName = CoreContainer.DEFAULT_DEFAULT_CORE_NAME;
      initShardHandler(null);
      initZooKeeper(System.getProperty("zkHost"), 10000);
    }
  };
  LogWatcher<?> logging = new JulWatcher("test");
  logging.registerListener(new ListenerConfig(), container);
  container.setLogging(logging);
  
  CoreDescriptor dcore = new CoreDescriptor(container, coreName, solrConfig.getResourceLoader().getInstanceDir());
  dcore.setConfigName(solrConfig.getResourceName());
  dcore.setSchemaName(indexSchema.getResourceName());
  SolrCore core = new SolrCore(coreName, dataDirectory, solrConfig, indexSchema, dcore);
  container.register(coreName, core, false);

  // TODO: we should be exercising the *same* core container initialization code, not equivalent code!
  if (container.getZkController() == null && core.getUpdateHandler().getUpdateLog() != null) {
    // always kick off recovery if we are in standalone mode.
    core.getUpdateHandler().getUpdateLog().recoverFromLog();
  }
  return container;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:29,代码来源:TestHarness.java

示例6: getResourceDirectory

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
private static File getResourceDirectory()
{
    return new File(SolrResourceLoader.locateSolrHome(), "conf");
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:5,代码来源:AlfrescoSolrDataModel.java

示例7: checkEnforce

import org.apache.solr.core.SolrResourceLoader; //导入方法依赖的package包/类
@Override
protected boolean checkEnforce(ServletContext context) throws IOException
{
    /*
    * Rely on the SolrResourceLoader to locate the solr home directory.
    */

    int httpsPort = getHttpsPort();

    if(httpsPort > -1)
    {
        setHttpsPort(httpsPort);
    }

    String solrHome = SolrResourceLoader.locateSolrHome();

    if(logger.isDebugEnabled())
    {
        logger.debug("solrHome:"+solrHome);
    }

    /*
    * Find the active cores.
    */
    List<File> cores = new ArrayList();
    findCores(new File(solrHome), cores);

    /*
    * Get the alfresco.secureComms value for each core.
    */
    Set<String> secureCommsSet = new HashSet();
    for(File core : cores)
    {
        collectSecureComms(core, secureCommsSet);
    }

    /*
    * alfresco.secureComms values should be in sync for each core
    */

    if(secureCommsSet.size() > 1)
    {
        StringBuilder buf = new StringBuilder();
        int i = 0;
        for(String s : secureCommsSet)
        {
            if(i > 0)
            {
                buf.append(" | ");
            }
            buf.append(s);
            i++;
        }

        throw new IOException("More then one distinct value found for alfresco.secureComms:"+ buf.toString()+
                              ". All alfresco.secureComms values must be set to the same value.");
    }

    if(secureCommsSet.size() == 0)
    {
        //No secureComms were found.
        return false;
    }


    String secureComms = secureCommsSet.iterator().next();

    if(logger.isDebugEnabled())
    {
        logger.debug("secureComms:"+secureComms);
    }

    if("none".equals(secureComms))
    {
        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:82,代码来源:Solr4X509ServletFilter.java


注:本文中的org.apache.solr.core.SolrResourceLoader.locateSolrHome方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。