org.apache.solr.core

## Class CoreContainer

- java.lang.Object
- - org.apache.solr.core.CoreContainer

-     public class CoreContainer
      extends Object

  Since:
    solr 1.3

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CoreContainer.CoreLoadFailure`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected NodeConfig` | `cfg`
    `protected CollectionsHandler` | `collectionsHandler`
    `protected ConfigSetsHandler` | `configSetsHandler`
    `protected Properties` | `containerProperties`
    `protected CoreAdminHandler` | `coreAdminHandler`
    `protected Map<String,CoreContainer.CoreLoadFailure>` | `coreInitFailures`
    `protected CoresLocator` | `coresLocator`
    `protected SolrResourceLoader` | `loader`
    `protected LogWatcher` | `logging`
    `protected SecurityConfHandler` | `securityConfHandler`
    `protected ShardHandlerFactory` | `shardHandlerFactory`
    `protected String` | `solrHome`
    `protected ZkContainer` | `zkSys`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `CoreContainer()` Create a new CoreContainer using system properties to detect the solr home directory.
    `` | `CoreContainer(NodeConfig config)` Create a new CoreContainer using the given SolrResourceLoader, configuration and CoresLocator.
    `` | `CoreContainer(NodeConfig config, Properties properties)`
    `` | `CoreContainer(NodeConfig config, Properties properties, boolean asyncSolrCoreLoad)`
    `` | `CoreContainer(NodeConfig config, Properties properties, CoresLocator locator)`
    `` | `CoreContainer(NodeConfig config, Properties properties, CoresLocator locator, boolean asyncSolrCoreLoad)`
    `protected` | `CoreContainer(Object testConstructor)` This method allows subclasses to construct a CoreContainer without any default init behavior.
    `` | `CoreContainer(SolrResourceLoader loader)` Create a new CoreContainer using the given SolrResourceLoader.
    `` | `CoreContainer(String solrHome)` Create a new CoreContainer using the given solr home directory.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancelCoreRecoveries()`
    `SolrCore` | `create(String coreName, Map<String,String> parameters)` Creates a new core, publishing the core state to the cluster
    `SolrCore` | `create(String coreName, Path instancePath, Map<String,String> parameters, boolean newCollection)` Creates a new core in a specified instance directory, publishing the core state to the cluster
    `static CoreContainer` | `createAndLoad(Path solrHome)`
    `static CoreContainer` | `createAndLoad(Path solrHome, Path configFile)` Create a new CoreContainer and load its cores
    `protected <T> T` | `createHandler(String handlerClass, Class<T> clazz)`
    `protected void` | `finalize()`
    `Collection<String>` | `getAllCoreNames()` get a list of all the cores that are currently loaded
    `AuthenticationPlugin` | `getAuthenticationPlugin()`
    `AuthorizationPlugin` | `getAuthorizationPlugin()`
    `BlobRepository` | `getBlobRepository()`
    `CollectionsHandler` | `getCollectionsHandler()`
    `NodeConfig` | `getConfig()`
    `ConfigSetsHandler` | `getConfigSetsHandler()`
    `Properties` | `getContainerProperties()`
    `SolrCore` | `getCore(String name)` Gets a core by name and increase its refcount.
    `CoreDescriptor` | `getCoreDescriptor(String coreName)`
    `List<CoreDescriptor>` | `getCoreDescriptors()` Get the CoreDescriptors for all cores managed by this container
    `Map<String,CoreContainer.CoreLoadFailure>` | `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.
    `Path` | `getCoreRootDirectory()`
    `Collection<SolrCore>` | `getCores()`
    `CoresLocator` | `getCoresLocator()`
    `ExecutorService` | `getCoreZkRegisterExecutorService()`
    `String` | `getHostName()`
    `InfoHandler` | `getInfoHandler()`
    `LogWatcher` | `getLogging()`
    `String` | `getManagementPath()` Gets 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.
    `CoreAdminHandler` | `getMultiCoreHandler()`
    `NodeConfig` | `getNodeConfig()`
    `PKIAuthenticationPlugin` | `getPkiAuthenticationPlugin()`
    `SolrRequestHandler` | `getRequestHandler(String path)`
    `PluginBag<SolrRequestHandler>` | `getRequestHandlers()`
    `SolrResourceLoader` | `getResourceLoader()`
    `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.
    `UpdateShardHandler` | `getUpdateShardHandler()`
    `ZkController` | `getZkController()`
    `boolean` | `isCoreLoading(String name)`
    `boolean` | `isLoaded(String name)` Determines whether the core is already loaded or not but does NOT load the core
    `boolean` | `isLoadedNotPendingClose(String name)`
    `boolean` | `isShutDown()`
    `boolean` | `isZooKeeperAware()`
    `void` | `load()` Load the cores defined for this CoreContainer
    `BackupRepository` | `newBackupRepository(Optional<String> repositoryName)` This method instantiates a new instance of BackupRepository.
    `protected SolrCore` | `registerCore(String name, SolrCore core, boolean registerInZk, boolean skipRecovery)`
    `void` | `reload(String name)` Recreates a SolrCore.
    `void` | `rename(String name, String toName)`
    `void` | `securityNodeChanged()`
    `void` | `shutdown()` Stops all cores.
    `void` | `swap(String n0, String n1)` Swaps two SolrCore descriptors.
    `void` | `unload(String name)` Unload a core from this container, leaving all files on disk
    `void` | `unload(String name, boolean deleteIndexDir, boolean deleteDataDir, boolean deleteInstanceDir)` Unload a core from this container, optionally removing the core's data and configuration
    `void` | `waitForLoadingCore(String name, long timeoutMs)`
    `void` | `waitForLoadingCoresToFinish(long timeoutMs)` If using asyncSolrCoreLoad=true, calling this after `load()` will not return until all cores have finished loading.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### coreInitFailures

          protected final Map<String,CoreContainer.CoreLoadFailure> coreInitFailures

    - #### coreAdminHandler

          protected CoreAdminHandler coreAdminHandler

    - #### collectionsHandler

          protected CollectionsHandler collectionsHandler

    - #### configSetsHandler

          protected ConfigSetsHandler configSetsHandler

    - #### containerProperties

          protected Properties containerProperties

    - #### zkSys

          protected ZkContainer zkSys

    - #### shardHandlerFactory

          protected ShardHandlerFactory shardHandlerFactory

    - #### logging

          protected LogWatcher logging

    - #### cfg

          protected final NodeConfig cfg

    - #### loader

          protected final SolrResourceLoader loader

    - #### solrHome

          protected final String solrHome

    - #### coresLocator

          protected final CoresLocator coresLocator

    - #### securityConfHandler

          protected SecurityConfHandler securityConfHandler

  - ### Constructor Detail

    - #### CoreContainer

          public CoreContainer()

      Create a new CoreContainer using system properties to detect the solr home directory. The container's cores are not loaded.
      See Also:
        `load()`

    - #### CoreContainer

          public CoreContainer(SolrResourceLoader loader)

      Create a new CoreContainer using the given SolrResourceLoader. The container's cores are not loaded.
      Parameters:
        `loader` - the SolrResourceLoader
      See Also:
        `load()`

    - #### CoreContainer

          public CoreContainer(String solrHome)

      Create a new CoreContainer using the given solr home directory. The container's cores are not loaded.
      Parameters:
        `solrHome` - a String containing the path to the solr home directory
      See Also:
        `load()`

    - #### CoreContainer

          public CoreContainer(NodeConfig config)

      Create a new CoreContainer using the given SolrResourceLoader, configuration and CoresLocator. The container's cores are not loaded.
      Parameters:
        `config` - a ConfigSolr representation of this container's configuration
      See Also:
        `load()`

    - #### CoreContainer

          public CoreContainer(NodeConfig config,
                               Properties properties)

    - #### CoreContainer

          public CoreContainer(NodeConfig config,
                               Properties properties,
                               boolean asyncSolrCoreLoad)

    - #### CoreContainer

          public CoreContainer(NodeConfig config,
                               Properties properties,
                               CoresLocator locator)

    - #### CoreContainer

          public CoreContainer(NodeConfig config,
                               Properties properties,
                               CoresLocator locator,
                               boolean asyncSolrCoreLoad)

    - #### CoreContainer

          protected CoreContainer(Object testConstructor)

      This method allows subclasses to construct a CoreContainer without any default init behavior.
      Parameters:
        `testConstructor` - pass (Object)null.
      WARNING: This API is experimental and might change in incompatible ways in the next release.

  - ### Method Detail

    - #### newBackupRepository

          public BackupRepository newBackupRepository(Optional<String> repositoryName)

      This method instantiates a new instance of BackupRepository.
      Parameters:
        `repositoryName` - The name of the backup repository (Optional). If not specified, a default implementation is used.
      Returns:
        a new instance of BackupRepository.

    - #### getCoreZkRegisterExecutorService

          public ExecutorService getCoreZkRegisterExecutorService()

    - #### getRequestHandler

          public SolrRequestHandler getRequestHandler(String path)

    - #### getRequestHandlers

          public PluginBag<SolrRequestHandler> getRequestHandlers()

    - #### createAndLoad

          public static CoreContainer createAndLoad(Path solrHome)

    - #### createAndLoad

          public static CoreContainer createAndLoad(Path solrHome,
                                                    Path configFile)

      Create a new CoreContainer and load its cores
      Parameters:
        `solrHome` - the solr home directory
        `configFile` - the file containing this container's configuration
      Returns:
        a loaded CoreContainer

    - #### getContainerProperties

          public Properties getContainerProperties()

    - #### getPkiAuthenticationPlugin

          public PKIAuthenticationPlugin getPkiAuthenticationPlugin()

    - #### load

          public void load()

      Load the cores defined for this CoreContainer

    - #### securityNodeChanged

          public void securityNodeChanged()

    - #### isShutDown

          public boolean isShutDown()

    - #### shutdown

          public void shutdown()

      Stops all cores.

    - #### cancelCoreRecoveries

          public void cancelCoreRecoveries()

    - #### finalize

          protected void finalize()
                           throws Throwable

      Overrides:
        `finalize` in class `Object`
      Throws:
        `Throwable`

    - #### getCoresLocator

          public CoresLocator getCoresLocator()

    - #### registerCore

          protected SolrCore registerCore(String name,
                                          SolrCore core,
                                          boolean registerInZk,
                                          boolean skipRecovery)

    - #### create

          public SolrCore create(String coreName,
                                 Map<String,String> parameters)

      Creates a new core, publishing the core state to the cluster
      Parameters:
        `coreName` - the core name
        `parameters` - the core parameters
      Returns:
        the newly created core

    - #### create

          public SolrCore create(String coreName,
                                 Path instancePath,
                                 Map<String,String> parameters,
                                 boolean newCollection)

      Creates a new core in a specified instance directory, publishing the core state to the cluster
      Parameters:
        `coreName` - the core name
        `instancePath` - the instance directory
        `parameters` - the core parameters
      Returns:
        the newly created core

    - #### getCores

          public Collection<SolrCore> getCores()

      Returns:
        a Collection of registered SolrCores

    - #### getCoreNames

          public Collection<String> getCoreNames()

      Returns:
        a Collection of the names that cores are mapped to

    - #### getCoreNames

          public Collection<String> getCoreNames(SolrCore core)

      This method is currently experimental.
      Returns:
        a Collection of the names that a specific core is mapped to.

    - #### getAllCoreNames

          public Collection<String> getAllCoreNames()

      get a list of all the cores that are currently loaded
      Returns:
        a list of al lthe available core names in either permanent or transient core lists.

    - #### getCoreInitFailures

          public Map<String,CoreContainer.CoreLoadFailure> 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.

      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:

      - Failed attempts to create new SolrCores will add new Exceptions.
      - Failed attempts to re-create a SolrCore using a name already contained in this Map will replace the Exception.
      - Failed attempts to reload a SolrCore will cause an Exception to be added to this list -- even though the existing SolrCore with that name will continue to be available.
      - Successful attempts to re-created a SolrCore using a name already contained in this Map will remove the Exception.
      - Registering an existing SolrCore with a name already contained in this Map (ie: ALIAS or SWAP) will remove the Exception.

    - #### reload

          public void reload(String name)

      Recreates a SolrCore. While the new core is loading, requests will continue to be dispatched to and processed by the old core
      Parameters:
        `name` - the name of the SolrCore to reload

    - #### swap

          public void swap(String n0,
                           String n1)

      Swaps two SolrCore descriptors.

    - #### unload

          public void unload(String name)

      Unload a core from this container, leaving all files on disk
      Parameters:
        `name` - the name of the core to unload

    - #### unload

          public void unload(String name,
                             boolean deleteIndexDir,
                             boolean deleteDataDir,
                             boolean deleteInstanceDir)

      Unload a core from this container, optionally removing the core's data and configuration
      Parameters:
        `name` - the name of the core to unload
        `deleteIndexDir` - if true, delete the core's index on close
        `deleteDataDir` - if true, delete the core's data directory on close
        `deleteInstanceDir` - if true, delete the core's instance directory on close

    - #### rename

          public void rename(String name,
                             String toName)

    - #### getCoreDescriptors

          public List<CoreDescriptor> getCoreDescriptors()

      Get the CoreDescriptors for all cores managed by this container
      Returns:
        a List of CoreDescriptors

    - #### getCoreDescriptor

          public CoreDescriptor getCoreDescriptor(String coreName)

    - #### getCoreRootDirectory

          public Path getCoreRootDirectory()

    - #### getCore

          public SolrCore getCore(String name)

      Gets a core by name and increase its refcount.
      Parameters:
        `name` - the core name
      Returns:
        the core if found, null if a SolrCore by this name does not exist
      Throws:
        `SolrException` - if a SolrCore with this name failed to be initialized
      See Also:
        `SolrCore.close()`

    - #### getBlobRepository

          public BlobRepository getBlobRepository()

    - #### waitForLoadingCoresToFinish

          public void waitForLoadingCoresToFinish(long timeoutMs)

      If using asyncSolrCoreLoad=true, calling this after `load()` will not return until all cores have finished loading.
      Parameters:
        `timeoutMs` - timeout, upon which method simply returns

    - #### waitForLoadingCore

          public void waitForLoadingCore(String name,
                                         long timeoutMs)

    - #### createHandler

          protected <T> T createHandler(String handlerClass,
                                        Class<T> clazz)

    - #### getMultiCoreHandler

          public CoreAdminHandler getMultiCoreHandler()

    - #### getCollectionsHandler

          public CollectionsHandler getCollectionsHandler()

    - #### getInfoHandler

          public InfoHandler getInfoHandler()

    - #### getConfigSetsHandler

          public ConfigSetsHandler getConfigSetsHandler()

    - #### getHostName

          public String getHostName()

    - #### getManagementPath

          public String getManagementPath()

      Gets 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. This can also be used in a pseudo single-core environment so admins can prepare a new version before swapping.

    - #### getLogging

          public LogWatcher getLogging()

    - #### isLoaded

          public boolean isLoaded(String name)

      Determines whether the core is already loaded or not but does NOT load the core

    - #### isLoadedNotPendingClose

          public boolean isLoadedNotPendingClose(String name)

    - #### getUnloadedCoreDescriptor

          public CoreDescriptor getUnloadedCoreDescriptor(String cname)

      Gets a solr core descriptor for a core that is not loaded. Note that if the caller calls this on a loaded core, the unloaded descriptor will be returned.
      Parameters:
        `cname` - - name of the unloaded core descriptor to load. NOTE:
      Returns:
        a coreDescriptor. May return null

    - #### getSolrHome

          public String getSolrHome()

    - #### isZooKeeperAware

          public boolean isZooKeeperAware()

    - #### getZkController

          public ZkController getZkController()

    - #### getConfig

          public NodeConfig getConfig()

    - #### getShardHandlerFactory

          public ShardHandlerFactory getShardHandlerFactory()

      The default ShardHandlerFactory used to communicate with other solr instances

    - #### getUpdateShardHandler

          public UpdateShardHandler getUpdateShardHandler()

    - #### getResourceLoader

          public SolrResourceLoader getResourceLoader()

    - #### isCoreLoading

          public boolean isCoreLoading(String name)

    - #### getAuthorizationPlugin

          public AuthorizationPlugin getAuthorizationPlugin()

    - #### getAuthenticationPlugin

          public AuthenticationPlugin getAuthenticationPlugin()

    - #### getNodeConfig

          public NodeConfig getNodeConfig()

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.