Interface ConfigurationService
- All Known Implementing Classes:
ConfigurationServiceImpl,ConfigurationServiceInternalImpl
public interface ConfigurationService
Service that helps access different Studio configuration.
- Author:
- avasquez
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetCacheKey(String siteId, String module, String path, String environment) Builds the key for a given fileBuilds the key for a given fileorg.dom4j.DocumentgetConfigurationAsDocument(String siteId, String module, String path, String environment) Get configuration as DOM document for given parametersgetConfigurationAsString(String siteId, String module, String path, String environment) Get configuration as string for given parametersgetConfigurationHistory(String siteId, String module, String path, String environment) Get configuration history for given parametersorg.dom4j.DocumentGet configuration from global repository as DocumentGet configuration from global repository as StringGet global role mappings configurationorg.apache.commons.configuration2.HierarchicalConfiguration<?> Reads a configuration file using Apache Commons Configurationorg.springframework.core.io.ResourceGet a file from a plugingetRoleMappings(String siteId) Get role mappings configuration for given sitegetTranslationConfiguration(String siteId) Get the translation configuration for a given siteorg.apache.commons.configuration2.HierarchicalConfiguration<?> getXmlConfiguration(String siteId, String path) Reads a configuration file using Apache Commons Configurationorg.apache.commons.configuration2.HierarchicalConfiguration<?> getXmlConfiguration(String siteId, String module, String path) Reads a configuration for the current environment, or fallback to the default environment if the file is missingvoidinvalidateConfiguration(String siteId) Invalidates all objects for a given sitevoidinvalidateConfiguration(String siteId, String path) Invalidates the cache for the given filevoidinvalidateConfiguration(String siteId, String module, String path, String environment) Invalidates the cache for the given filelegacyGetConfiguration(String site, String path) This method holds logic for API 1, can be deleted when API 1 get configuration is removedvoidmakeBlobStoresReadOnly(String siteId) Update blob stores configuration to make all blobStores read-onlyvoidwriteConfiguration(String siteId, String module, String path, String environment, InputStream content) Write configuration file for given parametersvoidwriteGlobalConfiguration(String path, InputStream content) Write configuration file within global repo
-
Method Details
-
getRoleMappings
Map<NormalizedGroup,List<NormalizedRole>> getRoleMappings(String siteId) throws ServiceLayerException Get role mappings configuration for given site- Parameters:
siteId- Site id to use- Returns:
- role mappings configuration
- Throws:
ConfigurationException- configuration errorServiceLayerException
-
getGlobalRoleMappings
Get global role mappings configuration- Returns:
- role mappings configuration
- Throws:
ConfigurationException- configuration errorServiceLayerException
-
getConfigurationAsString
String getConfigurationAsString(String siteId, String module, String path, String environment) throws ContentNotFoundException Get configuration as string for given parameters- Parameters:
siteId- site id to usemodule- CrafterCMS modulepath- path of configuration fileenvironment- environment to use. if empty using default- Returns:
- String content of configuration file
- Throws:
ContentNotFoundException- if there is any issue reading the file from the repository
-
getConfigurationAsDocument
org.dom4j.Document getConfigurationAsDocument(String siteId, String module, String path, String environment) throws ServiceLayerException Get configuration as DOM document for given parameters- Parameters:
siteId- site id to usemodule- CrafterCMS modulepath- path of configuration fileenvironment- environment to use. if empty using default- Returns:
- DOM document representing configuration file
- Throws:
ServiceLayerException- if there is any error loading the configuration
-
getXmlConfiguration
org.apache.commons.configuration2.HierarchicalConfiguration<?> getXmlConfiguration(String siteId, String path) throws ConfigurationException Reads a configuration file using Apache Commons Configuration- Parameters:
siteId- the id of the sitepath- the path of the file- Returns:
- the configuration object
- Throws:
ConfigurationException- if there is any error reading or parsing the file
-
getXmlConfiguration
org.apache.commons.configuration2.HierarchicalConfiguration<?> getXmlConfiguration(String siteId, String module, String path) throws ConfigurationException Reads a configuration for the current environment, or fallback to the default environment if the file is missing- Parameters:
siteId- the id of the sitemodule- the modulepath- the path of the file- Returns:
- the configuration object
- Throws:
ConfigurationException- if there is any error reading or parsing the file
-
getGlobalXmlConfiguration
org.apache.commons.configuration2.HierarchicalConfiguration<?> getGlobalXmlConfiguration(String path) throws ConfigurationException Reads a configuration file using Apache Commons Configuration- Parameters:
path- the path of the file- Returns:
- the configuration object
- Throws:
ConfigurationException- if there is any error reading or parsing the file
-
getGlobalConfigurationAsDocument
Get configuration from global repository as Document- Parameters:
path- path of the configuration file- Returns:
- the Document
- Throws:
ServiceLayerException- if there is any error reading the configuration
-
getGlobalConfigurationAsString
Get configuration from global repository as String- Parameters:
path- path of configuration file- Returns:
- String content of configuration file
- Throws:
ContentNotFoundException- if there is any issue reading the file from the repository
-
writeConfiguration
void writeConfiguration(String siteId, String module, String path, String environment, InputStream content) throws ServiceLayerException, UserNotFoundException Write configuration file for given parameters- Parameters:
siteId- site id to usemodule- CrafterCMS modulepath- path where to store configuration fileenvironment- environment to use. if empty using defaultcontent- content of configuration file- Throws:
ServiceLayerException- general service errorUserNotFoundException
-
getPluginFile
org.springframework.core.io.Resource getPluginFile(String siteId, String pluginId, String type, String name, String filename) throws ContentNotFoundException Get a file from a plugin- Parameters:
siteId- the id of sitepluginId- the id of the plugintype- the type of pluginname- the name of the pluginfilename- the path and name of the file- Returns:
- the file as a resource
- Throws:
ContentNotFoundException- if there is any issue reading the file from the repository
-
getConfigurationHistory
ConfigurationHistory getConfigurationHistory(String siteId, String module, String path, String environment) throws ServiceLayerException Get configuration history for given parameters- Parameters:
siteId- site id to usemodule- CrafterCMS modulepath- path of configuration fileenvironment- environment to use. if empty using default- Returns:
- configuration history
- Throws:
ServiceLayerException
-
writeGlobalConfiguration
Write configuration file within global repo- Parameters:
path- path of configuration filecontent- content of configuration file- Throws:
ServiceLayerException- general service error
-
getTranslationConfiguration
Get the translation configuration for a given site- Parameters:
siteId- the id of the site- Returns:
- the translation configuration
- Throws:
ServiceLayerException- general service error
-
legacyGetConfiguration
This method holds logic for API 1, can be deleted when API 1 get configuration is removed- Throws:
ServiceLayerException
-
getCacheKey
Builds the key for a given file- Parameters:
siteId- the id of the sitemodule- the module of the filepath- the path of the fileenvironment- the environment of the file- Returns:
- the key for the file
-
getCacheKey
Builds the key for a given file- Parameters:
siteId- the id of the sitemodule- the module of the filepath- the path of the fileenvironment- the environment of the filesuffix- the suffix for the cache key- Returns:
- the key for the file
-
invalidateConfiguration
Invalidates the cache for the given file- Parameters:
siteId- the id of the sitepath- the path of the file
-
invalidateConfiguration
Invalidates the cache for the given file- Parameters:
siteId- the id of the sitemodule- the module of the filepath- the path of the fileenvironment- the environment of the file
-
invalidateConfiguration
Invalidates all objects for a given site- Parameters:
siteId- the id of the site
-
makeBlobStoresReadOnly
Update blob stores configuration to make all blobStores read-only- Parameters:
siteId- the id of the site- Throws:
ServiceLayerException- if an error occurs while reading or writing the configuration
-