Class WebConfResourceLocator

java.lang.Object
fr.paris.lutece.portal.service.init.WebConfResourceLocator

public class WebConfResourceLocator extends Object
The WebConfResourceLocator class provides utility methods to scan and retrieve resources from the /WEB-INF/conf/ directory and its subdirectories. This class focuses on gathering resources related to plugin configurations, core overrides, and logging configurations. The methods in this class support filtering resources based on file extensions, patterns, or wildcard strings, making it useful for locating and handling specific configuration files in a web application.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.github.classgraph.ResourceList
    Returns all resources found in the /WEB-INF/conf/ directories.
    static Set<String>
    Retrieves a set of paths to configuration log files (e.g., "_log.xml") found in the scanned directories.
    static Set<String>
    Retrieves the properties files located under the override directories (override/ and override/plugins), in their loading order: override/plugins is loaded after override/, so its values win.
    static Set<String>
    Retrieves the properties files that are NOT located under the override directories (override/ and override/plugins), in their loading order: the last one loaded wins, so the themes win over the plugins.
    static Set<String>
    Retrieves a set of paths to xml files found in the scanned directories.
    static io.github.classgraph.ResourceList
    Retrieves all resources that match the provided regular expression pattern in their paths.
    static io.github.classgraph.ResourceList
    Retrieves all resources that match the provided wildcard pattern in their paths.
    static io.github.classgraph.ResourceList
    Retrieves all resources with the specified file extension from the scanned directories.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WebConfResourceLocator

      public WebConfResourceLocator()
  • Method Details

    • getAllResources

      public static io.github.classgraph.ResourceList getAllResources()
      Returns all resources found in the /WEB-INF/conf/ directories. If the resources have not been scanned yet, it will trigger a scan of the directories.
      Returns:
      A list of resources found in the specified directories.
    • getResourcesWithExtension

      public static io.github.classgraph.ResourceList getResourcesWithExtension(String extension)
      Retrieves all resources with the specified file extension from the scanned directories. The extension is case-insensitive.
      Parameters:
      extension - the file extension to match (e.g., "xml").
      Returns:
      A list of resources that match the specified extension.
    • getResourcesMatchingPattern

      public static io.github.classgraph.ResourceList getResourcesMatchingPattern(Pattern pattern)
      Retrieves all resources that match the provided regular expression pattern in their paths.
      Parameters:
      pattern - The regex pattern to match against resource paths.
      Returns:
      A list of resources whose paths match the provided pattern.
    • getResourcesMatchingWildcard

      public static io.github.classgraph.ResourceList getResourcesMatchingWildcard(String wildcardString)
      Retrieves all resources that match the provided wildcard pattern in their paths. The wildcard pattern can include:
      • Single asterisks (*) to match any sequence of characters excluding '/'.
      • Double asterisks (**) to match any sequence of characters including '/'.
      • Question marks (?) to match any single character.
      Parameters:
      wildcardString - The wildcard pattern to match against resource paths.
      Returns:
      A list of resources whose paths match the provided wildcard pattern.
    • getPathConfLog

      public static Set<String> getPathConfLog()
      Retrieves a set of paths to configuration log files (e.g., "_log.xml") found in the scanned directories.
      Returns:
      A set of paths to the log configuration files.
    • getPathPropertiesFileWithoutOverride

      public static Set<String> getPathPropertiesFileWithoutOverride()
      Retrieves the properties files that are NOT located under the override directories (override/ and override/plugins), in their loading order: the last one loaded wins, so the themes win over the plugins. This is the content of the base ConfigSource.
      Returns:
      A set of paths to the non-override properties files.
    • getPathOverridePropertiesFile

      public static Set<String> getPathOverridePropertiesFile()
      Retrieves the properties files located under the override directories (override/ and override/plugins), in their loading order: override/plugins is loaded after override/, so its values win. This is the content of the override ConfigSource, whose higher ordinal makes all of them win over the base ones.
      Returns:
      A set of paths to the override properties files.
    • getPathXmlFile

      public static Set<String> getPathXmlFile()
      Retrieves a set of paths to xml files found in the scanned directories.
      Returns:
      A set of paths to xml files.