Package org.apache.solr.cloud
Class ZkConfigSetService
- java.lang.Object
- 
- org.apache.solr.core.ConfigSetService
- 
- org.apache.solr.cloud.ZkConfigSetService
 
 
- 
 public class ZkConfigSetService extends ConfigSetService SolrCloud Zookeeper ConfigSetService impl.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.solr.core.ConfigSetServiceConfigSetService.ConfigResource
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static StringCONFIGS_ZKNODEZkNode where named configs are stored- 
Fields inherited from class org.apache.solr.core.ConfigSetServiceparentLoader, UPLOAD_FILENAME_EXCLUDE_PATTERN, UPLOAD_FILENAME_EXCLUDE_REGEX
 
- 
 - 
Constructor SummaryConstructors Constructor Description ZkConfigSetService(org.apache.solr.common.cloud.SolrZkClient zkClient)This is for ZkCLI and some testsZkConfigSetService(CoreContainer cc)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckConfigExists(String configName)Check whether a config existsStringconfigSetName(CoreDescriptor cd)Return a name for the ConfigSet for a core to be used for printing/diagnostic purposes.voidcopyConfig(String fromConfig, String toConfig)Copy a configSolrResourceLoadercreateCoreResourceLoader(CoreDescriptor cd)Create 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 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 LonggetCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFile)Returns a modification version for the schema file.org.apache.solr.client.solrj.cloud.SolrCloudManagergetSolrCloudManager()List<String>listConfigs()List the names of configs (non-null)protected org.apache.solr.common.util.NamedList<Object>loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader)Return the ConfigSet flags or null if none.voidsetConfigMetadata(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 dir)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 createNew param is set to true then file be overwritten- 
Methods inherited from class org.apache.solr.core.ConfigSetServicebootstrapConf, createConfigSetService, createIndexSchema, createSolrConfig, getConfigsetPath, getDefaultConfigDirPath, loadConfigSet, loadConfigSetProperties
 
- 
 
- 
- 
- 
Field Detail- 
CONFIGS_ZKNODEpublic static final String CONFIGS_ZKNODE ZkNode where named configs are stored- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
ZkConfigSetServicepublic ZkConfigSetService(CoreContainer cc) 
 - 
ZkConfigSetServicepublic ZkConfigSetService(org.apache.solr.common.cloud.SolrZkClient zkClient) This is for ZkCLI and some tests
 
- 
 - 
Method Detail- 
createCoreResourceLoaderpublic SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd) Description copied from class:ConfigSetServiceCreate a SolrResourceLoader for a core- Specified by:
- createCoreResourceLoaderin class- ConfigSetService
- Parameters:
- cd- the core's CoreDescriptor
- Returns:
- a SolrResourceLoader
 
 - 
loadConfigSetFlagsprotected org.apache.solr.common.util.NamedList<Object> loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) throws IOException Description copied from class:ConfigSetServiceReturn the ConfigSet flags or null if none.- Overrides:
- loadConfigSetFlagsin class- ConfigSetService
- Throws:
- IOException
 
 - 
getCurrentSchemaModificationVersionprotected Long getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFile) throws IOException 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 class- ConfigSetService
- Throws:
- IOException
 
 - 
configSetNamepublic String configSetName(CoreDescriptor cd) Description copied from class:ConfigSetServiceReturn a name for the ConfigSet for a core to be used for printing/diagnostic purposes.- Specified by:
- configSetNamein class- ConfigSetService
- Parameters:
- cd- the core's CoreDescriptor
- Returns:
- a name for the core's ConfigSet
 
 - 
checkConfigExistspublic boolean checkConfigExists(String configName) throws IOException Description copied from class:ConfigSetServiceCheck whether a config exists- Specified by:
- checkConfigExistsin class- ConfigSetService
- Parameters:
- configName- the config to check if it exists
- Returns:
- whether the config exists or not
- Throws:
- IOException
 
 - 
deleteConfigpublic void deleteConfig(String configName) throws IOException Description copied from class:ConfigSetServiceDelete a config (recursively deletes its files if not empty)- Specified by:
- deleteConfigin class- ConfigSetService
- Parameters:
- configName- the config to delete
- Throws:
- IOException
 
 - 
deleteFilesFromConfigpublic void deleteFilesFromConfig(String configName, List<String> filesToDelete) throws IOException Description copied from class:ConfigSetServiceDelete files in config- Specified by:
- deleteFilesFromConfigin class- ConfigSetService
- Parameters:
- configName- the name of the config
- filesToDelete- a list of file paths to delete
- Throws:
- IOException
 
 - 
copyConfigpublic void copyConfig(String fromConfig, String toConfig) throws IOException Description copied from class:ConfigSetServiceCopy a config- Specified by:
- copyConfigin class- ConfigSetService
- Parameters:
- fromConfig- the config to copy from
- toConfig- the config to copy to
- Throws:
- IOException
 
 - 
uploadConfigpublic void uploadConfig(String configName, Path dir) throws IOException Description copied from class:ConfigSetServiceUpload files from a given path to config- Specified by:
- uploadConfigin class- ConfigSetService
- Parameters:
- configName- the config name
- dir-- Pathto the files
- Throws:
- IOException- if an I/O error occurs or the path does not exist
 
 - 
uploadFileToConfigpublic 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 createNew param is set to true then file be overwritten- Specified by:
- uploadFileToConfigin class- ConfigSetService
- Parameters:
- configName- the name to give the config
- fileName- the name of the file
- data- the content of the file
- overwriteOnExists- if true then file will be overwritten
- Throws:
- IOException
 
 - 
setConfigMetadatapublic void setConfigMetadata(String configName, Map<String,Object> data) throws IOException 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 class- ConfigSetService
- Parameters:
- configName- the config name
- data- the metadata to be set on config
- Throws:
- IOException
 
 - 
getConfigMetadatapublic Map<String,Object> getConfigMetadata(String configName) throws IOException Description copied from class:ConfigSetServiceGet the config metadata (mutable, non-null)- Specified by:
- getConfigMetadatain class- ConfigSetService
- Parameters:
- configName- the config name
- Returns:
- the config metadata
- Throws:
- IOException
 
 - 
downloadConfigpublic void downloadConfig(String configName, Path dir) throws IOException Description copied from class:ConfigSetServiceDownload all files from this config to the filesystem at dir- Specified by:
- downloadConfigin class- ConfigSetService
- Parameters:
- configName- the config to download
- dir- the- Pathto write files under
- Throws:
- IOException
 
 - 
downloadFileFromConfigpublic byte[] downloadFileFromConfig(String configName, String filePath) throws IOException Description copied from class:ConfigSetServiceDownload a file from config If the file does not exist, it returns null- Specified by:
- downloadFileFromConfigin class- ConfigSetService
- Parameters:
- configName- the name of the config
- filePath- the file to download
- Returns:
- the content of the file
- Throws:
- IOException
 
 - 
listConfigspublic List<String> listConfigs() throws IOException Description copied from class:ConfigSetServiceList the names of configs (non-null)- Specified by:
- listConfigsin class- ConfigSetService
- Returns:
- list of config names
- Throws:
- IOException
 
 - 
getAllConfigFilespublic List<String> getAllConfigFiles(String configName) throws IOException 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 class- ConfigSetService
- Parameters:
- configName- the config name
- Returns:
- list of file name paths in the config
- Throws:
- IOException
 
 - 
getSolrCloudManagerpublic org.apache.solr.client.solrj.cloud.SolrCloudManager getSolrCloudManager() 
 
- 
 
-