Spring Data Solr

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

java.lang.Object
  extended by org.springframework.data.solr.server.support.MulticoreSolrServerFactory
All Implemented Interfaces:
DisposableBean, SolrServerFactory

public class MulticoreSolrServerFactory
extends Object

Author:
Christoph Strobl

Constructor Summary
protected MulticoreSolrServerFactory()
           
  MulticoreSolrServerFactory(org.apache.solr.client.solrj.SolrServer solrServer)
           
  MulticoreSolrServerFactory(org.apache.solr.client.solrj.SolrServer solrServer, List<String> cores)
           
  MulticoreSolrServerFactory(org.apache.solr.client.solrj.SolrServer solrServer, String... cores)
           
 
Method Summary
 void addSolrServerForCore(org.apache.solr.client.solrj.SolrServer solrServer, String core)
          Add SolrServer for core to factory - Will override existing.
protected  org.apache.solr.client.solrj.SolrServer createServerForCore(org.apache.solr.client.solrj.SolrServer reference, String core)
           
 void destroy()
           
protected  void destroy(org.apache.solr.client.solrj.SolrServer server)
           
 List<String> getCores()
          Get list of cores
protected static String getShortClassName(Class<?> clazz)
          Get the class short name.
 org.apache.solr.client.solrj.SolrServer getSolrServer()
          Get base SolrServer instance
 org.apache.solr.client.solrj.SolrServer getSolrServer(Class<?> clazz)
          Get configured SolrServer for specific class tying to determine core name via SolrDocument or its class name.
 org.apache.solr.client.solrj.SolrServer getSolrServer(String core)
          Get configured SolrServer for specific core
 boolean isCreateMissingSolrServer()
           
protected  boolean isHttpSolrServer(org.apache.solr.client.solrj.SolrServer solrServer)
           
 void removeSolrSever(String core)
          Remove SolrServer from factory.
 void setCreateMissingSolrServer(boolean createMissingSolrServer)
          if true missing solrServers for cores will be created
 void setSolrServer(org.apache.solr.client.solrj.SolrServer solrServer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MulticoreSolrServerFactory

protected MulticoreSolrServerFactory()

MulticoreSolrServerFactory

public MulticoreSolrServerFactory(org.apache.solr.client.solrj.SolrServer solrServer)

MulticoreSolrServerFactory

public MulticoreSolrServerFactory(org.apache.solr.client.solrj.SolrServer solrServer,
                                  String... cores)

MulticoreSolrServerFactory

public MulticoreSolrServerFactory(org.apache.solr.client.solrj.SolrServer solrServer,
                                  List<String> cores)
Method Detail

getSolrServer

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

Returns:

addSolrServerForCore

public void addSolrServerForCore(org.apache.solr.client.solrj.SolrServer solrServer,
                                 String core)
Add SolrServer for core to factory - Will override existing.

Parameters:
solrServer -
core -

removeSolrSever

public void removeSolrSever(String core)
Remove SolrServer from factory. Calls SolrServer.shutdown() on remove.

Parameters:
core -

getSolrServer

public org.apache.solr.client.solrj.SolrServer getSolrServer(Class<?> clazz)
Get configured SolrServer for specific class tying to determine core name via SolrDocument or its class name.

Parameters:
clazz -
Returns:

getShortClassName

protected static String getShortClassName(Class<?> clazz)
Get the class short name. Strips the outer class name in case of an inner class.

Parameters:
clazz -
Returns:
See Also:
ClassUtils.getShortName(Class)

getCores

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

Returns:
empty list if no cores defined

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean

createServerForCore

protected org.apache.solr.client.solrj.SolrServer createServerForCore(org.apache.solr.client.solrj.SolrServer reference,
                                                                      String core)

isCreateMissingSolrServer

public boolean isCreateMissingSolrServer()

setCreateMissingSolrServer

public void setCreateMissingSolrServer(boolean createMissingSolrServer)
if true missing solrServers for cores will be created

Parameters:
createMissingSolrServer - default is true

isHttpSolrServer

protected final boolean isHttpSolrServer(org.apache.solr.client.solrj.SolrServer solrServer)

getSolrServer

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

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

setSolrServer

public void setSolrServer(org.apache.solr.client.solrj.SolrServer solrServer)

destroy

protected void destroy(org.apache.solr.client.solrj.SolrServer server)
Parameters:
server -

Spring Data Solr

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