Spring Data Solr

org.springframework.data.solr.server.support
Class EmbeddedSolrServerFactory

java.lang.Object
  extended by org.springframework.data.solr.server.support.EmbeddedSolrServerFactory
All Implemented Interfaces:
DisposableBean, SolrServerFactory
Direct Known Subclasses:
EmbeddedSolrServerFactoryBean

public class EmbeddedSolrServerFactory
extends Object
implements SolrServerFactory, DisposableBean

The EmbeddedSolrServerFactory allows hosting of an SolrServer instance in embedded mode. Configuration files are loaded via ResourceUtils, therefore it is possible to place them in classpath. Use this class for Testing. It is not recommended for production.

Author:
Christoph Strobl

Constructor Summary
protected EmbeddedSolrServerFactory()
           
  EmbeddedSolrServerFactory(String solrHome)
           
 
Method Summary
 org.apache.solr.client.solrj.embedded.EmbeddedSolrServer createPathConfiguredSolrServer(String path)
           
 void destroy()
           
 List<String> getCores()
          Get list of cores
 org.apache.solr.client.solrj.embedded.EmbeddedSolrServer getSolrServer()
          Get base SolrServer instance
 org.apache.solr.client.solrj.SolrServer getSolrServer(String core)
          Get configured SolrServer for specific core
protected  void initSolrServer()
           
 void setSolrHome(String solrHome)
           
 void shutdownSolrServer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedSolrServerFactory

protected EmbeddedSolrServerFactory()

EmbeddedSolrServerFactory

public EmbeddedSolrServerFactory(String solrHome)
                          throws ParserConfigurationException,
                                 IOException,
                                 SAXException
Parameters:
solrHome - Any Path expression valid for use with ResourceUtils that points to the solr.solr.home directory
Throws:
ParserConfigurationException
IOException
SAXException
Method Detail

getSolrServer

public org.apache.solr.client.solrj.embedded.EmbeddedSolrServer getSolrServer()
Description copied from interface: SolrServerFactory
Get base SolrServer instance

Specified by:
getSolrServer in interface SolrServerFactory
Returns:
a reusable solrServer instance

initSolrServer

protected void initSolrServer()

createPathConfiguredSolrServer

public final org.apache.solr.client.solrj.embedded.EmbeddedSolrServer createPathConfiguredSolrServer(String path)
                                                                                              throws ParserConfigurationException,
                                                                                                     IOException,
                                                                                                     SAXException
Parameters:
path - Any Path expression valid for use with ResourceUtils
Returns:
new instance of EmbeddedSolrServer
Throws:
ParserConfigurationException
IOException
SAXException

shutdownSolrServer

public void shutdownSolrServer()

getCores

public List<String> getCores()
Description copied from interface: SolrServerFactory
Get list of cores

Specified by:
getCores in interface SolrServerFactory
Returns:
empty list if no cores defined

setSolrHome

public void setSolrHome(String solrHome)

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

getSolrServer

public org.apache.solr.client.solrj.SolrServer getSolrServer(String core)
Description copied from interface: SolrServerFactory
Get configured SolrServer for specific core

Specified by:
getSolrServer in interface SolrServerFactory
Returns:

Spring Data Solr

Copyright © 2011-2014-2014 Pivotal. All Rights Reserved.