Class ManagedIndexSchemaFactory
- java.lang.Object
-
- org.apache.solr.schema.IndexSchemaFactory
-
- org.apache.solr.schema.ManagedIndexSchemaFactory
-
- All Implemented Interfaces:
NamedListInitializedPlugin
,SolrCoreAware
public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements SolrCoreAware
Factory for ManagedIndexSchema
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.schema.IndexSchemaFactory
IndexSchemaFactory.VersionedConfig
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME
static String
LEGACY_MANAGED_SCHEMA_RESOURCE_NAME
static String
MANAGED_SCHEMA_RESOURCE_NAME
static String
UPGRADED_SCHEMA_EXTENSION
-
Fields inherited from class org.apache.solr.schema.IndexSchemaFactory
CACHE_MISS_LISTENER
-
-
Constructor Summary
Constructors Constructor Description ManagedIndexSchemaFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ManagedIndexSchema
create(String resourceName, SolrConfig config, ConfigSetService configSetService)
First, try to locate the managed schema file named in the managedSchemaResourceName param.SolrConfig
getConfig()
String
getManagedSchemaResourceName()
SolrResourceLoader
getResourceLoader()
ManagedIndexSchema
getSchema()
String
getSchemaResourceName(String cdResourceName)
Returns the resource (file) name that will be used for the schema itself.Object
getSchemaUpdateLock()
void
inform(SolrCore core)
void
init(org.apache.solr.common.util.NamedList<?> args)
init
will be called just once, immediately after creation.boolean
isMutable()
Path
lookupLocalManagedSchemaPath()
Lookup the path to the managed schema, dealing with falling back to the legacy managed-schema file, instead of the expected managed-schema.xml file if the legacy file exists.String
lookupZKManagedSchemaPath()
Lookup the path to the managed schema, dealing with falling back to the legacy managed-schema file, instead of the expected managed-schema.xml file if the legacy file exists.void
setSchema(ManagedIndexSchema schema)
-
Methods inherited from class org.apache.solr.schema.IndexSchemaFactory
buildIndexSchema, buildIndexSchema, getConfigResource, getFromCache, getParsedSchema, newIndexSchemaFactory
-
-
-
-
Field Detail
-
UPGRADED_SCHEMA_EXTENSION
public static final String UPGRADED_SCHEMA_EXTENSION
- See Also:
- Constant Field Values
-
DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME
public static final String DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME
- See Also:
- Constant Field Values
-
LEGACY_MANAGED_SCHEMA_RESOURCE_NAME
public static final String LEGACY_MANAGED_SCHEMA_RESOURCE_NAME
- See Also:
- Constant Field Values
-
MANAGED_SCHEMA_RESOURCE_NAME
public static final String MANAGED_SCHEMA_RESOURCE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getManagedSchemaResourceName
public String getManagedSchemaResourceName()
-
getResourceLoader
public SolrResourceLoader getResourceLoader()
-
init
public void init(org.apache.solr.common.util.NamedList<?> args)
Description copied from interface:NamedListInitializedPlugin
init
will be called just once, immediately after creation.Source of the initialization arguments will typically be solrconfig.xml, but will ultimately depends on the plugin itself
- Specified by:
init
in interfaceNamedListInitializedPlugin
- Parameters:
args
- non-null list of initialization parameters (may be empty)
-
getSchemaResourceName
public String getSchemaResourceName(String cdResourceName)
Description copied from class:IndexSchemaFactory
Returns the resource (file) name that will be used for the schema itself. The answer may be a guess. Do not pass the result of this toIndexSchemaFactory.create(String, SolrConfig, ConfigSetService)
. The input is the name coming from theCoreDescriptor
which acts as a default or asked-for name.- Overrides:
getSchemaResourceName
in classIndexSchemaFactory
-
lookupZKManagedSchemaPath
public String lookupZKManagedSchemaPath()
Lookup the path to the managed schema, dealing with falling back to the legacy managed-schema file, instead of the expected managed-schema.xml file if the legacy file exists.This method is duplicated in ManagedIndexSchema.
-
lookupLocalManagedSchemaPath
public Path lookupLocalManagedSchemaPath()
Lookup the path to the managed schema, dealing with falling back to the legacy managed-schema file, instead of the expected managed-schema.xml file if the legacy file exists.
-
create
public ManagedIndexSchema create(String resourceName, SolrConfig config, ConfigSetService configSetService)
First, try to locate the managed schema file named in the managedSchemaResourceName param. If the managed schema file exists and is accessible, it is used to instantiate an IndexSchema.If the managed schema file can't be found, the resource named by the resourceName parameter is used to instantiate an IndexSchema.
Once the IndexSchema is instantiated, if the managed schema file does not exist, the instantiated IndexSchema is persisted to the managed schema file named in the managedSchemaResourceName param, in the directory given by
SolrResourceLoader.getConfigPath()
, or if configs are in ZooKeeper, underZkSolrResourceLoader.getConfigSetZkPath()
.After the managed schema file is persisted, the original schema file is renamed by appending the extension named in
UPGRADED_SCHEMA_EXTENSION
.- Overrides:
create
in classIndexSchemaFactory
-
getSchemaUpdateLock
public Object getSchemaUpdateLock()
-
inform
public void inform(SolrCore core)
- Specified by:
inform
in interfaceSolrCoreAware
-
getSchema
public ManagedIndexSchema getSchema()
-
setSchema
public void setSchema(ManagedIndexSchema schema)
-
isMutable
public boolean isMutable()
-
getConfig
public SolrConfig getConfig()
-
-