Class ConfigurationServiceImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.configuration.ConfigurationServiceImpl
- All Implemented Interfaces:
ConfigurationService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuilds 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-onlyvoidsetConfigurationServiceInternal(ConfigurationService configurationServiceInternal) voidwriteConfiguration(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 repoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.craftercms.studio.api.v2.service.config.ConfigurationService
getCacheKey
-
Constructor Details
-
ConfigurationServiceImpl
public ConfigurationServiceImpl()
-
-
Method Details
-
setConfigurationServiceInternal
-
getRoleMappings
public Map<NormalizedGroup,List<NormalizedRole>> getRoleMappings(String siteId) throws ServiceLayerException Description copied from interface:ConfigurationServiceGet role mappings configuration for given site- Specified by:
getRoleMappingsin interfaceConfigurationService- Parameters:
siteId- Site id to use- Returns:
- role mappings configuration
- Throws:
ServiceLayerException
-
getGlobalRoleMappings
public Map<NormalizedGroup,List<NormalizedRole>> getGlobalRoleMappings() throws ServiceLayerExceptionDescription copied from interface:ConfigurationServiceGet global role mappings configuration- Specified by:
getGlobalRoleMappingsin interfaceConfigurationService- Returns:
- role mappings configuration
- Throws:
ServiceLayerException
-
getConfigurationAsString
public String getConfigurationAsString(String siteId, String module, String path, String environment) throws ContentNotFoundException Description copied from interface:ConfigurationServiceGet configuration as string for given parameters- Specified by:
getConfigurationAsStringin interfaceConfigurationService- 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
public org.dom4j.Document getConfigurationAsDocument(String siteId, String module, String path, String environment) throws ServiceLayerException Description copied from interface:ConfigurationServiceGet configuration as DOM document for given parameters- Specified by:
getConfigurationAsDocumentin interfaceConfigurationService- 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
public org.apache.commons.configuration2.HierarchicalConfiguration<?> getXmlConfiguration(String siteId, String path) throws ConfigurationException Description copied from interface:ConfigurationServiceReads a configuration file using Apache Commons Configuration- Specified by:
getXmlConfigurationin interfaceConfigurationService- 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
public org.apache.commons.configuration2.HierarchicalConfiguration<?> getXmlConfiguration(String siteId, String module, String path) throws ConfigurationException Description copied from interface:ConfigurationServiceReads a configuration for the current environment, or fallback to the default environment if the file is missing- Specified by:
getXmlConfigurationin interfaceConfigurationService- 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
public org.apache.commons.configuration2.HierarchicalConfiguration<?> getGlobalXmlConfiguration(String path) throws ConfigurationException Description copied from interface:ConfigurationServiceReads a configuration file using Apache Commons Configuration- Specified by:
getGlobalXmlConfigurationin interfaceConfigurationService- Parameters:
path- the path of the file- Returns:
- the configuration object
- Throws:
ConfigurationException- if there is any error reading or parsing the file
-
getGlobalConfigurationAsDocument
public org.dom4j.Document getGlobalConfigurationAsDocument(String path) throws ServiceLayerException Description copied from interface:ConfigurationServiceGet configuration from global repository as Document- Specified by:
getGlobalConfigurationAsDocumentin interfaceConfigurationService- Parameters:
path- path of the configuration file- Returns:
- the Document
- Throws:
ServiceLayerException- if there is any error reading the configuration
-
getGlobalConfigurationAsString
Description copied from interface:ConfigurationServiceGet configuration from global repository as String- Specified by:
getGlobalConfigurationAsStringin interfaceConfigurationService- 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
public void writeConfiguration(String siteId, String module, String path, String environment, InputStream content) throws ServiceLayerException, UserNotFoundException Description copied from interface:ConfigurationServiceWrite configuration file for given parameters- Specified by:
writeConfigurationin interfaceConfigurationService- 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
-
getCacheKey
public String getCacheKey(String siteId, String module, String path, String environment, String suffix) Description copied from interface:ConfigurationServiceBuilds the key for a given file- Specified by:
getCacheKeyin interfaceConfigurationService- 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
-
getPluginFile
public org.springframework.core.io.Resource getPluginFile(String siteId, String pluginId, String type, String name, String filename) throws ContentNotFoundException Description copied from interface:ConfigurationServiceGet a file from a plugin- Specified by:
getPluginFilein interfaceConfigurationService- 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
public ConfigurationHistory getConfigurationHistory(String siteId, String module, String path, String environment) throws ServiceLayerException Description copied from interface:ConfigurationServiceGet configuration history for given parameters- Specified by:
getConfigurationHistoryin interfaceConfigurationService- 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
Description copied from interface:ConfigurationServiceWrite configuration file within global repo- Specified by:
writeGlobalConfigurationin interfaceConfigurationService- Parameters:
path- path of configuration filecontent- content of configuration file- Throws:
ServiceLayerException- general service error
-
getTranslationConfiguration
public TranslationConfiguration getTranslationConfiguration(String siteId) throws ServiceLayerException Description copied from interface:ConfigurationServiceGet the translation configuration for a given site- Specified by:
getTranslationConfigurationin interfaceConfigurationService- Parameters:
siteId- the id of the site- Returns:
- the translation configuration
- Throws:
ServiceLayerException- general service error
-
invalidateConfiguration
Description copied from interface:ConfigurationServiceInvalidates the cache for the given file- Specified by:
invalidateConfigurationin interfaceConfigurationService- Parameters:
siteId- the id of the sitepath- the path of the file
-
invalidateConfiguration
Description copied from interface:ConfigurationServiceInvalidates the cache for the given file- Specified by:
invalidateConfigurationin interfaceConfigurationService- Parameters:
siteId- the id of the sitemodule- the module of the filepath- the path of the fileenvironment- the environment of the file
-
invalidateConfiguration
Description copied from interface:ConfigurationServiceInvalidates all objects for a given site- Specified by:
invalidateConfigurationin interfaceConfigurationService- Parameters:
siteId- the id of the site
-
makeBlobStoresReadOnly
Description copied from interface:ConfigurationServiceUpdate blob stores configuration to make all blobStores read-only- Specified by:
makeBlobStoresReadOnlyin interfaceConfigurationService- Parameters:
siteId- the id of the site- Throws:
ServiceLayerException- if an error occurs while reading or writing the configuration
-
legacyGetConfiguration
public Map<String,Object> legacyGetConfiguration(String site, String path) throws ServiceLayerException Description copied from interface:ConfigurationServiceThis method holds logic for API 1, can be deleted when API 1 get configuration is removed- Specified by:
legacyGetConfigurationin interfaceConfigurationService- Throws:
ServiceLayerException
-