Package org.apache.solr.core
Class FileSystemConfigSetService
- java.lang.Object
-
- org.apache.solr.core.ConfigSetService
-
- org.apache.solr.core.FileSystemConfigSetService
-
public class FileSystemConfigSetService extends ConfigSetService
Solr Standalone File System 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
-
Fields inherited from class org.apache.solr.core.ConfigSetService
parentLoader, UPLOAD_FILENAME_EXCLUDE_PATTERN, UPLOAD_FILENAME_EXCLUDE_REGEX
-
-
Constructor Summary
Constructors Constructor Description FileSystemConfigSetService(CoreContainer cc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkConfigExists(String configName)
Check whether a config existsString
configSetName(CoreDescriptor cd)
Return a name for the ConfigSet for a core to be used for printing/diagnostic purposes.void
copyConfig(String fromConfig, String toConfig)
Copy a configSolrResourceLoader
createCoreResourceLoader(CoreDescriptor cd)
Create a SolrResourceLoader for a corevoid
deleteConfig(String configName)
Delete a config (recursively deletes its files if not empty)void
deleteFilesFromConfig(String configName, List<String> filesToDelete)
Delete files in configvoid
downloadConfig(String configName, Path dir)
Download all files from this config to the filesystem at dirbyte[]
downloadFileFromConfig(String configName, String filePath)
Download a file from config If the file does not exist, it returns nullList<String>
getAllConfigFiles(String configName)
Get the names of the files in config including dirs (mutable, non-null) sorted lexicographically e.g.Map<String,Object>
getConfigMetadata(String configName)
Get the config metadata (mutable, non-null)protected Long
getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFileName)
Returns a modification version for the schema file.List<String>
listConfigs()
List the names of configs (non-null)protected Path
locateInstanceDir(CoreDescriptor cd)
void
setConfigMetadata(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 metadatavoid
uploadConfig(String configName, Path dir)
Upload files from a given path to configvoid
uploadFileToConfig(String configName, String fileName, byte[] data, boolean overwriteOnExists)
Upload a file to config If file does not exist, it will be uploaded If createNew param is set to true then file be overwritten-
Methods inherited from class org.apache.solr.core.ConfigSetService
bootstrapConf, createConfigSetService, createIndexSchema, createSolrConfig, getConfigsetPath, getDefaultConfigDirPath, loadConfigSet, loadConfigSetFlags, loadConfigSetProperties
-
-
-
-
Constructor Detail
-
FileSystemConfigSetService
public FileSystemConfigSetService(CoreContainer cc)
-
-
Method Detail
-
createCoreResourceLoader
public SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd)
Description copied from class:ConfigSetService
Create a SolrResourceLoader for a core- Specified by:
createCoreResourceLoader
in classConfigSetService
- Parameters:
cd
- the core's CoreDescriptor- Returns:
- a SolrResourceLoader
-
configSetName
public String configSetName(CoreDescriptor cd)
Description copied from class:ConfigSetService
Return a name for the ConfigSet for a core to be used for printing/diagnostic purposes.- Specified by:
configSetName
in classConfigSetService
- Parameters:
cd
- the core's CoreDescriptor- Returns:
- a name for the core's ConfigSet
-
checkConfigExists
public boolean checkConfigExists(String configName) throws IOException
Description copied from class:ConfigSetService
Check whether a config exists- Specified by:
checkConfigExists
in classConfigSetService
- Parameters:
configName
- the config to check if it exists- Returns:
- whether the config exists or not
- Throws:
IOException
-
deleteConfig
public void deleteConfig(String configName) throws IOException
Description copied from class:ConfigSetService
Delete a config (recursively deletes its files if not empty)- Specified by:
deleteConfig
in classConfigSetService
- Parameters:
configName
- the config to delete- Throws:
IOException
-
deleteFilesFromConfig
public void deleteFilesFromConfig(String configName, List<String> filesToDelete) throws IOException
Description copied from class:ConfigSetService
Delete files in config- Specified by:
deleteFilesFromConfig
in classConfigSetService
- Parameters:
configName
- the name of the configfilesToDelete
- a list of file paths to delete- Throws:
IOException
-
copyConfig
public void copyConfig(String fromConfig, String toConfig) throws IOException
Description copied from class:ConfigSetService
Copy a config- Specified by:
copyConfig
in classConfigSetService
- Parameters:
fromConfig
- the config to copy fromtoConfig
- the config to copy to- Throws:
IOException
-
uploadConfig
public void uploadConfig(String configName, Path dir) throws IOException
Description copied from class:ConfigSetService
Upload files from a given path to config- Specified by:
uploadConfig
in classConfigSetService
- Parameters:
configName
- the config namedir
-Path
to 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:ConfigSetService
Upload a file to config If file does not exist, it will be uploaded If createNew param is set to true then file be overwritten- Specified by:
uploadFileToConfig
in classConfigSetService
- Parameters:
configName
- the name to give the configfileName
- the name of the filedata
- the content of the fileoverwriteOnExists
- if true then file will be overwritten- Throws:
IOException
-
setConfigMetadata
public void setConfigMetadata(String configName, Map<String,Object> data) throws IOException
Description copied from class:ConfigSetService
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 metadata- Specified by:
setConfigMetadata
in classConfigSetService
- Parameters:
configName
- the config namedata
- the metadata to be set on config- Throws:
IOException
-
getConfigMetadata
public Map<String,Object> getConfigMetadata(String configName) throws IOException
Description copied from class:ConfigSetService
Get the config metadata (mutable, non-null)- Specified by:
getConfigMetadata
in classConfigSetService
- Parameters:
configName
- the config name- Returns:
- the config metadata
- Throws:
IOException
-
downloadConfig
public void downloadConfig(String configName, Path dir) throws IOException
Description copied from class:ConfigSetService
Download all files from this config to the filesystem at dir- Specified by:
downloadConfig
in classConfigSetService
- Parameters:
configName
- the config to downloaddir
- thePath
to write files under- Throws:
IOException
-
listConfigs
public List<String> listConfigs() throws IOException
Description copied from class:ConfigSetService
List the names of configs (non-null)- Specified by:
listConfigs
in classConfigSetService
- Returns:
- list of config names
- Throws:
IOException
-
downloadFileFromConfig
public byte[] downloadFileFromConfig(String configName, String filePath) throws IOException
Description copied from class:ConfigSetService
Download a file from config If the file does not exist, it returns null- Specified by:
downloadFileFromConfig
in classConfigSetService
- Parameters:
configName
- the name of the configfilePath
- the file to download- Returns:
- the content of the file
- Throws:
IOException
-
getAllConfigFiles
public List<String> getAllConfigFiles(String configName) throws IOException
Description copied from class:ConfigSetService
Get 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:
getAllConfigFiles
in classConfigSetService
- Parameters:
configName
- the config name- Returns:
- list of file name paths in the config
- Throws:
IOException
-
locateInstanceDir
protected Path locateInstanceDir(CoreDescriptor cd)
-
getCurrentSchemaModificationVersion
protected Long getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFileName) throws IOException
Description copied from class:ConfigSetService
Returns a modification version for the schema file. Null may be returned if not known, and if so it defeats schema caching.- Specified by:
getCurrentSchemaModificationVersion
in classConfigSetService
- Throws:
IOException
-
-