Interface ConfigurationService

  • All Known Implementing Classes:
    ConfigurationServiceImpl

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

      • getConfigurationAsString

        String getConfigurationAsString​(String siteId,
                                        String module,
                                        String path,
                                        String environment)
        Get configuration as string for given parameters
        Parameters:
        siteId - site id to use
        module - crafter CMS module
        path - path of configuration file
        environment - 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 use
        module - crafter CMS 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
      • 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
      • 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 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
      • 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
      • 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