Interface ConfigurationService
-
- All Known Implementing Classes:
ConfigurationServiceImpl
public interface ConfigurationService
Service that helps access different Studio configuration.- Author:
- avasquez
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default String
getCacheKey(String siteId, String module, String path, String environment)
Builds the key for a given fileString
getCacheKey(String siteId, String module, String path, String environment, String suffix)
Builds the key for a given fileorg.dom4j.Document
getConfigurationAsDocument(String siteId, String module, String path, String environment)
Get configuration as DOM document for given parametersString
getConfigurationAsString(String siteId, String module, String path, String environment)
Get configuration as string for given parametersConfigurationHistory
getConfigurationHistory(String siteId, String module, String path, String environment)
Get configuration history for given parametersorg.dom4j.Document
getGlobalConfigurationAsDocument(String path)
Get configuration from global repository as DocumentString
getGlobalConfigurationAsString(String path)
Get configuration from global repository as StringMap<String,List<String>>
getGlobalRoleMappings()
Get global role mappings configurationorg.apache.commons.configuration2.HierarchicalConfiguration<?>
getGlobalXmlConfiguration(String path)
Reads a configuration file using Apache Commons Configurationorg.springframework.core.io.Resource
getPluginFile(String siteId, String pluginId, String type, String name, String filename)
Get a a file from a pluginMap<String,List<String>>
getRoleMappings(String siteId)
Get role mappings configuration for given siteTranslationConfiguration
getTranslationConfiguration(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 Configurationvoid
invalidateConfiguration(String siteId)
Invalidates all objects for a given sitevoid
invalidateConfiguration(String siteId, String path)
Invalidates the cache for the given filevoid
invalidateConfiguration(String siteId, String module, String path, String environment)
Invalidates the cache for the given fileMap<String,Object>
legacyGetConfiguration(String site, String path)
This method holds logic for API 1, can be deleted when API 1 get configuration is removedvoid
writeConfiguration(String siteId, String module, String path, String environment, InputStream content)
Write configuration file for given parametersvoid
writeGlobalConfiguration(String path, InputStream content)
Write configuration file within global repo
-
-
-
Method Detail
-
getRoleMappings
Map<String,List<String>> 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
Map<String,List<String>> getGlobalRoleMappings() throws ServiceLayerException
Get global role mappings configuration- Returns:
- role mappings configuration
- Throws:
ConfigurationException
- configuration errorServiceLayerException
-
getConfigurationAsString
String getConfigurationAsString(String siteId, String module, String path, String environment)
Get configuration as string for given parameters- Parameters:
siteId
- site id to usemodule
- crafter CMS modulepath
- path of configuration fileenvironment
- environment to use. if empty using default- Returns:
- String content of configuration file
-
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
- crafter CMS 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
-
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
org.dom4j.Document getGlobalConfigurationAsDocument(String path) throws ServiceLayerException
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
String getGlobalConfigurationAsString(String path)
Get configuration from global repository as String- Parameters:
path
- path of configuration file- Returns:
- String content of configuration file
-
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
- crafter CMS 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 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 SiteNotFoundException, ContentNotFoundException
Get configuration history for given parameters- Parameters:
siteId
- site id to usemodule
- crafter CMS modulepath
- path of configuration fileenvironment
- environment to use. if empty using default- Returns:
- configuration history
- Throws:
SiteNotFoundException
ContentNotFoundException
-
writeGlobalConfiguration
void writeGlobalConfiguration(String path, InputStream content) throws ServiceLayerException
Write configuration file within global repo- Parameters:
path
- path of configuration filecontent
- content of configuration file- Throws:
ServiceLayerException
- general service error
-
getTranslationConfiguration
TranslationConfiguration getTranslationConfiguration(String siteId) throws ServiceLayerException
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
Map<String,Object> legacyGetConfiguration(String site, String path) throws ServiceLayerException
This method holds logic for API 1, can be deleted when API 1 get configuration is removed- Throws:
ServiceLayerException
-
getCacheKey
default String getCacheKey(String siteId, String module, String path, String environment)
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
String getCacheKey(String siteId, String module, String path, String environment, String suffix)
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
void invalidateConfiguration(String siteId, String path)
Invalidates the cache for the given file- Parameters:
siteId
- the id of the sitepath
- the path of the file
-
invalidateConfiguration
void invalidateConfiguration(String siteId, String module, String path, String environment)
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
void invalidateConfiguration(String siteId)
Invalidates all objects for a given site- Parameters:
siteId
- the id of the site
-
-