Class CoreDescriptor


  • public class CoreDescriptor
    extends Object
    Metadata about a SolrCore. It's mostly loaded from a file on disk at the very beginning of loading a core.

    It's mostly but not completely immutable; we should fix this!

    Since:
    solr 1.3
    • Constructor Detail

      • 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
      • CoreDescriptor

        public CoreDescriptor​(String name,
                              Path instanceDir,
                              Map<String,​String> coreProps,
                              Properties containerProperties,
                              ZkController zkController)
        Create a new CoreDescriptor.
        Parameters:
        name - the CoreDescriptor's name
        instanceDir - a Path resolving to the instanceDir. Must be absolute.
        coreProps - a Map of the properties for this core
        containerProperties - the properties from the enclosing container.
        zkController - the ZkController in SolrCloud mode, otherwise null.
    • 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'
      • 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:
        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()
      • getInstanceDir

        public Path getInstanceDir()
        The core instance directory (absolute).
      • getConfigName

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

        public String getSchemaName()
        Returns:
        the core schema resource name. Not actually used if schema is managed mode.
      • getName

        public String getName()
        Returns:
        the initial core name
      • getCollectionName

        public String getCollectionName()
      • 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
      • getConfigSet

        public String getConfigSet()
      • setConfigSet

        public void setConfigSet​(String configSetName)
        TODO remove mutability or at least make this non-public?
      • getConfigSetPropertiesName

        public String getConfigSetPropertiesName()
      • isConfigSetTrusted

        public boolean isConfigSetTrusted()
      • setConfigSetTrusted

        public void setConfigSetTrusted​(boolean trusted)
        TODO remove mutability