Class FileSorterUtil
java.lang.Object
fr.paris.lutece.portal.service.util.FileSorterUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSorts the list of file paths based on extension priority.sortByPathPriority(List<String> set) Sorts the list of file paths in descending order based on path priority.Sorts the list of file paths based on path priority.Sorts properties file paths into their loading order, from the weakest location to the strongest: the plugins, the themes, the override directory, then the override/plugins directory, each one in alphabetical order.Sorts the list of file paths by both path priority and extension priority.
-
Field Details
-
PATH_CONF
- See Also:
-
PATH_PLUGINS
- See Also:
-
PATH_THEMES
- See Also:
-
PATH_OVERRIDE_CORE
- See Also:
-
PATH_OVERRIDE_PLUGINS
- See Also:
-
-
Constructor Details
-
FileSorterUtil
public FileSorterUtil()
-
-
Method Details
-
sortByPropertiesPrecedence
Sorts properties file paths into their loading order, from the weakest location to the strongest: the plugins, the themes, the override directory, then the override/plugins directory, each one in alphabetical order. The files are loaded in this order into one set of properties, so a key set in several files takes the value of the last one, as in Lutece 7. A path may be relative, the way the classpath scan returns it, or start with a slash.The configuration is exposed to MicroProfile Config through two
ConfigSources, so the four ranks never appear together in one list: the base source is given the plugins and the themes only, the override source the two override directories only. This order therefore arbitrates inside a source. Between the two sources, it is theirConfigSourceordinal that makes the override values win, not this sort.- Parameters:
set- The list of properties file paths- Returns:
- The paths in the order they must be loaded
-
sortedByPathAndExtensionList
Sorts the list of file paths by both path priority and extension priority. First, the list is sorted by path priority, and then by extension priority.- Parameters:
set- The list of file paths to be sorted- Returns:
- The sorted list of file paths
-
sortByPathPriority
Sorts the list of file paths in descending order based on path priority. Paths with higher priority values will appear later in the list.- Parameters:
set- The list of file paths to sort in descending path priority- Returns:
- The list of file paths sorted in descending path priority
-
sortByPathPriorityDescending
Sorts the list of file paths based on path priority. Paths are prioritized based on specific prefixes (e.g., PATH_OVERRIDE_PLUGINS, PATH_OVERRIDE_CORE, etc.).- Parameters:
set- The list of file paths to sort by path priority- Returns:
- The list of file paths sorted by path priority
-
sortByExtensionPriority
Sorts the list of file paths based on extension priority. Extensions are prioritized (e.g., .xml, .json, .properties, etc.). If two files have the same extension priority, they are sorted alphabetically.- Parameters:
set- The list of file paths to sort by extension priority- Returns:
- The list of file paths sorted by extension priority
-