public class CoreContainer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CoreContainer.Initializer |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
adminHandler |
protected java.lang.String |
adminPath |
protected java.io.File |
configFile |
protected java.util.Properties |
containerProperties |
protected CoreAdminHandler |
coreAdminHandler |
protected java.util.Map<java.lang.String,SolrCore> |
cores |
private static java.lang.String |
DEF_SOLR_XML |
private static java.lang.String |
DEFAULT_DEFAULT_CORE_NAME |
private boolean |
defaultAbortOnConfigError |
private java.lang.String |
defaultCoreName |
protected java.util.Map<java.lang.String,IndexSchema> |
indexSchemaCache |
private boolean |
isShutDown |
protected java.lang.String |
libDir |
protected java.lang.ClassLoader |
libLoader |
protected SolrResourceLoader |
loader |
protected static org.slf4j.Logger |
log |
protected java.lang.String |
managementPath |
private int |
numCoresAbortOnConfigError |
protected boolean |
persistent |
protected boolean |
shareSchema |
protected java.lang.String |
solrConfigFilenameOverride |
protected java.lang.String |
solrHome |
Constructor and Description |
---|
CoreContainer()
Deprecated.
use the single arg constructure with locateSolrHome()
|
CoreContainer(SolrResourceLoader loader)
Minimal CoreContainer constructor.
|
CoreContainer(java.lang.String solrHome) |
CoreContainer(java.lang.String dir,
java.io.File configFile)
Initalize CoreContainer directly from the constructor
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
checkDefault(java.lang.String name) |
SolrCore |
create(CoreDescriptor dcore)
Creates a new core based on a descriptor but does not register it.
|
protected CoreAdminHandler |
createMultiCoreHandler(java.lang.String adminHandlerClass)
Creates a CoreAdminHandler for this MultiCore.
|
static void |
fileCopy(java.io.File src,
java.io.File dest)
Copies a src file to a dest file:
used to circumvent the platform discrepancies regarding renaming files.
|
protected void |
finalize() |
java.lang.String |
getAdminPath() |
java.io.File |
getConfigFile() |
java.util.Properties |
getContainerProperties() |
SolrCore |
getCore(java.lang.String name)
Gets a core by name and increase its refcount.
|
java.util.Collection<java.lang.String> |
getCoreNames() |
java.util.Collection<java.lang.String> |
getCoreNames(SolrCore core)
This method is currently experimental.
|
private static java.util.Properties |
getCoreProps(java.lang.String instanceDir,
java.lang.String file,
java.util.Properties defaults) |
java.util.Collection<SolrCore> |
getCores() |
java.lang.String |
getDefaultCoreName() |
java.lang.String |
getManagementPath() |
CoreAdminHandler |
getMultiCoreHandler() |
java.lang.String |
getSolrHome() |
boolean |
isPersistent() |
void |
load(java.lang.String dir,
java.io.File configFile)
Load a config file listing the available solr cores.
|
void |
load(java.lang.String dir,
org.xml.sax.InputSource cfgis)
Load a config file listing the available solr cores.
|
void |
persist()
Persists the cores config file in cores.xml.
|
(package private) void |
persist(java.io.Writer w)
Write the cores configuration through a writer.
|
(package private) void |
persist(java.io.Writer w,
CoreDescriptor dcore)
Writes the cores configuration node for a given core.
|
void |
persistFile(java.io.File file)
Persists the cores config file in a user provided file.
|
private java.util.Properties |
readProperties(Config cfg,
org.w3c.dom.Node node) |
SolrCore |
register(SolrCore core,
boolean returnPrev)
Registers a SolrCore descriptor in the registry using the core's name.
|
SolrCore |
register(java.lang.String name,
SolrCore core,
boolean returnPrevNotClosed)
Registers a SolrCore descriptor in the registry using the specified name.
|
void |
reload(java.lang.String name)
Recreates a SolrCore.
|
SolrCore |
remove(java.lang.String name)
Removes and returns registered core w/o decrementing it's reference count
|
void |
setAdminPath(java.lang.String adminPath) |
void |
setManagementPath(java.lang.String path)
Sets the alternate path for multicore handling:
This is used in case there is a registered unnamed core (aka name is "") to
declare an alternate way of accessing named cores.
|
void |
setPersistent(boolean persistent) |
void |
shutdown()
Stops all cores.
|
void |
swap(java.lang.String n0,
java.lang.String n1)
Swaps two SolrCore descriptors.
|
private void |
writeAttribute(java.io.Writer w,
java.lang.String name,
java.lang.Object value) |
private void |
writeProperties(java.io.Writer w,
java.util.Properties props,
java.lang.String indent) |
private static final java.lang.String DEFAULT_DEFAULT_CORE_NAME
protected static org.slf4j.Logger log
protected final java.util.Map<java.lang.String,SolrCore> cores
protected boolean persistent
protected java.lang.String adminPath
protected java.lang.String managementPath
protected CoreAdminHandler coreAdminHandler
protected java.io.File configFile
protected java.lang.String libDir
protected java.lang.ClassLoader libLoader
protected SolrResourceLoader loader
protected java.util.Properties containerProperties
protected java.util.Map<java.lang.String,IndexSchema> indexSchemaCache
protected java.lang.String adminHandler
protected boolean shareSchema
protected java.lang.String solrHome
protected java.lang.String solrConfigFilenameOverride
private java.lang.String defaultCoreName
private boolean defaultAbortOnConfigError
private int numCoresAbortOnConfigError
private boolean isShutDown
private static final java.lang.String DEF_SOLR_XML
@Deprecated public CoreContainer()
SolrResourceLoader.locateSolrHome()
public CoreContainer(java.lang.String dir, java.io.File configFile) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
dir
- configFile
- javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public CoreContainer(SolrResourceLoader loader)
loader
- the CoreContainer resource loaderpublic CoreContainer(java.lang.String solrHome)
public java.util.Properties getContainerProperties()
private static java.util.Properties getCoreProps(java.lang.String instanceDir, java.lang.String file, java.util.Properties defaults)
public void load(java.lang.String dir, java.io.File configFile) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
dir
- the home directory of all resources.configFile
- the configuration filejavax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public void load(java.lang.String dir, org.xml.sax.InputSource cfgis) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
dir
- the home directory of all resources.cfgis
- the configuration file InputStreamjavax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
private java.util.Properties readProperties(Config cfg, org.w3c.dom.Node node) throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionException
public void shutdown()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public SolrCore register(java.lang.String name, SolrCore core, boolean returnPrevNotClosed)
public SolrCore register(SolrCore core, boolean returnPrev)
public SolrCore create(CoreDescriptor dcore) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
dcore
- a core descriptorjavax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public java.util.Collection<SolrCore> getCores()
public java.util.Collection<java.lang.String> getCoreNames()
public java.util.Collection<java.lang.String> getCoreNames(SolrCore core)
public void reload(java.lang.String name) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
name
- the name of the SolrCore to reloadjavax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
private java.lang.String checkDefault(java.lang.String name)
public void swap(java.lang.String n0, java.lang.String n1)
n0
- n1
- public SolrCore remove(java.lang.String name)
public SolrCore getCore(java.lang.String name)
name
- the core nameSolrCore.open()
,
SolrCore.close()
protected CoreAdminHandler createMultiCoreHandler(java.lang.String adminHandlerClass)
public CoreAdminHandler getMultiCoreHandler()
public java.lang.String getDefaultCoreName()
public boolean isPersistent()
public void setPersistent(boolean persistent)
public java.lang.String getAdminPath()
public void setAdminPath(java.lang.String adminPath)
public java.lang.String getManagementPath()
public void setManagementPath(java.lang.String path)
path
- public java.io.File getConfigFile()
public void persist()
public void persistFile(java.io.File file)
void persist(java.io.Writer w) throws java.io.IOException
java.io.IOException
private void writeAttribute(java.io.Writer w, java.lang.String name, java.lang.Object value) throws java.io.IOException
java.io.IOException
void persist(java.io.Writer w, CoreDescriptor dcore) throws java.io.IOException
java.io.IOException
private void writeProperties(java.io.Writer w, java.util.Properties props, java.lang.String indent) throws java.io.IOException
java.io.IOException
public static void fileCopy(java.io.File src, java.io.File dest) throws java.io.IOException
java.io.IOException
public java.lang.String getSolrHome()