Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Servlets Resolver 2.9.8
-
None
Description
Currently the ResourceCollector uses the LocationIterator to build a list of possible locations where the script for a resource type can be located.
The interface is based on Strings (representing a repository path), although both within the LocationIterator and in the ResourceCollector Resources are used.
- The mapping of a path to a string requires a repository access, thus accessing the repo twice (checking in the LocationIterator if a resource exists at a certain path, plus conversion of that path again into a resource in the ResourceCollector) is redundant. Instead the LocationIterator should just return resources instead of the paths to resources.
- The LocationIterator implements the Iterator interface, although it is only used in the ResourceCollector, which just iterates over all entries in a single loop. The LocationIterator could just return a collection of Resources (not implementing the Iterator interface), which makes the logic in this class much cleaner.