Package org.apache.solr.core
Class FileSystemConfigSetService
java.lang.Object
org.apache.solr.core.ConfigSetService
org.apache.solr.core.FileSystemConfigSetService
FileSystem ConfigSetService impl.
Loads a ConfigSet defined by the core's configSet property, looking for a directory named for the configSet property value underneath a base directory. If no configSet property is set, loads the ConfigSet instead from the core's instance directory.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.solr.core.ConfigSetService
ConfigSetService.ConfigResource -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String.metadata.json hidden file where metadata is storedFields inherited from class org.apache.solr.core.ConfigSetService
parentLoader, UPLOAD_FILENAME_EXCLUDE_PATTERN, UPLOAD_FILENAME_EXCLUDE_REGEX -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFileSystemConfigSetService(Path configSetBase) Testing purpose -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckConfigExists(String configName) Check whether a config existsReturn a name for the ConfigSet for a core to be used for printing/diagnostic purposes.voidcopyConfig(String fromConfig, String toConfig) Copy a configCreate a SolrResourceLoader for a corevoiddeleteConfig(String configName) Delete a config (recursively deletes its files if not empty)voiddeleteFilesFromConfig(String configName, List<String> filesToDelete) Delete files in configvoiddownloadConfig(String configName, Path dest) Download all files from this config to the filesystem at dirbyte[]downloadFileFromConfig(String configName, String fileName) Download a file from config If the file does not exist, it returns nullgetAllConfigFiles(String configName) Get the names of the files in config including dirs (mutable, non-null) sorted lexicographically e.g.protected PathgetConfigDir(String configName) getConfigMetadata(String configName) Get the config metadata (mutable, non-null)getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFileName) Returns a modification version for the schema file.List the names of configs (non-null)protected PathvoidsetConfigMetadata(String configName, Map<String, Object> data) Set the config metadata If config does not exist, it will be created and set metadata on it Else metadata will be replaced with the provided metadatavoiduploadConfig(String configName, Path source) Upload files from a given path to configvoiduploadFileToConfig(String configName, String fileName, byte[] data, boolean overwriteOnExists) Upload a file to config If file does not exist, it will be uploaded If overwriteOnExists is set to true then file will be overwrittenMethods inherited from class org.apache.solr.core.ConfigSetService
createConfigSetService, createIndexSchema, createSolrConfig, getConfigsetPath, getDefaultConfigDirPath, loadConfigSet, loadConfigSetFlags, loadConfigSetProperties
-
Field Details
-
METADATA_FILE
.metadata.json hidden file where metadata is stored- See Also:
-
-
Constructor Details
-
FileSystemConfigSetService
-
FileSystemConfigSetService
Testing purpose
-
-
Method Details
-
createCoreResourceLoader
Description copied from class:ConfigSetServiceCreate a SolrResourceLoader for a core- Specified by:
createCoreResourceLoaderin classConfigSetService- Parameters:
cd- the core's CoreDescriptor- Returns:
- a SolrResourceLoader
-
configSetName
Description copied from class:ConfigSetServiceReturn a name for the ConfigSet for a core to be used for printing/diagnostic purposes.- Specified by:
configSetNamein classConfigSetService- Parameters:
cd- the core's CoreDescriptor- Returns:
- a name for the core's ConfigSet
-
checkConfigExists
Description copied from class:ConfigSetServiceCheck whether a config exists- Specified by:
checkConfigExistsin classConfigSetService- Parameters:
configName- the config to check if it exists- Returns:
- whether the config exists or not
- Throws:
IOException
-
deleteConfig
Description copied from class:ConfigSetServiceDelete a config (recursively deletes its files if not empty)- Specified by:
deleteConfigin classConfigSetService- Parameters:
configName- the config to delete- Throws:
IOException
-
deleteFilesFromConfig
Description copied from class:ConfigSetServiceDelete files in config- Specified by:
deleteFilesFromConfigin classConfigSetService- Parameters:
configName- the name of the configfilesToDelete- a list of file paths to delete using '/' as file path separator- Throws:
IOException
-
copyConfig
Description copied from class:ConfigSetServiceCopy a config- Specified by:
copyConfigin classConfigSetService- Parameters:
fromConfig- the config to copy fromtoConfig- the config to copy to- Throws:
IOException
-
uploadConfig
Description copied from class:ConfigSetServiceUpload files from a given path to config- Specified by:
uploadConfigin classConfigSetService- Parameters:
configName- the config namesource-Pathto the files- Throws:
IOException- if an I/O error occurs or the path does not exist
-
uploadFileToConfig
public void uploadFileToConfig(String configName, String fileName, byte[] data, boolean overwriteOnExists) throws IOException Description copied from class:ConfigSetServiceUpload a file to config If file does not exist, it will be uploaded If overwriteOnExists is set to true then file will be overwritten- Specified by:
uploadFileToConfigin classConfigSetService- Parameters:
configName- the name to give the configfileName- the name of the file with '/' used as the file path separatordata- the content of the fileoverwriteOnExists- if true then file will be overwritten- Throws:
IOException
-
setConfigMetadata
Description copied from class:ConfigSetServiceSet the config metadata If config does not exist, it will be created and set metadata on it Else metadata will be replaced with the provided metadata- Specified by:
setConfigMetadatain classConfigSetService- Parameters:
configName- the config namedata- the metadata to be set on config- Throws:
IOException
-
getConfigMetadata
Description copied from class:ConfigSetServiceGet the config metadata (mutable, non-null)- Specified by:
getConfigMetadatain classConfigSetService- Parameters:
configName- the config name- Returns:
- the config metadata
- Throws:
IOException
-
downloadConfig
Description copied from class:ConfigSetServiceDownload all files from this config to the filesystem at dir- Specified by:
downloadConfigin classConfigSetService- Parameters:
configName- the config to downloaddest- thePathto write files under- Throws:
IOException
-
listConfigs
Description copied from class:ConfigSetServiceList the names of configs (non-null)- Specified by:
listConfigsin classConfigSetService- Returns:
- list of config names
- Throws:
IOException
-
downloadFileFromConfig
Description copied from class:ConfigSetServiceDownload a file from config If the file does not exist, it returns null- Specified by:
downloadFileFromConfigin classConfigSetService- Parameters:
configName- the name of the configfileName- the file to download with '/' as the separator- Returns:
- the content of the file
- Throws:
IOException
-
getAllConfigFiles
Description copied from class:ConfigSetServiceGet the names of the files in config including dirs (mutable, non-null) sorted lexicographically e.g. solrconfig.xml, lang/, lang/stopwords_en.txt- Specified by:
getAllConfigFilesin classConfigSetService- Parameters:
configName- the config name- Returns:
- list of file name paths in the config with '/' uses as file path separators
- Throws:
IOException
-
locateInstanceDir
-
getCurrentSchemaModificationVersion
public Long getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFileName) Description copied from class:ConfigSetServiceReturns a modification version for the schema file. Null may be returned if not known, and if so it defeats schema caching.- Specified by:
getCurrentSchemaModificationVersionin classConfigSetService
-
getConfigDir
- Throws:
IOException
-