public class CoreContainer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CoreContainer.Initializer |
Modifier and Type | Field and Description |
---|---|
protected String |
adminHandler |
protected String |
adminPath |
protected CollectionsHandler |
collectionsHandler |
protected File |
configFile |
protected Properties |
containerProperties |
protected CoreAdminHandler |
coreAdminHandler |
protected Map<String,Exception> |
coreInitFailures |
static String |
DEFAULT_DEFAULT_CORE_NAME |
protected String |
defaultCoreName |
protected String |
host |
protected String |
hostContext |
protected String |
hostPort |
protected Map<String,IndexSchema> |
indexSchemaCache |
protected String |
libDir |
protected SolrResourceLoader |
loader |
protected static org.slf4j.Logger |
log |
protected LogWatcher |
logging |
protected String |
managementPath |
protected boolean |
persistent |
protected boolean |
shareSchema |
protected String |
solrHome |
protected Integer |
zkClientTimeout |
Constructor and Description |
---|
CoreContainer()
Deprecated.
use the single arg constructor with locateSolrHome()
|
CoreContainer(SolrResourceLoader loader)
Minimal CoreContainer constructor.
|
CoreContainer(String solrHome) |
CoreContainer(String dir,
File configFile)
Initalize CoreContainer directly from the constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cancelCoreRecoveries() |
String |
checkUniqueDataDir(String targetPath)
Checks that the data dir passed is is NOT shared by any other core
|
SolrCore |
create(CoreDescriptor dcore)
Creates a new core based on a descriptor but does not register it.
|
protected CoreAdminHandler |
createMultiCoreHandler(String adminHandlerClass)
Creates a CoreAdminHandler for this MultiCore.
|
protected void |
finalize() |
String |
getAdminPath() |
Collection<String> |
getAllCoreNames()
get a list of all the cores that are currently loaded
|
String |
getBadCoreMessage(String name) |
CollectionsHandler |
getCollectionsHandler() |
File |
getConfigFile() |
Properties |
getContainerProperties() |
SolrCore |
getCore(String name)
Gets a core by name and increase its refcount.
|
Map<String,Exception> |
getCoreInitFailures()
Returns an immutable Map of Exceptions that occured when initializing
SolrCores (either at startup, or do to runtime requests to create cores)
keyed off of the name (String) of the SolrCore that had the Exception
during initialization.
|
Collection<String> |
getCoreNames() |
Collection<String> |
getCoreNames(SolrCore core)
This method is currently experimental.
|
Collection<SolrCore> |
getCores() |
String |
getDefaultCoreName()
the default core name, or null if there is no default core name
|
String |
getHost() |
String |
getHostContext() |
String |
getHostPort() |
LogWatcher |
getLogging() |
String |
getManagementPath() |
CoreAdminHandler |
getMultiCoreHandler() |
ShardHandlerFactory |
getShardHandlerFactory()
The default ShardHandlerFactory used to communicate with other solr instances
|
String |
getSolrHome() |
CoreDescriptor |
getUnloadedCoreDescriptor(String cname)
Gets a solr core descriptor for a core that is not loaded.
|
int |
getZkClientTimeout() |
ZkController |
getZkController() |
protected void |
initShardHandler() |
protected void |
initZooKeeper(String zkHost,
int zkClientTimeout) |
boolean |
isLoaded(String name)
Determines whether the core is already loaded or not but does NOT load the core
|
boolean |
isPersistent() |
boolean |
isShareSchema() |
boolean |
isShutDown() |
boolean |
isZooKeeperAware() |
void |
load(String dir,
File configFile)
Load a config file listing the available solr cores.
|
protected void |
load(String dir,
InputStream is,
String fileName)
Load a config file listing the available solr cores.
|
void |
persist()
Persists the cores config file in cores.xml.
|
void |
persistFile(File file)
Persists the cores config file in a user provided file.
|
SolrCore |
register(SolrCore core,
boolean returnPrev)
Registers a SolrCore descriptor in the registry using the core's name.
|
SolrCore |
register(String name,
SolrCore core,
boolean returnPrev) |
protected SolrCore |
registerCore(boolean isTransientCore,
String name,
SolrCore core,
boolean returnPrevNotClosed) |
void |
reload(String name)
Recreates a SolrCore.
|
SolrCore |
remove(String name)
Removes and returns registered core w/o decrementing it's reference count
|
void |
rename(String name,
String toName) |
void |
setLogging(LogWatcher v) |
void |
setManagementPath(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(String n0,
String n1)
Swaps two SolrCore descriptors.
|
public static final String DEFAULT_DEFAULT_CORE_NAME
protected static org.slf4j.Logger log
protected boolean persistent
protected String adminPath
protected String managementPath
protected String hostPort
protected String hostContext
protected String host
protected CoreAdminHandler coreAdminHandler
protected CollectionsHandler collectionsHandler
protected File configFile
protected String libDir
protected SolrResourceLoader loader
protected Properties containerProperties
protected Map<String,IndexSchema> indexSchemaCache
protected String adminHandler
protected boolean shareSchema
protected Integer zkClientTimeout
protected String solrHome
protected String defaultCoreName
protected LogWatcher logging
@Deprecated public CoreContainer()
SolrResourceLoader.locateSolrHome()
public CoreContainer(String dir, File configFile) throws FileNotFoundException
FileNotFoundException
public CoreContainer(SolrResourceLoader loader)
loader
- the CoreContainer resource loaderpublic CoreContainer(String solrHome)
protected void initZooKeeper(String zkHost, int zkClientTimeout)
public Properties getContainerProperties()
public void load(String dir, File configFile) throws FileNotFoundException
dir
- the home directory of all resources.configFile
- the configuration fileFileNotFoundException
protected void load(String dir, InputStream is, String fileName)
dir
- the home directory of all resources.is
- the configuration file InputStream. May be a properties file or an xml fileprotected void initShardHandler()
public boolean isShutDown()
public void shutdown()
public void cancelCoreRecoveries()
protected void finalize() throws Throwable
protected SolrCore registerCore(boolean isTransientCore, String name, SolrCore core, boolean returnPrevNotClosed)
public SolrCore register(SolrCore core, boolean returnPrev)
public SolrCore create(CoreDescriptor dcore)
dcore
- a core descriptorpublic Collection<SolrCore> getCores()
public Collection<String> getCoreNames()
public Collection<String> getCoreNames(SolrCore core)
public Collection<String> getAllCoreNames()
public String checkUniqueDataDir(String targetPath)
targetPath
- - path to checkpublic Map<String,Exception> getCoreInitFailures()
While the Map returned by this method is immutable and will not change once returned to the client, the source data used to generate this Map can be changed as various SolrCore operations are performed:
public void reload(String name)
name
- the name of the SolrCore to reloadpublic SolrCore remove(String name)
public SolrCore getCore(String name)
name
- the core nameSolrException
- if a SolrCore with this name failed to be initializedSolrCore.close()
protected CoreAdminHandler createMultiCoreHandler(String adminHandlerClass)
public CoreAdminHandler getMultiCoreHandler()
public CollectionsHandler getCollectionsHandler()
public String getDefaultCoreName()
public boolean isPersistent()
public void setPersistent(boolean persistent)
public String getAdminPath()
public String getHostPort()
public String getHostContext()
public String getHost()
public int getZkClientTimeout()
public String getManagementPath()
public void setManagementPath(String path)
public LogWatcher getLogging()
public void setLogging(LogWatcher v)
public File getConfigFile()
public boolean isLoaded(String name)
public void persist()
public CoreDescriptor getUnloadedCoreDescriptor(String cname)
cname
- - name of the unloaded core descriptor to load. NOTE:public void persistFile(File file)
public String getSolrHome()
public boolean isZooKeeperAware()
public ZkController getZkController()
public boolean isShareSchema()
public ShardHandlerFactory getShardHandlerFactory()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.