Hi,

I was looking at a few cases where we use an administrative
ResourceResolver just to get the current search paths, for example in
ScriptCacheImpl [1], the (simplified) pattern is:

  ResourceResolver resolver = rrf.getAdministrativeResourceResolver(null);
  searchPaths = resolver.getSearchPath();
  resolver.close();

Conceptually there's no need to have a resource resolver to get the
search path, nor should it be necessary to login to anything - the
search path is just a configuration in
ResourceResolverFactoryActivator.

To avoid having to create service users just for this, I suggest
creating a service that provides the search path, and letting the
ResourceResolverFactoryActivator provide that service. We can then get
rid of a number of admin sessions and resolvers, in various places.

WDYT?

-Bertrand

[1] 
https://github.com/apache/sling/blob/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/ScriptCacheImpl.java

Reply via email to