Interface ConfigurationManager

  • All Known Implementing Classes:
    ConfigurationManagerImpl, MockConfigurationManagerImpl

    public interface ConfigurationManager
    The ConfigurationManager is the component allowing to access to the configuration of a given eXo container. We have one instance of ConfigurationManager per eXo container. All the url provided in String format can use the next prefixes:
    • war: try to find the file using the Servlet Context of your portal.war or any web applications defined as PortalContainerConfigOwner, so for example in case of the portal.war if the URL is war:/conf/common/portlet-container-configuration.xml it will try to get the file from portal.war/WEB-INF/conf/common/portlet-container-configuration.xml.
    • jar or classpath: you can use this prefix to find a file that is accessible using the ClassLoader. For example jar:/conf/my-file.xml will be understood as try to find conf/my-file.xml from the ClassLoader.
    • file: this prefix will indicate the configuration manager that it needs to interpret the URL as an absolute path. For example file:///path/to/my/file.xml will be understood as an absolute path.
    • Without prefixes: it will be understood as a relative path from the parent directory of the last processed configuration file. For example, if the configuration manager is processing the file corresponding to the URL file:///path/to/my/configuration.xml and in this file you import dir/to/foo.xml, the configuration manager will try to get the file from file:///path/to/my/dir/to/foo.xml. Please note that it works also for other prefixes
    • Field Detail

      • LOG_DEBUG_PROPERTY

        static final String LOG_DEBUG_PROPERTY
        The name of the system property that indicates whether the logger of the configuration must be in debug more or not.
        See Also:
        Constant Field Values
      • LOG_DEBUG

        static final boolean LOG_DEBUG
        Constant that indicates whether the logger of the configuration must be in debug more or not.
    • Method Detail

      • getConfiguration

        Configuration getConfiguration()
        Gives the entire configuration
      • getComponent

        Component getComponent​(String service)
        Gives the component configuration of a given service
        Parameters:
        service - the FQN of the service for which we want the configuration
      • getComponent

        Component getComponent​(Class<?> clazz)
        Gives the component configuration of a given service
        Parameters:
        clazz - the Class of the service for which we want the configuration
      • getComponents

        Collection<Component> getComponents()
        Gives the configuration of all the registered components
      • addConfiguration

        void addConfiguration​(String url)
                       throws Exception
        Adds a new location of a configuration file
        Parameters:
        url - the url of the configuration to add, that we want to resolve
        Throws:
        Exception - if the configuration could not be found or the url in String format could not be resolved
      • addConfiguration

        void addConfiguration​(Collection<URL> urls)
        Adds a collection URL corresponding to the location of the configuration files to add
        Parameters:
        urls - the URLs of configuration files to add
      • addConfiguration

        void addConfiguration​(URL url)
        Adds a new location of a configuration file
        Parameters:
        url - the url of the configuration to add
      • getResource

        URL getResource​(String url,
                        String defaultURL)
                 throws Exception
        Gives the URL of the resource file corresponding to the url provided in String format
        Parameters:
        url - the url to resolve
        defaultURL - The default URL to use in case the parameter url is null.
        Returns:
        The URL representing the String url to resolve
        Throws:
        Exception - if the String url could not be resolved
      • getResource

        URL getResource​(String url)
                 throws Exception
        Gives the URL of the resource file corresponding to the url provided in String format
        Parameters:
        url - the url to resolve
        Returns:
        The URL representing the String url to resolve
        Throws:
        Exception - if the String url could not be resolved
      • getInputStream

        InputStream getInputStream​(String url,
                                   String defaultURL)
                            throws Exception
        Gives the InputStream of the resource file corresponding to the url provided in String format
        Parameters:
        url - the url to resolve
        defaultURL - The default URL to use in case the parameter url is null.
        Returns:
        The InputStream of the resource file
        Throws:
        Exception - if the String url could not be resolved
      • getInputStream

        InputStream getInputStream​(String url)
                            throws Exception
        Gives the InputStream of the resource file corresponding to the url provided in String format
        Parameters:
        url - the url to resolve
        Returns:
        The InputStream of the resource file
        Throws:
        Exception - if the String url could not be resolved
      • getProfiles

        default Set<String> getProfiles()
        Returns:
        a Set of profiles used to parse configuration entries