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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionof
(Collection<ResourceWrapper> resources) Creates a new scanner from a fixed set of predefined resources.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.void
setResources
(Set<ResourceWrapper> resources) This method may not be used outside Quarkus internal code.
-
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
- Returns:
- the set of scanned / discovered resources
-
setResources
This method may not be used outside Quarkus internal code.- Parameters:
resources
- a new set of resources
-
scan
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 interfaceac.simons.neo4j.migrations.core.ClasspathResourceScanner
- Parameters:
locations
- The locations to scan- Returns:
- The resources found
- See Also:
-
ClasspathResourceScanner.scan(List)
-