Class StaticClasspathResourceScanner

java.lang.Object
ac.simons.neo4j.migrations.quarkus.runtime.StaticClasspathResourceScanner
All Implemented Interfaces:
ac.simons.neo4j.migrations.core.ClasspathResourceScanner

public final class StaticClasspathResourceScanner extends Object implements ac.simons.neo4j.migrations.core.ClasspathResourceScanner
This resource scanner holds a list of resource wrappers, pointing to (Cypher) resources found on the classpath. The resources as well as this special scanner are mutable. They must be as that is the way how Quarkus works when serializing them to bytecode.
Since:
1.3.0
Author:
Michael J. Simons
  • Constructor Details

    • StaticClasspathResourceScanner

      public StaticClasspathResourceScanner()
  • Method Details

    • of

      Creates a new scanner from a fixed set of predefined resources. No further checking is done if This exists or not.
      Parameters:
      resources - The set of resources found elsewhere
      Returns:
      a correctly initialized scanner
    • getResources

      public Set<ResourceWrapper> getResources()
      Returns:
      the set of scanned / discovered resources
    • setResources

      public void setResources(Set<ResourceWrapper> resources)
      This method may not be used outside Quarkus internal code.
      Parameters:
      resources - a new set of resources
    • scan

      public List<URL> scan(List<String> locations)
      This method takes the statically found URLs and transform them depending on the runtime: If the scan is invoked in native image runtime, the resource: protocol is used with the original path of the resource. Otherwise the current thread classloader is used to retrieve a resource url with that path. If that url is null, we are most likely looking at file: url.

      The URLs must be recreated for reasons explained in ResourceWrapper.getUrl().

      Specified by:
      scan in interface ac.simons.neo4j.migrations.core.ClasspathResourceScanner
      Parameters:
      locations - The locations to scan
      Returns:
      The resources found
      See Also:
      • ClasspathResourceScanner.scan(List)