Interface ConfigurationService

All Known Implementing Classes:
ConfigurationServiceImpl, ConfigurationServiceInternalImpl

public interface ConfigurationService
Service that helps access different Studio configuration.
Author:
avasquez
  • Method Details

    • getRoleMappings

      Get role mappings configuration for given site
      Parameters:
      siteId - Site id to use
      Returns:
      role mappings configuration
      Throws:
      ConfigurationException - configuration error
      ServiceLayerException
    • getGlobalRoleMappings

      Map<NormalizedGroup,List<NormalizedRole>> getGlobalRoleMappings() throws ServiceLayerException
      Get global role mappings configuration
      Returns:
      role mappings configuration
      Throws:
      ConfigurationException - configuration error
      ServiceLayerException
    • 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 use
      module - CrafterCMS module
      path - path of configuration file
      environment - 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 use
      module - CrafterCMS module
      path - path of configuration file
      environment - 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 site
      path - 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 site
      module - the module
      path - 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) throws ContentNotFoundException
      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 use
      module - CrafterCMS module
      path - path where to store configuration file
      environment - environment to use. if empty using default
      content - content of configuration file
      Throws:
      ServiceLayerException - general service error
      UserNotFoundException
    • 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 site
      pluginId - the id of the plugin
      type - the type of plugin
      name - the name of the plugin
      filename - 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 use
      module - CrafterCMS module
      path - path of configuration file
      environment - environment to use. if empty using default
      Returns:
      configuration history
      Throws:
      ServiceLayerException
    • writeGlobalConfiguration

      void writeGlobalConfiguration(String path, InputStream content) throws ServiceLayerException
      Write configuration file within global repo
      Parameters:
      path - path of configuration file
      content - 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 site
      module - the module of the file
      path - the path of the file
      environment - 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 site
      module - the module of the file
      path - the path of the file
      environment - the environment of the file
      suffix - 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 site
      path - 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 site
      module - the module of the file
      path - the path of the file
      environment - the environment of the file
    • invalidateConfiguration

      void invalidateConfiguration(String siteId)
      Invalidates all objects for a given site
      Parameters:
      siteId - the id of the site
    • makeBlobStoresReadOnly

      void makeBlobStoresReadOnly(String siteId) throws ServiceLayerException
      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