public abstract class SourceCache extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SourceCache.SourceCacheFeature
An automatic feature class which acquires the image loader class path via the afterAnalysis
callback.
|
Modifier and Type | Field and Description |
---|---|
protected static List<String> |
classPathEntries
A list of all entries in the classpath used by the native image classloader.
|
protected static List<String> |
sourcePathEntries
A list of all entries in the classpath used by the native image classloader.
|
protected List<Path> |
srcRoots
A list of root directories which may contain source files from which this cache can be
populated.
|
Modifier | Constructor and Description |
---|---|
protected |
SourceCache()
Create some flavour of source cache.
|
Modifier and Type | Method and Description |
---|---|
protected File |
cachedFile(Path candidate)
Convert a potential resolved candidate path to the corresponding local File in this cache.
|
protected Path |
cachedPath(Path candidate)
Convert a potential resolved candidate path to the corresponding local Path in this cache.
|
Path |
checkCacheFile(Path filePath)
Check whether the copy of a given source file in the local source cache is up to date with
respect to any original located in this cache's and if not copy the original to the
subdirectory that belongs to this cache.
|
static SourceCache |
createSourceCache(SourceCacheType type)
Create and intialize the source cache used to locate and cache sources of a given type as
determined by the supplied key.
|
protected Path |
extendPath(Path root,
Path filePath)
Extend a root path form one file system using a path potentially derived from another file
system by converting he latter to a text string and replacing the file separator if
necessary.
|
File |
findCandidate(Path filePath)
Given a prototype path for a file to be resolved return a File identifying a cached candidate
for for that Path or null if no cached candidate exists.
|
protected abstract SourceCacheType |
getType()
Identify the specific type of this source cache.
|
Path |
resolve(Path filePath)
Cache the source file identified by the supplied prototype path if a legitimate candidate for
inclusion in this cache can be identified and is not yet included in the cache or
alternatively identify and validate any existing candidate cache entry to ensure it is not
out of date refreshing it if need be.
|
Path |
tryCacheFile(Path filePath)
Attempt to copy a source file from one of this cache's source roots to the local sources
directory storing it in the subdirectory that belongs to this cache.
|
protected static final List<String> classPathEntries
protected static final List<String> sourcePathEntries
protected abstract SourceCacheType getType()
public Path resolve(Path filePath)
filePath
- a prototype path for a file to be included in the cache derived from the name
of some associated class.public File findCandidate(Path filePath)
filePath
- a prototype path for a file to be included in the cache derived from the name
of some associated class.public Path tryCacheFile(Path filePath)
filePath
- a path appended to each of the cache's source roots in turn until an
acceptable source file is found and copied to the local source directory.public Path checkCacheFile(Path filePath)
filePath
- a path appended to each of the cache's source roots in turn until an matching
original source is found for comparison against the local source directory.public static SourceCache createSourceCache(SourceCacheType type)
type
- an enum identifying both the type of Java sources cached by the returned cache
and the subdir of the cached source subdirectory in which those sources are
located.protected Path extendPath(Path root, Path filePath)
root
- the path to be extendedfilePath
- the subpath to extend it withprotected Path cachedPath(Path candidate)
candidate
- a resolved candidate path for some given resolution request