public class ResourceOracleImpl extends Object implements ResourceOracle
ResourceOracle
.Constructor and Description |
---|
ResourceOracleImpl(List<ClassPathEntry> classPath)
Constructs a
ResourceOracleImpl from a set of
ClassPathEntries . |
ResourceOracleImpl(TreeLogger logger)
Constructs a
ResourceOracleImpl from the thread's default
ClassLoader . |
ResourceOracleImpl(TreeLogger logger,
ClassLoader classLoader)
Constructs a
ResourceOracleImpl from a ClassLoader . |
ResourceOracleImpl(TreeLogger logger,
ResourceLoader resources) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Frees up all existing resources and transient internal state.
|
static void |
clearCache() |
static ClassPathEntry |
createEntryForUrl(TreeLogger logger,
URL url) |
Set<String> |
getPathNames()
Returns an unmodifiable set of unique abstract path names with constant
lookup time.
|
PathPrefixSet |
getPathPrefixes() |
Map<String,Resource> |
getResourceMap()
Returns an unmodifiable map of abstract path name to resource.
|
Set<Resource> |
getResources()
Returns an unmodifiable set of unique resources with constant lookup time.
|
static void |
preload(TreeLogger logger)
Preinitializes the classpath from the thread default
ClassLoader . |
static void |
preload(TreeLogger logger,
ClassLoader classLoader)
Preinitializes the classpath for a given
ClassLoader . |
static void |
preload(TreeLogger logger,
ResourceLoader resources)
Preinitializes the classpath for a given
ResourceLoader . |
static void |
refresh(TreeLogger logger,
ResourceOracleImpl first,
ResourceOracleImpl... rest)
Rescans the associated paths to recompute the available resources.
|
void |
setPathPrefixes(PathPrefixSet pathPrefixSet) |
public ResourceOracleImpl(List<ClassPathEntry> classPath)
ResourceOracleImpl
from a set of
ClassPathEntries
. The list is held by reference and
must not be modified.public ResourceOracleImpl(TreeLogger logger)
ResourceOracleImpl
from the thread's default
ClassLoader
.public ResourceOracleImpl(TreeLogger logger, ClassLoader classLoader)
ResourceOracleImpl
from a ClassLoader
. The
specified ClassLoader
and all of its parents which are instances of
URLClassLoader
will have their class path entries added to this
instances underlying class path.public ResourceOracleImpl(TreeLogger logger, ResourceLoader resources)
public static void clearCache()
public static ClassPathEntry createEntryForUrl(TreeLogger logger, URL url) throws URISyntaxException, IOException
URISyntaxException
IOException
public static void preload(TreeLogger logger)
ClassLoader
.public static void preload(TreeLogger logger, ClassLoader classLoader)
ClassLoader
.public static void preload(TreeLogger logger, ResourceLoader resources)
ResourceLoader
.public static void refresh(TreeLogger logger, ResourceOracleImpl first, ResourceOracleImpl... rest)
logger
- status and error details are written herefirst
- At least one ResourceOracleImpl must be passed to refreshrest
- Callers may optionally pass several oraclespublic void clear()
ResourceOracle
clear
in interface ResourceOracle
public Set<String> getPathNames()
ResourceOracle
getPathNames
in interface ResourceOracle
public PathPrefixSet getPathPrefixes()
public Map<String,Resource> getResourceMap()
ResourceOracle
getResourceMap
in interface ResourceOracle
public Set<Resource> getResources()
ResourceOracle
getResources
in interface ResourceOracle
public void setPathPrefixes(PathPrefixSet pathPrefixSet)
Copyright © 2018. All rights reserved.