CoreContainer (Solr 3.6.2 API)
Keywords: org.apache.solr.core.CoreContainer class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.core
Class CoreContainer

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

    public class CoreContainer

extends Object

Since:
  solr 1.3
Version:
  $Id: CoreContainer.java 1354881 2012-06-28 09:26:42Z janhoy $

Nested Class Summary
`static class` | `CoreContainer.Initializer`

Field Summary
`protected String` | `adminHandler`
`protected String` | `adminPath`
`protected File` | `configFile`
`protected Properties` | `containerProperties`
`protected CoreAdminHandler` | `coreAdminHandler`
`protected Map<String,SolrCore>` | `cores`
`protected Map<String,IndexSchema>` | `indexSchemaCache`
`protected String` | `libDir`
`protected ClassLoader` | `libLoader`
`protected SolrResourceLoader` | `loader`
`protected static org.slf4j.Logger` | `log`
`protected String` | `managementPath`
`protected boolean` | `persistent`
`protected boolean` | `shareSchema`
`protected String` | `solrConfigFilenameOverride`
`protected String` | `solrHome`

Constructor Summary
`CoreContainer()` Deprecated. use the single arg constructure with locateSolrHome()
`CoreContainer(SolrResourceLoader loader)` Minimal CoreContainer constructor.
`CoreContainer(String solrHome)`
`CoreContainer(String dir, File configFile)` Initalize CoreContainer directly from the constructor

Method Summary
`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.
`static void` | `fileCopy(File src, File dest)` Copies a src file to a dest file: used to circumvent the platform discrepancies regarding renaming files.
`protected void` | `finalize()`
`String` | `getAdminPath()`
`File` | `getConfigFile()`
`Properties` | `getContainerProperties()`
`SolrCore` | `getCore(String name)` Gets a core by name and increase its refcount.
`Collection<String>` | `getCoreNames()`
`Collection<String>` | `getCoreNames(SolrCore core)` This method is currently experimental.
`Collection<SolrCore>` | `getCores()`
`String` | `getDefaultCoreName()`
`String` | `getManagementPath()`
`CoreAdminHandler` | `getMultiCoreHandler()`
`String` | `getSolrHome()`
`boolean` | `isPersistent()`
`void` | `load(String dir, File configFile)` Load a config file listing the available solr cores.
`void` | `load(String dir, InputSource cfgis)` 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 returnPrevNotClosed)` Registers a SolrCore descriptor in the registry using the specified name.
`void` | `reload(String name)` Recreates a SolrCore.
`SolrCore` | `remove(String name)` Removes and returns registered core w/o decrementing it's reference count
`void` | `setAdminPath(String adminPath)`
`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.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static org.slf4j.Logger log

### cores

    protected final Map<String,SolrCore> cores

### persistent

    protected boolean persistent

### adminPath

    protected String adminPath

### managementPath

    protected String managementPath

### coreAdminHandler

    protected CoreAdminHandler coreAdminHandler

### configFile

    protected File configFile

### libDir

    protected String libDir

### libLoader

    protected ClassLoader libLoader

### loader

    protected SolrResourceLoader loader

### containerProperties

    protected Properties containerProperties

### indexSchemaCache

    protected Map<String,IndexSchema> indexSchemaCache

### adminHandler

    protected String adminHandler

### shareSchema

    protected boolean shareSchema

### solrHome

    protected String solrHome

### solrConfigFilenameOverride

    protected String solrConfigFilenameOverride

Constructor Detail

### CoreContainer

    @Deprecated
    public CoreContainer()

  Deprecated. use the single arg constructure with locateSolrHome()

  Deprecated

  See Also:
    `SolrResourceLoader.locateSolrHome()`

### CoreContainer

    public CoreContainer(String dir,
                         File configFile)
                  throws ParserConfigurationException,
                         IOException,
                         SAXException

  Initalize CoreContainer directly from the constructor

  Parameters:
    `dir` -
    `configFile` -
  Throws:
    `ParserConfigurationException`
    `IOException`
    `SAXException`

### CoreContainer

    public CoreContainer(SolrResourceLoader loader)

  Minimal CoreContainer constructor.

  Parameters:
    `loader` - the CoreContainer resource loader

### CoreContainer

    public CoreContainer(String solrHome)

Method Detail

### getContainerProperties

    public Properties getContainerProperties()

### load

    public void load(String dir,
                     File configFile)
              throws ParserConfigurationException,
                     IOException,
                     SAXException

  Load a config file listing the available solr cores.

  Parameters:
    `dir` - the home directory of all resources.
    `configFile` - the configuration file
  Throws:
    `ParserConfigurationException`
    `IOException`
    `SAXException`

### load

    public void load(String dir,
                     InputSource cfgis)
              throws ParserConfigurationException,
                     IOException,
                     SAXException

  Load a config file listing the available solr cores.

  Parameters:
    `dir` - the home directory of all resources.
    `cfgis` - the configuration file InputStream
  Throws:
    `ParserConfigurationException`
    `IOException`
    `SAXException`

### shutdown

    public void shutdown()

  Stops all cores.

### finalize

    protected void finalize()
                     throws Throwable

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

### register

    public SolrCore register(String name,
                             SolrCore core,
                             boolean returnPrevNotClosed)

  Registers a SolrCore descriptor in the registry using the specified name. If returnPrevNotClosed==false, the old core, if different, is closed. if true, it is returned w/o closing the core

  Returns:
    a previous core having the same name if it existed

### register

    public SolrCore register(SolrCore core,
                             boolean returnPrev)

  Registers a SolrCore descriptor in the registry using the core's name. If returnPrev==false, the old core, if different, is closed.

  Returns:
    a previous core having the same name if it existed and returnPrev==true

### create

    public SolrCore create(CoreDescriptor dcore)
                    throws ParserConfigurationException,
                           IOException,
                           SAXException

  Creates a new core based on a descriptor but does not register it.

  Parameters:
    `dcore` - a core descriptor
  Returns:
    the newly created core
  Throws:
    `ParserConfigurationException`
    `IOException`
    `SAXException`

### 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.

### reload

    public void reload(String name)
                throws ParserConfigurationException,
                       IOException,
                       SAXException

  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
  Throws:
    `ParserConfigurationException`
    `IOException`
    `SAXException`

### swap

    public void swap(String n0,
                     String n1)

  Swaps two SolrCore descriptors.

  Parameters:
    `n0` -
    `n1` -

### remove

    public SolrCore remove(String name)

  Removes and returns registered core w/o decrementing it's reference count

### 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
  See Also:
    `SolrCore.open()`, `SolrCore.close()`

### createMultiCoreHandler

    protected CoreAdminHandler createMultiCoreHandler(String adminHandlerClass)

  Creates a CoreAdminHandler for this MultiCore.

  Returns:
    a CoreAdminHandler

### getMultiCoreHandler

    public CoreAdminHandler getMultiCoreHandler()

### getDefaultCoreName

    public String getDefaultCoreName()

### isPersistent

    public boolean isPersistent()

### setPersistent

    public void setPersistent(boolean persistent)

### getAdminPath

    public String getAdminPath()

### setAdminPath

    public void setAdminPath(String adminPath)

### getManagementPath

    public String getManagementPath()

### setManagementPath

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

  Parameters:
    `path` -

### getConfigFile

    public File getConfigFile()

### persist

    public void persist()

  Persists the cores config file in cores.xml.

### persistFile

    public void persistFile(File file)

  Persists the cores config file in a user provided file.

### fileCopy

    public static void fileCopy(File src,
                                File dest)
                         throws IOException

  Copies a src file to a dest file: used to circumvent the platform discrepancies regarding renaming files.

  Throws:
    `IOException`

### getSolrHome

    public String getSolrHome()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD