org.apache.solr.core
Class CoreDescriptor

java.lang.Object
  extended by org.apache.solr.core.CoreDescriptor

public class CoreDescriptor
extends Object

A Solr core descriptor

Since:
solr 1.3

Field Summary
static String CORE_ABS_INSTDIR
           
static String CORE_COLLECTION
           
static String CORE_CONFIG
           
static String CORE_DATADIR
           
static String CORE_INSTDIR
           
static String CORE_LOADONSTARTUP
           
static String CORE_NAME
           
static String CORE_NODE_NAME
           
static String CORE_PROPERTIES
           
static String CORE_ROLES
           
static String CORE_SCHEMA
           
static String CORE_SHARD
           
static String CORE_TRANSIENT
           
static String CORE_ULOGDIR
           
protected  Properties coreProperties
          The properties for this core, as available through getProperty()
static String DEFAULT_EXTERNAL_PROPERTIES_FILE
           
protected  Properties originalCoreProperties
          The original standard core properties, before substitution
protected  Properties originalExtraProperties
          The original extra core properties, before substitution
static String SOLR_CORE_PROP_PREFIX
           
static com.google.common.collect.ImmutableList<String> standardPropNames
           
protected  Properties substitutableProperties
          The properties for this core, substitutable by resource loaders
 
Constructor Summary
CoreDescriptor(CoreContainer container, String name, String instanceDir)
          Create a new CoreDescriptor with a given name and instancedir
CoreDescriptor(CoreContainer container, String name, String instanceDir, Properties coreProps)
          Create a new CoreDescriptor.
CoreDescriptor(String coreName, CoreDescriptor other)
          Create a new CoreDescriptor using the properties of an existing one
 
Method Summary
protected  void buildSubstitutableProperties()
          Create the properties object used by resource loaders, etc, for property substitution.
static String checkPropertyIsNotEmpty(String value, String propName)
           
 CloudDescriptor getCloudDescriptor()
           
 String getCollectionName()
           
 String getConfigName()
           
 CoreContainer getCoreContainer()
           
 String getCoreProperty(String prop, String defVal)
          Returns a specific property defined on this CoreDescriptor
 String getDataDir()
           
 String getInstanceDir()
           
 String getName()
           
 Properties getPersistableStandardProperties()
          Get the standard properties in persistable form
 Properties getPersistableUserProperties()
          Get user-defined core properties in persistable form
 String getPropertiesName()
           
 String getRawInstanceDir()
           
 String getSchemaName()
           
 Properties getSubstitutableProperties()
          Returns all substitutable properties defined on this CoreDescriptor
 String getUlogDir()
           
 boolean isLoadOnStartup()
           
 boolean isTransient()
           
protected static boolean isUserDefinedProperty(String propName)
          Is this property a Solr-standard property, or is it an extra property defined per-core by the user?
protected  void loadExtraProperties()
          Load properties specified in an external properties file.
protected  File resolvePaths(String filepath)
           
 String toString()
           
 boolean usingDefaultDataDir()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CORE_NAME

public static final String CORE_NAME
See Also:
Constant Field Values

CORE_CONFIG

public static final String CORE_CONFIG
See Also:
Constant Field Values

CORE_INSTDIR

public static final String CORE_INSTDIR
See Also:
Constant Field Values

CORE_ABS_INSTDIR

public static final String CORE_ABS_INSTDIR
See Also:
Constant Field Values

CORE_DATADIR

public static final String CORE_DATADIR
See Also:
Constant Field Values

CORE_ULOGDIR

public static final String CORE_ULOGDIR
See Also:
Constant Field Values

CORE_SCHEMA

public static final String CORE_SCHEMA
See Also:
Constant Field Values

CORE_SHARD

public static final String CORE_SHARD
See Also:
Constant Field Values

CORE_COLLECTION

public static final String CORE_COLLECTION
See Also:
Constant Field Values

CORE_ROLES

public static final String CORE_ROLES
See Also:
Constant Field Values

CORE_PROPERTIES

public static final String CORE_PROPERTIES
See Also:
Constant Field Values

CORE_LOADONSTARTUP

public static final String CORE_LOADONSTARTUP
See Also:
Constant Field Values

CORE_TRANSIENT

public static final String CORE_TRANSIENT
See Also:
Constant Field Values

CORE_NODE_NAME

public static final String CORE_NODE_NAME
See Also:
Constant Field Values

SOLR_CORE_PROP_PREFIX

public static final String SOLR_CORE_PROP_PREFIX
See Also:
Constant Field Values

DEFAULT_EXTERNAL_PROPERTIES_FILE

public static final String DEFAULT_EXTERNAL_PROPERTIES_FILE

standardPropNames

public static com.google.common.collect.ImmutableList<String> standardPropNames

originalCoreProperties

protected final Properties originalCoreProperties
The original standard core properties, before substitution


originalExtraProperties

protected final Properties originalExtraProperties
The original extra core properties, before substitution


coreProperties

protected final Properties coreProperties
The properties for this core, as available through getProperty()


substitutableProperties

protected final Properties substitutableProperties
The properties for this core, substitutable by resource loaders

Constructor Detail

CoreDescriptor

public CoreDescriptor(CoreContainer container,
                      String name,
                      String instanceDir,
                      Properties coreProps)
Create a new CoreDescriptor.

Parameters:
container - the CoreDescriptor's container
name - the CoreDescriptor's name
instanceDir - a String containing the instanceDir
coreProps - a Properties object of the properties for this core

CoreDescriptor

public CoreDescriptor(CoreContainer container,
                      String name,
                      String instanceDir)
Create a new CoreDescriptor with a given name and instancedir

Parameters:
container - the CoreDescriptor's container
name - the CoreDescriptor's name
instanceDir - the CoreDescriptor's instancedir

CoreDescriptor

public CoreDescriptor(String coreName,
                      CoreDescriptor other)
Create a new CoreDescriptor using the properties of an existing one

Parameters:
coreName - the new CoreDescriptor's name
other - the CoreDescriptor to copy
Method Detail

getPersistableStandardProperties

public Properties getPersistableStandardProperties()
Get the standard properties in persistable form

Returns:
the standard core properties in persistable form

getPersistableUserProperties

public Properties getPersistableUserProperties()
Get user-defined core properties in persistable form

Returns:
user-defined core properties in persistable form

loadExtraProperties

protected void loadExtraProperties()
Load properties specified in an external properties file. The file to load can be specified in a properties property on the original Properties object used to create this CoreDescriptor. If this has not been set, then we look for conf/solrcore.properties underneath the instance dir. File paths are taken as read from the core's instance directory if they are not absolute.


buildSubstitutableProperties

protected void buildSubstitutableProperties()
Create the properties object used by resource loaders, etc, for property substitution. The default solr properties are prefixed with 'solr.core.', so, e.g., 'name' becomes 'solr.core.name'


resolvePaths

protected File resolvePaths(String filepath)

isUserDefinedProperty

protected static boolean isUserDefinedProperty(String propName)
Is this property a Solr-standard property, or is it an extra property defined per-core by the user?

Parameters:
propName - the Property name
Returns:
@{code true} if this property is user-defined

checkPropertyIsNotEmpty

public static String checkPropertyIsNotEmpty(String value,
                                             String propName)

getPropertiesName

public String getPropertiesName()

getDataDir

public String getDataDir()

usingDefaultDataDir

public boolean usingDefaultDataDir()

getRawInstanceDir

public String getRawInstanceDir()
Returns:
the core instance directory.

getInstanceDir

public String getInstanceDir()
Returns:
the core instance directory, prepended with solr_home if not an absolute path.

getConfigName

public String getConfigName()
Returns:
the core configuration resource name.

getSchemaName

public String getSchemaName()
Returns:
the core schema resource name.

getName

public String getName()
Returns:
the initial core name

getCollectionName

public String getCollectionName()

getCoreContainer

public CoreContainer getCoreContainer()

getCloudDescriptor

public CloudDescriptor getCloudDescriptor()

isLoadOnStartup

public boolean isLoadOnStartup()

isTransient

public boolean isTransient()

getUlogDir

public String getUlogDir()

getCoreProperty

public String getCoreProperty(String prop,
                              String defVal)
Returns a specific property defined on this CoreDescriptor

Parameters:
prop - - value to read from the properties structure.
defVal - - return if no property found.
Returns:
associated string. May be null.

getSubstitutableProperties

public Properties getSubstitutableProperties()
Returns all substitutable properties defined on this CoreDescriptor

Returns:
all substitutable properties defined on this CoreDescriptor

toString

public String toString()
Overrides:
toString in class Object


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