org.apache.solr.core
Class SolrXMLCoresLocator

java.lang.Object
  extended by org.apache.solr.core.SolrXMLCoresLocator
All Implemented Interfaces:
CoresLocator
Direct Known Subclasses:
SolrXMLCoresLocator.NonPersistingLocator

public class SolrXMLCoresLocator
extends Object
implements CoresLocator

Writes any changes in core definitions to this instance's solr.xml


Nested Class Summary
static class SolrXMLCoresLocator.NonPersistingLocator
           
 
Field Summary
static String DEFAULT_CORE_NAME
          Core name to use if a core definition has no name
static String INDENT
           
static String NEWLINE
           
 
Constructor Summary
SolrXMLCoresLocator(String originalXML, ConfigSolrXmlOld cfg)
          Create a new SolrXMLCoresLocator
 
Method Summary
protected static String buildCoreTag(CoreDescriptor cd)
          Serialize a coredescriptor as a String containing an XML <core> tag.
protected  String buildSolrXML(List<CoreDescriptor> cds)
           
 void create(CoreContainer cc, CoreDescriptor... coreDescriptors)
          Make new cores available for discovery
 void delete(CoreContainer cc, CoreDescriptor... coreDescriptors)
          Ensure that the core definitions from the passed in CoreDescriptors are not available for discovery
 List<CoreDescriptor> discover(CoreContainer cc)
          Load all the CoreDescriptors from persistence store
protected  void doPersist(String xml)
           
 void persist(CoreContainer cc, CoreDescriptor... coreDescriptors)
          Ensure that the core definitions from the passed in CoreDescriptors will persist across container restarts.
 void rename(CoreContainer cc, CoreDescriptor oldCD, CoreDescriptor newCD)
          Persist the new name of a renamed core
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CORE_NAME

public static final String DEFAULT_CORE_NAME
Core name to use if a core definition has no name

See Also:
Constant Field Values

NEWLINE

public static final String NEWLINE

INDENT

public static final String INDENT
See Also:
Constant Field Values
Constructor Detail

SolrXMLCoresLocator

public SolrXMLCoresLocator(String originalXML,
                           ConfigSolrXmlOld cfg)
Create a new SolrXMLCoresLocator

Parameters:
originalXML - the original content of the solr.xml file
cfg - the CoreContainer's config object
Method Detail

buildSolrXML

protected String buildSolrXML(List<CoreDescriptor> cds)

buildCoreTag

protected static String buildCoreTag(CoreDescriptor cd)
Serialize a coredescriptor as a String containing an XML <core> tag.

Parameters:
cd - the CoreDescriptor
Returns:
an XML representation of the CoreDescriptor

persist

public final void persist(CoreContainer cc,
                          CoreDescriptor... coreDescriptors)
Description copied from interface: CoresLocator
Ensure that the core definitions from the passed in CoreDescriptors will persist across container restarts.

Specified by:
persist in interface CoresLocator
Parameters:
cc - the CoreContainer
coreDescriptors - CoreDescriptors to persist

doPersist

protected void doPersist(String xml)

create

public void create(CoreContainer cc,
                   CoreDescriptor... coreDescriptors)
Description copied from interface: CoresLocator
Make new cores available for discovery

Specified by:
create in interface CoresLocator
Parameters:
cc - the CoreContainer
coreDescriptors - CoreDescriptors to persist

delete

public void delete(CoreContainer cc,
                   CoreDescriptor... coreDescriptors)
Description copied from interface: CoresLocator
Ensure that the core definitions from the passed in CoreDescriptors are not available for discovery

Specified by:
delete in interface CoresLocator
Parameters:
cc - the CoreContainer
coreDescriptors - CoreDescriptors of the cores to remove

rename

public void rename(CoreContainer cc,
                   CoreDescriptor oldCD,
                   CoreDescriptor newCD)
Description copied from interface: CoresLocator
Persist the new name of a renamed core

Specified by:
rename in interface CoresLocator
Parameters:
cc - the CoreContainer
oldCD - the CoreDescriptor of the core before renaming
newCD - the CoreDescriptor of the core after renaming

discover

public List<CoreDescriptor> discover(CoreContainer cc)
Description copied from interface: CoresLocator
Load all the CoreDescriptors from persistence store

Specified by:
discover in interface CoresLocator
Parameters:
cc - the CoreContainer
Returns:
a list of all CoreDescriptors found


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